
var WebRootDir="http://www.xxx.com/";

function layer_hide(){
	document.all.popLayer.style.visibility = 'hidden';
	document.frames.board.location.href = 'blank.htm';
}

function layer_show(){
	document.all.popLayer.style.visibility = 'visible';
	document.frames.board.location.href = "event.html";
}


var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the FSCommand messages in a Flash movie.
function shell_DoFSCommand(command, args) {
	var shellObj = isInternetExplorer ? document.all.shell : document.shell;

	if(command=="show"){
       openLayer();		
    }
    if(command=="hide"){
       closeLayer();
    }
	if(command=="down"){
       filedown(args);
    }
	if(command=="fbrower"){	
	alert(123)
		 debug(args);
	}
	if(command=="upfile"){		
		 debug(args);
	}
	if(command=="debug"){		
		 debug(args);
	}
	//
}
//打开文件选择
function userDoBrowerFile(){
	alert(123)
	/*try {
		if(typeof(document.upform.filesel) == "object"){			
			document.upform.filesel.click();			
		}
	} catch(err) {
		return false;
	}*/
}
//给flash传参
/*function sendvarToflash(args){
	var sendText = args.value;
	alert(sendText )
	document.shell.SetVariable("File_txt.text", sendText);
}*/


// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub shell_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call shell_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

function openLayer(pageurl) 
{ 
	var w, h; 
	w = 330; 
	h = 275;
	pageurl = "event.html";

	WebRootDir2 = WebRootDir + "swf/"+ pageurl;
	
	var tempX = ((screen.width - w) / 2 - 1) - 140;
	var tempY = ((screen.height - h) / 2 - 1) - 70;
	
	popLayer.style.left = tempX;
		
	// NT 5.0  /  NT 5.1; SV2  / NT 5.2; SV1
	if (navigator.userAgent.indexOf("NT 5.0") > 0) {
		popLayer.style.top = tempY + 185;
		h -= 20;
	}
	else if (navigator.userAgent.indexOf("NT 5.2; SV1") > 0 || navigator.userAgent.indexOf("NT 5.1; SV2") > 0)
		popLayer.style.top = tempY - 195;
	else if (navigator.userAgent.indexOf("NT 5.1") > 0)
		popLayer.style.top = tempY - 185;
	
	popLayer.innerHTML="<iframe name='popObject' src='"+WebRootDir2+"' frameborder='0' width='330' height='275' allowtransparency='true'></iframe>";
	popLayer.style.display = 'block';

	
}

function closeLayer() 
{
	popLayer.style.display = 'none';
}

// 
function swf_load(fileid, filename, widths, heights, fvs, wmd){

this.FlashVars = (fvs != undefined)? fvs :'';
this.Wmod = (wmd != undefined)? wmd :''; 


var strSwf = "";

strSwf += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
strSwf += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"';
strSwf += 'width="'+widths+'" height="'+heights+'" id="'+fileid+'" >';
strSwf += '<param name="movie" value="'+filename+'" />';
strSwf += '<param name="quality" value="high" />';
strSwf += '<param name="menu" value="false" />';
strSwf += (FlashVars != null) ? '<param name="FlashVars" value="'+FlashVars+'">' : '';
strSwf += (Wmod != null) ? '<param name="wmode" value="'+Wmod+'">' : ''; 
strSwf += '<embed';
strSwf += (FlashVars != null) ? ' FlashVars="'+FlashVars+'"' : ''; 
strSwf += (Wmod != null) ? ' wmode="'+Wmod+'"' : ''; 
strSwf += ' src="'+filename+'" quality="high" menu="false" pluginspage="http://www.macromedia.com/go/getflashplayer"';
strSwf += 'type="application/x-shockwave-flash" width="'+widths+'" height="'+heights+'"  name="'+fileid+'" ></embed>';
strSwf += '</object>';


document.write(strSwf);
}

function filedown(filename)
	{
		var pop_event;
		//var nfile = "filedownload.asp?filepath="+path+"&filename="+filename+"";

		var s_width; 
		  var s_height; 
		  
		  var posx=0;
		  var posy=0;
		  
		  s_width   = (screen.width); 
		  s_height  = (screen.height);  
		    
		  width     = 100; 
		  height    = 100;  
		    
		  posx = ((s_width - width) / 2 - 1) - 5; 
		  posy = ((s_height - height) / 2 - 1) - 5; 

		position = "width=" + width + ",height=" + height + ",scrollbars=no,top=0,left=0,resizable=no,status=no";
		pop_event = window.open(WebRootDir+filename,"down",position);
		pop_event.focus()

	}
//Debug display
function debug(flag){
	debugtextbox.value+=flag+"\n"
}
function opendebug(){	
	debugLayer.style.display = 'block'
}
function closedebug(){
	debugLayer.style.display = 'none'
}
function cleardebug(){
	debugtextbox.value=""
}
function checkey(){ 
	if(event.ctrlKey&&event.keyCode==120) {//ctrl+F9
		if(debugLayer.style.display == 'none'){
			opendebug();
		}else{
			closedebug();	
		}		
	}
//alert(event.keyCode)
} 
document.onkeydown=checkey;