var PlayerWidth = 330;
var PlayerHeight = 319;

function EmGET(arrayKey, arrayValue, Value) { 
    count = arrayKey.length; 
    for(i=0;i<count;i++) { 
        if(arrayKey[i]==Value) { 
            return arrayValue[i]; 
            break; 
        } 
    } 
} 

// ie ativeX Ãâ·Â º¯°æ ÇÔ¼ö 
function Embed() { 
var emtype; 
    var key = new Array(); 
    var value = new Array(); 
  
    for(i=0;i<Embed.arguments.length;i++) { 
        data = Embed.arguments[i].split('='); 
        
        if (data[0] == "FlashVars" && data.length >= 2 ) {
        	key[i] = data[0]; 
        	value[i] = data[1] + "=" + data[2];
    	} else {
    		key[i] = data[0]; 
        	value[i] = data[1]; 	
    	}
    } 

    contents = ''; 
	srcdata = EmGET(key,value,'src').toLowerCase(); 

    classid = EmGET(key,value,'classid'); 
    codebase = EmGET(key,value,'codebase'); 
    
	if(/\.(swf)$/.test(srcdata)) { //flash 
        classid = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; 
        codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.c-ab#version=6,0,29,0'; 
		emtype="flash";
    } else if(/\.(wmv|wma|asf|avi|wav|asx|mpeg|mp3|midi|aiff|au|wpl|wm|wmx|wmd|wmz)$/.test(srcdata)){//media 
        classid = 'CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95'; 
        codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; 
		emtype="media"; 
	} 
	
    if(classid && codebase) { 
        contents += '<object'; 
        if(classid) { 
            contents += ' classid="' + classid + '"'; 
        } 
        if(codebase) { 
            contents += ' codebase="' + codebase + '"'; 
        } 
        count = key.length; 
        for(i=0;i<count;i++) { 
            if(value[i]!='') { 
                if(key[i]!='src') { 
                    contents += ' ' + key[i] + '="' + value[i] + '"'; 
                } 
            } 
        } 
        contents += '>'; 
        for(i=0;i<count;i++) { 
            if(value[i]!='') { 
                if(emtype=='flash' && key[i]=='src') { 
                    contents += '<param name="movie" value="' + value[i] + '" />'; 
                } else  if(emtype=='media' && key[i]=='src') { 
                    contents += '<param name="filename" value="' + value[i] + '" />'; 
                } else { 
                    contents += '<param name="' + key[i] + '" value="' + value[i] + '" />'; 
                } 
            } 
        } 
    } 
    
    contents += '<embed'; 
    for(i=0;i<count;i++) { 
        if(value[i]!='') { 
            contents += ' ' + key[i] + '="' + value[i] + '"'; 
        } 
    }
     
    contents += '>'; 
    contents += '</embed>'; 
    if(classid && codebase) { 
        contents += '</object>'; 
    }
     
	document.write(contents); 
} 


function PlayerView(Param, Width, Height){
	if (Width) {
		PlayerWidth = Width;
	}
	
	if (Height) {
		PlayerHeight = Height;
	}
	
	document.writeln("<OBJECT id='Player' onfocus='this.blur();' codeBase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' type='application/x-oleobject' height='"+PlayerHeight+"' width='"+PlayerWidth+"' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' VIEWASTEXT>");
	document.writeln("<PARAM NAME='URL' VALUE='"+Param+"'>");
	document.writeln("<PARAM NAME='rate' VALUE='1'>");
	document.writeln("<PARAM NAME='balance' VALUE='0'>");
	document.writeln("<PARAM NAME='currentPosition' VALUE='0'>");
	document.writeln("<PARAM NAME='defaultFrame' VALUE=''>");
	document.writeln("<PARAM NAME='playCount' VALUE='1'>");
	document.writeln("<PARAM NAME='autoStart' VALUE='-1'>");
	document.writeln("<PARAM NAME='currentMarker' VALUE='0'>");
	document.writeln("<PARAM NAME='invokeURLs' VALUE='0'>");
	document.writeln("<PARAM NAME='baseURL' VALUE=''>");
	document.writeln("<PARAM NAME='volume' VALUE='100'>");
	document.writeln("<PARAM NAME='mute' VALUE='0'>");
	document.writeln("<PARAM NAME='uiMode' VALUE='full'>");
	document.writeln("<PARAM NAME='stretchToFit' VALUE='-1'>");
	document.writeln("<PARAM NAME='windowlessVideo' VALUE='0'>");
	document.writeln("<PARAM NAME='enabled' VALUE='-1'>");
	document.writeln("<PARAM NAME='fullScreen' VALUE='0'>");
	document.writeln("<PARAM NAME='AutoSize' VALUE='1'>");
	document.writeln("<PARAM NAME='AutoResize' VALUE='1'>");
	document.writeln("</OBJECT>");
}

function PlayerSize(nsize) {
	switch (nsize){
		case 0:					// Normal
			document.Player.width = PlayerWidth;
			document.Player.height = PlayerHeight;
			break;

		case 1:					// Double
			document.Player.width = PlayerWidth*2;
			document.Player.height = PlayerHeight*2;
			break;

		case 2:					// FULL ScreenMode
			if(Player.playState == 3)	//Àç»ýÁßÀÏ¶§¸¸
				document.Player.fullScreen = "true";
			break;
	}
}

/*ÇÃ·¡½Ã*/
function Embed1(flashfilename, flashwidth, flashheight, flashvars)
{
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ flashwidth +'" height="'+ flashheight +'">');
	document.write('<param name="movie" value="'+ flashfilename +'">');
	document.write('<param name="flashVars" value="'+ flashvars +'">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<param name="allowScriptAccess" value="always" />');

	if(flashvars) document.write('<param name="flashVars" value="'+ flashvars +'">');

	document.write('<param name="wmode" value="transparent">');
	document.write('<embed');
	if(flashvars) document.write(' flashVars="'+ flashvars +'" ');
	document.write(' src="'+ flashfilename +'" width="'+ flashwidth +'" height="'+ flashheight +'" ');
	document.write(' quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" >');
	document.write('</embed>');
	document.write('</object>');
}

function swfView4(width, height, url, fvalues, idname){
	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' ");
	document.write("codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' ");
	if(idname != ""){
		document.write("id='"+idname+"' ");
	}
	document.write("width='"+width+"' height='"+height+"' align='middle'>");
	document.write("<param name='allowScriptAccess' value='always' /> ");
	document.write("<param name='movie' value='"+url+"' /> ");
	document.write("<param name='quality' value='high' /> ");
	document.write("<param name='allowFullScreen'	value='true' />	");	
	document.write("<param name='wmode' value='transparent'> ");
	document.write("<param name='flashVars' value='"+fvalues+"'/> ");  
	document.write("<embed src='"+url+"' quality='high' width='"+width+"' height='"+height+"' allowFullScreen='true' align='middle' wmode='transparent' ");
	if(idname != ""){
		document.write("id='"+idname+"' ");
	}
	document.write("allowScriptAccess='always' swfLiveConnect=true type='application/x-shockwave-flash' ");
	document.write("pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>");
}