var file = ffile;
var server = "http://cl-t056-120cl.privatedns.com/~wwwflas/flash-games-nhas13gfj9/";
var border = "0";
var width='594';
var height='390';
var tt = 0;
if (webfrom!=0){
	file = server + ffile;
}

lad = "<div id='load_flash' style='background:#FFFFFF;width:594px;height:390px;padding-top:60px;'><img src='/images/Load.gif' style='border:0px;' align='absmiddle'><b>Loading... Please wait!</b> <span id='percent' style='color:#FF0000;font-weight:bold;'></span></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 #E5C9FB;'>");
	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(){
	var bb = document.getElementById('percent');
	var loadflsahok = document.getElementById('flash').PercentLoaded()
	bb.innerHTML= loadflsahok + '%';
	tt = tt+30;
	if(loadflsahok<90 && tt<60000) {
		var timeout = window.setTimeout(loaded,30);
	} else {
		clearTimeout(timeout);
		hid();
	}
}

function hid(){
	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){	
				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, '300', '70');
		break;
	case "mov":
		makeMovPlayer(file, '400', '300');
		break;
	case "wav":
	case "wmv":
	case "mpg":
	case "mpeg":
	case "asf":
		makeMediaPlayer(file, '550', '400');
		break;
	default: 
       		makeFlashPlayer(file, "flash", width, height, "#000000");
		break;
	}
}