//-----------------------------------------------------------------------------
// ActiveX ÆÐÄ¡¿¡ ÀÇÇÑ Å×µÎ¸® Á¦°Å (ÇÃ·¡½Ã, ¹Ìµð¾îÇÃ·¹ÀÌ¾î)
//-----------------------------------------------------------------------------

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] + '" />'; 
										/* Åõ¸íÇÏ°Ô ÇÏ·Á¸é ÀÌ°÷ÀÇ ÁÖ¼®À» »èÁ¦ÇÏ¼¼¿ä */
										contents += '<param name = "wmode" value="transparent"' + 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, GetValue){
	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+"?"+GetValue+"'>");
	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;
	}
}

