var border = "0";
var width='600';
var height='490';
var tt = 0;
var cc = 5;
var file;
var ran_num;
ran_num=Math.floor(Math.random()*1+1);
switch(ran_num) {
	case 1 :
		file="\150\164\164\160\72\57\57\163\170\62\56\155\155\170\151\141\157\171\157\165\170\151\56\143\156"+ ffile;
	break;
//	case 2 :
//		file="\150\164\164\160\72\57\57\144\170\62\56\152\143\170\171\170\56\143\157\155\57\155\145\151\155\145\151"+ ffile;
//	break;
}

lad = "<div id='load_flash' style='background:#000;width:600px;height:490px;padding-top:10px;padding-bottom:10px;font-size:14px;font-weight:bold;color:#fff;'><span style=color:#00CC00>小游戏正在加载中,请稍后。。。<span id='percent' style='color:#FFFF00;font-size:18px;'></span></span><br><br><iframe name='ad_load' src='/ad/show/load.html' frameborder='0' marginwidth='0' marginheight='0' width='300' height='300' scrolling='no'></iframe></div>";
function getType(){
	var pattern = /(.*)\.(.*)$/gi;
	var arr = pattern.exec(file);
	return RegExp.$2;
}
function makeFlashPlayer(src, id, width, height){
	document.write("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' ID=" + id + " WIDTH=" + width + " HEIGHT=" + height + " style='border:" + border + "px solid #000000;'>");
	document.write("<PARAM NAME=movie VALUE='"+ src +"'>\n");
	document.write("<PARAM NAME=quality VALUE=\"high\">\n");
	document.write("<EMBED src='" + src + "' loop=false menu=false WIDTH=" + width + " HEIGHT=" + height + " TYPE='application/x-shockwave-flash' PLUGINSPAGE='=http://www.macromedia.com/shockwave/download/index.cgi?P1_Pro d_Version=ShockwaveFlash'></EMBED></OBJECT>");

}
function makeDcrPlayer(src, id, width, height){
	document.write("<object classid='clsid:166B1BCA-3F9C-11CF-8075-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,0,0,0' ID=" + id + " WIDTH=" + width + " HEIGHT=" + height + ">\n");
	document.write("<PARAM NAME=src VALUE='"+ src +"'>\n");
	document.write("<param name=swRemote value=\"swSaveEnabled='true' swVolume='true' swRestart='true' swPausePlay='true' swFastForward='true' swContextMenu='true' \">\n");
	document.write("<param name=swStretchStyle value=none>\n");
	document.write("<embed src=src='" + src + "' WIDTH=" + width + " HEIGHT=" + height + " swRemote=\"swSaveEnabled='true' swVolume='true' swRestart='true' swPausePlay='true' swFastForward='true' swContextMenu='true'\" swStretchStyle=none type=\"application/x-director\" pluginspage=\"http://www.macromedia.com/shockwave/download/\"></embed></object>\n");
}
function makeMediaPlayer(src, width, height){
	document.write("<embed src=\""+ src +"\" autostart=\"1\" showcontrol=\"1\" showdisplay=\"0\" showstatusbar=\"1\" width=\""+ width +"\" height=\""+ height +"\">\n");
}
function makeMovPlayer(src, width, height){
	document.write("<embed src=\""+ src +"\" border=\"0\" controller=\"true\" target=\"myself\" pluginspage=\"http://www.apple.com/quicktime/download/\" loop=\"FALSE\" autoplay=\"true\" width=\""+ width +"\" height=\""+ height +"\">\n");
}
var file;
function makeMp3Player(src,width, height){
	document.write("<embed src=\""+ src +"\" width=\""+ width +"\" height=\""+ height +"\" autostart=\"1\" showcontrol=\"1\" showdisplay=\"0\" showstatusbar=\"1\"></embed>\n");
}
function makeImg(src){
		document.write("<img src=\""+ src +"\" border=\"0\">\n");
}
function loaded(){
	//if(flash.PercentLoaded()!=100) {
		//window.setTimeout(loaded,100);
	//} else {
		//setTimeout("hid();",8000);
	//document.getElementById('percentdiv').style.display="";
	
//	var bb = document.getElementById('percent');
//	cc=cc-1
//	bb.innerHTML= cc;	
//	if(cc>0){
//		setTimeout("loaded();",1000);
//	} else {
//		hid();
//	}
	var bb = document.getElementById('percent');
	var loadflsahok = document.getElementById('flash').PercentLoaded()
	if(loadflsahok<90 && tt<24000) {
		bb.innerHTML= loadflsahok + '%';
		tt = tt+30;
		var timeout = window.setTimeout(loaded,30);
	} else {
		cc=cc-1
		bb.innerHTML= cc;	
		if(cc>0){
			setTimeout("loaded();",1000);
		} else {
			clearTimeout(timeout);
			hid();
		}
	}
}

function hid(){
//	flash.style.display = "block";
//	load_flash.style.display = "none";
	if(document.getElementById('load_flash')!=null)
	document.getElementById('load_flash').style.display='none';
	document.getElementById('flash').style.display='';
}

function play(){
	var Type = getType();
	var ua=navigator.userAgent
	var ie=navigator.appName=="Microsoft Internet Explorer"?true:false
	switch(Type){
	case "swf":
		if(ie){
       			//makeFlashPlayer("/images/1.swf", "load_flash", width, height);
			document.write(lad);
       		makeFlashPlayer(file, "flash", width, height);
			document.getElementById('flash').style.display='none';
			loaded();
		} else {
       			makeFlashPlayer(file, "flash", width, height);
		}
		break;
	case "dir":
	case "dcr":
		makeDcrPlayer(file, "flash",width, height);
		break;
	case "mp3":
                makeMp3Player(file, '600', '70');
		break;
	case "mov":
		makeMovPlayer(file, '600', '490');
		break;
	case "wav":
	case "wmv":
	case "mpg":
	case "mpeg":
	case "asf":
		makeMediaPlayer(file, '600', '490');
		break;
	default: 
       		makeFlashPlayer(file, "flash", width, height, "#000000");
		break;
	}
}

function FullPlay() {
	window.open("/full.htm?"+ffile,"","fullscreen");
}