/* ¸µÅ©¿¡ Á¡¼±¾ø¾Ö´Â ÀÚ¹Ù ½ºÅ©¸³Æ® */
function bluring(){ 
if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
} 
document.onfocusin=bluring; 


/* LEFT ¸Þ´º ÀÌµ¿ */
function leftmenu_go(arg1,arg2)
{	
	location.href = arg1 + "?section=" + arg2 ;
}

/* Top_sub ¸Þ´º ÀÌµ¿ (shop_subview.asp - top, step) */
function subview_go(arg1,arg2)
{	
	location.href = "../shop/shop_subview.asp?top=" + arg1 + "&step=" + arg2 ;
}

/* Left_sub ¸Þ´º ÀÌµ¿ (shop_subview.asp - top, step) */
function left_subview_go(arg1,arg2)
{	
	location.href = "../shop/shop_subview.asp?top=" + arg1 + "&step=" + arg2 ;
}

/* »õÃ¢ ¶Ù¿ì±â */
function openWin(url, name, w, h)
{
	window.open(url, name, 'width='+w+',height='+h+',resizable=yes,scrollbars=no');
}

function s_over(object,num) {
	object.src = 'http://image.lgeshop.com/common_2004/btn_search' + num + '_on.gif';
}
function s_out(object,num) {
	object.src = 'http://image.lgeshop.com/common_2004/btn_search' + num + '_off.gif';
}

function over(bar) {
	bar.style.background = 'EEFAFF';
}
function out(bar) {
	bar.style.background = 'FFFFFF';
}

function over0(object,url,num) {
	object.src = 'http://image.lgeshop.com/' + url + num + '_on.gif';
}
function out0(object,url,num) {
	object.src = 'http://image.lgeshop.com/'+ url + num + '_off.gif';
}
function over1(bar) {
	bar.style.background = 'FFF6F9';
}
function over2(object,num) {
	object.src = 'http://image.lgeshop.com/myLGeshop_new/tab_menu' + num + '_on.gif';
}
function out2(object,num) {
	object.src = 'http://image.lgeshop.com/myLGeshop_new/tab_menu' + num + '_off.gif';
}
function over3(object,num) {
	object.src = 'http://image.lgeshop.com/myLGeshop_new/s_menu' + num + '_on.gif';
}
function out3(object,num) {
	object.src = 'http://image.lgeshop.com/myLGeshop_new/s_menu' + num + '_off.gif';
}
function over4(object) {
	object.background = 'http://image.lgeshop.com/myLGeshop_new/tab_menu01_on.gif';
}
function out4(object) {
	object.background = 'http://image.lgeshop.com/myLGeshop_new/tab_menu01_off.gif';
}
function over5(object,num) {
	object.src = 'http://image.lgeshop.com/myLGeshop_new/tab_s' + num + '_on.gif';
}
function out5(object,num) {
	object.src = 'http://image.lgeshop.com/myLGeshop_new/tab_s' + num + '_off.gif';
}
function over6(obj,num) {
	obj.src = 'http://image.lgeshop.com/top_2004/top_cate' + num + '_on.gif';
}
function out6(obj,num) {
	obj.src = 'http://image.lgeshop.com/top_2004/top_cate' + num + '_off.gif';
}

function over2_1(object,num) {
	object.src = 'image/tab_menu' + num + '_on.gif';
}
function out2_1(object,num) {
	object.src = 'image/tab_menu' + num + '_off.gif';
}

function over4_1(object) {
	object.background = 'http://image.lgeshop.com/tvhome_2004/tab_menu01_on.gif';
}
function out4_1(object) {
	object.background = 'http://image.lgeshop.com/tvhome_2004/tab_menu01_off.gif';
}

function over5_1(obj, num) {
	obj.src = 'http://image.lgeshop.com/tvhome_2004/tab_s' + num + '_on.gif';
}
function out5_1(obj, num) {
	obj.src = 'http://image.lgeshop.com/tvhome_2004/tab_s' + num + '.gif';
}


function tab_view(num) {
	for(i = 1; i <= 4; i++) {
		var tab = eval('tab' + i);

		if(num == i) tab.style.display = 'block';
		else tab.style.display = 'none';
	}
}


//·Î±×ÀÎ Ã¢
function openLogin(){
 	var newWin = window.open('/jsp/jseig_LogIn.jsp','LGeShopLogIn','Width=400,Height=300,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}


//·Î±×ÀÎ Ã¢ (Áö½ÄÇÁ·£Áî¿ë)
function openLogin1(){
 	var newWin = window.open('http://www.lgeshop.com/jsp/jseig_LogIn.jsp','LGeShopLogIn','Width=310,Height=230,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');
	newWin.focus();
}

// ÄíÅ° ÀÐ±â
function GetCookie(name){
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;

    while(i < clen){
        var j = i + alen;
        if(document.cookie.substring(i, j) == arg)
        return getCookieVal(j);
        i = document.cookie.indexOf(" ", i) + 1;
        if(i == 0) break;
    }
    return null;
}

// ÄíÅ° ÀÐ±â
function getCookieVal(offset){
    var endstr = document.cookie.indexOf(";", offset);
    if(endstr == -1)
        endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

// ÄíÅ° ÀÐ±â2 - 2Áß ÄíÅ°¿¡¼­ »ç¿ë
function GetCookie2(key1, key2) {
  var tmp = GetCookie(key1);
  if(tmp == null)
    return null;

  tmp = tmp.split("~");
  for(var i = 0; i<tmp.length; i++) {
    var tmp2 = tmp[i].split("=");
    if(tmp2.length == 2 && tmp2[0] == key2) {
      return tmp2[1];
    }
  }
  return null;
}

// °áÀçÂÊ¿¡¼­ ¾²ÀÌ´Â°Å...
isPopup = 0;

function noChild(){
   if (isPopup==0) return;
   newWin.close();
   isPopup = 0;
}

// »þÇÇ
function openShoppy(){
	window.open("/shoppy/shoppy.jsp","LGeShopShoppy","width=310,height=230,left=10,top=10,resizable=0");
	return;
}

// ¸ÖÆ¼¸Þ¼¼Áö
function mmsgClose(){
	document.all.mmsg.style.display = "none";
}

// ÀÌ¼ó°¡ÀÌµå
function openGuide(){
	window.open('/eshopGuide/jseig_eshopGuide.jsp','guide','width=700,height=491,top=10');
	return;
}

// ÀÌ¼ó°¡ÀÌµå (Áö½ÄÇÁ·£Áî¿ë)
function openGuide_know(){
	window.open('http://www.lgeshop.com/eshopGuide/jseig_eshopGuide.jsp','guide','width=700,height=491,top=10');
	return;
}

// ÄíÆù
function getCoupon() {

	var args = getCoupon.arguments;

	if(args.length == 1) {

		window.open('/selection/coupon/jseig_GetCoupon.jsp?num=' + args[0],'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,WIDTH=310,HEIGHT=230,left=390,top=0');

	} else if(args.length == 2) {

  	window.open('/selection/coupon/coupon.jsp?couponno=' + args[0] + '&img=' + args[1],'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,WIDTH=310,HEIGHT=230,left=390,top=0');
  }

  return;
}

// ÂªÀº¸ÞÀÏ º¸³»±â
function writeMail(email, name) {
  window.open("/email/writeMail.jsp?rec_email=" + email + "&receiver=" + name, 'writeMail', 'width=310,height=230,topmargin=0,leftmargin=0,left=0,top=0,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
  return;
}


// ´Ù¸¥ ´ëºÐ·ùº¸±â
function showSectL() {
	if(document.all.sectMS) {
		document.all.sectMS.style.display = "none";
	}
	document.all.sectL.style.display = "";
}
function hideSectL() {
	document.all.sectL.style.display = "none";
	if(document.all.sectMS) {
		document.all.sectMS.style.display = "";
	}
}

function HANA_showHideLayers() { //v3.0	
var i,p,v,obj,args=HANA_showHideLayers.arguments;	
for (i=0; i<(args.length-2); i+=3) if ((obj=HANA_findObj(args[i]))!=null) { v=args[i+2];	
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }	
obj.visibility=v; }	
}


function showSectAll(sectl) {
	window.open('/jsp/jseip_SectAll.jsp?sectl=' + sectl,'pop_sect','width=796,height=600, topmargin=0, leftmargin=0, left=0, top=0, toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes');
	return;
}



// »ó¼¼°Ë»ö
function detailSearch() {
  window.open("/jsp/detailSearch.jsp", "detailSearch" , "toolbar=no , directories=no, status=no resizable=no, width=457, height=350 scrollbars=no");
}

// °Ë»öÃ¢ ¿£ÅÍ ÀÔ·Â Ã³¸®
function onSearchKeyPress () {
  var keycode;
  if (window.event) keycode = window.event.keyCode;
  else if (e) keycode = e.which;
 	else return true;
  if (keycode == 13) {
    sechfrmsubmit();
    return false;
  }
}

// °Ë»öÇÏ±â
function goSearch() {

	var args = goSearch.arguments;

	var wf = document.sechfrm.wf.value;
	var pg = document.sechfrm.pg.value;
	var so = document.sechfrm.so.value;
	var user = GetCookie("UVID");
	var tq = args[0];	// °Ë»ö¾î
	var catid = "";
	if(args.length > 1) {
		 catid = args[1]; // Ä«Å×°í¸®
	}
	var strSearch = "/jsp/jseip_SearchList.jsp?wf=" + wf + "&pg=" + pg + "&so=" + so + "&user=" + user + "&tq=" + tq + "&catid=" + catid;

	if(args.length == 3) {

		if(args[2] == "_self") {

			document.location.href = strSearch;

		} else if(args[2] == "_parent") {

			_parent.document.location.href = strSearch;

		} else if(args[2] == "_top") {

			_top.document.location.href = strSearch;

		// _blank, ±âÅ¸ µîµî
		} else {

			window.open(strSearch, args[1], "");

		}

	} else {

		document.location.href = strSearch;

	}

	return;

}

function goTop10(catid) {

	if(document.all.top10_tq.value == "") {
		alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØ ÁÖ¼¼¿ä!");
		document.all.top10_tq.focus();
		return;
	}

	goSearch(document.all.top10_tq.value, catid);

	return;

}

// °Ë»öÃ¢ ¿£ÅÍ ÀÔ·Â Ã³¸®
function onTop10KeyPress (cateid) {
  var keycode;
  if (window.event) keycode = window.event.keyCode;
  else if (e) keycode = e.which;
 	else return true;
  if (keycode == 13) {
    goTop10(cateid);
    return false;
  }
}

// ÀÌº¯¼ö´Â °è¼Ó ¾´´Ù.
// 0 ; ·Î±×ÀÎ »óÅÂ
// 1 ; ·Î±×¾Æ¿ô »óÅÂ
var loginStatus = 1;

if(GetCookie("login") != null && GetCookie("login") == "true") {

  loginStatus = 0;

}

// footer ¸µÅ©
function prGo() {
	var args = prGo.arguments;

	var idx = eval(args[0]);
	var wtarget = "_LGHS";

	if(args.length > 1) {
		wtarget = args[1];
	}

  var footer_urls = new Array();

  footer_urls[0] = "http://company.lgeshop.com/";
  footer_urls[1] = "http://company.lgeshop.com/company/company_index.asp";
  footer_urls[2] = "http://company.lgeshop.com/homeshopping/homeshopping_index.asp";
  footer_urls[3] = "http://company.lgeshop.com/invest/invest_index.asp";
  footer_urls[4] = "http://company.lgeshop.com/recruit/recruit_index.asp";
  footer_urls[5] = "http://company.lgeshop.com/join/join_index.asp";
  footer_urls[6] = "/jsp/jseig_guide.jsp";
  footer_urls[7] = "/jsp/jseig_guide_protect.jsp";

  if(idx > footer_urls.length -1)
    return;


  var url = "";
  if(idx > footer_urls.length -3) {
    url = footer_urls[idx];
    if(args.length > 1) {
    	window.open(url, wtarget, "");
  	} else {
    	document.location.href = url;
    }
  } else {
    url = "http://company.lgeshop.com/sess_check.asp?nextUrl=" + escape(footer_urls[idx]) + "&sessId=" + escape(nvl(GetCookie2("ecid", "eclname"), "")) + "&sessName=" + escape(nvl(GetCookie("username"), ""));
    window.open(url, wtarget, "");
  }

}

// utility
function nvl(chk, repl) {
  if(chk == null) {
    return repl;
  } else {
    return chk;
  }
}


// »óÇ°ºñ±³
function checkContent() {
	var args = checkContent.arguments;
	var frmname;
	if(args.length == 0) {
		frmname = "Qform";
	} else {
		frmname = args[0];
	}

	var obj = eval("document." + frmname);
	var n = obj.ecpid.length;
	var cnt = 0;

	for (var i = 0; i < n; i++) {
		if (obj.ecpid[i].checked) {
			cnt ++;
		}
	}

	if (cnt > 3) {
		alert ("»óÇ°³»¿ë ºñ±³´Â ÃÖ´ë 3°³ ¸ðµ¨±îÁö ºñ±³ÇÒ ¼ö ÀÖ½À´Ï´Ù.");
		return;
	}

	if ( cnt < 2 ) {
		alert ("»óÇ°³»¿ë ºñ±³´Â ÃÖ¼Ò 2°³ÀÌ»ó ÃÖ´ë 3°³ ¸ðµ¨±îÁö ¼±ÅÃÇÏ¼Å¾ß ÇÕ´Ï´Ù." );
		return;
	}

	obj.action = "/jsp/jseip_Compare.jsp";
	obj.target = "compare";

	window.open("", "compare", "width=720,height=620,menubar=no,toolbar=no,location=no,scrollbars=yes");

	obj.submit();
	return;
}

// ÁßºÐ·ù tab
function tab_sectM(num) {
  var obj;
  for(var i = 0; i < 3; i++) {
	  obj = eval("document.all.tab_corner" + i);
	  obj.style.display = "none";
  }
  obj = eval("document.all.tab_corner" + num);
  obj.style.display = "";
}

// ÁßºÐ·ù tab
function tab_sectL(num) {
  var obj;
  for(var i = 0; i < 3; i++) {
	  obj = eval("document.all.tab_corner" + i);
	  obj.style.display = "none";
  }
  obj = eval("document.all.tab_corner" + num);
  obj.style.display = "";
}

// Å©°Ôº¸±â
function openLarge(ecpid){
	openLarge(ecpid, 'Y');
  return;
}
function openLarge(ecpid, goPrd) {
  var URL = "/jsp/jseip_LargePic.jsp?ecpid=" + ecpid + "&goPrd=" + goPrd;
  window.open(URL, 'picture', 'width=780,height=660,menubar=no,toolbar=no,location=no,scrollbars=auto');
  return;
}

// µ¿¿µ»óº¸±â
function openVOD_256(ecpid) {
   openVOD(ecpid, "256");
}
function openVOD_512(ecpid) {
  openVOD(ecpid, "512");
}
function openVOD(ecpid, qt) {
  var URL = "/jsp/flashPlayer.jsp?ecpid=" + ecpid + "&vodType=" + qt;
  window.open(URL, 'VODWindow', 'width=331,height=335,scrollbars=no');
  return;
}

//¹Ì¸®°è»êÇÏ±â
function preCalc(ecpid){
  window.open('/jsp/jseio_prePlaceOrder.jsp?ecpid=' + ecpid, '¹Ì¸®°è»ê','width=310,height=230,status=no menubar=no,scrollbars=0');
}

// modified by stmhsj 2003.11.30
function openGift() {
  newWin = window.open("/jsp/jseip_guideForGiftWrapping.jsp","frameWindow","toolbar=no,width=520,top=100,left=150,directories=no, status=yes menubar=no,scrollbars=yes, resizable=yes");
  if (!newWin.opener) newWin.opener=self;
  if (!newWin.focus) newWin.focus();
}

//-------------------------------------------------
// ¿ë    µµ : WishList º¸°üÇÔ ¸®½ºÆ® ÆË¾÷À» ¶ç¿î´Ù.
// ÆÄ¶ó¹ÌÅÍ : ¾øÀ½
// ¸®    ÅÏ : ¾øÀ½
//-------------------------------------------------
function addWishList(paramPrdid) {

	var itemid;

	if(document.prditm == null) {

		itemid = "0";

	} else {

		try {

		  if(document.prditm.TotalItem != null) {
		    var index = document.prditm.TotalItem.selectedIndex-1;
		    if(index < 0) {
		      alert("Á¾·ù¸¦ ¼±ÅÃÇØ ÁÖ¼¼¿ä!");
		      document.prditm.TotalItem.focus();
		      return;
		    }
		  }

		  itemid = document.prditm.prditmid.value;

		} catch(e) {

			itemid = "0";

		}

	}

  var url = "/jsp/jseig_selectMyWishList.jsp?action=6&wishgubun=1&prdid=" + paramPrdid + "&itemid=" + itemid;

  var winWish = window.open(url, "addWish", "width=400,height=295,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0");
  winWish.opener = self;
  winWish.focus();
  return;
}

// µÚ·Î º¸³»±â.. ¾øÀ¸¸é ¸ÞÀÎÀ¸·Î
function goback() {
	if(history.length > 0) {
		history.go(-1);
	} else {
		location.href="/jsp/main.jsp";
	}
}

// ´ÜÇ° »óÇ°Æò
var old_menu = '';
var old_cell = '';

function menuclick(num) {
	var submenu = eval('prdPar_' + num);

	if(old_menu != submenu) {
		if(old_menu != '') old_menu.style.display = 'none';
		submenu.style.display = 'block';
		old_menu = submenu;
	} else {
		submenu.style.display = 'none';
		old_menu = '';
	}
}

// ½Ç½Ã°£ ÄíÆù
function fn_multiMsg(strPrdid) {
  ifrExecute.location.href = "jseip_RealtimeMsg.jsp?action=s&prdid=" + strPrdid;
}


// ·ÎÄÉÀÌ¼Ç ¿ìÃø ½ºÅ©·Ñ °ü·Ã
function lgmove1(whichlayer){
	lgtlayer = eval(whichlayer);

	if(lgtlayer.top > 0 && lgtlayer.top <= lgnum) {
		lgtlayer.top = 0;
		setTimeout("lgmove1(lgtlayer)", lgscrollspeed);
		setTimeout("lgmove2(document.lgmain.document.lgsecond)", lgscrollspeed);
		return;
	}
	if (lgtlayer.top >= lgtlayer.document.height * -1) {
		lgtlayer.top -= lgnum;
		setTimeout("lgmove1(lgtlayer)", lgwaitingtime);
	} else {
		lgtlayer.top = lgscrollerheight;
		lgtlayer.document.write(lgmessages[lgi]);
		lgtlayer.document.close();

		if(lgi == lgmessages.length - 1) lgi = 0;
		else lgi++;
	}
}

function lgmove2(whichlayer) {
	lgtlayer2 = eval(whichlayer);

	if(lgtlayer2.top > 0 && lgtlayer2.top <= lgnum) {
		lgtlayer2.top = 0;
		setTimeout("lgmove2(lgtlayer2)", lgscrollspeed);
		setTimeout("lgmove1(document.lgmain.document.lgfirst)", lgscrollspeed);
		return;
	}
	if (lgtlayer2.top >= lgtlayer2.document.height * -1) {
		lgtlayer2.top -= lgnum;
		setTimeout("lgmove2(lgtlayer2)", lgwaitingtime);
	} else {
		lgtlayer2.top=lgscrollerheight;
		lgtlayer2.document.write(lgmessages[lgi]);
		lgtlayer2.document.close();

		if(lgi == lgmessages.length - 1) lgi = 0;
		else lgi++;
	}
}

function lgmove3(whichdiv) {
	lgtdiv = eval(whichdiv);

	if(lgtdiv.style.pixelTop > 0 && lgtdiv.style.pixelTop <= lgnum) {
		lgtdiv.style.pixelTop = 0;
		setTimeout("lgmove3(lgtdiv)", lgscrollspeed);
		setTimeout("lgmove4(lgsecond2)", lgscrollspeed);
		return;
	}
	if(lgtdiv.style.pixelTop >= lgtdiv.offsetHeight * -1){
		lgtdiv.style.pixelTop -= lgnum;
		setTimeout("lgmove3(lgtdiv)", lgwaitingtime);
	} else {
		lgtdiv.style.pixelTop = lgscrollerheight;
		lgtdiv.innerHTML = lgmessages[lgi];

		if(lgi == lgmessages.length - 1) lgi = 0;
		else lgi++;
	}
}

function lgmove4(whichdiv) {
	lgtdiv2 = eval(whichdiv);

	if(lgtdiv2.style.pixelTop > 0 && lgtdiv2.style.pixelTop <= lgnum) {
		lgtdiv2.style.pixelTop = 0;
		setTimeout("lgmove4(lgtdiv2)", lgscrollspeed);
		setTimeout("lgmove3(lgfirst2)", lgscrollspeed);
		return;
	}
	if(lgtdiv2.style.pixelTop >= lgtdiv2.offsetHeight * -1) {
		lgtdiv2.style.pixelTop -= lgnum;
		setTimeout("lgmove4(lgsecond2)", lgwaitingtime);
	} else {
		lgtdiv2.style.pixelTop = lgscrollerheight;
		lgtdiv2.innerHTML = lgmessages[lgi];

		if(lgi == lgmessages.length - 1) lgi = 0;
		else lgi++;
	}
}

function lgonmouse_event(){
	lgnum = 0;
}

function lgmouseout_event(){
	lgnum = 1;
}

function lgstartscroll() {
	if(document.all) {
		lgmove3(lgfirst2);
		lgsecond2.style.top = lgscrollerheight;
		lgsecond2.style.visibility = 'visible';
	} else if(document.layers) {
		document.lgmain.visibility = 'show';
	move1(document.lgmain.document.lgfirst);
		document.lgmain.document.lgsecond.top = lgscrollerheight + lgnum;
		document.lgmain.document.lgsecond.visibility = 'show';
	}
}