/*  
Toplink Offical JS for MMOsite
Use for: mmosite.com
Version: 3.0
Date: 2007/10/14 11:49:00
Author: 33
*/


//Get the document id
function getId(id) {
	return document.getElementById(id);
}

//bug_report
function win_open_bug(){
	var toUrl = 'http://report.help.mmosite.com/bug_report.htm?backurl='+escape(top.window.location.href);
	window.open(toUrl);
}

function winOpenBug(){
	win_open_bug();
}

//mmoPop
function mmoPop(num){
	if (num ==1){
	document.getElementById("moregbi").style.display = "block"
	}else{
	document.getElementById("moregbi").style.display = "none"
	}
}

//Add to favorite
function myAddPanel(homeName, homePage){
	if((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))//Gecko
		window.sidebar.addPanel(homeName,homePage,"");
	else//IE
		window.external.AddFavorite(homePage,homeName);
}

//setHomePage
function setHomePage(obj,siteUrl)
{
	var ua = navigator.userAgent.toLowerCase();
	var isIE = (ua.indexOf("msie") > -1),isIE7 = (ua.indexOf("msie 7") > -1),isOpera = (ua.indexOf("opera") > -1),isSafari = (ua.indexOf("webkit") != -1 || ua.indexOf("khtml") != -1),isGecko = (!isSafari && ua.indexOf("gecko") > -1);

  if(isIE){
	  var strHref=window.location.href;obj.style.behavior='url(#default#homepage)';obj.setHomePage(siteUrl);
  }else{
		  if(window.netscape){
			  try {  
				  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
			  }  catch (e)  {  
				  alert("Dear user,the copy function fails under firefox browser!\nPlease input 'about:config?? in the browser address\n and press enter and set \n'[signed.applets.codebase_principal_support]' to 'true'.");  
			  }
		  }
			  var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
			  prefs.setCharPref('browser.startup.homepage',siteUrl);
          }
		  
}


//ShowFlash
function showFlash(iUrl,iWidth,iHeight,iWmode)
{
	var flash = '<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="'+ iWidth +'" height="' + iHeight +'" />';
	flash = flash + '<param name="movie" value="'+ iUrl +'" />';
	flash = flash + '<param name="quality" value="high" />';
	flash = flash + '<param name="menu" value="false" />';
	if (iWmode == 1) {
	   flash = flash + '<param name="wmode" value="transparent" />';      
	}
	flash = flash + '<embed src="' + iUrl + '" width="'+ iWidth +'" height="'+ iHeight +'" menu="false" quality="high" ';
	if (iWmode == 1) {
	   flash = flash + 'wmode="transparent" ';      
	}
	flash = flash + ' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" mwode="transparent"></embed>';
	flash = flash + '</object>';
	
	document.writeln(flash); 
	//alert(flash);
}

 /******************************
 *Filename:      public.js
 *Version:       1.1.0(2009-4-16)
 *Website:       http://mmosite.com/public.js
 *Author:        S.S.L
 *Modify:	     S.S.L(2009-6-2)
*******************************/
function Bgad(){
	var o = this;
	var ladurl,radurl,bgpic,version;
    var ti = 1;
	
	var adcontainer_style = {
		"id":"newbgad",
		"width":"1002px",
		"margin":"0 auto",
		"position":"relative"
	}
	
	function getAdContainer(){
		var ad = document.createElement( "div" );

		ad.id= adcontainer_style.id;
		ad.style.width = adcontainer_style.width;
		ad.style.position = adcontainer_style.position;
		ad.style.margin = adcontainer_style.margin;
		
		return ad;
	}
	
	function setAdContainer( adcontainer,ad1,ad2 ){
		adcontainer.appendChild( ad1 );
		adcontainer.appendChild( ad2 );
		
		document.body.style.overflowX = "hidden";
        document.body.style.position= "relative";
		document.body.insertBefore( adcontainer,document.body.childNodes[0] );
	}
	
	function getAd( url,id ){
		ad = document.createElement( "div" );
		
		ad.id = id;
		
		ad.style.position = "absolute";
		ad.style.cursor = "pointer";
		/*ad.style.border = "1px solid red";*/

		ad.style.backgroundImage = "url(" + bgpic + ")"; 
		ad.style.backgroundRepeat = "no-repeat";
		ad.style.backgroundAttachment = "fixed";
		
		ad.onclick = function(){
			window.open( url );
		}
		
		return ad;
	}

	//calculate position
	function resize( ad1,ad2 ){
		var adwidth,adheight,adScrollHeight,adScrollTop;
		
		/*var doc = document.compatMode != "CSS1Compat" ? document.body : document.documentElement;
		
		adwidth = Math.abs(doc.clientWidth-1002)/2 - 4;
		adheight = doc.clientHeight;
		
		adScrollTop = doc.scrollTop;
  		adScrollHeight = doc.scrollHeight;*/
		
		if( document.all ){
			adwidth = Math.abs(document.body.clientWidth-1002)/2 - 4;
			adheight = Math.min(document.body.clientHeight,document.documentElement.clientHeight);

			adScrollTop = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
		} else {
			adwidth = Math.abs(document.documentElement.clientWidth-1002)/2 - 4;
			adheight = document.documentElement.clientHeight;
		
			adScrollTop = document.documentElement.scrollTop;
		}
		
		if( document.compatMode != "CSS1Compat" ){
			adheight = document.body.clientHeight;
			adScrollTop = document.body.scrollTop;
		}
  		adScrollHeight = document.body.scrollHeight;
		
		ad1.style.top = "0px";	
		ad1.style.width = adwidth + "px";
		
		if( adScrollHeight == ( adScrollTop + adheight ) ){
		    adScrollHeight = (document.all && version == null) ? (adScrollHeight-95) : (adScrollHeight-80);
		}
		ad1.style.height = adScrollHeight + "px";
		ad1.style.left = "-" + adwidth + "px";

		ad2.style.width = ad1.style.width;
		ad2.style.height = ad1.style.height;
		ad2.style.right = ad1.style.left;		
		ad2.style.top = ad1.style.top;
		
		ad1.style.backgroundPosition =Math.ceil ( adwidth-219+4 ) + "px " + ( ( adScrollTop<=30 && version == null )? "32px":"0" );
		
		if( window.XMLHttpRequest )
				ad2.style.backgroundPosition = ad1.style.backgroundPosition;
			else
				ad2.style.backgroundPosition = "-1222px " + ( ( adScrollTop<=30 && version == null )? "32px":"0" );
	}
	
	function isWidthScreen(){
		return window.screen.width > 1024 ? true : false;
	}
	
	this.init = function(newadurl1,newadurl2,newbgpic,newversion){
		ladurl = newadurl1;
		radurl = newadurl2;
		bgpic = newbgpic;
		version = newversion;
		
		if( !isWidthScreen() ) return;
		
		var adcontainer = getAdContainer();
		
		var ad1 = getAd( ladurl ,"leftad" );
		var ad2 = getAd( radurl ,"rightad" );
		
		//add ad div
		setAdContainer( adcontainer,ad1,ad2 );
		
		//add listener
		if( document.all ){
			window.attachEvent( "onload",function(){resize( ad1,ad2 );} );
			if( window.XMLHttpRequest )
				window.attachEvent( "onscroll",function(){resize( ad1,ad2 );} );
			window.attachEvent( "onresize",function(){resize( ad1,ad2 );} );
		} else {
			window.addEventListener( "load",function(){resize( ad1,ad2 );},false );
			window.addEventListener( "scroll",function(){resize( ad1,ad2 );},true );
			window.addEventListener( "resize",function(){resize( ad1,ad2 );},true );
		}
	}
}

/******************************
 *Filename:      nav.js
 *Version:       1.0.0(2009-6-2)
 *Website:       http://
 *Author:        S.S.L
*******************************/

function MMOStation(){
	
	var more = [
		[ "Answer","http://answer.mmosite.com/" ],
		[ "immosite","http://my.mmosite.com/" ],
		[ "Company","http://company.mmosite.com/" ],
		[ "Contest","http://contest.mmosite.com/" ],
		[ "Database","http://db.mmosite.com/" ],
		[ "Download","http://download.mmosite.com/" ],
		[ "Feature","http://feature.mmosite.com/" ],
		[ "Forum","http://forum.mmosite.com/" ],
		[ "Gamelist","http://gamelist.mmosite.com/" ],
		[ "Mobile","http://m.mmosite.com/sample/index.shtml" ],
        [ "My Profile","http://accounts.mmosite.com/user/myprofile.php" ],
		[ "News","http://news.mmosite.com/" ],
		[ "Photo","http://photo.mmosite.com/" ],
		[ "Search","http://search.mmosite.com/" ],
		[ "Shop","http://shop.mmosite.com/" ],
		[ "Tag","http://tag.mmosite.com/" ],
		[ "Top100","http://top100.mmosite.com/" ],
		[ "Video","http://video.mmosite.com/" ],
		[ "Vote","http://vote.mmosite.com/" ],
		[ "Help","http://help.mmosite.com/" ]
	];
	
	function $( id ){ 
		return document.getElementById( id ); 
	}
	
	this.setDisplay = function( k ){
		$( "mmo_menu" ).style.display = ( k==1 )? "block":"none";
	}
	
	function getCafeStyle(){
		var str = '<style type="text/css">';
		
		str += '#mmo_global_nav { text-align:center; height:31px; background:url(http://images.mmosite.com/www/newnav_version2/cafe.gif) 0 0 repeat-x; font-family:Arial, Helvetica, sans-serif; font-size:11px;}';
		str += '#mmo_global_nav ul { list-style:none; margin:0; padding:0;}';
		str += '#mmo_global_nav a { text-decoration:none;}';
		str += '#mmo_global_nav a:hover { text-decoration:underline;}';
		str += '#mmo_wrapper { width:1002px; margin:0 auto; text-align:left; height:28px; padding:1px 0 2px 0; background:url(http://images.mmosite.com/www/newnav_version2/cafe.gif) 0 0 repeat-x;}';
		
		/*logo*/
		str += '#mmo_logo { float:left; padding-left:5px; display:none;}';
		str += '#mmo_logo a { display:block; width:94px; height:28px; background:url(http://images.mmosite.com/www/newnav_version2/cafe.gif) 0 -31px no-repeat; text-indent:-1000em; overflow:hidden;}';
		
		/*user*/
		str += '#mmo_user { float:left; padding-left:5px;}';
		str += '#mmo_user ul li { float:left; line-height:28px; padding:0 3px;}';
		str += '#mmo_user a { color:#ffd1a2; padding-left:13px;}';
		str += '#mmo_user a:hover { color:#f4aa5e;}';
		str += '	#mmo_user .ico_home { background:url(http://images.mmosite.com/www/newnav_version2/cafe.gif) 0 -93px no-repeat;}';
		str += '	#mmo_user .ico_home:hover { background-position:0 -94px;}';
		str += '	#mmo_user .ico_mycenter { background:url(http://images.mmosite.com/www/newnav_version2/cafe.gif) 0 -122px no-repeat;}';
		str += '	#mmo_user .ico_mycenter:hover { background-position:0 -123px;}';
		str += '	#mmo_user .ico_blog { background:url(http://images.mmosite.com/www/newnav_version2/cafe.gif) 0 -150px no-repeat;}';
		str += '	#mmo_user .ico_blog:hover { background-position:0 -151px;}';
		
		/*service*/
		str += '#mmo_service { float:right; padding-right:10px;}';
		str += '#mmo_service ul li { float:left; height:28px; line-height:28px; padding:0 10px; background:url(http://images.mmosite.com/www/newnav_version2/cafe.gif) right bottom no-repeat;}';
		str += '#mmo_service li a { color:#ded1c4;}';
		str += '#mmo_service li a:hover { color:#fff;}';
		str += '	#mmo_service .mmo_more { background:none; position:relative; }';
		str += '	#mmo_service .mmo_more a { display:block; float:left; width:52px; height:18px;  margin-top:7px; background:url(http://images.mmosite.com/www/newnav_version2/cafe.gif) 0 -64px no-repeat; text-indent:-1000em; overflow:hidden;}';
		
		/*menu*/
		str += '#mmo_menu { position:absolute; top:29px; right:20px; width:524px; display:none; background:url(http://images.mmosite.com/www/newnav_version2/cafe_menu.gif) -1048px bottom no-repeat; z-index:1000;}';
		str += '	#mmo_menu .mmo_head { height:6px; line-height:6px; font-size:1%;  overflow:hidden; background:url(http://images.mmosite.com/www/newnav_version2/cafe_menu.gif) 0 0 no-repeat;}';
		str += '	#mmo_menu .mmo_foot { height:6px; line-height:6px; font-size:1%; overflow:hidden;}';
		str += '	#mmo_menu .mmo_body { background:url(http://images.mmosite.com/www/newnav_version2/cafe_menu.gif) -524px 0 repeat-y; padding:0 6px;}';
		str += '	#mmo_menu h3 { padding:10px 0; margin:0; font-size:18px; color:#ded2c4; text-align:center; position:relative; }';
		str += '	#mmo_menu h3 .mmo_close { position:absolute; top:15px; right:10px; width:13px; height:13px; background:url(http://images.mmosite.com/www/newnav_version2/cafe_menu.gif) right top no-repeat; text-indent:-1000em; overflow:hidden;}';
		str += '	#mmo_menu ul { background:#d8c4c4; border:#5a3c3d solid 1px; padding:6px; overflow:auto; zoom:1;}';
		str += '	#mmo_menu ul li { border-bottom:#ffffff dotted 1px; padding:2px; float:left;}';
		str += '	#mmo_menu li a { display:inline-block; width:67px; height:20px; line-height:20px; text-align:center; color:#6c5253;}';
		str += '	#mmo_menu li a:hover { background:#c8acac;}';
		
		str += '</style>';
		
		return str;
	}
	
	function getMilkStyle(){
		var str = '<style type="text/css">';
		
		str += '#mmo_global_nav { text-align:center; height:31px; background:url(http://images.mmosite.com/www/newnav_version2/milk.gif) 0 0 repeat-x; font-family:Arial, Helvetica, sans-serif; font-size:11px;}';
		str += '#mmo_global_nav ul { list-style:none; margin:0; padding:0;}';
		str += '#mmo_global_nav a { text-decoration:none;}';
		str += '#mmo_global_nav a:hover { text-decoration:underline;}';
		str += '#mmo_wrapper { width:1002px; margin:0 auto; text-align:left; height:28px; padding:1px 0 2px 0; background:url(http://images.mmosite.com/www/newnav_version2/milk.gif) 0 0 repeat-x;}';
		
		/*logo*/
		str += '#mmo_logo { float:left; padding-left:5px; display:none;}';
		str += '#mmo_logo a { display:block; width:94px; height:28px; background:url(http://images.mmosite.com/www/newnav_version2/milk.gif) 0 -31px no-repeat; text-indent:-1000em; overflow:hidden;}';
		
		/*user*/
		str += '#mmo_user { float:left; padding-left:5px;}';
		str += '#mmo_user ul li { float:left; line-height:28px; padding:0 3px;}';
		str += '#mmo_user a { color:#000000; padding-left:13px;}';
		str += '#mmo_user a:hover { color:#333;}';
		str += '	#mmo_user .ico_home { background:url(http://images.mmosite.com/www/newnav_version2/milk.gif) 0 -93px no-repeat;}';
		str += '	#mmo_user .ico_home:hover { background-position:0 -94px;}';
		str += '	#mmo_user .ico_mycenter { background:url(http://images.mmosite.com/www/newnav_version2/milk.gif) 0 -122px no-repeat;}';
		str += '	#mmo_user .ico_mycenter:hover { background-position:0 -123px;}';
		str += '	#mmo_user .ico_blog { background:url(http://images.mmosite.com/www/newnav_version2/milk.gif) 0 -150px no-repeat;}';
		str += '	#mmo_user .ico_blog:hover { background-position:0 -151px;}';
		
		/*service*/
		str += '#mmo_service { float:right; padding-right:10px;}';
		str += '#mmo_service ul li { float:left;height:28px;line-height:28px; padding:0 10px; background:url(http://images.mmosite.com/www/newnav_version2/milk.gif) right bottom no-repeat;}';
		str += '#mmo_service li a { color:#757575;}';
		str += '#mmo_service li a:hover { color:#333;}';
		str += '	#mmo_service .mmo_more { background:none; position:relative;}';
		str += '	#mmo_service .mmo_more a { display:block; float:left; width:52px; height:18px; margin-top:7px; background:url(http://images.mmosite.com/www/newnav_version2/milk.gif) 0 -64px no-repeat; text-indent:-1000em; overflow:hidden;}';
		
		
		/*menu*/
		str += '#mmo_menu { position:absolute; top:29px; right:20px; width:524px; display:none; background:url(http://images.mmosite.com/www/newnav_version2/milk_menu.gif) -1048px bottom no-repeat; z-index:1000;}';
		str += '	#mmo_menu .mmo_head { height:6px; line-height:6px; font-size:1%;  overflow:hidden; background:url(http://images.mmosite.com/www/newnav_version2/milk_menu.gif) 0 0 no-repeat;}';
		str += '	#mmo_menu .mmo_foot { height:6px; line-height:6px; font-size:1%; overflow:hidden;}';
		str += '	#mmo_menu .mmo_body { background:url(http://images.mmosite.com/www/newnav_version2/milk_menu.gif) -524px 0 repeat-y; padding:0 6px;}';
		str += '	#mmo_menu h3 { padding:10px 0; margin:0; font-size:18px; color:#757575; text-align:center; position:relative; }';
		str += '	#mmo_menu h3 .mmo_close { position:absolute; top:15px; right:10px; width:13px; height:13px; background:url(http://images.mmosite.com/www/newnav_version2/milk_menu.gif) right top no-repeat; text-indent:-1000em; overflow:hidden;}';
		str += '	#mmo_menu ul { background:#fff; border:#dcdcdc solid 1px; padding:6px; overflow:auto; zoom:1;}';
		str += '	#mmo_menu ul li { border-bottom:#bbbbbb dotted 1px; padding:2px; float:left;}';
		str += '	#mmo_menu li a { display:inline-block; width:67px; height:20px; line-height:20px; text-align:center; color:#757575;}';
		str += '	#mmo_menu li a:hover { background:#eaeaea;}';
	
		str += '</style>';
		
		return str;
	}
	
	function getCafeHtml(){
		var str = "";
		
		str += '<!--MMOsite Global Navigation-->';
		str += '<div id="mmo_global_nav">';
		str += '<div id="mmo_wrapper">';
		str += '    <!--mmo logo-->';
		str += '    <div id="mmo_logo">';
		str += '        <a href="http://www.mmosite.com/" title="MMOsite.com">MMOsite.com</a>';
		str += '    </div>';
		str += '    <!-- / mmo logo-->';
		str += '	<!--mmo user-->';
		str += '	<div id="mmo_user">';
		str += '		<ul>';
		str += '			<li><a href="http://www.mmosite.com/" title="Home" class="ico_home">Home</a></li>';
		str += '			<li><a href="http://accounts.mmosite.com/user/myprofile.php" title="My Profile" class="ico_mycenter">My Profile</a></li>';
		str += '			<li><a href="http://my.mmosite.com/" title="immosite" class="ico_blog">immosite</a></li>';        
		str += '		</ul>';
		str += '	</div>';
		str += '	<!-- / mmo user-->';
		str += '	<!--mmo service-->';
		str += '	<div id="mmo_service">';
		str += '		<ul>';
		str += '			<li><a href="http://contest.mmosite.com/" title="Contest">Contest</a></li>';
		str += '			<li><a href="http://download.mmosite.com/" title="Download">Download</a></li>';
		str += '			<li><a href="http://feature.mmosite.com/" title="Feature">Feature</a></li>';
		str += '			<li><a href="http://forum.mmosite.com/" title="Forum">Forum</a></li>';
		str += '			<li><a href="http://gamelist.mmosite.com/" title="Gamelist">Gamelist</a></li>';
		str += '			<li><a href="http://answer.mmosite.com/dic/" title="Gamepedia">Gamepedia</a></li>';
		str += '			<li><a href="http://news.mmosite.com/" title="News">News</a></li>';
		str += '			<li class="mmo_more" onmouseover="mmo_handler.setDisplay(1)" onmouseout="mmo_handler.setDisplay(0)"><a href="#" title="More">More</a></li>';
		str += '		</ul>';
		str += '	</div>';
		str += '	<!-- / mmo service-->';
		str += '	<!--mmo menu-->';
		str += '	<div id="mmo_menu" onmouseover="mmo_handler.setDisplay(1)" onmouseout="mmo_handler.setDisplay(0)">';
		str += '		<div class="mmo_head"></div>';
		str += '		<div class="mmo_body">';
		str += '		<h3>MMOsite Service </h3>';
		str += '		<ul>';
		
		//more里面的内容
		for( var i = 0; i < more.length; i++ ){
			str += '<li><a href="' + more[i][1] + '" title="' + more[i][0] + '">' + more[i][0] + '</a></li>';
		}		
		
		str += '		</ul>';
		str += '		</div>';
		str += '		<div class="mmo_foot"></div>';
		str += '	</div>';
		str += '	<!-- / mmo menu-->';
		str += '</div>';
		str += '</div>';
		str += '<!-- / MMOsite Global Navigation-->';
		
		return str;
	
	}
	
	this.addCafeHeader = function(){
		document.write( getCafeStyle() + getCafeHtml() );
	}
	
	this.addMilkHeader = function(){
		document.write( getMilkStyle() + getCafeHtml() );
	}
	
	function init(){}
	
	init();
}
var mmo_handler = new MMOStation();

//mmoHeader
//edit by millet 2009-02-18
function mmoHeader(){
	mmo_handler.addMilkHeader();
}

//edit by millet 2009-02-18 use for game style
function mmoGameHeader(){
	mmo_handler.addCafeHeader();
}

//mmoAds
function mmoAds_deliverActiveX(content)
{
	document.write(content);	
}

//mmoHeader
function autoBgHeight(){
	docbody = document.body;
	Elebody = document.documentElement;
  if( getId('flashdiv1'))	{  	 
	  if(docbody.scrollHeight != 'undefined'){	
		  getId('flashdiv1').style.height =  docbody.scrollHeight  - 2 + "px"
		  getId('flashdiv2').style.height =  docbody.scrollHeight - 2 + "px"		    			
	  }else{
		  getId('flashdiv1').style.height =  Elebody.scrollHeight  - 2 + "px"
		  getId('flashdiv2').style.height =  Elebody.scrollHeight - 2 + "px" 
	  }
  }	 
}

//Footer
//modify by millet 2009-04-23 new footer
function mmoFooter(){
   //Script for bglink
   autoBgHeight();
	var cs = [];
	cs[0] = "<style>#mmo_bottom{ width:1002px;margin:0 auto; font-size:12px; font-family:Arial; line-height:16px; text-align:left; }#mmo_bottom .copyright{ width:650px; float:left; padding-top:6px; text-align:left;}#mmo_bottom .footer_logo{ width:50px; height:41px; float:left; margin:10px 15px 0px 57px; display:inline-block;}html>body #mmo_bottom .footer_logo{background:url(\"http:\/\/images.mmosite.com\/www\/mmologo.png\") no-repeat;}* html #mmo_bottom .footer_logo {filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src=\"http:\/\/images.mmosite.com\/www\/mmologo.png\");background:none;}#mmo_bottom .footerico{ float:right; width:160px;}#mmo_bottom .footerico a{ width:70px; height:16px; font-size:11px; display:block; padding:0 0 0 21px; background:url(http:\/\/images.mmosite.com\/www\/images0904\/footer_ico.gif) no-repeat; margin-bottom:7px;}#mmo_bottom .footerico a.footer_rss{ background-position:left bottom;}#mmo_bottom .clear:after { content:\".\"; display:block; height:0; clear:both; visibility:hidden; }#mmo_bottom .clear {+display:none; clear:both }<\/style>";
	cs[1] = "<div id=\"mmo_bottom\"><div class=\"footer_logo\"><\/div><div class=\"copyright\">2005-2009 MMOsite.com All Rights Reserved <br \/><b><a href=\"http:\/\/www.mmosite.com\/about\/sitemap.shtml\" target=\"_blank\"><strong>Site   Map<\/strong><\/a> | <a href=\"http:\/\/www.mmosite.com\/about\/contact.shtml\" target=\"_blank\"><strong>Contact Us<\/strong><\/a> | <a href=\"http:\/\/www.mmosite.com\/about\/index.shtml\" target=\"_blank\"><strong>About Us<\/strong><\/a> | <a href=\"http:\/\/www.mmosite.com\/about\/useragreement.shtml\" target=\"_blank\"><strong>User Agreement<\/strong><\/a> | <a href=\"http:\/\/www.mmosite.com\/about\/adsolution.shtml\" target=\"_blank\"><strong>Advertise<\/strong><\/a> | <a href=\"http:\/\/www.mmosite.com\/service\" target=\"_blank\"><strong>Service<\/strong><\/a> | <a href=\"javascript:win_open_bug();\"><strong>Report & Suggestion<\/strong><\/a><\/b> <br/><strong>Sister Site: <\/strong><a href=\"http:\/\/www.bbgsite.com\" target=\"_blank\">BBGsite.com<\/a><\/strong> |  <\/strong><a href=\"http:\/\/www.arabmmo.com\" target=\"_blank\">Arabmmo.com<\/a><\/strong> |  <\/strong><a href=\"http:\/\/www.espmmo.com\" target=\"_blank\">Espmmo.com<\/a><\/strong>  |  <\/strong><a href=\"http:\/\/www.pandaapp.com\" target=\"_blank\">Pandaapp.com<\/a><\/strong><\/div><div class=\"footerico\"><a title=\"Help\" href=\"http:\/\/help.mmosite.com\/\" class=\"footer_help\">Get help<\/a><a title=\"MMOsite RSS Center\" href=\"http:\/\/news.mmosite.com\/rss\" class=\"footer_rss\">Rss feed<\/a><\/div><br class=\"clear\" \/><\/div>"
//aiya start
	cs[2] = "<div style=\"display:none\"><scr"+"ipt language='javascript' src='http://js.aiya.com.cn/stat.js'></scr"+"ipt><noscript><img src=\"http://logs.aiya.com.cn/a?ci=mmosite\" alt=\"\"><\/noscript><\/div>";
//aiya end
	return document.writeln(cs.join(""));
}


/******************************
 *Filename:      random.js
 *Version:       1.0.0(05/22/2009)
 *Website:       http://
 *Author:        S.SL
 *Modyfy:        1.0.1(2009-6-13)
*******************************/

function MyGold(){
	var o = this;
	var cookie_name = "cookieForGold";
	var cookie_value = 1;
	
	var myflash;
	
	/*
	 *求整数a到b之间的随机整数 
	 *var  r=Math.ceil(Math.random()*(b-a)+a);
	 */
	function getRandom(){
		var r = Math.ceil(Math.random()*(11-1)+1);
		return r;
	}
	
	//读cookie
	function gecontestookie( exit_cookie_name ){
		//取 cookie 字符串，由于 expires 不可读，所以 expires 将不会出现在 cookieStr 中。
		var cookieStr = document.cookie;
		
		if (cookieStr == "")return null;
		
		//将各个 cookie 分隔开，并存为数组，多个 cookie 之间用分号加空隔隔开，不过前面我们只使用了一个 cookie，它的值与 expires 之间也是用分号加空格隔开的
		var cookieValue = cookieStr.split("; "); 

		
		var startPos = -1;
		var endPos = -1;
		for( var i=0; i < cookieValue.length; i++ ){
			startPos = cookieValue[i].indexOf( exit_cookie_name );
			 //当前 cookie 不是名称为 varName 的 cookie，判断下一个 cookie
			if (startPos != 0){
				continue;
			}
			
			//当前 cookie 就是名称为 varName 的 cookie，由于有等号，所以 +1
			startPos += exit_cookie_name.length + 1;
			endPos = cookieValue[i].length;
			
			var exit_cookie_value = unescape( cookieValue[i].substring( startPos,endPos ) );
			return exit_cookie_value;
		}
		return null;
	}
	
	//写cookie
	function secontestookie( new_cookie_name ,new_cookie_value){
		var the_date = new Date("December 31, 2020");
		var expiresDate = the_date.toGMTString();//将时间转为GMT全球标准时间
		document.cookie = new_cookie_name + "=" + escape( new_cookie_value ) + "; expires=" + expiresDate; 
	}
	
	//删除指定名称的cookie
	function deleteCookie( del_cookie_name ){
		var exp = new Date();   
		exp.setTime( exp.getTime() - 1 );   
		var cval = gecontestookie( del_cookie_name );   
		document.cookie = del_cookie_name + "=" + cval + "; expires=" + exp.toGMTString();
	}
	
	function createRandom(){
		var visited = gecontestookie( cookie_name );
		
		if( visited != null ){
			//显示flash
			myflash = new loadSWFFile();
			//进到这里面就代表了第二次显示这个了,这个时候就可以把cookie删除掉了
			deleteCookie( cookie_name );			
		} else {
			var random_num = getRandom();//产生新的随机数
			if( random_num == cookie_value ){
				myflash = new loadSWFFile();
				secontestookie( cookie_name,cookie_value );
			}
		}
	}
	
	//销毁页面上的Flash 调用的是loadSWFFile类里面的方法
	this.destroyFlash = function(){
                               if( myflash == undefined || myflash == null )
                                myflash = new loadSWFFile();
      
		myflash.destroyFlash();
		//return false;
	}
	
	//跳转到登录页面
	this.userLogin = function(){
		window.location = "http://accounts.mmosite.com/port/login.php?url=" + window.location.href;
	}
	//构造器
	function init(){
		if( document.all ){
			window.attachEvent( "onload",createRandom );
		} else {
			window.addEventListener( "load",createRandom,false );
		}
	}
	
	init();
	
}

function loadSWFFile(){
	var o = this;
	var style1 = {
		id:"gold_flash",
		position:"absolute",
		zindex:"9999"
	}
	
	function $( id ){ return document.getElementById( id ); }
	
	function getFlash(){
		var str = '';
		str += '<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="450" height="430">';
		str += '	<param name="movie" value="http://contest.mmosite.com/mmos/mmos_secure.swf" />';
		str += '	<param name="quality" value="high" />';
		str += '	<param name="swfversion" value="8.0.35.0" />';
                                str += '	<param name="allowScriptAccess" value="always" />';
		str += '	<param name="wmode" value="transparent" />';
		str += '	<param name="flashVars" value="server=http://contest.mmosite.com/" />'
		str += '	<embed src="http://contest.mmosite.com/mmos/mmos_secure.swf" quality="high" wmode="transparent" width="450" height="430" name="mygold" allowScriptAccess="always"  allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashVars="server=http://contest.mmosite.com/"/>';
		str += '</object>';
		
		return str;
	}
	
	//销毁页面上的Flash
	this.destroyFlash = function(){
		if( $( style1.id ) == undefined ) return;
		$( style1.id ).parentNode.removeChild( $( style1.id ) );
	}
	
	function addFlashTOBody(){
		if( $( style1.id ) != undefined ) return;
		
		var newdiv = document.createElement( "div" );
				
		newdiv.id = style1.id;
		newdiv.style.position = style1.position;
		newdiv.style.zIndex = style1.zindex;
		
		newdiv.innerHTML = getFlash();
		
		document.body.appendChild( newdiv );		
	}

	//产生范围内的随机数[down_val,up_val]
	function getRandom( down_val,up_val ){
		var random_value = Math.floor( Math.random()*( Math.abs( up_val-down_val )+1 ) + down_val );
		return random_value;
	}
	
	//设置Flash显示的位置
	function setFlashPostion(){
		if( $( style1.id ) == undefined ) return;
		
		var scr_width = document.body.clientWidth;
		var scr_height = document.body.scrollHeight;
		
		var flash_width = $( style1.id ).clientWidth;
		var flash_height = $( style1.id ).clientHeight;
		
		var startX = Math.floor( ( scr_width - 1002 )/2 ) + 10;
		var endX = startX + 1002 - flash_width;
		
		var startY = 180;
		var endY = scr_height - flash_height;
		
		//alert( "scr_width=" + scr_width + "," + "scr_height=" + scr_height + "," + "flash_width=" + flash_width + "," +"flash_height=" + flash_height  );
		$( style1.id ).style.left = getRandom( startX,endX ) + "px";
		$( style1.id ).style.top =  getRandom( startY,endY ) + "px";
	}
	
	function init(){
                               var cur_url = window.location.href;
		if( cur_url.indexOf( "http://accounts.mmosite." ) >= 0 ) return;

		addFlashTOBody();
		setFlashPostion();
	}
	
	init();
}
var myrandom = new MyGold();