var border = "0";
var tt = 0;
var width='638';
var height='438';
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 #CEBE90;'>");
	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(){
	tt = tt+30;
	if(loadingbar){
		loadingbar.style.display='';
		bg = document.getElementById('bar');
		bb = document.getElementById('percent');
	}
	if(document.getElementById('flash').PercentLoaded()<0) {
		hid();
	} else {
		if(loadingbar){
			bg.style.width=5 * document.getElementById('flash').PercentLoaded();
			bb.innerHTML=document.getElementById('flash').PercentLoaded() + '%';
		}
	}
	if(document.getElementById('flash').PercentLoaded()<100 && tt<30000) {
		var timeout = window.setTimeout(loaded,30);
	} else {
		if(tt<5000){
			var timeout = window.setTimeout(loaded,30);
		} else {
			tt = 0;
			clearTimeout(timeout);
			if(loadingbar) loadingbar.style.display='none';
			hid();
		}
	}
}
function hid(){
	if(document.getElementById('load_flash')!=null) document.getElementById('load_flash').style.display='none';
	document.getElementById('flash').style.display='';
}

function hit(id){var obj = document.getElementById(id);obj.style.display=obj.style.display=='none'?'':'none';}
function play(){
	fuck();	
	if(document.getElementById('percentdiv')!=null) loadingbar = document.getElementById('percentdiv');
	var Type = getType();
	if(loadingbar) loadingbar.style.display='none';
	var ua=navigator.userAgent;
	var ie=navigator.appName=="Microsoft Internet Explorer"?true:false;
	switch(Type){
	case "dir":
		makeDcrPlayer(file, "flash", "100%", "100%");
		break;
	case "mp3":
        makeMp3Player(file, '300', '70');
		break;
	case "mov":
		makeMovPlayer(file, '400', '300');
		break;
	case "asf":
		makeMediaPlayer(file, '550', '400');
		break;
	default: 
		if(document.all && ie!=false){
			if(loadingbar) loadingbar.style.display='';
			makeFlashPlayer("/images/1.swf", "load_flash", width, height);
			makeFlashPlayer(file, "flash", width, height);
			document.getElementById('flash').style.display='none';
			loaded();
		}else{
			makeFlashPlayer("/images/1.swf", "load_flash", width, height);
			makeFlashPlayer(file, "flash", width, height);
			document.getElementById('flash').style.display='none';
		}
		break;
	}
}

function Replay() {
		document.getElementById('flash').movie=" ";
		document.getElementById('flash').movie=file;
}

var d=document;
var t=d.selection?(d.selection.type!='None'?d.selection.createRange().text:''):(d.getSelection?d.getSelection():'');

function fuck(){
	if(!file) {
		if(sid=='2144.cn') {
		sid=''
		}else{
		sid+='/'
		}
		file = sid + s + f
	}
	ffile = file;
	if((file.slice(0,7)!="http://") && (file.slice(1,2)!=":")){
	file="/upload_file/"+file;
	return file;
	}
}