var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";



function moveRightEdge()
{
    var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;



    if (isNS4) {
        yMenuFrom   = divMenu.top;
        yMenuTo     = windows.pageYOffset + 100;   // À§ÂÊ À§Ä¡
    } else if (isDOM) {
        yMenuFrom   = parseInt (divMenu.style.top, 10);
        yMenuTo     = (isNS ? window.pageYOffset : document.documentElement.scrollTop) + 50; // À§ÂÊ À§Ä¡
    }



    timeoutNextCheck = 500;



    if (yMenuFrom != yMenuTo) {
        yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
        if (yMenuTo < yMenuFrom)
            yOffset = -yOffset;



        if (isNS4)
            divMenu.top += yOffset;
        else if (isDOM)
            divMenu.style.top = parseInt (divMenu.style.top, 10) + yOffset;



            timeoutNextCheck = 10;
    }



    setTimeout ("moveRightEdge()", timeoutNextCheck);
}
/*********************************************************************************************************************
 * ÇØ´ç¸µÅ©·Î ÀÌµ¿
 ********************************************************************************************************************/
function goLink(link) {
	location.href = link;
}


/*********************************************************************************************************************
 * Çì´õ¸Þ´º ¸¶¿ì½º ¿À¹ö/¾Æ¿ô
 ********************************************************************************************************************/
function MO(obj, idx, mode) {
	if(mode == "over") {
		obj.style.display = "none";
		document.getElementById(idx + "_ovr").style.display = "block";
	}
	else {
		obj.style.display = "none";
		document.getElementById(idx + "_nor").style.display = "block";
	}
}


/*********************************************************************************************************************
 * ¸¶¿ì½º ¿À¹ö,¾Æ¿ô
 ********************************************************************************************************************/
function MOTR(obj, color) {
	obj.style.backgroundColor = color;
}


/*********************************************************************************************************************
 * ·Î±×¾Æ¿ô
 ********************************************************************************************************************/
function logout() {
	location.href = "/login/logout.php";
}


/*********************************************************************************************************************
 * ÄíÅ° °¡Á®¿À±â
 ********************************************************************************************************************/
function GetCookie(NameCookie){

	var i=document.cookie.indexOf(NameCookie+'=');

	if(i!=-1){
		i+=NameCookie.length+1;
		NameEnd=document.cookie.indexOf(';',i);

		if(NameEnd==-1) {
			NameEnd = document.cookie.length;
		}

		return unescape(document.cookie.substring(i,NameEnd));
	}
	else {
		return "";
	}
}


/*********************************************************************************************************************
 * ÄíÅ° ¼¼ÆÃ
 ********************************************************************************************************************/
function setCookie(name, value, expiredays) {

	var todayDate = new Date();

	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}


/*********************************************************************************************************************
 * iframe ³ôÀÌ ÀÚµ¿Á¶Àý
 ********************************************************************************************************************/
function Resizeiframe(obj) {
	obj.setExpression('height', iframeDoc.document.body.scrollHeight+50);
}


/*********************************************************************************************************************
 * SMSÀü¼Û
 ********************************************************************************************************************/
function sendSMS(handphone) {
	window.open("/admin2/sms/sms.html?handphone=" + handphone, "sms", "width=200, height=330, top=0, left=0");
}


/*********************************************************************************************************************
 * ¸ÞÀÏ¹ß¼Û
 ********************************************************************************************************************/
function sendEmail(email) {
	window.open("/admin2/mail/mail.html?email=" + email, "sms", "width=800, height=450, top=0, left=0");
}


/*********************************************************************************************************************
 * ÇÃ·¡½Ã ÆÐÄ¡ ½ÃÀÛ
 ********************************************************************************************************************/
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://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,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=\"quality\" VALUE=\"high\" />";
                } 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);
}


// ie ativeX Ãâ·Â º¯°æ ÇÔ¼ö
function Embedx() {
var emtype;
    var key = new Array();
    var value = new Array();

    for(i=0;i<Embedx.arguments.length;i++) {
        data = Embedx.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://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,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\" />";
                } 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 center() {
    var x, y;
    if (self.innerHeight) { // IE ¿Ü ¸ðµç ºê¶ó¿ìÀú
        x = (screen.availWidth - self.innerWidth) / 2;
        y = (screen.availHeight - self.innerHeight) / 2;
    }
	else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict ¸ðµå
        x = (screen.availWidth - document.documentElement.clientWidth) / 2;
        y = (screen.availHeight - document.documentElement.clientHeight) / 2;
    }
	else if (document.body) { // ´Ù¸¥ IE ºê¶ó¿ìÀú( IE < 6)
        x = (screen.availWidth - document.body.clientWidth) / 2;
        y = (screen.availHeight - document.body.clientHeight) / 2;
    }
    window.moveTo(x,y);
}




