var screenWidth = location.search.split('?')[1];
function PlayInFull(flashUrl,furl) {
	window.open("/playinfullnew.shtml?fswf="+flashUrl+"&furl="+furl+"&open=1","17173","fullscreen");
	window.close()
}
function choice()
{
     var reurl = window.location.href;
     if( reurl.indexOf('?')>0 ){
     		reurl = reurl.split('?')[0];
     	}
     window.location.href = reurl ;
     //window.location.reload();
}
function replaceAll(text,replacement,target){
		if(text==null || text=="") return text;//如果text无内容,返回text
		if(replacement==null || replacement=="") return text;//如果replacement无内容,返回text
		if(target==null) target="";//如果target无内容,设置为空串
		var returnString="";//定义返回值变量,并初始化
		var index=text.indexOf(replacement);//定义查找replacement的索引下标,并进行第一次查找
		while(index!=-1)
		{//直至未找到replacement,要么进行下面的处理
		returnString+=text.substring(0,index)+target;//如果找到的replacement前有字符,累加到返回值中,并加上target
		text=text.substring(index+replacement.length);//取掉找到的replacement及前边的字符
		index=text.indexOf(replacement);//进行查询,准备下一次处理
		}
		if(text!="") returnString+=text;//如果找到的最后一个replacement后有字符,累加到返回值中
		return returnString;//返回
}
function gotoqzone()
{
	var qq;
  qq=prompt("输入您的QQ号按确定按钮。进入空间后按左上角进行登陆，登陆完毕后再点一次“转载的QQ空间”就可以转载了，登陆一次就可无限转载。","");  
  if(qq.match(/^[1-9]\d{4,9}$/)==null)
  {
  	alert('请输入正确的QQ号码');
  	return gotoqzone();
  }
  else{
  	var title = document.getElementById("game_title").value;
  	var content = document.getElementById("game_content").value;
  	var count=50;
		if(content.length>count)
		{
			content = content.substring(0,count);
		}
  	content = replaceAll(content,"<br>","%0A%0A");
  	var locurl = window.location.href;
  	var img = document.getElementById("game_img").value;
  	locurl = locurl.replace("#","");
  	content = "[url="+locurl+"][img]"+img+"[/img][/url]%0A%0A[url="+locurl+"][B]"+title+"[/B][/url]%0A%0A"+content+"%0A%0A";
  	content = content+"游戏地址：[url="+locurl+"]"+locurl+"[/url]";
		//window.location.href="http://new.qzone.qq.com/"+qq+"/addNewBlog?title="+title+"&category=FLASH游戏分类&content="+content;	
		var openurl = "http://new.qzone.qq.com/"+qq+"/addNewBlog?title="+title+"&category=FLASH游戏分类&content="+content;
		window.open(openurl,null);
  }	  
}
function flashStart(){
	showPlay();
	//setTimeout('setFlash()',srctime*1000);
}
function showPlay()
{	
     document.write("<scr"+"ipt  language=javascript  src=http://flash.17173.com/x/flashhzh700500.js></scr"+"ipt>");
}
function setFlash()
{	
	GameScale(screenWidth);
	str = "<OBJECT ID=\"flashgame\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ";
	str += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+w+"\" height=\""+h+"\">";
	str += "<param name=\"movie\"  value=\"" + flashPath + "\">";     
	str += "<param name=quality value=high>\n";
	str += "<param name=allowScriptAccess value=always >\n";
	str += "<embed src=" + flashPath + " loop=false menu=false quality=high ";
	str += "height='"+h+"' width='"+w+"' TYPE=application/x-shockwave-flash PLUGINSPAGE=http://www.macromedia.com/shockwave/download/index.cgi?P1_Pro d_Version=ShockwaveFlash type='application/x-shockwave-flash'>";
	str += "</OBJECT>";	
	document.getElementById(flashid).innerHTML = str;
}
function GameScale(width)
{
	switch(width){
	case '800':
		w="800px";
		h="600px";
		break;
	case '1024':
		w="900px";
		h="675px";
		break;	
	}
    if( undefined == width ){
		w = w+"px";	
		h = h+"px";
	} 
	document.getElementById("bofak").style.width=w;
	document.getElementById("bofak").style.height=h;
	document.getElementById("bofak").style.clear="both";
	document.getElementById("bofak").style.margin="0px auto";
}
function getOs()
{
	var agt=window.navigator.userAgent.toLowerCase();
	if(agt.indexOf("msie")>=0)return 0;
	if(agt.indexOf("firefox")>=0)return 1;
	if(agt.indexOf("opera")>=0)return 3;
	if(agt.indexOf("camino")>=0)return 4;
	if(agt.indexOf("gecko/")>=0)return 5;
	return 0;
}
function dogamescale(width){		
		var loc=window.location.pathname;
		window.location.href=loc+"?"+width;		
}
function down1(img,author,size,time,furl,name){		
		//window.location.href="/down/down1.shtml?name="+name+"&furl="+furl+"&author="+author+"&size="+size+"&time="+time;
		var durl = "/down/down1.shtml?img="+img+"&author="+author+"&size="+size+"&time="+time+"&furl="+furl+"&name="+name;
		window.open(durl,null,'toolbar=no,location=no,status=no,menubar=no,width=700,height=435');
}
function down2(img,author,size,time,furl,name){		
		window.location.href="/down/down2.shtml?img="+img+"&author="+author+"&size="+size+"&time="+time+"&furl="+furl+"&name="+name;		
}
