function flashObject(swf, width, height) {
    var str = new String();
    if (navigator.appName.indexOf("Microsoft") != -1) {
    	str+='<object width="'+width+'" height="'+height+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" wmode="transparent">';
        str+='<param name="movie" value="'+swf+'">';
        str+='<param name="wmode" value="transparent">';
        str+='<param name="quality" value="autohigh">';
        str+='<param name="allowScriptAccess" value="always" > ';
        str+='<embed width="'+width+'" height="'+height+'" src="'+swf+'" quality="autohigh" wmode="transparent" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>';
        str+='</object>';
    } else {
        str += '<object style="outline: medium none; width: '+width+'px; height: '+height+'px;" data="' + swf + '">';
        str += '<param value="always" name="allowscriptaccess">';
        str += '<param value="opaque" name="wmode">';
        str += '<param value="high" name="quality">';
        str += '<param value="application/x-shockwave-flash" name="type">';
        str += '</object>';
    }
    return str;
}

function r(d) {
	var ss = 0,sr = 0,er = 0,mx = 180,p = 0,r = Math.random()*mx;
	for (var i=0;i<d.length;i++) ss += parseInt(d[i].st);
	for (var i=0;i<d.length;i++) {
		var it = d[i]; sr = er; er = sr + Math.ceil(mx * it.st/ss);
		if (r > sr - 1 && r < er + 1) {p = i;break;}
	}
	return p;
}

function getCookie(name) {
	var cookie = "";
    if(document.cookie.length > 0) {
    	var cookies = document.cookie.split(";");
        for(var i=0;i<cookies.length;i++){
			var item = cookies[i].split("=");
			if(item[0].replace(" ","") == name.replace(" ","")) {
			   cookie = unescape(item[1]);
			   break;
			}
		}
    }
    return cookie;
}

var panda_out = "";
var panda_url = "http://panda.kdnet.net/stat/pandastat.php";
var userId = 0;
var userCookie = getCookie("kdnet%5Fuser");
if (userCookie == "") userCookie = getCookie("kdnet_user");
if (userCookie != "") userId = userCookie.split(",")[0];
panda_url = panda_url+"?userid="+userId;


/*function getOSVersion() {   
    var os="";   
    var userAgent = navigator.userAgent;   
  if (userAgent.indexOf("NT 5.1")>0) os="Windows XP";
	else if (userAgent.indexOf("Linux")>0) os="Linux";
 	else if (userAgent.indexOf("NT 5.2")>0) os="Windows 2003";
 	else if (userAgent.indexOf("Windows CE")>0) os="Windows CE";
	else if (userAgent.indexOf("NT 4.0")>0) os="Windows NT";
	else if (userAgent.indexOf("NT 5.0")>0) os="Windows 2000";
	else if (userAgent.indexOf("NT")>0) os="Windows NT";
	else if (userAgent.indexOf("Windows")>0) os="Windows";
	else if (userAgent.indexOf("9x")>0) os="Windows ME";
	else if (userAgent.indexOf("98")>0) os="Windows 98";
	else if (userAgent.indexOf("95")>0) os="Windows 95";
	else if (userAgent.indexOf("Win32")>0) os="Win32";
	else if (userAgent.indexOf("Linux")>0) os="Linux";
	else if (userAgent.indexOf("SunOS")>0) os="SunOS";
	else if (userAgent.indexOf("Mac")>0) os="Mac";
	else os="Unknow";
    return os;   
}
function getBrowserVersion() {   
    var browser = {};   
    var userAgent = navigator.userAgent.toLowerCase();   
    var s;   
    (s = userAgent.match(/msie ([\d.]+)/))   
            ? browser.ie = s[1]   
            : (s = userAgent.match(/firefox\/([\d.]+)/))   
                    ? browser.firefox = s[1]   
                    : (s = userAgent.match(/chrome\/([\d.]+)/))   
                            ? browser.chrome = s[1]   
                            : (s = userAgent.match(/opera.([\d.]+)/))   
                                    ? browser.opera = s[1]   
                                    : (s = userAgent   
                                            .match(/version\/([\d.]+).*safari/))   
                                            ? browser.safari = s[1]   
                                            : 0;   
    var version = "";   
    if (browser.ie) {   
        version = 'IE ' + browser.ie;   
    } else if (browser.firefox) {   
        version = 'FireFox ' + browser.firefox;   
    } else if (browser.chrome) {   
        version = 'chrome ' + browser.chrome;   
    } else if (browser.opera) {   
        version = 'opera ' + browser.opera;   
    } else if (browser.safari) {   
        version = 'safari ' + browser.safari;   
    } else {   
        version = 'Unknow';   
    }   
    return version;   
}

function __log(type, uqstr, id, url) {
	if(typeof(U_id)   ==   'undefined') var U_id = 0;

	var kd_s = screen.width+"*"+screen.height; 
	var kd_l = window.location;
	kd_l=escape(kd_l);
	var kd_f = document.referrer; 
	if ((kd_f == "") || (kd_f == "[unknown origin]") || (kd_f == "unknown") || (kd_f == "undefined")) 
		kd_f = ""; 
	kd_f = escape(kd_f);
	var kd_b = getBrowserVersion(); 
	kd_b = escape(kd_b);
	
	var kd_os=getOSVersion();
	kd_os=escape(kd_os);
	
	var kd_out = "http://panda2.kdnet.net/l.php?url="+url+"&l=" + kd_l +"&s=" +kd_s + "&f=" +kd_f;
	kd_out = kd_out + "&b="+kd_b;
	kd_out = kd_out + "&o="+kd_os;
	kd_out = kd_out + "&u="+U_id;
	kd_out = kd_out + "&t="+type;
	kd_out = kd_out + "&uq="+uqstr;
	kd_out = kd_out + "&id="+id;

	if (type == 1) {
		kd_out = "<script src=\"" + kd_out + "\"></script>";
		document.write (kd_out);
	} else {
		return kd_out;
	}
}*/
