/**
 * @author Jim
 */
var webGame;
if (!webGame){webGame = {};}

if(!webGame.acrossDomain){webGame.acrossDomain = {};}
 
var scriptBlock = document.createElement("script");
webGame.acrossDomain.request = function(vPath,func,isDebug)
{
    scriptBlock = document.createElement("script"); 
	//var vPath='http://svr.game.xunlei.com:8080/loginWithUsername.webGameLogin?username='+uid; 
	//var vPath='http://svr.game.xunlei.com:8080/xlgamesvr/loginWithUsername.webGameLogin?username='+uid; 
    if(isDebug)alert(vPath); 
	scriptBlock.src = vPath;
	scriptBlock.type = "text/javascript";
	scriptBlock.language = "javascript";
	
	if(webGame.acrossDomain.getBrowseName().toLocaleLowerCase() == "ie"){
		scriptBlock.onreadystatechange = function(){
			if(isDebug)
				alert(scriptBlock.readyState);
			webGame.acrossDomain.cleanStatus();
			if("loaded" == scriptBlock.readyState || "complete" == scriptBlock.readyState){
				func(votertn);
			}
			webGame.acrossDomain.resetStatus();
		}
	}else{
		scriptBlock.onload = function(){
			webGame.acrossDomain.cleanStatus(); 
			try{ 
				func(votertn);
			 
			}catch(e){ 
			}  
			webGame.acrossDomain.resetStatus();
		}
	}
	document.getElementsByTagName("head")[0].appendChild(scriptBlock);
}

webGame.acrossDomain.getBrowseName = function()
{
	if (window.navigator.userAgent.indexOf("MSIE")>=1)
	{
		 return 'IE';
	}else{
		if (window.navigator.userAgent.indexOf("Firefox")>=1)
		{
			//Firefox
			 return 'fiefox';
			
		}else{
			//other brownse
			 return 'unknow';
		}
	}
} 

 
webGame.acrossDomain.cleanStatus = function(txt){
	if(!txt){txt='Loading ... ...';}
	try{
		window.status=txt;
	}catch(e){
		alert('Debug:Status='+e);
	}
}
webGame.acrossDomain.resetStatus = function()
{
	try{
		window.status="";
	}catch(e){
	}
}