function iKeyword(obj,type){
    var init="请输入小游戏名...";
    switch(type){
        case 1:
            if(obj.value==init){obj.value="";}
            obj.style.cssText="color:black";
            break;
        case 2:
            if(obj.value==""){
                obj.value=init;
                obj.style.cssText="";
            }else{
                obj.style.cssText="color:black";
            }
        break;
    }
}

function search_location(item)
{
	var init="请输入小游戏名...";
	var keyword = document.getElementById('keyword').value;

	if(keyword && init != keyword)
	{
		window.location.href = '/'+item+'s/'+keyword;
	}
	else
	{
		window.alert('请输入关键词');
		document.getElementById('keyword').focus();
	}
}

function search_onkeydown(item)
{
	document.getElementById('keyword').onkeydown=function()
	{
		if (event.keyCode==13)
		{
			search_location(item);
		}
	}
}

function FullPlay(sUrl) {
	if(document.getElementById("flashgame").readystate==4){
		if(sUrl.substr(sUrl.length-4,4).toLowerCase()==".swf")
			sUrl = sUrl.substr(0,sUrl.length-4);
		window.open("FullPlay.htm?"+sUrl,"4399","fullscreen");
		window.opener =null;
		window.close();
	}
	else{
		alert("请等动画下载完毕再全屏播放，Thanks：）");
	}
}
function FullPlay1(sUrl) {
	if(sUrl.substr(sUrl.length-4,4).toLowerCase()==".swf")
		sUrl = sUrl.substr(0,sUrl.length-4);
	window.open("FullPlay.htm?"+sUrl,"4399","fullscreen");
	window.opener =null;
	window.close()
}
function FullPlay3(sUrl) {
	window.open("FullPlay1.htm?"+sUrl,"4399","menubar=no,toolbar=no,location=no,status=no,fullscreen=yes");
	window.opener = null;
	window.close()
}
function GameScale(width){
/*
	switch(width){
	case '800':
		movie.width="650px";
		movie.height=430;
		break;
	case '1024':
		movie.width="671px";
		movie.height="486px";
		break;
	case '1280':
		movie.width="880px";
		movie.height="661px";
		break;
	default:
		movie.width="650px";
		movie.height="430px";
		break;
	}
*/
}
var screenWidth = location.search.split('?')[1]

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 refreshProgress(){
	var nPercentLoaded = Math.abs(movie.PercentLoaded());
	bar.style.width=Math.ceil((downProgressWidth-80-100-2)*nPercentLoaded/100)+"px";

	if(nPercentLoaded==100){
		clearTimeout(nTimeoutId);
		bar.style.width=(downProgressWidth-80-100-2)+"px";
		downStatus.innerHTML="下载完毕";
	}
	else{
		nTimeoutId = setTimeout('refreshProgress()',300)
	}
}