// JavaScript Document

//if (top.location != self.location)
//top.location=self.location;

function address()
{
 window.external.AddFavorite('http://www.xlhs.com','美女小游戏');
}

var webServer;
var Server1; //电信主机
var Server2; //网通主机
var Server3; //铁通主机

var title=document.title
var url=document.location.href

var Flash_width=600; //flash宽
var Flash_height=400; //flash高

Server1="http://swf.dx.xlhs.com/";
Server2="http://swf.dx.xlhs.com/";
Server3="http://swf.dx.xlhs.com/";

webServer=Server1;

function Select_Server(obj) //选择服务器
{ 
 if(obj=="1")
 {
	flashgame.movie = CreateFlashADDress(Server1 ,Flashurl);
	//flashgame.Play();
	document.all.PlayServerName.innerHTML ="当前:电信";
	postCookie("1");  //写入Cookies
	clear_play_css();  //清除Css
	Ser1.className="defaultplay";
	 }
 
 if(obj=="2")
 {
	 flashgame.movie=  CreateFlashADDress(Server2 ,Flashurl);
	 flashgame.Play();
	 document.all.PlayServerName.innerHTML ="当前:网通";
	 postCookie("2");  //写入Cookies
	 clear_play_css();
	 Ser2.className="defaultplay";
	 }
 
 if(obj=="3")
 {   
     flashgame.movie =  CreateFlashADDress(Server3 ,Flashurl);
	 flashgame.Play();
	 document.all.PlayServerName.innerHTML ="当前:铁通";
	 postCookie("3");  //写入Cookies
	 clear_play_css();
	 Ser3.className="defaultplay";
	 }
}

//组合Flash的播放地址
function CreateFlashADDress(ser,flashaddress)
{
	if(flashaddress.toLowerCase().indexOf("http")<0)
	{
		return ser + Flashurl;
	}else
	{
		return flashaddress;
	}
}


function clear_play_css()//清除Css
{
	Ser1.className="";
	Ser2.className="";
	Ser3.className="";
	}
	
function view_Flash_Server() //选择Flash服务器
{	
	document.write(" <div class=\"play_top\"> ");
	document.write(" <ul> ");
	document.write(" <li style=\"width:100px; font-weight:bold; color:#FFFFFF; background-color:#FF9900;padding: 2px;\" id=\"PlayServerName\"> 当前:电信服务器</li> ");
	document.write("  <li><a href=\"###\" onclick=\"Select_Server('1')\" id=\"Ser1\"> 电信服务器  </a></li> ");
	document.write("  <li><a href=\"####\" onclick=\"Select_Server('2')\" id=\"Ser2\"> 网通服务器  </a></li> ");
	document.write("  <li><a href=\"####\" onclick=\"Select_Server('3')\" id=\"Ser3\"> 铁通服务器 </a></li> ");
	document.write(" </ul> ");
	document.write("</div>");
	document.write("<span id=\"test_window\"></span>");
	
	switch (getCookie('FlashServer'))
	{
		case "1":
		   webServer=Server1;
		  document.all.PlayServerName.innerHTML ="当前:电信";
		  Ser1.className="defaultplay";
		 break;
		 case "2":
		  webServer=Server2;
		  document.all.PlayServerName.innerHTML ="当前:网通";
		  Ser2.className="defaultplay";
		 break;
		 case "3":
		  webServer=Server3;
		  document.all.PlayServerName.innerHTML ="当前:铁通";
		  Ser3.className="defaultplay";
		 break;
		 default:
          webServer=Server1;
		  document.all.PlayServerName.innerHTML ="当前:电信";
		  Ser1.className="defaultplay";
		}	
	}

//复制标题和网址
function copypageurltitle()
{
   var clipBoardContent=''; 
   clipBoardContent =Flash_Name.innerText;
   clipBoardContent+='\r\n';
   clipBoardContent+=document.location;
   window.clipboardData.setData("Text",clipBoardContent);
  // alert("标题和网址已经拷贝，请发给你QQ/Msn或者可以粘贴到论坛上和您的好友一起分享 ^_^ ");
   View_window("标题和网址已经拷贝，请发给你QQ/Msn或者可以粘贴到论坛上和您的好友一起分享 ^_^ ",500);
  }

//显示半透明的提示框
function View_window(Temo_mess,Temo_width)
 {
	var obj=document.getElementById("view_window_test");

	if(obj==null)
	  {
		test_window.innerHTML=("<div id=\"view_window_test\">谢谢你的参与</div>");	
		obj=document.getElementById("view_window_test");
		obj.style.filter="Alpha()";
	  }
	    
	    view_window_test.style.display="";
		view_window_test.innerText=Temo_mess;
	    view_window_test.style.background="#EFFEF1";
		view_window_test.style.position="absolute";
		obj.filters.Alpha.opacity =80;
		
	    view_window_test.style.border="1px solid #009900";
	    view_window_test.style.text="center";
	    view_window_test.style.width=Temo_width+"px";
	    view_window_test.style.height="20px";
		view_window_test.style.padding="3 0 0 0";
		view_window_test.style.left= event.clientX + document.documentElement.scrollLeft - Temo_width/2;
		
		var downtop= event.clientY + document.documentElement.scrollTop + 20 ;
		
	    view_window_test.style.top=  downtop;

		setTimeout("fadeIn('view_window_test')",1000);
 }


//慢慢消失
function fadeIn(dypopLayer)
{
	var obj=document.getElementById(dypopLayer);
	if(obj.filters.Alpha.opacity>0) {
		obj.filters.Alpha.opacity-=1;
		tFadeIn=setTimeout("fadeIn(\""+dypopLayer+"\")",1);
		}
}

//写入Cookies
function postCookie(cookievalue)  
{
  var expdate = new Date();
  expdate.setTime(expdate.getTime() + 60480000000);
  document.cookie="FlashServer="+cookievalue+";expires="+expdate.toGMTString() +";PATH=/;" ;
}


//读取Cookies值
function getCookie(cookieName) 
{ 
 var cookieString =document.cookie; 
 var start = cookieString.indexOf(cookieName + '='); 
 // 加上等号的原因是避免在某些 Cookie 的值里有 
 // 与 cookieName 一样的字符串。 
 if (start == -1) // 找不到
 return null; 
 start += cookieName.length + 1; 
 var end = cookieString.indexOf(';', start); 
 if (end == -1) 
 return unescape(cookieString.substring(start));
 return unescape(cookieString.substring(start, end)); 
}

//弹出新窗口
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

//弹出新窗口第二种方式
function MM_openBrWindow_2(theURL)
{
	window.open(theURL,'skype','height=200,width=300');
	}

//退出的时候运行
function shoucang()
{
	if (getCookie("FlashLoad")!="Yes")
		window.external.AddFavorite(document.location.href,document.title);
	postFlashad();
}

//加载完的时候执行

function init()
{
	
}

function Begin_Play_Flash()
{
 var Flash_Play_View_1 = document.getElementById("Flash_Play_View_1");
  var Flash_Play_View_2 = document.getElementById("Flash_Play_View_2");
//if(getCookie("FlashLoad")!="Yes")
//{
//postFlashad();
  var flashgame=document.getElementById("flashgame");
  flashgame.Play();
   Flash_Play_View_2.style.display='none';
  Flash_Play_View_1.style.display='';
  var Flash_play_Temp="";
  Flash_Play_View_1.innerHTML = "<iframe scrolling='no' frameborder='0' marginheight='0' marginwidth='0' width='600' height='422' allowTransparency src='/adfile/033.html'></iframe>";
setTimeout('Close_Play_ad()',16000);

//}
//
//else
//{
//setTimeout('Close_Play_ad()',5000);
//}
 }
function Close_Play_start()
{
	     Flash_Play_View_1.innerHTML+="<div style='height:78px;margin-left:215;'><img src='/adfile/game_start.gif' onclick='Close_Play_ad()' /></div>";

	   
	}
function Close_Play_ad()
{
  var Flash_Play_View_1 = document.getElementById("Flash_Play_View_1");
  var Flash_Play_View_2 = document.getElementById("Flash_Play_View_2");
 var gg=document.getElementById("gg");
  Flash_Play_View_2.style.display='';
  Flash_Play_View_1.style.display='none';
gg.style.display='';
  gg.innerHTML="<iframe scrolling='no' frameborder='0' marginheight='0' marginwidth='0' width='336' height='280' allowTransparency src='/adfile/flash61.htm'></iframe>";
  var flashgame=document.getElementById("flashgame");
}

//写入加载广告Cookies
function postFlashad()
{
  var expdate = new Date();
  expdate.setTime(expdate.getTime() + 1800000);
  document.cookie="FlashLoad=Yes;expires="+expdate.toGMTString() +";PATH=/;" ;
}
