//player

function displayMultiMediaPlayer()
{
	var _object_ = "";
	
	_object_= '<OBJECT ID="MediaPlayer" Name="MediaPlayer" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject " bgcolor="DarkBlue" width="340" Height="240" >';
	_object_ += '<PARAM NAME="AutoStart" VALUE="1">';
	_object_ += '<PARAM NAME="AutoSize" VALUE="1">';
	_object_ += '<PARAM NAME="AnimationAtStart" VALUE="0">';
	_object_ += '<param name="fullScreen" value="0">';
	_object_ += '<PARAM NAME="DisplayMode" VALUE="4">';
	_object_ += '<PARAM NAME="Enabled" VALUE="0">';
	_object_ += '<PARAM NAME="ShowControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowAudioControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowDisplay" VALUE="0">';
	_object_ += '<PARAM NAME="ShowGotoBar" VALUE="0">';
	_object_ += '<PARAM NAME="ShowPositionControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowStatusBar" VALUE="0">';
	_object_ += '<PARAM NAME="Volume" VALUE="0">';
	_object_ += '<PARAM NAME="ShowCaptioning" VALUE="0">';
	_object_ += '<PARAM NAME="TransparentAtStart" value="1">';
	_object_ += '<EMBED invokeURLs="false" type="application/x-mpPlayerOnPlayBtn_div" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" id="MediaPlayer" Name="MediaPlayer" DisplaySize="4" AutoSize="1" ShowControls="0" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>';
	_object_ += '</OBJECT>';
	
	document.write(_object_);
}
function pop_scroll(url,intWidth,intHeight) { 
      window.open(url, "_blank", "width="+intWidth+",height="+intHeight+",resizable=0,scrollbars=1") ;
}

function pop_700k(url,intWidth,intHeight) { 
      window.open(url, "_movie_", "width=720,height=670,resizable=0,scrollbars=0") ;
}

function pop_jmage(url,intWidth,intHeight) { 
      window.open(url, "_image_", "width="+intWidth+",height="+intHeight+",resizable=0,scrollbars=1") ;
}
function displayMultiMediaPlayer_H()
{
	var _object_ = "";
	
	_object_= '<OBJECT ID="MediaPlayer" Name="MediaPlayer" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject " bgcolor="DarkBlue" width="640" Height="480" >';
	_object_ += '<PARAM NAME="AutoStart" VALUE="1">';
	_object_ += '<PARAM NAME="AutoSize" VALUE="1">';
	_object_ += '<PARAM NAME="AnimationAtStart" VALUE="0">';
	_object_ += '<param name="fullScreen" value="0">';
	_object_ += '<PARAM NAME="DisplayMode" VALUE="4">';
	_object_ += '<PARAM NAME="Enabled" VALUE="0">';
	_object_ += '<PARAM NAME="ShowControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowAudioControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowDisplay" VALUE="0">';
	_object_ += '<PARAM NAME="ShowGotoBar" VALUE="0">';
	_object_ += '<PARAM NAME="ShowPositionControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowStatusBar" VALUE="0">';
	_object_ += '<PARAM NAME="Volume" VALUE="0">';
	_object_ += '<PARAM NAME="ShowCaptioning" VALUE="0">';
	_object_ += '<PARAM NAME="TransparentAtStart" value="1">';	
	_object_ += '<EMBED invokeURLs="false" type="application/x-mpPlayerOnPlayBtn_div" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" id="MediaPlayer" Name="MediaPlayer" DisplaySize="4" AutoSize="1" ShowControls="0" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>';
	_object_ += '</OBJECT>';
	
	document.write(_object_);
}

function displayMediaPlayer(mpid){

	var playerID;
	
	if(mpid!="" && mpid != undefined){
		playerID=mpid;
	}else{
		playerID="MediaPlayer";
	}
	

	var _object_ = "";
	_object_= '<OBJECT ID="'+playerID+'" Name="'+playerID+'"  classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject " bgcolor="DarkBlue" width="100%" Height="100%" >';
	_object_ += '<PARAM NAME="AutoStart" VALUE="1">';
	_object_ += '<PARAM NAME="AutoSize" VALUE="1">';
	_object_ += '<PARAM NAME="AnimationAtStart" VALUE="0">';
	_object_ += '<param name="fullScreen" value="0">';
	_object_ += '<PARAM NAME="DisplayMode" VALUE="4">';
	_object_ += '<PARAM NAME="Enabled" VALUE="0">';
	_object_ += '<PARAM NAME="ShowControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowAudioControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowDisplay" VALUE="0">';
	_object_ += '<PARAM NAME="ShowGotoBar" VALUE="0">';
	_object_ += '<PARAM NAME="ShowPositionControls" VALUE="0">';
	_object_ += '<PARAM NAME="ShowStatusBar" VALUE="0">';
	_object_ += '<PARAM NAME="Volume" VALUE="0">';
	_object_ += '<PARAM NAME="ShowCaptioning" VALUE="0">';
	_object_ += '<PARAM NAME="TransparentAtStart" value="1">';
	_object_ += '<EMBED invokeURLs="false" type="application/x-mpPlayerOnPlayBtn_div" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" id="'+playerID+'"  Name="'+playerID+'"  DisplaySize="4" AutoSize="1" ShowControls="0" ShowDisplay="0" ShowStatusBar="1" autostart="1"></EMBED>';
	_object_ += '</OBJECT>';
	
	document.write(_object_);
}



function plyerImg(player,mm,url){
	var PlayerIE=document.getElementById(player);
	var ImgIE=document.getElementById(player+"Img");
	if(mm=='play'){
		PlayerIE.style.display="";
		ImgIE.style.display="none";
		PlayerIE.open(url);
	}else{
		PlayerIE.style.display="none";
		ImgIE.style.display="";
		PlayerIE.stop();
	}
}




// roundBox Layout
function initLayout(layoutEl,childEl) {
    var layoutId = document.getElementById(layoutEl);
    var contentsId = document.getElementById(childEl);
        
    //create and build div structure
    var bodyTH = document.createElement('div');
    var bodyLV = document.createElement('div');
    var bodyRV = document.createElement('div');
    var bodyBH = document.createElement('div');
    var bodyTL = document.createElement('div');
    var bodyTR = document.createElement('div');
    var bodyBL = document.createElement('div');
    var bodyBR = document.createElement('div');
    bodyTH.className = "bodyTH";
    bodyLV.className = "bodyLV";
    bodyRV.className = "bodyRV";
    bodyBH.className = "bodyBH";
    bodyTL.className = "bodyTL";
    bodyTR.className = "bodyTR";
    bodyBL.className = "bodyBL";
    bodyBR.className = "bodyBR";

    layoutId.appendChild(bodyTH);
    bodyTH.appendChild(bodyLV);
    bodyLV.appendChild(bodyRV);
    bodyRV.appendChild(bodyBH);
    bodyBH.appendChild(bodyTL);
    bodyTL.appendChild(bodyTR);
    bodyTR.appendChild(bodyBL);
    bodyBL.appendChild(bodyBR);

    bodyBR.appendChild(contentsId);

}

//Images Btn_KSS
function BtnOn(imgEl){
	imgEl.src = imgEl.src.replace(".gif", "_on.gif");
}
function BtnOut(imgEl){
	imgEl.src = imgEl.src.replace("_on.gif", ".gif");
}

//openDrop Layer
function viewInfo(list,total,num){
var size = total;// list count +1
var id = list;
	for(i=1;i<size;i++){
		var liEI = document.getElementById(id+i);
		if(i==num){
			if(liEI.className == "open"){
				liEI.className = "";
			}else{
				liEI.className = "open";
			}
		}else{
			liEI.className = "";
		}
	}
}


//LEFT ¸Þ´º ÁÖ¼Ò¸µÅ©ÀÌµ¿
function gopage(url){
	location.href=url;
}

//Left ÀÌ¹ÌÁö ·Ñ¿À¹ö
function leftRollover(){
	var MenuCounts = document.getElementById("subMenu").getElementsByTagName("img");
	for (i=0;i<MenuCounts.length;i++) {
		var numImg=MenuCounts.item(i);
		var ImgCheck = numImg.src.substring(numImg.src.length-6,numImg.src.length);

		if (ImgCheck!="on.gif") {
			numImg.onmouseover = function () {
				this.src = this.src.replace(".gif", "on.gif");
			}
			numImg.onmouseout = function () {
				this.src = this.src.replace("on.gif", ".gif");
			}
			} else{
		}

	}
}


//Footer ÀÌ¹ÌÁö ·Ñ¿À¹ö
function FooterRollover(){
	img_el = document.getElementById("footerMenu").getElementsByTagName("img")
		for (i = 0; i < img_el.length; i++) {
			img_el.item(i).onmouseover = function () {
			this.src = this.src.replace(".gif", "on.gif");};
			img_el.item(i).onmouseout = function () {
			this.src = this.src.replace("on.gif", ".gif");};
	}
}

//»çÀÌÆ®¸Ê ÀÌ¹ÌÁö ·Ñ¿À¹ö
function siteRollover(){
	for(j=1; j<7;j++){
		var idName="depID"+j;
		var img_el = document.getElementById(idName).getElementsByTagName("img");
			for (i = 0; i < img_el.length; i++) {
				img_el.item(i).onmouseover = function () {
				this.src = this.src.replace(".gif", "on.gif");};
				img_el.item(i).onmouseout = function () {
				this.src = this.src.replace("on.gif", ".gif");};
		}
	}
}


// openwindow
function openwindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function popOpen(url, opid, intWidth,intHeight, scroll) { 
      window.open(url, opid, "width="+intWidth+",height="+intHeight+",resizable=0,scrollbars="+scroll) ;
}

/* --------------------------------------------- 
 * ÇÔ¼ö¸í : checkSpecialChar 
 * ¼³  ¸í : Æ¯¼ö¹®ÀÚ Ã¼Å©  URI·ÎÄÉÀÌ¼Ç ÆÄ¶ó¹ÌÅÍ °ª Ã¼Å© 
 * ¿¹) if(!checkSpecialChar()) return; 
 ---------------------------------------------*/ 
function checkSpecialChar(Chk){ 

    if(Chk.search(/[?]/) >= 0) { 
//      alert("¹®ÀÚ¿­¿¡ Æ¯¼ö¹®ÀÚ( \",  ',  <,  > )°¡ ÀÖ½À´Ï´Ù.\nÆ¯¼ö¹®ÀÚ¸¦ Á¦°ÅÇÏ¿© ÁÖ½Ê½Ã¿À!");         
      return true;
      } else { return false; }
} 


/********************************************************************
*  Function Name		: LocationSetting
*  Description			: uri ·ÎÄÉÀÌ¼Ç ¼ÂÆÃ 
*  Input Data			: tagURL
*  Output Data			: None
*  »ç¿ëµÇ´Â Function 		: None
/********************************************************************/

function LocationSetting(uri,param,val){

 var Chars = checkSpecialChar(uri);

  if(Chars == true){ // ÆÄ¶ó¹ÌÅÍ °ªÀÌ ÀÖÀ¸¸é     
	location.href=uri.replace(" ","")+"&section="+param+"&from="+val;
  } else {    // ÆÄ¶ó¹ÌÅÍ °ªÀÌ ¾øÀ¸¸é     
	location.href=uri.replace(" ","")+"?section="+param+"&from="+val;
 }
}

//LG»çÀÌÆ® ¹Ù·Î°¡±â(»õÃ¢)
function goKor(){
	openwindow('http://www.lg.co.kr/index.jsp?section=obj_kor_history&from=util', 'winLang', '');
}

//Story Of LG_ ¸ÞÀÎ(»õÃ¢)
function goHistoryMain(){
	openwindow('/STORY/lg_history.swf?section=obj_history&from=main', 'winHistory', 'width=1024,height=744,resizable=0,scrollbars=no');
}

//LG°¡ °É¾î¿Â µµÀüÀÇ ¿ª»ç(»õÃ¢)
function goHistory(){
	openwindow('/STORY/lg_history.swf?section=obj_webbook&from=subpage', 'winHistory', 'width=1024,height=744,resizable=0,scrollbars=no');
}

//Virtual Meseum(»õÃ¢)
function goMuseum(){
	openwindow('/jsp/virtual/virtual_museum.jsp?section=obj_museum_history&from=subpage', 'winMuseum', 'width=760,height=560,resizable=0,scrollbars=no');
}

//LG ¿ª»ç½Å¹®(»õÃ¢)
function goPaper(value){
	if(window.navigator.appName == "Netscape")
	{
		openwindow('/newspaper/history.html?loadnum=1&section=obj_newspaper&from='+value+'', 'winNewsPaper', 'width=1035,height=641,resizable=1,scrollbars=yes');
	}
	else
	{
		openwindow('/newspaper/intro.html?section=obj_newspaper&from='+value+'', 'winNewsPaper', 'width=1053,height=641,resizable=1,scrollbars=yes');
	}
	
}

//LG 60³â»ç e-book (»õÃ¢)
function goWebbook(){
	openwindow('/LG_60_0405/autorun.html?section=obj_ebook_history&from=subpage', 'winEbook', '');
}

//¸ÞÀÎ¸í¿¹È¸Àå(self)
function goSangnam(){
	LocationSetting ('/sangnam/sangnam/history.jsp', 'obj_sangnam' , 'main');	
}

//¸ÞÀÎÃ¢¾÷È¸Àå(self)
function goYonam(){
	LocationSetting ('/yonam/yonam/history.jsp', 'obj_yonam' , 'main');	
}

//top »çÀÌÆ®¸Ê(self)
function goSitemap(value){
	LocationSetting ('/util/sitemap.jsp', 'obj_sitemap' , 'util');	
}

//top Help Desk(self)
function goHelpdesk(value){
	LocationSetting ('/util/helpdesk.jsp', 'obj_helpdesk' , 'util');	
}

//°³ÀÎÁ¤º¸º¸È£Á¤Ã¥(self)
function goPrivacy(){
	LocationSetting ('/util/protection.jsp', 'obj_privacy' , 'util');	
}

//ÀÌ¸ÞÀÏÁÖ¼Ò ¹«´Ü¼öÁý°ÅºÎ(self)
function goEmail(){
	LocationSetting ('/util/email.jsp', 'obj_email' , 'util');	
}


/********************************************************************************/
/**
 * ¹®ÀÚ¿­ÀÇ leftÂÊ trim()
 * @return trimµÈ ¹®ÀÚ¿­
 */
function ltrim(str)
{
    var i;
    var ch;
    var retStr = '';
    if (str.length == 0)
        return str;
    for (i = 0; i < str.length; i++)
    {
        ch = str.charAt(i);
        if (retStr.length == 0 && (ch == ' ' || ch == '\r' || ch == '\n'))
            continue;
        retStr += ch;
    }
    return retStr;
}

/**
 * ¹®ÀÚ¿­ÀÇ rightÂÊ trim()
 * @return trimµÈ ¹®ÀÚ¿­
 */
function rtrim(str)
{
    var i;
    var ch;
    var retStr = '';
    if (str.length == 0)
        return str;
    for (i = str.length - 1; i >= 0; i--)
    {
        ch = str.charAt(i);
        if (ch != ' ' && ch != '\r' && ch != '\n')
        {
            break;
        }
    }
    retStr = str.substring(0, i + 1);
    return retStr;
}

/**
 * ¹®ÀÚ¿­ÀÇ ¾çÂÊ trim()
 * @return trimµÈ ¹®ÀÚ¿­
 */
function trim(str)
{
    var retStr;
    retStr = ltrim(str);
    retStr = rtrim(retStr);
    return retStr;
}

/**
 * ¹®ÀÚ¿­Ä¡È¯
 * @return trimµÈ ¹®ÀÚ¿­
 */
function replaceStr(str, oldstr, newstr)
{
    var index = 1;
    var temp = String(str);

    if (newstr == null)
        newstr = "";

    while (index > 0)
    {
        temp = temp.replace(oldstr, newstr);
        index = temp.indexOf(oldstr);
    }

    return temp;
}


/****************************************/
function checkEmail( emailbox ) {
    emailbox.value = alltrim(emailbox.value);

    if (emailbox.value.length == 0) {
        alert("ÀüÀÚ¿ìÆíÀ» ÀÔ·ÂÇÏÁö ¾Ê¾Ò½À´Ï´Ù.");
        emailbox.focus();
        return false;
    }

    if (isAllowStr(emailbox.value, "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@.-_") == false) {
        alert("ÀüÀÚ¿ìÆí¿¡´Â ¿µ¹®°ú ¼ýÀÚ - _ . @¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
        return false;
    }

    var atCnt = 0;
    var dotCnt = 0;
    for (i = 0; i < emailbox.value.length ; i++) {
        ch = emailbox.value.charAt(i);
        if (ch == "@")
            atCnt++;
        if (ch == ".") {
            dotCnt++;
        }
    }

    if (atCnt != 1 || dotCnt < 1) {
        alert ("À¯È¿ÇÏÁö ¾ÊÀº ÀüÀÚ¿ìÆíÀÔ´Ï´Ù.");
        emailbox.focus();
        return false;
    }

    var atIndex = 0;
    atIndex = emailbox.value.indexOf("@");

    if (atIndex <= 0) {
        alert ("À¯È¿ÇÏÁö ¾ÊÀº ÀüÀÚ¿ìÆíÀÔ´Ï´Ù.");
        emailbox.focus();
        return false;
    }

    return true;
}

function isAllowStr(str, allowStr) {
    var i;
    var ch;
    for (i=0;i<str.length;i++) {
        ch = str.charAt(i);
        if (allowStr.indexOf(ch) < 0) {
            return false;
        }
    }
    return true;
}

function alltrim(str) {
    var i;
    var ch;
    var retStr = '';
    var retStr1 = '';
    if (str.length == 0)
        return str;
    for (i=0;i<str.length;i++) {
        ch = str.charAt(i);
        if (ch == ' ' || ch == '\r' || ch == '\n')
            continue;
         retStr += ch;
    }
    return retStr;
}


/** XSS º¸¾ÈÃ³¸® **/
function removeTag(obj)
{ 	
	var description = obj.value;
	var re = /\r\n/g;	
	description = description.replace(re, "@@@");	
	re = /<\s*script.+?<\/\s*script\s*>/gi;	
 	description = description.replace(re, "");  	       
   	re = /eval\((.*)\)/gi;   
    	description = description.replace(re, "");      
 	re = /</g;
 	description = description.replace(re, "&lt;");
 	re = />/g;
 	description = description.replace(re, "&gt;"); 	
 //	re = /'/g;
// 	description = description.replace(re, "''"); 	 	
	re = /@@@/g;
 	description = description.replace(re, "\r\n"); 	 	      
  
  	obj.value = description;  	
}
