//하다마이 플래시 삽입 자바스크립트-액티브엑스패치대비
//2006-02-09
//각 속성 외부 입력.다중사용.

function FlashInsert(FlashIDName, FlashFileName, FlashWidth, FlashHeight, DNSSetting, WMODESetting, FlashBGColor, QSetting, FlashAlign, FlashVars)
{
	document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('CODEBASE="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0" ');
	document.write(' ID="'+FlashIDName+'" WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" ALIGN="'+FlashAlign+'">');
	document.write('<PARAM NAME="movie" VALUE="'+ FlashFileName +'">');
	document.write('<PARAM NAME="quality" VALUE="'+QSetting+'">');
	document.write('<PARAM NAME="bgcolor" VALUE="'+FlashBGColor+'">');
	document.write('<PARAM NAME="wmode" VALUE="'+WMODESetting+'">');
	document.write('<PARAM NAME="allowScriptAccess" VALUE="'+DNSSetting+'">');
	document.write('<PARAM NAME="flashVars" VALUE="'+FlashVars+'">');
	document.write('<EMBED SRC="'+ FlashFileName +'"  NAME="'+FlashIDName+'"');
	document.write(' WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" QUALITY="'+QSetting+'" BGCOLOR="'+FlashBGColor+'"');
	document.write(' ALLOWSCRIPTACCESS="'+DNSSetting+'" ALIGN="'+FlashAlign+'" WMODE="'+WMODESetting+'" TYPE="application/x-shockwave-flash" ');
	document.write(' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" >');
	document.write('</EMBED>');
	document.write('</OBJECT>');
}


// 메인 플래시

    function setFlashVars(command, buffer,k_name) {
           var _string = command;
           var _str = "getMovieName('"+k_name+"')."+_string+"('"+buffer+"');";
           eval(_str);
    }
	
    function fsetMouseOut(k_name)
    {
    	setFlashVars("EVENT_INFO", "MOUSE_OUT",k_name);
    }
    
    function fsetMouseOver(k_name)
    {
    	setFlashVars("EVENT_INFO", "MOUSE_OVER",k_name);
    }
	
    // ID값으로, 페이지에 있는 플래시파일을 검색해준다. (유용)
    function getMovieName(movieName) {
    
    	if (navigator.appName.indexOf("Microsoft") != -1) {
    		//return window[movieName];
    		return document.getElementById(movieName);
    	}
    	else {
    		//return document[movieName];
    		return document.getElementsByName(movieName);
    	}
    } 




// popup 추가 
function openw(sURL)
{
newwindow=open(sURL,"popupnav","titlebar=no, scrollbars=no, toolbar=no, directories=no, menubar=no, resizable=no, status=no,width=1,height=1, screenX=10000, screenY=10000" );
} 
function openw2(sURL)
{
newwindow=open(sURL,"popupnav","titlebar=no, scrollbars=yes, toolbar=no, directories=no, menubar=no, resizable=no, status=no,width=1,height=1, screenX=10000, screenY=10000" );
} 


// 플래시 채팅 추가 // 함수명 변경. .swf 처리 ??

function FlashInsertAction(FlashIDName, FlashPathName, FlashFileName, FlashWidth, FlashHeight, DNSSetting, WMODESetting, FlashBGColor, QSetting, FlashAlign, FlashVars)
{
	document.write('<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
	document.write('CODEBASE="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0" ');
	document.write(' ID="'+FlashIDName+'" WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" ALIGN="'+FlashAlign+'">');
	document.write('<PARAM NAME="movie" VALUE="'+ FlashFileName +'">');
	document.write('<PARAM NAME="quality" VALUE="'+QSetting+'">');
	document.write('<PARAM NAME="bgcolor" VALUE="'+FlashBGColor+'">');
	document.write('<PARAM NAME="wmode" VALUE="'+WMODESetting+'">');
	document.write('<PARAM NAME="showLiveConnect" VALUE ="true">');
	document.write('<PARAM NAME="allowScriptAccess" VALUE="'+DNSSetting+'">');
	document.write('<PARAM NAME="flashVars" VALUE="'+FlashVars+'">');
	document.write('<EMBED SRC="'+ FlashPathName +'"  NAME="'+FlashIDName+'"');
        document.write(' FlashVars="'+FlashVars+'"');
	document.write(' WIDTH="' + FlashWidth + '" HEIGHT="' + FlashHeight + '" QUALITY="'+QSetting+'" BGCOLOR="'+FlashBGColor+'"');
	document.write(' ALLOWSCRIPTACCESS="'+DNSSetting+'" ALIGN="'+FlashAlign+'" WMODE="'+WMODESetting+'" TYPE="application/x-shockwave-flash" ');
	document.write(' PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer" >');
	document.write('</EMBED>');
	document.write('</OBJECT>');
}

// 플래시 채팅 추가 // 함수명 변경. .swf 처리 ??


// vod 보기 - 추가 071028

function showPlayer(fla, width, height, AutoStart, ShowTracker, ShowControls, ShowGotoBar, ShowDisplay, ShowStatusBar, AutoSize)
{
	var object =
		"<object id='player' name='player' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' width='" + width + "' height='" + height + "'>"
		+ "<param name='FileName' value='" + fla + "'>"		
		+ "<param name='AutoStart' value='" + AutoStart + "'>"
		+ "<param name='ShowTracker' value='" + ShowTracker + "'>"
		+ "<param name='ShowControls' value='" + ShowControls + "'>"
		+ "<param name='ShowGotoBar' value='" + ShowGotoBar + "'>"
		+ "<param name='ShowDisplay' value='" + ShowDisplay + "'>"
		+ "<param name='ShowStatusBar' value='" + ShowStatusBar + "'>"
		+ "<param name='AutoSize' value='" + AutoSize + "'>"	
		+ "<embed src='" + fla + "' AutoStart='" + AutoStart + "' ShowTracker='" + ShowTracker + "' ShowControls='" + ShowControls + "' ShowGotoBar='" + ShowGotoBar + "' ShowDisplay='" + ShowDisplay + "' ShowStatusBar='" + ShowStatusBar + "' AutoSize='" + AutoSize + "' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/' width='" + width + "' height='" + height + "'></embed>"
		+ "</object>"
												
	document.write( object );
}

function m_play() {
	document.all.player.play();
}

function m_pause() {
	document.all.player.pause();
}

function m_stop() {
	document.all.player.stop();
}

function showPlayer2(fla, width, height, AutoStart, ShowTracker, ShowControls, ShowGotoBar, ShowDisplay, ShowStatusBar, AutoSize)
{
	var object =
		"<object id='player2' name='player2' classid='clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715' width='" + width + "' height='" + height + "'>"
		+ "<param name='FileName' value='" + fla + "'>"		
		+ "<param name='AutoStart' value='" + AutoStart + "'>"
		+ "<param name='ShowTracker' value='" + ShowTracker + "'>"
		+ "<param name='ShowControls' value='" + ShowControls + "'>"
		+ "<param name='ShowGotoBar' value='" + ShowGotoBar + "'>"
		+ "<param name='ShowDisplay' value='" + ShowDisplay + "'>"
		+ "<param name='ShowStatusBar' value='" + ShowStatusBar + "'>"
		+ "<param name='AutoSize' value='" + AutoSize + "'>"	
		+ "<embed src='" + fla + "' AutoStart='" + AutoStart + "' ShowTracker='" + ShowTracker + "' ShowControls='" + ShowControls + "' ShowGotoBar='" + ShowGotoBar + "' ShowDisplay='" + ShowDisplay + "' ShowStatusBar='" + ShowStatusBar + "' AutoSize='" + AutoSize + "' pluginspage='http://www.microsoft.com/windows/windowsmedia/download/' width='" + width + "' height='" + height + "'></embed>"
		+ "</object>"
												
	document.write( object );
}

function m_play2() {
	document.all.player2.play();
}

function m_pause2() {
	document.all.player2.pause();
}

function m_stop2() {
	document.all.player2.stop();
}

// common js 추가 합니다. 
//Trim 함수 구현
function Trim(inputString) {
	var retValue = inputString;
	var ch = retValue.substring(0, 1);
	
	while (ch == " ") {
	retValue = retValue.substring(1, retValue.length);
	ch = retValue.substring(0, 1);
	}
	ch = retValue.substring(retValue.length-1, retValue.length);

	while (ch == " ") {
	retValue = retValue.substring(0, retValue.length-1);
	ch = retValue.substring(retValue.length-1, retValue.length);
	
	}
	while (retValue.indexOf(" ") != -1) { 
	retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); 
	}
return retValue; 
}
// shop 사용 : 포인트 
function shop_point_use(f,opt){

	ddd = f.od_temp_point.value;

	if ( opt < ddd){

		alert(" 금액을 다시 설정해주세요! ");

		f.od_temp_point.value = 0;
		f.od_temp_point.focus(); 

		return;

	}

}
// 금액표시
function number_format(data) 
{
        
        var tmp = '';
        var number = '';
        var cutlen = 3;
        var comma = ',';
        var i;
       
        len = data.length;
        mod = (len % cutlen);
        k = cutlen - mod;
        for (i=0; i<data.length; i++) 
        {
            number = number + data.charAt(i);
            
            if (i < data.length - 1) 
            {
                k++;
                if ((k % cutlen) == 0) 
                {
                    number = number + comma;
                    k = 0;
                }
            }
        }

        return number;
}
// 전체선택
function check_all(f)
{
    var chk = document.getElementsByName("chk[]");

    for (i=0; i<chk.length; i++)
        chk[i].checked = f.chkall.checked;
}
function u_btn_check(f, str, opt)   // str : 문구 , url : 이동url
{

    if (str == "")
    { 
        return;
    } 

    if (opt != "")
    { 
		f.com_check.value = opt;
    } 


    var chk = document.getElementsByName("chk[]");
    var bchk = false;

    for (i=0; i<chk.length; i++)
    {
        if (chk[i].checked)
            bchk = true;
    }

    if (!bchk) 
    {
        alert(str + "할 자료를 하나 이상 선택하세요.");
        return;
    }

    if (str == "삭제")
    {
        if (!confirm("선택한 자료를 정말 삭제 하시겠습니까?"))
            return;
    }

    f.submit();
}
//
function href_move(url,msg) { 
    if(confirm(msg)) { 
       location.href=url; 
    } 
} 
//
