﻿var agent = navigator.userAgent.toLowerCase();

if (agent.indexOf('iphone') != -1) {
    if (document.referrer.indexOf("m.lgcns.com") == -1) {
        location.href = "http://m.lgcns.com";
    }
}
else if (agent.indexOf('android') != -1) {
    if (document.referrer.indexOf("m.lgcns.com") == -1) {
        location.href = "http://m.lgcns.com";
    }
}
else {
    if (document.referrer == "") {
        var language = window.navigator.userLanguage || window.navigator.language;

        if (language.indexOf("ko") != -1) {
            location.href = "http://www.lgcns.co.kr";
        }
        if (language.indexOf("ja") != -1) {
            location.href = "http://www.lgcns.co.jp";
        }
    }
}

$(document).ready(function() {
    // GNB
    $(".gnb_area li div").hide();
    $(".gnb_area li").hover(function() {
        $(this).find("a.active").addClass("on");
        $(this).children("div").show();
    },
	       function() {
	           $(this).find("a.active").removeClass("on");
	           $(this).children("div").hide();
	       });

    /* 20101203 start */
    // Footer SelectBox
    $('.showSelect ul').hide();
    $(".showSelect").hover(function() {
        $(this).find("ul").show();
    },
		       function() {
		           $(this).find("ul").fadeOut("slow");
		       });
    /* 20101203 end */

//    $('#txtSearch').keypress(function(event) {
//        if (event.keyCode == 13) {
//            goSearch();
//        }
//    });
});
function setPng24(obj) {
    obj.width = obj.height = 1;
    obj.className = obj.className.replace(/\bpng24\b/i, '');
    obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + obj.src + "',sizingMethod='image');";
    obj.src = '';
    return '';
}

function goSearch() {
    var keyword = $('#txtSearch').val();

    if (keyword == "") {
        alert("Insert Keyword");
        return false;
    }
    
    var url = "/search";
    if (keyword != "")
        url += "/" + keyword;

    document.location = url;

    return false;
}

try {
    document.execCommand("BackgroundImageCache", false, true);
} catch (err) { }
