//var jsBasePath = "/88yx.com";
var jsBasePath = "";
function getObj(obj){
	return document.getElementById(obj)
}
function addScript(url,id) {
    var g = document.createElement("script");
    g.type = "text/javascript";
    g.src = url;
	if (id) g.id=id;
    var headID = document.getElementsByTagName("head")[0];
	var oScript = getObj(id);
	if (oScript)
	{
		headID.removeChild(oScript);
	}
	headID.appendChild(g);
}

function addIframe(url,id) {
    var g = document.createElement("iframe");
    g.src = url;
	g.style.display='none';
	g.style.width='0px';
	g.style.height='0px';
	g.frameBorder='0px';
	if (id) g.id=id;
    var bd = document.getElementsByTagName("body")[0];
	var oScript = getObj(id);
	if (oScript)
	{
		bd.removeChild(oScript);
	}
	bd.appendChild(g);
}

String.prototype.trim = function(){
	return this.replace(/(^\s+)|(\s+$)/g, "");	
}
	
String.prototype.bytes = function(){
	return this.replace(/[^\x00-\xff]/g, "  ").length;
}

function SetCookie(name,value)
{
   var argv=SetCookie.arguments;
   var argc=SetCookie.arguments.length;
   var expires=(2<argc)?argv[2]:getExpDate(1000,0,0);
   var path=(3<argc)?argv[3]:'/';
   var domain=(4<argc)?argv[4]:null;
   var secure=(5<argc)?argv[5]:false;
   document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");
}
function GetCookie(Name)
{
   var search = Name + "=";
   var returnvalue = "";
   if (document.cookie.length > 0)
   {
      offset = document.cookie.indexOf(search);
   if (offset != -1)
   {
   offset += search.length;
         end = document.cookie.indexOf(";", offset);
   if (end == -1)
            end = document.cookie.length;
         returnvalue=unescape(document.cookie.substring(offset,end));
       }
    }
    return returnvalue;
}

function getExpDate(days, hours, minutes)
{
	var expDate = new Date();
	if(typeof(days) == "number" && typeof(hours) == "number" && typeof(hours) == "number")
	{
		expDate.setDate(expDate.getDate() + parseInt(days));
		expDate.setHours(expDate.getHours() + parseInt(hours));
		expDate.setMinutes(expDate.getMinutes() + parseInt(minutes));
		return expDate.toGMTString();
	}
}

function savePlayd(title, link) {
	var my_playd_arr = new Array();
	var playd = title+','+link;
	my_playd = GetCookie('my_play_history');
	my_playd_arr = my_playd.split('|');
	var len = my_playd_arr.length;
	for (i=0;i<len;i++) {
		var tmp = my_playd_arr[i].split(',');
		if (tmp[1] == link) {
			return;
		}
	}
	if (len>=10) my_playd_arr.shift(my_playd_arr);
	my_playd_arr.push(playd);
	my_playd = my_playd_arr.join('|');

	//my_play_history = GetCookie('my_play_history');
	SetCookie('my_play_history', my_playd);
}
function getPlaydLink() {
	my_playd = GetCookie('my_play_history');
	my_playd_arr = my_playd.split('|');
	var playd_html = '';
	for(i=(my_playd_arr.length-1);i>0;i--) {
		var game = my_playd_arr[i].split(',');
		playd_html += '<a href="'+game[1]+'" target="_blank">'+game[0]+'</a>&nbsp;&nbsp;&nbsp;';
	}
	return playd_html;
}



function tabSelect(tab_name, elm_name, len,j, tab_style_s, tab_style, elm_style_s, elm_style) {
	if (!tab_style_s) tab_style_s = 'selectTag';
	if (!tab_style) tab_style = '';
	if (!elm_style_s) elm_style_s = 'ttagContent selectTag';
	if (!elm_style) elm_style = 'ttagContent';
	for(i=0;i<len;i++){
		eval("getObj('"+tab_name+'_'+i+"').className='"+tab_style+"'");
		eval("getObj('"+elm_name+'_'+i+"').style.display='none'");
		if (elm_style_s) {
			eval("getObj('"+elm_name+'_'+i+"').className='"+elm_style+"'");
		}
	}
	eval("getObj('"+tab_name+'_'+j+"').className='"+tab_style_s+"'");
	eval("getObj('"+elm_name+'_'+j+"').style.display=''");
	eval("getObj('"+elm_name+'_'+j+"').className='"+elm_style_s+"'");
}



(function(){this.FX=function(el,attributes,duration,callback,ctx){this.el=DOM.get(el);this.attributes=attributes;this.duration=duration||0.7;this.callback=callback||function(){};this.ctx=ctx||window};this.FX.prototype={frame:{},endAttr:{},startAttr:{},start:function(){var fx=this;this.getAttributes();this.duration=this.duration*1000;this.time=new Date().getTime();this.animating=true;this.timer=setInterval(function(){var time=new Date().getTime();if(time<(fx.time+fx.duration)){fx.elapsed=time-fx.time;fx.setCurrentFrame()}else{fx.frame=fx.endAttr;fx.complete()}fx.setAttributes()},1)},stop:function(finish){if(this.animating){if(finish){this.frame=this.endAttr;this.setAttributes()}this.complete()}},ease:function(start,end){return start+((1-Math.cos((this.elapsed/this.duration)*Math.PI))/2)*(end-start)},complete:function(){clearInterval(this.timer);this.timer=null;this.animating=false;this.callback.call(this.ctx)},setCurrentFrame:function(){for(attr in this.startAttr){if(this.startAttr[attr]instanceof Array){this.frame[attr]=[];for(var i=0;i<this.startAttr[attr].length;i++){this.frame[attr][i]=this.ease(this.startAttr[attr][i],this.endAttr[attr][i])}}else{this.frame[attr]=this.ease(this.startAttr[attr],this.endAttr[attr])}}},getAttributes:function(){for(var attr in this.attributes){switch(attr){case'color':case'background-color':this.startAttr[attr]=parseColor(this.attributes[attr].from||DOM.getStyle(this.el,attr));this.endAttr[attr]=parseColor(this.attributes[attr].to);break;case'scrollTop':case'scrollLeft':var el=(this.el==document.body)?(document.documentElement||document.body):this.el;this.startAttr[attr]=this.attributes[attr].from||el[attr];this.endAttr[attr]=this.attributes[attr].to;break;default:this.startAttr[attr]=this.attributes[attr].from||(parseFloat(DOM.getStyle(this.el,attr))||0);this.endAttr[attr]=this.attributes[attr].to;break}}},setAttributes:function(){for(var attr in this.frame){switch(attr){case'opacity':DOM.setStyle(this.el,attr,this.frame[attr]);break;case'scrollLeft':case'scrollTop':var el=(this.el==document.body)?(document.documentElement||document.body):this.el;el[attr]=this.frame[attr];break;case'color':case'background-color':var rgb='rgb('+Math.floor(this.frame[attr][0])+','+Math.floor(this.frame[attr][1])+','+Math.floor(this.frame[attr][2])+')';DOM.setStyle(this.el,attr,rgb);break;default:DOM.setStyle(this.el,attr,this.frame[attr]+'px');break}}}};var DOM={get:function(id){return(typeof id=="string")?document.getElementById(id):id},getStyle:function(el,prop){prop=toCamelCase(prop);var view=document.defaultView;if(view&&view.getComputedStyle){return el.style[prop]||view.getComputedStyle(el,"")[prop]||null}else{if(prop=='opacity'){var opacity=el.filters('alpha').opacity;return isNaN(opacity)?1:(opacity?opacity/100:0)}return el.style[prop]||el.currentStyle[prop]||null}},setStyle:function(el,prop,value){if(prop=='opacity'){el.style.filter="alpha(opacity="+value*100+")";el.style.opacity=value}else{prop=toCamelCase(prop);el.style[prop]=value}}};var toCamelCase=(function(){var cache={};return function(str){if(!cache[str]){return cache[str]=str.replace(/-([a-z])/g,function($0,$1){return $1.toUpperCase()})}else{return cache[str]}}})();var parseColor=function(str){var rgb=str.match(/^#?(\w{2})(\w{2})(\w{2})$/);if(rgb&&rgb.length==4){return[parseInt(rgb[1],16),parseInt(rgb[2],16),parseInt(rgb[3],16)]}rgb=str.match(/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/);if(rgb&&rgb.length==4){return[parseInt(rgb[1],10),parseInt(rgb[2],10),parseInt(rgb[3],10)]}rgb=str.match(/^#?(\w{1})(\w{1})(\w{1})$/);if(rgb&&rgb.length==4){return[parseInt(rgb[1]+rgb[1],16),parseInt(rgb[2]+rgb[2],16),parseInt(rgb[3]+rgb[3],16)]}}})();

// search
var lastindex=-1;
var search_prompt_flag=false;
var listlength=0;
function StringBuffer(){this.data=[];} 
StringBuffer.prototype.append=function(){this.data.push(arguments[0]);return this;} 
StringBuffer.prototype.tostring=function(){return this.data.join("");} 

var XmlResultBuffer={
	data : {},
	append : function(key,value){this.data[key]=value},
	inBuffer : function(key){if(this.data[key]){return true}else{return false}},
	getBuffer : function(key){if(this.data[key]){return this.data[key]}else{return}}
	
}
var RequestDelayHandle=0;

function $(elm) {
	return getObj(elm);
}

function hiddensearch(){
	if(!$('search_prompt_list') || !$('search_prompt_frame') )return;
    $('search_prompt_list').style.display="none";
    $('search_prompt_frame').style.display="none";
}
function showsearch(num){
	if(!$('search_prompt_list') || !$('search_prompt_frame') )return;
    $('search_prompt_list').style.display='';
    $('search_prompt_frame').style.display='';
    $('search_prompt_list').style.height=num*20+num+'px';
    $('search_prompt_frame').style.height=num*20+num+2+'px';
}

function createlist(){
//	//边框
//	//var listDiv=document.createElement("div");
//	//listDiv.id="search_prompt_list";
//	var listDiv=$("search_prompt_list");        
//	listDiv.style.zIndex="2";
//	listDiv.style.position="absolute"; 
//	listDiv.style.border="solid 1px #7D7D7D";
//	listDiv.style.backgroundColor="#FFFFFF";
//	listDiv.style.display="none";	
//	listDiv.style.width=$('search_key').clientWidth+"px";
//	
//	//内容容器
//	var listFrame=$("search_prompt_frame");
//	listFrame.style.zIndex="1";
//	listFrame.style.position="absolute";
//	listFrame.style.border="0";
//	listFrame.style.display="none";	
//	listFrame.style.width=$('search_key').clientWidth+"px";
	
}
function setstyle(element,classname){
	switch (classname){
        case 'm':
            element.style.fontSize="12px";
		    element.style.fontFamily="arial,sans-serif";
		    element.style.backgroundColor="#3366cc";
		    element.style.color="black";
		    element.style.width=$('search_key').clientWidth-10+"px";
		    element.style.height="20px";
            element.style.padding="1px 5px 0px 5px";
            if(element.displayTitleSpan)element.displayTitleSpan.style.color="white";
            if(element.displayHitSpan)element.displayHitSpan.style.color="white";
		    break;
        case 'd':
	        element.style.fontSize="12px";
		    element.style.fontFamily="arial,sans-serif";
		    element.style.backgroundColor="white";
		    element.style.color="black";
		    element.style.width=$('search_key').clientWidth-10+"px";
		    element.style.height="20px";
            element.style.padding="1px 5px 0px 5px";
            if(element.displayTitleSpan)element.displayTitleSpan.style.color="black";
            if(element.displayHitSpan)element.displayHitSpan.style.color="#909090";
		    break;
	 case 't':
            element.style.width="60%";
            if(window.navigator.userAgent.toLowerCase().indexOf("firefox")!=-1)element.style.cssFloat="left";
            else element.style.styleFloat="left";
            element.style.whiteSpace="nowrap";
            element.style.overflow="hidden";
            element.style.textOverflow="ellipsis";
            element.style.fontSize="12px";
            element.style.textAlign="left";
            break;
	 case 'h':
            element.style.width="40%";
            if(window.navigator.userAgent.toLowerCase().indexOf("firefox")!=-1)element.style.cssFloat="right";
            else element.style.styleFloat="right";
            element.style.textAlign="right";
            element.style.color="#909090";
            break;
    }
}

function searchkeydown(e){
	if(!$('search_prompt_list') || !$('search_prompt_frame') )return;
    if($('search_prompt_list').innerHTML=='')return;
    var keycode=(window.navigator.appName=="Microsoft Internet Explorer")?event.keyCode:e.which;
    
    //down
    if(keycode==40){
	   if(lastindex==-1||lastindex==listlength-1){
	       focusitem(0);
	       searchclick(0);
	   }else{
	       focusitem(lastindex+1);
	       searchclick();
	   }
    }
    //up
    if(keycode==38){
	   if(lastindex==-1 && listlength>0){
	       //focusitem(0);
	       //searchclick(0);
	       focusitem(listlength-1);
	       searchclick(listlength-1);
	   }else{
	       focusitem(lastindex-1);
	       searchclick();
	   }
    }
    //enter
    if(keycode==13){
        if(lastindex!=-1){
            focusitem(lastindex);
            $("search_key").value=$('title'+lastindex).innerHTML;
        }
        hiddensearch();
    }
    //backspace || delete
    if(keycode==46||keycode==8){search_prompt_flag=false;ajaxsearch();}
}
function showresult(responseText,buffer){
	if(typeof(responseText)!="string")return;
	if(responseText.trim()=="")return;
	var result=eval(responseText);
	
	if(typeof(result)!="object")return;
	if(!buffer){
		XmlResultBuffer.append(result.keyword,responseText);
	}
	
	if(result.result!=''){
        var resultstring=new StringBuffer();
        for(var i=0;i<result.result.length;i++){
            resultstring.append('<div id="item'+i+'" onmousemove="focusitem('+i+')" onmousedown="searchformsubmit(\''+result.result[i].url+'\');searchclick('+i+');"><input type="hidden" id="item_url_'+i+'" value="'+result.result[i].url+'">');
            resultstring.append('<span id=title'+i+'>');
            resultstring.append(result.result[i].title);
            resultstring.append('</span>');
            resultstring.append('<span id=hits'+i+'>');
			if (result.result[i].type == 'fla')
			{
				var type_txt = '直接游戏';
			}
			else if (result.result[i].type == 'tag')
			{
				var type_txt = '进入专题';
			}
            resultstring.append(type_txt);
            resultstring.append('</span>');
            resultstring.append('</div>');
        }
        $('search_prompt_list').innerHTML=resultstring.tostring();
        for(var j=0;j<result.result.length;j++){
            setstyle($('item'+j),'d');
            $('item'+j).displayTitleSpan=$('title'+j);
            $('item'+j).displayHitSpan=$('hits'+j);
            setstyle($('title'+j),'t');
            setstyle($('hits'+j),'h');
        }
        showsearch(result.result.length);
        listlength=result.result.length;
        lastindex=-1;
	}else hiddensearch();
}

function sendRequest(){
	var value=$('search_key').value.trim();
	var url="/search_ajax.php?inajax=1&keyword="+encodeURIComponent(value);
	addScript(url);
}

function initFootqValue(){
	if(!$("footq"))return;
	if(!$("footq").checked){
		$("footq").style.color="#c6c6c6";
		$("footq").value=defaultSearchTextValue;
	}else{
		footUserClicked=true;
	}
	$("footq").onfocus=function(){focusSearchTxt($("footq"))};
	$("footq").onblur=function(){blurSearchTxt($("footq"))};
	
}
function focusSearchTxt(objSearchTxt){
	if(location.href.indexOf(useDomain)==-1)return ;
	if(objSearchTxt.defaultValue!='')return;
	if(objSearchTxt.id=='search_key'){
		if(!headUserClicked){
			objSearchTxt.style.color="black";
			objSearchTxt.value="";
			headUserClicked=true;
		}
	}else{
		if(!footUserClicked){
			objSearchTxt.style.color="black";
			objSearchTxt.value="";
			footUserClicked=true;
		}
	}
}
function blurSearchTxt(objSearchTxt){
	if(location.href.indexOf(useDomain)==-1)return ;
	if(objSearchTxt.defaultValue!='')return;
	if(objSearchTxt.id=='search_key'){
		if(headUserClicked && objSearchTxt.value==''){
			objSearchTxt.style.color="#c6c6c6";
			objSearchTxt.value=defaultSearchTextValue;
			headUserClicked=false;
		}
	}else{
		if(footUserClicked && objSearchTxt.value==''){
			objSearchTxt.style.color="#c6c6c6";
			objSearchTxt.value=defaultSearchTextValue;
			footUserClicked=false;
		}
	}
}
chengui_ajax=
{
  getHTTPObject:function()
  {
    var A=false;
    if(typeof ActiveXObject!="undefined")
    {
      try
      {
        A=new ActiveXObject("Msxml2.XMLHTTP")
      }
      catch(C)
      {
        try
        {
          A=new ActiveXObject("Microsoft.XMLHTTP")
        }
        catch(B)
        {
          A=false
        }
      }
    }
    else
    {
      if(window.XMLHttpRequest)
      {
        try
        {
          A=new XMLHttpRequest()
        }
        catch(C)
        {
          A=false
        }
      }
    }
    return A
  }
  ,load:function(url,callback,format,method,opt)
  {
    var http=this.init();
    if(!http||!url)
    {
      return
    }
    if(http.overrideMimeType)
    {
      http.overrideMimeType("text/xml")
    }
    if(!method)
    {
      method="GET"
    }
    if(!format)
    {
      format="text"
    }
    if(!opt)
    {
      opt=
      {
      }
    }
    format=format.toLowerCase();
    method=method.toUpperCase();
    var now="uid="+new Date().getTime();
    if(method!="GET")
    {
      url+=(url.indexOf("?")+1)?"&":"?";
      url+=now;
    }
    var parameters=null;
    if(method=="POST")
    {
      var parts=url.split("?");
      url=parts[0];
      parameters=parts[1]
    }
    http.open(method,url,true);
    if(method=="POST")
    {
      http.setRequestHeader("Content-type","application/x-www-form-urlencoded");
      http.setRequestHeader("Content-length",parameters.length);
      http.setRequestHeader("Connection","close")
    }
    var ths=this;
    if(opt.handler)
    {
      http.onreadystatechange=function()
      {
        opt.handler(http)
      }
    }
    else
    {
      http.onreadystatechange=function()
      {
        if(http.readyState==4)
        {
          if(http.status==200)
          {
            var result="";
            if(http.responseText)
            {
              result=http.responseText
            }
            if(format.charAt(0)=="j")
            {
              result=result.replace(/[\n\r]/g,"");
              result=eval("("+result+")")
            }
            else
            {
              if(format.charAt(0)=="x")
              {
                result=http.responseXML
              }
            }
            if(callback)
            {
              callback(result)
            }
          }
          else
          {
            if(opt.loadingIndicator)
            {
              document.getElementsByTagName("body")[0].removeChild(opt.loadingIndicator)
            }
			  
            if(opt.loading&&opt.loading!=undefined)
            {
              document.getElementById(opt.loading).style.display="none"
            }
			var error;
            if(error)
            {
              error(http.status)
            }
          }
        }
      }
    }
    http.send(parameters)
  }
  ,bind:function(A)
  {
    var C=
    {
      "url":"","onSuccess":false,"onError":false,"format":"text","method":"GET","update":"","loading":"","loadingIndicator":""
    };
    for(var B in C)
    {
      if(A[B])
      {
        C[B]=A[B]
      }
    }
    if(!C.url)
    {
      return
    }
    var D=false;
    if(C.loadingIndicator)
    {
      D=document.createElement("div");
      D.setAttribute("style","position:absolute;top:0px;left:0px;");
      D.setAttribute("class","loading-indicator");
      D.innerHTML=C.loadingIndicator;
      document.getElementsByTagName("body")[0].appendChild(D);
      this.opt.loadingIndicator=D
    }
    if(C.loading)
    {
      document.getElementById(C.loading).style.display="block"
    }
    this.load(C.url,function(E)
    {
      if(C.onSuccess)
      {
        C.onSuccess(E)
      }
      if(C.update)
      {
        document.getElementById(C.update).innerHTML=E
      }
      if(D)
      {
        document.getElementsByTagName("body")[0].removeChild(D)
      }
      if(C.loading)
      {
        document.getElementById(C.loading).style.display="none"
      }
    }
    ,C.format,C.method,C)
  }
  ,init:function()
  {
    return this.getHTTPObject()
  }
}
// 我玩过游戏记录
function my_play_history(){
	if ($('my_play_history')) {
		var playd_link = getPlaydLink();
		alert(playd_link);
		$('my_play_history').innerHTML=playd_link;
	}
}

var delta = 0.15;  //移动速度，数字越大越快，注意：值要小于等于1
var collection;
var closeFlag = false;
 
function ad_object()
{ 
 this.items = [];
 this.addItem = function(ad_id, ad_w, ad_h, ad_x, ad_y, ad_content)
 {
	html = '<div id="'+ad_id+'" style="z- index:10;position:absolute;width:'+ad_w+'px;height:'+ad_h+'px;left:'+ (typeof(ad_x)=='string'?eval(ad_x):ad_x)+'px;top:'+ (typeof(ad_y)=='string'?eval(ad_y):ad_y)+'px; border:0px #000000 solid;"&gt;';
  if (closeFlag) {
	html += '<div style="float:right;z-index:11;width:24px;height:12px; top:-15px;left:'+(ad_w-30)+'px;position:absolute;font- size:12px;cursor:pointer;" onclick="javascript:closeAd('+ad_id+');">关闭</div>';
  }
  html += '<div>'+ad_content+'</div></div>';
  document.write(html);
  var newItem = {};
  newItem.object = document.getElementById(ad_id);
  newItem.x = ad_x;
  newItem.y = ad_y;
  this.items[this.items.length] = newItem;
 }
 this.play = function()
 {
  collection = this.items
  setInterval('play()',30);
 }
}
function play()
{
 for(var i=0;i<collection.length;i++)
 {
  var followObj = collection[i].object;
  var followObj_x = (typeof(collection[i].x)=='string'?eval(collection[i].x):collection[i].x);
  var followObj_y = (typeof(collection[i].y)=='string'?eval(collection[i].y):collection[i].y);
  
  if(followObj.offsetLeft != (document.documentElement.scrollLeft + followObj_x))
  {
   var dx = (document.documentElement.scrollLeft + followObj_x - followObj.offsetLeft) * delta;
   dx = (dx > 0 ? 1 : -1) * Math.ceil(Math.abs(dx));
   followObj.style.left = followObj.offsetLeft + dx + "px";
  }
  if(followObj.offsetTop != (document.documentElement.scrollTop + followObj_y))
  {
   var dy = (document.documentElement.scrollTop + followObj_y - followObj.offsetTop) * delta;
   dy = (dy > 0 ? 1 : -1) * Math.ceil(Math.abs(dy));
   followObj.style.top = followObj.offsetTop + dy + "px";
  }
 }
} 
  
function closeAd(obj_id)
{
 eval(obj_id).style.display = "none";
 return;
}


function playclicks(aid){
	var url=jsBasePath+'/ajax.php?inajax=1&action=clicks&aid='+aid+'&rand='+Math.random();
	chengui_ajax.load(url,function(data){},'text','get'
	);
}

function showclicks(aid){
	var url= jsBasePath+'/ajax.php?inajax=1&action=showclicks&aid='+aid+'&rand='+Math.random();
	chengui_ajax.load(url,function(data){
		document.getElementById('showclicks').innerHTML=data;
		},'text','get'
	);
}



function getRealSize(w, h, m){
	var t;
	if(m == 1){
		t = parseInt(flash_width * h/flash_height);
		if(t > w){
			return w;	
		}else{
			return t;
		}
	}else{
		t = parseInt(w * flash_height/flash_width);
		if(t > h){
			return h;
		}else{
			return t;
		}
	}
}
var nowScreenWidth = document.documentElement.clientWidth;
var nowScreenHeight = document.documentElement.clientHeight-30;

function resizeFlash(m) {
	if (m == 1)
	{
		//rw = getRealSize(965,540,1);
		//rh = getRealSize(rw,540,2);
		rw = 965;
		rh = 713;
        $('similar').style.display="none";
		$('similar').style.height="auto";
	} else if (m == 2)
	{
		//rw = getRealSize(730,540,1);
		//rh = getRealSize(rw,540,2);
		rw = 730;
		rh = 540;
        $('similar').style.display="block";
		$('similar').style.height="auto";
	} else if (m == 3)
	{
		rw = 594;
		rh = 440;
		$('similar').style.display="block";
		$('similar').style.height=478+'px';
	} else if (m == 4)
	{
		rw = getRealSize(nowScreenWidth,nowScreenHeight,1);
		rh = getRealSize(rw,nowScreenHeight,2);
	}else {
		rw = flash_width;
		rh = flash_height;
	}
	if ($('flasharea'))
	{
		$('flasharea').style.width = rw+'px';
		$('flasharea').style.height=rh+'px';
	}
	if($('flashgame_play_before'))
	{
		$('flashgame_play_before').style.width = rw+'px';
		$('flashgame_play_before').style.height = rh+'px';
	}
	document.getElementsByTagName('iframe').item(1).width = rw+'px'
	document.getElementsByTagName('iframe').item(1).height = rh+'px'
	$('flashgame').width  = rw+'px';
	$('flashgame').height = rh+'px';
}
var boolFullScreen = 0;
var boolExitFullScreen = 0;
function fullScreen() {
	var getEIDflashGameWar = document.getElementById('flashGameWar');

	getEIDflashGameWar.style.position = "absolute";

	getEIDflashGameWar.style.zIndex="9999";
	getEIDflashGameWar.style.backgroundColor="#ffffff";
	document.documentElement.scrollTop = "0";
	document.documentElement.scrollLeft = "0";
	getEIDflashGameWar.style.width  = document.documentElement.clientWidth + 40+'px';
	getEIDflashGameWar.style.height = document.documentElement.clientHeight + 40 +'px';
	getEIDflashGameWar.style.top="0";
	getEIDflashGameWar.style.left = "0";
	document.getElementById("menuOfFull").style.display = "block";
	document.documentElement.style.overflow='hidden';
	boolFullScreen = 1;
	boolExitFullScreen = 0;
	bigFullScreen(); 
	if (window.XMLHttpRequest) { // Mozilla, Safari,IE7
	} else {
	document.body.style.width = document.documentElement.clientWidth - 20 + 'px';
	}
}


window.onresize = function(){
	if(boolExitFullScreen)
	{	
		if (window.XMLHttpRequest) { // Mozilla, Safari,IE7
		} else {
		document.body.style.width = document.documentElement.clientWidth;
		}
	}
	if(boolFullScreen){
	var getEIDflashGameWar = document.getElementById('flashGameWar');
	getEIDflashGameWar.style.width  = document.documentElement.clientWidth + 40+'px';
	getEIDflashGameWar.style.height = document.documentElement.clientHeight + 40 +'px';
	bigFullScreen();
	}
}
function exitFullScreen()
{
	boolFullScreen = 0;
	var getEIDflashGameWar = document.getElementById('flashGameWar');
	getEIDflashGameWar.style.position = "static";
	getEIDflashGameWar.style.zIndex="0";
	getEIDflashGameWar.style.backgroundColor="transparent";
	getEIDflashGameWar.style.width  = "auto";
	getEIDflashGameWar.style.height = "auto";
	document.getElementById("menuOfFull").style.display = "none";
	document.documentElement.style.overflow="auto";
	location.href = "#flashGameWar";
	if(boolExitFullScreen)
	{
		if (window.XMLHttpRequest) { // Mozilla, Safari,IE7
		} else {
		document.body.style.width = document.documentElement.clientWidth;
		}
	}
	$('flashgame').style.marginTop = "0";
	$('flashgame_play_before').style.marginTop = "0";
	boolExitFullScreen = 1;
	resizeFlash(2);

}
function normalScreen() {
	resizeFlash(3);
}

function normalScreen2() {
	resizeFlash(2);
}

function mediumScreen(){
	resizeFlash(1);
}

function downlink(name,url){   
	var link_url = 'http://www.9191.com/downlink.php?name='+name+'&url='+url;
	var txt = '<iframe frameborder="0" width="0" height="0"  src="'+link_url+'"></iframe>';
	$('pfdiv').innerHTML=txt;
}
function bigFullScreen(){
	nowScreenWidth = document.documentElement.clientWidth;
	nowScreenHeight = document.documentElement.clientHeight-30;
	resizeFlash(4);
	isChangeFlashGame();
	
}

function enlargeFullScreen(){
	if(document.documentElement.clientWidth - nowScreenWidth >= 50 && document.documentElement.clientHeight - 30 - nowScreenHeight >= 50)
	{
	nowScreenWidth = nowScreenWidth + 50;
	nowScreenHeight = nowScreenHeight + 50;
	resizeFlash(4);
	isChangeFlashGame();
	}
	else{
	bigFullScreen();
	}
}
function isChangeFlashGame(){
	$('flashgame').style.marginTop = (document.documentElement.clientHeight-30 - nowScreenHeight)/2 +"px";
	$('flashgame_play_before').style.marginTop = (document.documentElement.clientHeight-30 - nowScreenHeight)/2 +"px";
	}

function show_favorite_msg(msg) {
	alert(msg);
}

function rand(min,max){
	return Math.round(min+(Math.random()*(max-min)));
};

function setStarVote(vote) {
	var my_voted = GetCookie('my_voted');
	voted_arr = my_voted.split(',');
	var len = voted_arr.length;
	for (i=0;i<len;i++) {
		if (voted_arr[i] == vote) {
			return;
		}
	}
	if (len>=50) voted_arr.shift(voted_arr);
	voted_arr.push(vote);
	my_voted = voted_arr.join(',');
	SetCookie('my_voted', my_voted);

}

function checkStarVote() {
	var my_voted = GetCookie('my_voted');
	voted_arr = my_voted.split(',');
	var len = voted_arr.length;
	for (i=0;i<len;i++) {
		if (voted_arr[i] == vote) {
			return;
		}
	}
}

var startime;

function hideVote() {
	var fx = new FX('pfdiv', 
		{width: {to: 0}}, null, function() {$('pfdiv').style.display='none';}
	);
	fx.start();
}




function replayFlash() {
	if (disp_gg) return false;

	var type = getTheType();

	if (type == 'swf') playSwfFlash(true);
	else playIframeFlash(true);
}

function playTheFlash() {
	var type = getTheType();

	if (type == 'swf') playSwfFlash();
	else playIframeFlash();
	
}

function playSwfFlash(replay) {
	var params = {
		allowNetworking: "internal"
	};
	swfobject.embedSWF(flash_url, "flashgame", flash_width, flash_height, "9.0.0", "expressInstall.swf",null,params);
	if (replay) {
		$('flashgame').style.display='block';
	}
}

function playIframeFlash(replay) {
	var html = "<iframe id='flash_frame' frameborder='0' width='"+flash_width+"' height='"+flash_height+"'  src='"+flash_url+"'></iframe>";
	$('flashgame').style.width=flash_width;
	$('flashgame').style.height=flash_height;
	$('flashgame').innerHTML=html;
	if (replay) {
		$('flashgame').style.display='block';
	}
}

function flashPercent() {
	var str = '<div id="percentdiv"><div class="loading_bar"><div id="bar" style="background:#009CE8;float:left;height:8px;"></div></div><div>小游戏已加载<span id="progress"></span></div></div>';
	$('percent').innerHTML=str;
	setTimeout("percent()", 200);
}
var download_AD = 0;
function percent() {
	var flashgame = document.getElementById('flashgame');
	if (document.all && typeof(flashgame) == 'object') {
		var bg = document.getElementById('bar');
		var loaded = flashgame.PercentLoaded();
		if (typeof(loaded) != 'undefined')
		{
			var timeout = setTimeout('percent()',300);

			bg.style.width=4.5 * loaded;
			var bb = document.getElementById('progress');
			bb.innerHTML=loaded + '%';
			
			if (loaded == 100) {
				$('percentdiv').style.display="none";
				clearTimeout(timeout);
				hidepercent();
				if($('flashgame_play_before').style.display == "none")
				{
				$('downStatus').innerHTML="下载完成";
				$('downProgress').style.display = "none";
				$('zjwz').style.display = "";
				
				}
				else{
					download_AD = 1;	
				}
			}
		} else {
			hidepercent();
		}
	} else {
		hidepercent();
	}
}



  
	

  
	
