var windowbrow=navigator.appName;
  var windowtype;
  if (windowbrow.indexOf("Netscape")!=-1)
  {
     windowtype=1;
     //alert("you are using Netscape(Mozilla) family browser,good!");
     }   
  if (windowbrow.indexOf("Microsoft")!=-1)
  {
     //isIE=1;
     windowtype=0;
     //alert("You are using Microsoft's Internet Explorer browser,Opps,shit!");
  }   

// retrieve XML document (reusable generic function);
// parameter is URL string (relative or complete) to
// an .xml file whose Content-Type is a valid XML
// type, such as text/xml; XML source must be from
// same domain as HTML file
function loadXMLDoc(url,tfunc,ffunc) {
	var req;

    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        //req.OnReadyStateChange = processReqChange(req);//,tfunc,ffunc);
        req.open("GET", url, false);
        req.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        isIE = true;
        req = new ActiveXObject("Microsoft.XMLHTTP");
        if (req) {
            //req.OnReadyStateChange = processReqChange(req);//,tfunc,ffunc);
            req.open("GET", url, false);
            req.send();
        }
    }
	return req;
}

// handle onreadystatechange event of req object
function processReqChange(req) { //,tfunc,ffunc) {
	// only if req shows "loaded"
	if (req.readyState == 4) {
		// only if "OK"
		if (req.status == 200) {
		//execScript(tfunc, "javascript")
		} else {
		// execScript(ffunc, "javascript")
		}
	}
}

function decode_utf8(utftext) {
    var plaintext = ""; var i=0; var c=c1=c2=0;
    while(i<utftext.length)
        {
        c = utftext.charCodeAt(i);
        if (c<128) {
            plaintext += String.fromCharCode(c);
            i++;}
        else if((c>191) && (c<224)) {
            c2 = utftext.charCodeAt(i+1);
            plaintext += String.fromCharCode(((c&31)<<6) | (c2&63));
            i+=2;}
        else {
            c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
            plaintext += String.fromCharCode(((c&15)<<12) | ((c2&63)<<6) | (c3&63));
            i+=3;}
        }
    return plaintext;
}
function setCookie(name,value,expiry,path,domain,secure){
	var nameString = name + '=' + escape(value);
	var expiryString = (expiry == null) ? '' : ' ;expires = '+ expiry.toGMTString();
	var pathString = (path == null) ? '' : ' ;path = '+ path;
	var domainString = (domain == null) ? '' : ' ;domain = '+ domain;
	var secureString = (secure) ?';secure':'';
	document.cookie = nameString + expiryString + pathString + domainString + secureString;
}
function getCookie() {
	if (arguments.length==2){

		var CookieFound = false;
		var CookieString = getCookie(arguments[0]);

		var aCookieString=CookieString.split('&');
		for (var i=0;i<aCookieString.length;i++){
			j=aCookieString[i].indexOf('=');
			if (arguments[1]==aCookieString[i].substring(0,j))
				return unescape(aCookieString[i].substr(j+1));
		}
	} else {
		var CookieFound = false;
		var CookieString = document.cookie;

		var aCookieString=CookieString.split('; ');
		for (var i=0;i<aCookieString.length;i++){
			j=aCookieString[i].indexOf('=');
			if (arguments[0]==aCookieString[i].substring(0,j))
				return unescape(aCookieString[i].substr(j+1));
		}
	}
	return '';
}
function deleteCookie(name){
	var expires = new Date();
	expires.setTime (expires.getTime() - 1);
	setCookie( name , "Delete Cookie", expires,null,null,false);
}
function urlencode_gb2utf8(rawtext) {
    rawtext = rawtext.replace(/\r\n/g,"\n");
    var utftext = "";
    for(var n=0; n<rawtext.length; n++)
        {
        //
        var c=rawtext.charCodeAt(n);
        // 0-127 => 1byte
        if (c<128)
            utftext += escape(String.fromCharCode(c));    
        // 127 - 2047 => 2byte
        else if((c>127) && (c<2048)) {
            utftext += escape(String.fromCharCode((c>>6)|192));
            utftext += escape(String.fromCharCode((c&63)|128));}
        // 2048 - 66536 => 3byte
        else {
            utftext += escape(String.fromCharCode((c>>12)|224));
            utftext += escape(String.fromCharCode(((c>>6)&63)|128));
            utftext += escape(String.fromCharCode((c&63)|128));}
        }
    return utftext;
}

//弹出推广窗口 by zhufeng @2006.9.4 begin
//推广的页面
var OpenPhotoUrl=new Array("http://photo.yoka.com/Set.aspx?album=148"
	,"http://photo.yoka.com/Set.aspx?album=460"
	,"http://photo.yoka.com/Set.aspx?album=523"
	,"http://photo.yoka.com/Set.aspx?album=521"
	,"http://photo.yoka.com/Set.aspx?album=510"
	,"http://photo.yoka.com/Set.aspx?album=426"
	,"http://photo.yoka.com/Set.aspx?album=416"
	,"http://photo.yoka.com/Set.aspx?album=413"
	,"http://photo.yoka.com/Set.aspx?album=518"
	,"http://photo.yoka.com/Set.aspx?album=514"
	,"http://photo.yoka.com/Set.aspx?album=253"
	,"http://photo.yoka.com/Set.aspx?album=188"
	,"http://photo.yoka.com/Set.aspx?album=209"
	,"http://photo.yoka.com/Set.aspx?album=528"
	,"http://photo.yoka.com/Set.aspx?album=166"
	,"http://www.yoka.com/newyoka/tuig/180_240.shtml"
	,"http://www.yoka.com/newyoka/tuig/468_60.shtml"
	,"http://www.yoka.com/newyoka/tuig/760_100.shtml"
	,"http://www.yoka.com/newyoka/tuig/760_60.shtml"
	,"http://www.yoka.com/newyoka/tuig/760_80.shtml"
	,"http://photo.yoka.com/Tag.aspx?tag=%E5%A9%9A%E7%BA%B1"
	,"http://photo.yoka.com/Tag.aspx?tag=%e6%97%b6%e5%b0%9a"
	);

//开新窗口的页面
var NeedPhotoUrl=new Array("http://tmp.html"
	,"http://www.yoka.com/newyoka/tuig/content/18593.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/18788.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/18961.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/18965.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/19613.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/18820.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/18954.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/19657.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/18951.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/19616.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/19263.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/18969.shtml"
	,"http://www.yoka.com/newyoka/tuig/content/19611.shtml"
	,"http://www.yoka.com/newyoka/sex/safe/15843_4.shtml"
	,"http://bbs.yoka.com/read.php?tid=726"
	,"http://blog.yoka.com/index.php?op=ViewArticle&articleId=288&blogId=23"
	,"http://bbs.yoka.com/read.php?tid=815"
	,"http://bbs.yoka.com/read.php?tid=815"
	,"http://bbs.yoka.com/read.php?tid=709"
	,"http://www.yoka.com/newyoka/sex/index.shtml"
	,"http://bbs.yoka.com/read.php?tid=1164"
	,"http://bbs.yoka.com/read.php?tid=1010"
	,"http://www.yoka.com/newyoka/pinxing/7/8857.shtml"
	,"http://bbs.yoka.com/read.php?tid=1123"
	,"http://bbs.yoka.com/thread.php?fid=32"
	,"http://blog.yoka.com/"
	,""
	,"http://www.yoka.com/newyoka/photo/index.shtml"
	,"http://www.yoka.com/newyoka/photo/index.shtml"
	,"http://www.yoka.com/newyoka/luxury/17137.shtml"
	,"http://www.yoka.com/newyoka/sex/man/7889.shtml"
	,"http://bbs.yoka.com/read.php?tid=1034"
	,"http://bbs.yoka.com/read.php?tid=1070"
	,"http://bbs.yoka.com/read.php?tid=929"
	,"http://bbs.yoka.com/read.php?tid=806"
	,"http://bbs.yoka.com/read.php?tid=1111"
	,"http://bbs.yoka.com/read.php?tid=833"
	,"http://bbs.yoka.com/read.php?tid=1065"
	,"http://bbs.yoka.com/read.php?tid=1034"
	,"http://www.yoka.com/newyoka/luxury/17137.shtml"
	,"http://www.yoka.com/newyoka/luxury/16434.shtml"
	,"http://www.yoka.com/newyoka/luxury/16434.shtml"
	,"http://www.yoka.com/newyoka/sex/overclothes/17739.shtml"
	,"http://www.yoka.com/newyoka/celeb/17877.shtml"
	,"http://www.yoka.com/newyoka/celeb/17186.shtml"
	,"http://www.yoka.com/newyoka/celeb/17836.shtml"
	,"http://www.yoka.com/newyoka/celeb/17929.shtml"
	,"http://www.yoka.com/newyoka/celeb/17085.shtml"
	,"http://bbs.yoka.com/read.php?tid=1164&page=1&toread=1"
	,"http://www.yoka.com/newyoka/luxury/16634.shtml"
	,"http://www.yoka.com/newyoka/top/17493.shtml"
	,"http://www.yoka.com/newyoka/top/17486.shtml"
	,"http://www.yoka.com/newyoka/top/17387.shtml"
	,"http://www.yoka.com/newyoka/top/17091.shtml"
	,"http://www.yoka.com/newyoka/sex/sex/13998.shtml"
	,"http://www.yoka.com/newyoka/sex/sexhealth/13803.shtml"
	,"http://www.yoka.com/newyoka/luxury/17972.shtml"
	,"http://www.yoka.com/newyoka/luxury/16408.shtml"
	,"http://bbs.yoka.com/read.php?tid=876"
	,"http://www.yoka.com/newyoka/luxury/17823.shtml"
	,"http://www.yoka.com/newyoka/luxury/17655.shtml"
	,"http://www.yoka.com/newyoka/luxury/17819.shtml"
	,"http://bbs.yoka.com/read.php?tid=1093"
	,"http://bbs.yoka.com/read.php?tid=674"
	,"http://bbs.yoka.com/read.php?tid=902"
	,"http://blog.yoka.com/index.php?op=ViewArticle&articleId=268&blogId=46"
	,"http://blog.yoka.com/index.php?op=ViewArticle&articleId=266&blogId=46"
	,"http://blog.yoka.com/index.php?op=ViewArticle&articleId=247&blogId=46"
	,"http://blog.yoka.com/index.php?op=ViewArticle&articleId=33&blogId=23"
	,"http://blog.yoka.com/index.php?op=ViewArticle&articleId=34&blogId=23"
	,"http://blog.yoka.com/index.php?op=ViewArticle&articleId=63&blogId=41"
	,"http://blog.yoka.com/index.php?op=ViewArticle&articleId=96&blogId=23"
	,"http://www.yoka.com/newyoka/zt/pinr/5/16646.shtml"
	,"http://www.yoka.com/newyoka/forward/15809.shtml"
	,"http://www.yoka.com/newyoka/sex/women/15413.shtml"
	,"http://www.yoka.com/newyoka/fashiongift/15808.shtml"
	);
var refer=document.referrer;

if ((refer!='')&&((refer.indexOf('yoka.com')<0)||(refer.indexOf('yoka.com')>15))){
	for (var i=0;i<NeedPhotoUrl.length;i++)
	{
		if (window.location.href==NeedPhotoUrl[i])
		{
			window.open(OpenPhotoUrl[Math.round(Math.random()*(OpenPhotoUrl.length-1))],'YOKA','resizable=1,menubar=1,scrollbars=1,menubar＝1,width=1024,height=768,screenX=0,screenY=0');
			window.focus();
		}
	}
}
//弹出推广窗口 by zhufeng end