var CommonTopGoodsdaqUrl;
if ( document.domain.indexOf("dev")>= 0 )
	CommonTopGoodsdaqUrl = "http://dev.gmarket.co.kr/";
else
	CommonTopGoodsdaqUrl = "http://www.gmarket.co.kr/";

function chk_menusrch_val() {
    if (document.menusearchform.keyword.value == "") {
        window.alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
        document.menusearchform.keyword.focus();
        return false;
    }
    document.menusearchform.action = "http://search.gmarket.co.kr/search.aspx"
}
function chk_menusrch_val_button() {
    if (document.menusearchform.keyword.value == "") {
        window.alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
        document.menusearchform.keyword.focus();
        return false;
    }
    document.menusearchform.action = "http://search.gmarket.co.kr/search.aspx"
    document.menusearchform.submit();
}
function event_go() {
    if (gmktMain_keystatus == 2) {
        chk_menusrch_val_button();
    }
    else {
        document.location.href = document.menusearchform.action;
    }
}
function searchSSL() {
    var searchForm = document.menusearchform;
    if (searchForm.keyword.value == "") {
        window.alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.");
        searchForm.keyword.focus();
        return;
    }
    searchForm.action = "http://search.gmarket.co.kr/search.aspx"
    searchForm.submit();
}
var gtop_is;
function overGroupLayer(GNB_Gtype) {

    if (!($("cateIndiv").style.display == "block")) {
        for (var GNB_i = 1; GNB_i <= 8; GNB_i++) {
            if (GNB_i == GNB_Gtype)
			{
                $("gnbTab" + GNB_i).className = "tab" + GNB_i + "on";
				if ( GNB_i == 8 )
				{
					//alert(document.getElementById("GNBMenuIMG1").src);
					if ( document.getElementById("GNBMenuIMG1") )
					{
					
						if ( document.getElementById("GNBMenuIMG1").src == "")
						{
							for(var i=0; i< GSCnt_GNB ;  i++)
							{
								document.getElementById("GNBMenuURL"+(i+1)).href = arrGNB[i]['URL1'];
								document.getElementById("GNBMenuIMG"+(i+1)).src = gtop_is + arrGNB[i]['IMG1'];
							}
						}
					}
				}
			}
            else
                $("gnbTab" + GNB_i).className = "tab" + GNB_i;

        } //for
        $("gLayer" + GNB_Gtype).style.display = "";
    }
}
function outGroupLayer(Num) {
    $("gnbTab" + Num).className = "tab" + Num;
    $("gLayer" + Num).style.display = "none";
}

function hideGNBLayer() {
    $('layerAllCate').style.display = "none";
}
function openGNBLayer() {
    $('layerAllCate').style.display = "block";
}
function shBannerChange() {
    var tnum;
    tnum = Math.floor(Math.random() * shBanners.length);
    document.menusearchform.action = shBanners[tnum][0];
    document.menusearchform.keyword.value = shBanners[tnum][2];
    $("keyword").className = "sbox ad";
    eval(shBanners[tnum][3]);
}
function shBannerChangeVertical() {
	 var iTextNum = Math.floor(Math.random() * MenuTopTextBanners.length);
	 var iImageNum = Math.floor(Math.random() * MenuTopImageBanners.length);

    document.menusearchform.action =  MenuTopTextBanners[iTextNum][0];
    document.menusearchform.keyword.value =  MenuTopTextBanners[iTextNum][1];
	$("CommonTopURL").href = MenuTopImageBanners[iImageNum][0];
	$("CommonTopIMG").src =  MenuTopImageBanners[iImageNum][1];
}
function setLayerDisplay(layerId, attribute) {
    if (document.getElementById(layerId)) {
        document.getElementById(layerId).style.display = attribute;
    }
}
function toggleLayerDisplay(layerId, attribute) {
    if (document.getElementById(layerId)) {
        if (document.getElementById(layerId).style.display == attribute)
            document.getElementById(layerId).style.display = "none";
        else    
            document.getElementById(layerId).style.display = attribute;
    }
}
// Add Favorite Bookmark
function siteBookmark() {
    addBookmark('G¸¶ÄÏ - ³î¶ó¿òÀ» ¼îÇÎÇÏ´Ù, G¸¶ÄÏ', 'http://www.gmarket.co.kr/index.asp?jaehuid=200001254');
    return;
}
function addBookmark(title, url) {
    if (window.sidebar) // firefox 
        window.sidebar.addPanel(title, url, "");
    else if (document.all) // ie
        window.external.AddFavorite(url, title);
    else
        alert("Press Ctrl - D to bookmark");
}
function addBookmark_eventmain() {
    addBookmark('G¸¶ÄÏ - ³î¶ó¿òÀ» ¼îÇÎÇÏ´Ù, G¸¶ÄÏ', 'http://www.gmarket.co.kr/index.asp?jaehuid=200001254');
    return;
}
function fncGmktAddressCopy(sAddress) {
    if (window.clipboardData) {
        window.clipboardData.setData('Text', sAddress);
    }
    alert('G¸¶ÄÏ ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù. ÁÖ¼ÒÃ¢¿¡ ºÙ¿©³Ö±âÇÏ¼¼¿ä!\n(ºÙ¿©³Ö±â°¡ ¾ÈµÉ°æ¿ì, ÁÖ¼ÒÃ¢¿¡ http://www.gmarket.co.kr À» ÀÔ·ÂÇÏ¼¼¿ä)');
    return;
}
// Add Desktop Icon
function OpenActiveDesktop(sGB) {
    window.open("http://www.gmarket.co.kr/challenge/neo_app/popupDesktop.asp?gb=" + sGB, "desktopwin", "width=395, height=185, left=100, top=100, scrollbars=no,status=no,toolbar=no");
    return;
}
function goGplusServicePop() {
    var w = 840;
    var h = 740;
    var gplus_main_pop = window.open('http://gmsg.gmarket.co.kr/imagination/hlp/gpost_guide/gpost_guide.asp', 'gplus_main', 'top=' + (screen.height - h) / 3 + ',left=' + (screen.width - w) / 2 + ',toolbar=no, history=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=' + w + ', height=' + h);
    gplus_main_pop.focus();
}
function goGalleryServicePop() {
    var url = "http://www.gmarket.co.kr/challenge/neo_gallery/shop_main.asp";
    window.open(url, "", "top=50,left=50,Width=1250, Height=830, scrollbars=no, resizable=no, notoolba");
}
function regEdealerPop() {
	window.open('http://www.gmarket.co.kr/challenge/neo_member/ep_reg_popup.htm?pos_shop_cd=EC&pos_class_cd=900000269&pos_class_kind=T','center_popup', 'width=460, height=644, left=50, top=50, resize=no, scrollbars=no');
}
function fnOpenMobileCenter()
{
  window.open("http://image.gmarket.co.kr/Admin/I_goodsdaq/mobile_customer_center/mobile_cs.html", "mobile_customer_center","width=641,height=500,scroll=no;");
}
function openHelpGmarket()
{
	window.open("http://www.gmarket.co.kr/challenge/neo_bbs/help_kind2.asp", "PopupKind", "width=544, height=307, notoolba");
}
function goToMessageBoxLayer(){
    var w = 575;
    var h = 435;
	var wParam = CommonTopGoodsdaqUrl + 'challenge/neo_my_gd/message/my_message_box.asp#' + document.domain;
    GmktPopLayerAdd(wParam,w,h);
}
function showMyCouponPopupLayer() {
    var w = 800;
    var h = 670;
	var wParam = CommonTopGoodsdaqUrl + 'challenge/coupon/my_coupon_list.asp#' + document.domain;
    GmktPopLayerAdd(wParam,w,h);
}
function showMyCouponPopupForTop() {
    var w = fixed_coupon_box_width;
    var h = fixed_coupon_box_height;
    var my_coupon_pop = window.open('http://www.gmarket.co.kr/challenge/neo_goods/my_coupon/my_coupon_renew.asp?goodscode=', 'showMyCoupon', 'top=' + (screen.height - h) / 3 + ',left=' + (screen.width - w) / 2 + ',toolbar=no, history=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=' + w + ', height=' + h);
    my_coupon_pop.focus();
}
function showMyContentsPopupForTop() {
    var w = fixed_coupon_box_width;
    var h = fixed_coupon_box_height;
    var my_coupon_pop = window.open('http://item.gmarket.co.kr/challenge/neo_goods/my_coupon/my_coupon_renew.asp?m_id=6', 'showMyCoupon', 'top=' + (screen.height - h) / 3 + ',left=' + (screen.width - w) / 2 + ',toolbar=no, history=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width=' + w + ', height=' + h);
    my_coupon_pop.focus();
}
function goToMessageBox(){
	var w = fixed_coupon_box_width;
	var h = fixed_coupon_box_height;
	var my_coupon_pop = window.open('http://www.gmarket.co.kr/challenge/neo_goods/my_coupon/my_coupon_renew.asp?m_id=2&goodscode=' , 'showMyCoupon', 'top='+(screen.height-h)/3+',left='+(screen.width-w)/2+',toolbar=no, history=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, width='+w+', height='+h);
	my_coupon_pop.focus();
}


