﻿
var brandMenu = '1';
var isAni = false;
$(function() {

    $('#brandsort div').add('#brandMap div.tabarea').hide();
    $('#viewBrand').click(function() {

        $('#brandMap .tabarea ul.tab li').each(function(i) {
        $(this).attr('className', ((parseInt($(this).attr("id").substring(4), 10) == parseInt(brandMenu, 10)) ? 'tabon' : "tab") + ($(this).attr("id").substring(5)));
        });

        $('#brandMap').show();
        $('#brandsort').show();
        $('#brandsort div.brand0' + brandMenu).fadeIn();
        $('#brandMap div.tabarea').fadeIn();

        return false;
    });

     
    $('#brandsort div').each(function(i) {

        imagePreLoading("/Static/img/Main/bg_pop_cont0"+(i+1)+".png");
         

    });

});

function imagePreLoading(url) {
    
    imageObj = new Image();
    imageObj.src = url;
 
}

function showBrand(s) {

    if (isAni) return;

    var beforeMenu = brandMenu;
    brandMenu = s;
   
    if (beforeMenu == brandMenu) return;
    $('#brandMap .tabarea ul.tab li').each(function(i) {

    $(this).attr('className', ((parseInt($(this).attr("id").substring(4),10) == parseInt(brandMenu, 10)) ? 'tabon' : "tab") + ($(this).attr("id").substring(5)));
    });
     

    isAni = true;
    
    $('#brandsort div.brand0' + beforeMenu).css('zIndex', '9').fadeOut(500, function() { isAni = false; });
    $('#brandsort div.brand0' + brandMenu).css('zIndex', '8').show();

}
function brandMapClose() {
    $('#brandsort div').fadeOut();
    $('#brandMap div.tabarea').fadeOut();
    $('#brandMap').fadeOut();
}

$(function() {

    $("a[href*=/Popup/agreement.html]").click(function() {

        window.open(this.href, "popup_agreement", "width=580, height=496").focus();
        return false;
    });
    $("a[href*=/Popup/guideLegal.html]").click(function() {
        window.open(this.href, "popup_guidelegal", "width=580, height=496").focus();
        return false;
    });
    $("a[href*=/Popup/guidePrivacy.html]").click(function() {
        window.open(this.href, "popup_guideprivacy", "width=580, height=496").focus();
        return false;
    });

    $("a[href*=/Etc/advjeju.html]").click(function() {
        window.open(this.href, "etc", "width=499, height=401").focus();
        return false;
    });

    $("a[href*=/Etc/advenergyshot.html]").click(function() {
        window.open(this.href, "etc", "width=499, height=401").focus();
        return false;
    });

    $(".snslink").click(function() {

    window.open("http://www.twitter.com/CokeCaster");
    });

});



