/*
Author : 
Contact Us : 
Version : 
discription : 
*/


function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

//ÀÚ¹Ù½ºÅ©¸³Æ®·Î Ãß°¡µÇ´Â ¿ä¼Ò À§Ä¡Àâ±â
function insertAfter(newElement, targetElement){
	var parent = targetElement.parentNode;
	if(parent.lastChild == targetElement){
		parent.appendChild(newElement);
	}else{
		parent.insertBefore(newElement, targetElement.nextSibling);
	}
}
//´ÙÀ½³ëµå Ã£±â
function getNextElement(node){
	if(node.nodeType == 1){
		return node;
	}
	if(node.nextSibling){
		return getNextElement(node.nextSibling);
	}
	return false;
}
//ÀÌÀü³ëµå Ã£±â
function getPrevElement(node){
	if(node.nodeType == 1){
		return node;
	}
	if(node.previousSibling){
		return getPrevElement(node.previousSibling);
	}
	return false;
}
//¿øÇÏ´Â ³ëµå¸íÀÇ ºÎ¸ð³ëµå Ã£±â(Áß°£ ºÒÇÊ¿äÇÑ ºÎ¸ð³ëµå ¹«½Ã)
function getParentNode(node, nodeName){
	if(node.nodeName == nodeName){
		return node;
	}
	if(node.parentNode){
		return getParentNode(node.parentNode, nodeName);
	}
	return false;
}
//display°¡ noneÀÎ ºÎ¸ð³ëµå Ã£±â
function getParentNode_hidden(_node){
	if(_node.offsetWidth == 0){
		if(_node.parentNode.offsetWidth == 0){
			return getParentNode_hidden(_node.parentNode);
		}else{
			return _node;
		}
	}
	if(_node.parentNode){
		return getParentNode_hidden(_node.parentNode);
	}
	return false;
}

//´ÙÁß Å¬·¡½º Àû¿ëµÈ ¿ÀºêÁ§Æ®ÀÇ°æ¿ì Ã£°íÀÚ ÇÏ´Â Å¬·¡½º¸í Ã£¾Æ ¹ÝÈ¯ÇÏ±â
function multiClass_findName(_obj, _className){
	if(!_obj.className) return false;
	var className_arr = _obj.className.split(" ");
	if(className_arr){
		for(var i=0; i<className_arr.length; i++){
			if(className_arr[i] == _className){
				return true;
			}
		}
	}
	return false;
}
//Å¬·¡½º Ãß°¡ÇÏ±â
function addClass(_element, _value){
	if(!_element.className){
		_element.className = _value;
	}else{
		newClassName = _element.className;
		newClassName += " ";
		newClassName += _value;
		_element.className = newClassName;
	}
}
//ÇØ´ç Å¬·¡½º¸í »©ÁÖ±â
function  pullUpClass(_element, _value){
	//_value °ª »« ÈÄ µ¹·ÁÁÙ Å¬·¡½ºÅØ½ºÆ®°ª ÀúÀå
	var returnClassName;
	var className_arr = _element.className.split(" ");
	if(className_arr.length <= 1){
		_element.className ="";
	}else{
		for(var i=0; i<className_arr; i++){
			if(className_arr[i] != _value){
				returnClassName += className_arr[i] + " ";
			}
		}
		_element.className = returnClassName;
	}
}

try { 
    document.execCommand('BackgroundImageCache', false, true); 
} catch(acold) {}


function showHideElemMain(_objId, _param_split){
	var showObj = document.getElementById(_objId);
	if(!showObj) return false;
	//³ªÅ¸³¾ °´Ã¼°¡ ÀÖ°í ¼û±æ °´Ã¼°¡ ´Ù¼öÀÎ°æ¿ì
	if(_param_split){
		//¼û±æ °´Ã¼µé ¹®ÀÚ¿­(¾ð´õ¹Ù¸¦ ±¸ºÐÀÚ·Î ÆÄ¶ó¸ÞÅÍ¸¦ ¹Þ´Â´Ù)
		var hideObjId_arr = _param_split.split("_");
		//¼û±æ °´Ã¼ ¹è¿­
		var hideObj_arr = Array();
		for(i=0; i<hideObjId_arr.length; i++){
			hideObj_arr[i] = document.getElementById(hideObjId_arr[i]);
		}
		//¼û±æ °´Ã¼ ¼û±â±â
		for(i=0; i<hideObj_arr.length; i++){
			if(hideObj_arr[i].style){
				hideObj_arr[i].style.display = "none";
			}else{
				return false;
			}
		}
		//³ªÅ¸³¾ °´Ã¼ ³ªÅ¸³»±â
		showObj.style.display = "block";
	}
	//³ªÅ¸³»°Å³ª ¼û±æ °´Ã¼°¡ ÇÑ°³ÀÎ °æ¿ì 
	else{
		if(showObj.style.display == "block"){
			showObj.style.display = "none";
		}else{
			showObj.style.display = "block";
		}
	}
}





function showHideElem1(_objId, _param_split){
 var showObj = document.getElementById(_objId);
 if(!showObj) return false;
 //³ªÅ¸³¾ °´Ã¼°¡ ÀÖ°í ¼û±æ °´Ã¼°¡ ´Ù¼öÀÎ°æ¿ì
 if(_param_split){
  //¼û±æ °´Ã¼µé ¹®ÀÚ¿­(¾ð´õ¹Ù¸¦ ±¸ºÐÀÚ·Î ÆÄ¶ó¸ÞÅÍ¸¦ ¹Þ´Â´Ù)
  var hideObjId_arr = _param_split.split("_");
  //¼û±æ °´Ã¼ ¹è¿­
  var hideObj_arr = Array();
  for(i=0; i<hideObjId_arr.length; i++){
   hideObj_arr[i] = document.getElementById(hideObjId_arr[i]);
  }
  //¼û±æ °´Ã¼ ¼û±â±â
  for(i=0; i<hideObj_arr.length; i++){
   if(hideObj_arr[i].style){
    hideObj_arr[i].style.display = "none";
   }else{
    return false;
   }
  }
  //³ªÅ¸³¾ °´Ã¼ ³ªÅ¸³»±â
  showObj.style.display = "block";
 }
 //³ªÅ¸³»°Å³ª ¼û±æ °´Ã¼°¡ ÇÑ°³ÀÎ °æ¿ì
 else{
  if(showObj.style.display == "block"){
   showObj.style.display = "none";
  }else{
   showObj.style.display = "block";
  }
 }
 syncHeight();
}



function showHideElem2(_objId, _param_split){
	var showObj = document.getElementById(_objId);
	if(!showObj) return false;
	//³ªÅ¸³¾ °´Ã¼°¡ ÀÖ°í ¼û±æ °´Ã¼°¡ ´Ù¼öÀÎ°æ¿ì
	if(_param_split){
		//¼û±æ °´Ã¼µé ¹®ÀÚ¿­(¾ð´õ¹Ù¸¦ ±¸ºÐÀÚ·Î ÆÄ¶ó¸ÞÅÍ¸¦ ¹Þ´Â´Ù)
		var hideObjId_arr = _param_split.split("_");
		//¼û±æ °´Ã¼ ¹è¿­
		var hideObj_arr = Array();
		for(i=0; i<hideObjId_arr.length; i++){
			hideObj_arr[i] = document.getElementById(hideObjId_arr[i]);
		}
		//¼û±æ °´Ã¼ ¼û±â±â
		for(i=0; i<hideObj_arr.length; i++){
			if(hideObj_arr[i].style){
				hideObj_arr[i].style.display = "none";
			}else{
				return false;
			}
		}
		//³ªÅ¸³¾ °´Ã¼ ³ªÅ¸³»±â
		showObj.style.display = "block";
	}
	//³ªÅ¸³»°Å³ª ¼û±æ °´Ã¼°¡ ÇÑ°³ÀÎ °æ¿ì 
	else{
		if(showObj.style.display == "block"){
			showObj.style.display = "none";
		}else{
			showObj.style.display = "block";
		}
	}
}



//CSS ½ºÀ§Ä¡
function switchCSS(style) {
	var wrapper = document.getElementsByTagName('body');
	wrapper = wrapper[0];
	wrapper.className = style;
}




//·Ñ¿À¹ö ÀÌ¹ÌÁö Å¬·¡½º¸íÀ¸·Î »ç¿ë½Ã
//class="imgover" ¸¦ ÀÌ¹ÌÁö¿¡ »ðÀÔ
function initRollovers() {
    if (!document.getElementById) return
    
    var aPreLoad = new Array();
    var sTempSrc;
    var aImages = document.getElementsByTagName('img');

    for (var i = 0; i < aImages.length; i++) {        
        if (aImages[i].className == 'imgover') {
            var src = aImages[i].getAttribute('src');
            var ftype = src.substring(src.lastIndexOf('.'), src.length);
            var hsrc = src.replace(ftype, '_on'+ftype);

            aImages[i].setAttribute('hsrc', hsrc);
            
            aPreLoad[i] = new Image();
            aPreLoad[i].src = hsrc;
            
            aImages[i].onmouseover = function() {
                sTempSrc = this.getAttribute('src');
                this.setAttribute('src', this.getAttribute('hsrc'));
            }    
            
            aImages[i].onmouseout = function() {
                if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_on'+ftype, ftype);
                this.setAttribute('src', sTempSrc);
            }
        }
    }
}

window.onload = initRollovers;




//ÇÃ·¡½Ã ·Îµù
function commonFlash(SwfUrl, xmlURL,swfURL,left_xmlURL,depth1,depth2 ,depth3){	
	var pathArr = SwfUrl.split("/");
	var flashID = pathArr[pathArr.length-1].split(".")[0];

	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' style='width:100%; height:100%;' id='leftFlash' align='middle'>");
	document.write("<param name='allowScriptAccess' value='always' />");
	document.write("<param name='movie' value='"+SwfUrl+"' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<param name='FlashVars' value='xmlURL="+ xmlURL+"&swfURL="+swfURL+"&left_xmlURL="+left_xmlURL+"&depth1="+depth1+"&depth2="+depth2+"&depth3="+depth3+"' />");
	document.write("<param name='bgcolor' value='#FFFFFF' />");
	document.write("<embed src='"+SwfUrl+"' FlashVars='xmlURL="+ xmlURL+"&swfURL="+swfURL+"&left_xmlURL="+left_xmlURL+"&depth1="+depth1+"&depth2="+depth2+"&depth3="+depth3+"' quality='high' bgcolor='#FFFFFF' wmode='transparent' style='width:100%; height:100%;' width='100%' height='100%' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>"); 
}

function commonFlashEvent(SwfUrl, event_xmlURL){	
	var pathArr = SwfUrl.split("/");
	var flashID = pathArr[pathArr.length-1].split(".")[0];

	document.write("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' style='width:75px; height:100%; min-height:100%;' width='75' height='100%' id='"+flashID+"' align='middle'>");
	document.write("<param name='allowScriptAccess' value='always' />");
	document.write("<param name='movie' value='"+SwfUrl+"' />");
	document.write("<param name='quality' value='high' />");
	document.write("<param name='wmode' value='transparent' />");
	document.write("<param name='FlashVars' value='event_xmlURL="+event_xmlURL+"' />");
	document.write("<param name='bgcolor' value='#FFFFFF' />");
	document.write("<embed src='"+SwfUrl+"' FlashVars='event_xmlURL="+ event_xmlURL+"' quality='high' bgcolor='#FFFFFF' wmode='transparent' style='width:100%; height:100%; min-height:100%;' width='75' height='100%' align='middle' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />");
	document.write("</object>"); 
}

//CSS ½ºÀ§Ä¡
function switchCSS(style) {
	var wrapper = document.getElementsByTagName('body');
	wrapper = wrapper[0];
	wrapper.className = style;
}




function stripeTables() {
  if (!document.getElementsByTagName) return false;
  var tables = document.getElementsByTagName("table");
  for (var i=0; i<tables.length; i++) {
    var odd = false;
    var rows = tables[i].getElementsByTagName("tr");
    for (var j=1; j<rows.length; j++) {
      if (odd == true) {
        addClass(rows[j],"odd");
        odd = false;
      } else {
        odd = true;
      }
    }
  }
}


//ÁÂÃø ³×ºñ°ÔÀÌ¼Ç È£Ãâ
function naviOpen() {
  var para = document.getElementById("subNavi");
  try
  {
   pullUpClass(para, "naviClose2");
  }
  catch(e){}
  addClass(para,"naviOpen");    
}

function naviClose() {
  var para = document.getElementById("subNavi");
  try
  {
   pullUpClass(para, "naviOpen");
  }
  catch(e){}
  addClass(para,"naviClose2");
}







//¼­ºê³×ºñ°ÔÀÌ¼Ç°ú ÄÁÅÙÃ÷ ³ôÀÌ ¸ÂÃß±â
function syncHeight(){
 var _sideNavi = document.getElementById("sideNavi");
 var _nav = document.getElementById("subNavi");
 var _embed = document.getElementById("leftFlash");
 if(!_sideNavi) return false;
 if(!_nav) return false;
 var sheight = document.compatMode == "CSS1Compat" ? document.documentElement.scrollHeight  : document.body.scrollHeight;
 if(_sideNavi.offsetHeight < sheight){
  _sideNavi.style.height = sheight+"px";
 }
 if(_nav.offsetHeight < sheight){
  _nav.style.height = sheight+"px";
 }
 if(_embed.offsetHeight < sheight){
  _embed.style.height = sheight+"px";
 }
}



//±âº»¿ä¼Òµé ÃÊ±âÈ­
function startPage(){
 //¼­ºê³×ºñ°ÔÀÌ¼Ç°ú ÄÁÅÙÃ÷ ¿µ¿ª ³ôÀÌ ¸ÂÃß±â
 syncHeight();
}


//ºê¶ó¿ìÀú ³ôÀÌ °è»ê ÀÌº¥Æ®
function resize()
	{
	 syncHeight();
	}
window.onresize = resize;





try{
	document.title = "LG¿£½Ã½º À¥Áø Make IT Easy";
}catch(E){
	// ignore
}
/* ·Î±×ÀÎ ÆË¾÷ */
function loginPopUp(){
	window.open("../inc/popup.jsp?cmd=login", "POP_LOGIN", "width=300px, height=285px");
}
/* ´º½º·¹ÅÍ½ÅÃ»¾È³»ÆË¾÷ */
function newsletterPopUp(){
	window.open("../inc/newsletterAgreePopUp.jsp", "NEWS_LETTER", "width=460px, height=355px");
}
/* URLº¹»çÇÏ±â ÆË¾÷ */
function goUrlCopy(){
	window.clipboardData.setData('Text', document.getElementById("CLIP_BOARD").innerText);
	window.open("../inc/popup.jsp?cmd=clip", "CLIP", "width=380px,height=165px");
}
/* ¿ìÆí¹øÈ£ Ã£±â ÆË¾÷ */
function zipCodePopUp(){
	window.open( '../inc/popup.jsp?cmd=zip', 'zip_check_win', 'width=380,height=345' );
}
/* ÀÌº¥Æ® ´ãÃ»ÀÚ ÆË¾÷ */
function eventPrizePopUp(link){
	window.open(link, 'PREV_APP', 'width=745px, height=405,scrollbars=yes');
}
/* ¼³¹®´ãÃ»ÀÚÆË¾÷ */
function pollPrizePopUp(link){
	window.open(link, 'POLL_PRIZE', 'width=745px, height=405,scrollbars=yes');
}
/* ¼³¹®¸ñ·Ï ÆË¾÷ */
function pollListPopUp(){
	window.open('../inc/popup.jsp?cmd=pollList', 'POLL_LIST', 'width=728px, height=445');
}









addLoadEvent(stripeTables);
addLoadEvent(startPage);