var random_number = 1;//important 1=728 .5=728+468 0=468

//var mew_Rserv = "http://flash.gamemew.com";
var mew_Rserv = "http://www.gamemew.net";

var cpmstarmew_onoff=1;
var cpmstarmew_txt="loading now...";

if (navigator.appName == 'Netscape'){var random_language = navigator.language;}
else{var random_language = navigator.browserLanguage;}
if (random_language.indexOf('ko') > -1 || random_language.indexOf('zh') > -1)  {var random_number = 0;var cpmstarmew_onoff=0;var mew_Rserv = "http://flash.gamemew.com";}
//else{var random_number = 1; }
//if (random_language.indexOf('en') > -1 || random_language.indexOf('es') > -1)  {var cpmstarmew_onoff=1;}



var bookmarkname=document.title;

function addBookmark(title,url) {
    if (window.sidebar) {
        window.sidebar.addPanel(title, url,"");
    } else if( document.all ) {
        window.external.AddFavorite( url, title);
    } else if( window.opera && window.print ) {
        return true;
    }
}

function CopyText(obj) {
	ie = (document.all)? true:false
	if (ie){
		var rng = document.body.createTextRange();
		rng.moveToElementText(obj);
		rng.scrollIntoView();
		rng.select();
		rng.execCommand("Copy");
		rng.collapse(false);
		alert("Copy Right");
	}
}

function isSameSite(str)
{
    return (new RegExp("http://" + document.location.host)).test(str);
}


function PlayRefshow(RefdivName){
var outref=document.referrer;
var isoutsearch=/(google|yahoo)\.(org|com|net|co\.uk)/.test(outref);
			if (('' != outref) && !isSameSite(outref) && !isoutsearch)
			 {
			 var str='';
			 var outrefarry1=outref.split("/");
			 outrefarry2=outrefarry1[2].replace("www.","");
			 outreftitle=outrefarry2.substr(0,30);
			 str += '<div id="showoutref">You come from: <a href="'+ outref +'" title="You come from '+outrefarry2+'">'+outreftitle+'</a></div>';
	 document.write(str);
				}
				else {
				document.write('<div id="showoutref">(<a href="javascript:location.reload()" rel="nofollow" title="ReLoad this game">ReLoad this game</a>)</div>');
				}
}


//*********** show game
//start loading bar
var myCount=6;
function refreshflash()
{
	var bar = document.getElementById("line");	
	var bar1 = document.getElementById("loadpercent");
    var movie = getFlashMovieObject("mov");	
if(movie){

	       bar.style.width=movie.PercentLoaded()*1.5+"px";
	       if(movie.PercentLoaded()<100)
		      {

bar1.innerHTML="Loading " +  movie.PercentLoaded() + "%";
		      }
           else{
	        bar1.innerHTML="Loading 100%";
            clearInterval(num);
			tt3=window.setTimeout('count()',1000);
		    tt2=window.setTimeout('hideAd()', (myCount+2)*1000);
               }
         }
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else 
  {
    return document.getElementById(movieName);

  } 
}	


function hideAd()
   {
   document.getElementById('loadlayer').style.display='none';
   document.getElementById('flash').style.display='';
   clearInterval(tt3);
   clearTimeout(tt2);
   clearTimeout(tt1);
   }

function skiphideAd()
   {
   document.getElementById('loadlayer').style.display='none';
   document.getElementById('flash').style.display='';
   clearInterval(num);
   clearInterval(tt3);
   clearTimeout(tt2);
   clearTimeout(tt1);
   }

function count(){ 
document.getElementById("loadpercent").innerHTML = myCount; 
myCount--; 
tt1=window.setTimeout('count()',1000); 
} 







function show_flash(src, height, width, isfull) {
	if (isfull==1) 
	{
		height = document.body.clientHeight - 44;
		width = document.body.clientWidth;
		sxf_isdisplay = "";
	}
	else {
		sxf_isdisplay = "display: none;";
		document.writeln('<div id="flash" style="' + sxf_isdisplay + '">');
		}
	document.writeln('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="' + width + '" height="' + height + '" id="mov">');
	document.writeln('<param name="movie" value="' + src + '">');
	document.writeln('<param name="quality" value="high">');
	document.writeln('<embed src="' + src + '" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" menu="0"></embed>');
	document.writeln('</object>');
if (isfull!=1) 
	{
		document.writeln('</div>');
	}

if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0) && isfull != 1)
{ 
num=setInterval("refreshflash()",50);
}
else
{
	if (isfull!=1) 
	{
tt3=window.setTimeout('count()',1000);
tt2=window.setTimeout('hideAd()', (myCount+2)*1000);
	}
}



}

function show_shockwave(src, height, width, isfull) {
if (isfull!=1) 
	{
		sxf_isdisplay = "display: none;";
		document.writeln('<div id="flash" style="' + sxf_isdisplay + '">');
	}

	
	document.writeln('<object classid="clsid:166B1BCA-3F9C-11CF-8075-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0" width="' + width + '" height="' + height + '">');
	document.writeln('<param name="swRemote" value="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\'">');
	document.writeln('<param name="swStretchStyle" value="meet">');
	document.writeln('<param name="bgColor" value="#000000">');
	document.writeln('<param name="src" value="' + src + '">');
	document.writeln('<embed src="' + src + '" width="' + width + '" height="' + height + '" bgColor="#000000" swRemote="swSaveEnabled=\'true\' swVolume=\'true\' swRestart=\'true\' swPausePlay=\'true\' swFastForward=\'true\' swContextMenu=\'true\'" swStretchStyle="meet" type="application/x-director" pluginspage="http://www.macromedia.com/shockwave/download/"></embed>');
	document.writeln('</object>');
	
if (isfull!=1) 
	{
		document.writeln('</div>');
tt3=window.setTimeout('count()',1000);
tt2=window.setTimeout('hideAd()', (myCount+2)*1000);
	}

}

function show_frame(src, height, width, isfull) {
	if (isfull!=1) 
	{
		sxf_isdisplay = "display: none;";
		document.writeln('<div id="flash" style="' + sxf_isdisplay + '">');
	}
		
	document.writeln('<iframe src="' + src + '" height="' + height + '" width="' + width + '" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>');
	
	if (isfull!=1) 
	{
		document.writeln('</div>');
		tt3=window.setTimeout('count()',1000);
tt2=window.setTimeout('hideAd()', (myCount+2)*1000);
	}


}


//***************  Lab
function selectTag(showContent,selfObj){
	var tag = document.getElementById("tags").getElementsByTagName("li");
	var taglength = tag.length;
	for(i=0; i<taglength; i++){
		tag[i].className = "";
	}
	selfObj.parentNode.className = "selecttag";
	for(i=0; j=document.getElementById("tagcontent"+i); i++){
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
}