


function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}
function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_findObj(n, d) { //v4.01
    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
    }
    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}
function MM_showHideLayers() { //v9.0
    var i, p, v, obj, args = MM_showHideLayers.arguments;
    for (i = 0; i < (args.length - 2); i += 3)
        with (document) if (getElementById && ((obj = getElementById(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 vv_showHideLayers() { //v9.0
    var i, p, v, obj, args = MM_showHideLayers.arguments;
    for (i = 0; i < (args.length - 2); i += 3)
        with (document) if (getElementById && ((obj = getElementById(args[i])) != null)) {
        v = args[i + 2];
        if (obj.style) { obj = obj.style; v = (v == 'block') ? 'style' : (v == 'hide') ? 'none' : v; }
        obj.visibility = v;
    }
}



/* header */
function loginChk() {
    if ($('id').value == "" && $('password').value == "") {
        MM_showHideLayers('login_error', '', 'hide');
        MM_showHideLayers('login_none', '', 'show');
    } else if ($('id').value == "1" && $('password').value == "1") {
        MM_showHideLayers('login_error', '', 'hide');
        MM_showHideLayers('login_none', '', 'hide');
        MM_showHideLayers('logged', '', 'show');
        MM_showHideLayers('name_ov', '', 'show');
    } else {
        MM_showHideLayers('login_none', '', 'hide');
        MM_showHideLayers('login_error', '', 'show');
    }
}


/* myaccount-index */
function log_form_change(c) {
    if (c == 1) {
        MM_showHideLayers('business_tax_id_layer', '', 'show');
        MM_showHideLayers('business_type_in_layer', '', 'hide');
        MM_showHideLayers('business_type_us_layer', '', 'show');
        MM_showHideLayers('state_in_layer', '', 'hide');
        MM_showHideLayers('state_us_layer', '', 'show');
        MM_showHideLayers('star_layer', '', 'show');
        MM_showHideLayers('country_in_layer', '', 'hide');
    } else if (c == 2) {
        MM_showHideLayers('business_tax_id_layer', '', 'hide');
        MM_showHideLayers('business_type_in_layer', '', 'show');
        MM_showHideLayers('business_type_us_layer', '', 'hide');
        MM_showHideLayers('state_in_layer', '', 'show');
        MM_showHideLayers('state_us_layer', '', 'hide');
        MM_showHideLayers('star_layer', '', 'hide');
        MM_showHideLayers('country_in_layer', '', 'show');
    } else {
        return;
    }
}



/* detail */
function show_write_rev() {
    MM_showHideLayers('prbc_text', '', 'hide');
    MM_showHideLayers('review_write', '', 'show');
}

function hide_write_rev() {
    MM_showHideLayers('prbc_text', '', 'show');
    MM_showHideLayers('review_write', '', 'hide');
}


/* detail S½`function */
function show_nologin() {
    MM_showHideLayers('nologin', '', 'show');
    MM_showHideLayers('goods_info_bar', '', 'hide');
}
function hide_nologin() {
    MM_showHideLayers('nologin', '', 'hide');
    MM_showHideLayers('goods_info_bar', '', 'show');
}



/* checkout1 - playment method*/
function payment_type_change(c) {
    if (c == 1) {
        MM_showHideLayers('credit_card', '', 'show');
        MM_showHideLayers('billing_address', '', 'show');
        MM_showHideLayers('paypal', '', 'hide');
        MM_showHideLayers('cod', '', 'hide');
        $('send_button_image1').innerHTML = "<img src='/images/myaccount/btn_continue.gif' alt='continue' />";
        $('send_button_image2').innerHTML = "<img src='/images/myaccount/btn_continue.gif' alt='continue' />";
        $('send_button_image3').innerHTML = "<img src='/images/myaccount/btn_continue.gif' alt='continue' />";
        $('ship_to_select').innerHTML = "<select name='ship_to' id='ship_to' class='payment_select05' style='width:150px;' onchange='javascript:change_billing_info(), ship_to_ch(this.value);' ><option value='1' selected>select address</option><option value='4'>Previous shipping Address</option><option value='3'>other address</option></select>"
        $('cod_price').value = "0";
        $('cod_charge1').innerHTML = "$0";
        $('cod_charge2').innerHTML = "$0";
        $('cod_charge3').innerHTML = "$0";
        mileage(document.frmPayment.use_mileage.checked);
        
    } else if (c == 2) {
        MM_showHideLayers('credit_card', '', 'hide');
        MM_showHideLayers('billing_address', '', 'hide');
        MM_showHideLayers('paypal', '', 'show');
        MM_showHideLayers('cod', '', 'hide');
        $('send_button_image1').innerHTML = "<img src='/images/order/btn_paypal.gif' alt='continue' />";
        $('send_button_image2').innerHTML = "<img src='/images/order/btn_paypal.gif' alt='continue' />";
        $('send_button_image3').innerHTML = "<img src='/images/order/btn_paypal.gif' alt='continue' />";
        $('ship_to_select').innerHTML = "<select name='ship_to' id='ship_to' class='payment_select05' style='width:150px;' onchange='javascript:change_billing_info(), ship_to_ch(this.value);' ><option value='1' selected>select address</option><option value='4'>Previous shipping Address</option><option value='3'>other address</option></select>"
        $('cod_price').value = "0";
        $('cod_charge1').innerHTML = "$0";
        $('cod_charge2').innerHTML = "$0";
        $('cod_charge3').innerHTML = "$0";
        mileage(document.frmPayment.use_mileage.checked);
    } else if (c == 3) {
        MM_showHideLayers('credit_card', '', 'hide');
        MM_showHideLayers('billing_address', '', 'hide');
        MM_showHideLayers('paypal', '', 'hide');
        MM_showHideLayers('cod', '', 'show');
        $('send_button_image1').innerHTML = "<img src='/images/myaccount/btn_continue.gif' alt='continue' />";
        $('send_button_image2').innerHTML = "<img src='/images/myaccount/btn_continue.gif' alt='continue' />";
        $('send_button_image3').innerHTML = "<img src='/images/myaccount/btn_continue.gif' alt='continue' />";
        $('ship_to_select').innerHTML = "<select name='ship_to' id='ship_to' class='payment_select05' style='width:150px;' onchange='javascript:change_billing_info(), ship_to_ch(this.value);' ><option value='1' selected>select address</option><option value='4'>Previous shipping Address</option><option value='3'>other address</option></select>"
        $('cod_price').value = "9";
        $('cod_charge1').innerHTML = "$9.00";
        $('cod_charge2').innerHTML = "$9.00";
        $('cod_charge3').innerHTML = "$9.00";
        mileage(document.frmPayment.use_mileage.checked);
    } else {
        return;
    }
}



/* checkout1 - cvn_number*/
function show_cvn_number() {
    MM_showHideLayers('cvn_number_layer', '', 'show');
}

function hide_cvn_number() {
    MM_showHideLayers('cvn_number_layer', '', 'hide');
}

/* Div Show/Hide */
function show_div(div_id) {
    MM_showHideLayers(div_id, '', 'show');
}
function hide_div(div_id) {
    MM_showHideLayers(div_id, '', 'hide');
}



/* checkout1 - ship to SELECT box */
function ship_to_ch(c) {
    var frm = document.frmPayment;
    for (var i = 0; i < frm.shipping_cost.length; i++) {
        frm.shipping_cost[i].checked = false;

    }

    $('ship_select').style.display = "none";
    $('shpping_price').value = "0"

    if (c == 0) {
        MM_showHideLayers('billing_continue', '', 'hide');
        MM_showHideLayers('other_address_radio', '', 'hide');
        MM_showHideLayers('info_form', '', 'hide');
        MM_showHideLayers('state_us_layer', '', 'hide');
        MM_showHideLayers('state_in_layer', '', 'hide');
        MM_showHideLayers('state_us_terri', '', 'hide');
        MM_showHideLayers('zip_code_us_layer', '', 'hide');
        MM_showHideLayers('country_layer', '', 'hide');
        MM_showHideLayers('zip_code_in_layer', '', 'hide');
        MM_showHideLayers('us_shipping', '', 'hide');
        MM_showHideLayers('in_shipping', '', 'hide');
        MM_showHideLayers('al_shipping', '', 'hide');
    } else if (c == 1) {
    
        MM_showHideLayers('billing_continue', '', 'hide');
        MM_showHideLayers('other_address_radio', '', 'hide');
        MM_showHideLayers('info_form', '', 'hide');
        MM_showHideLayers('state_us_layer', '', 'hide');
        MM_showHideLayers('state_in_layer', '', 'hide');
        MM_showHideLayers('state_us_terri', '', 'hide');
        MM_showHideLayers('zip_code_us_layer', '', 'hide');
        MM_showHideLayers('country_layer', '', 'hide');
        MM_showHideLayers('zip_code_in_layer', '', 'hide');
        MM_showHideLayers('us_shipping', '', 'hide');
        MM_showHideLayers('in_shipping', '', 'hide');
        MM_showHideLayers('al_shipping', '', 'hide');
        
    } else if (c == 2) {
        /*
        MM_showHideLayers('billing_continue', '', 'hide');
        MM_showHideLayers('other_address_radio', '', 'show');
        MM_showHideLayers('info_form', '', 'show');
        MM_showHideLayers('state_us_layer', '', 'show');
        MM_showHideLayers('state_in_layer', '', 'hide');
        MM_showHideLayers('zip_code_us_layer', '', 'show');
        MM_showHideLayers('country_layer', '', 'hide');
        MM_showHideLayers('zip_code_in_layer', '', 'hide');
        MM_showHideLayers('us_shipping', '', 'show');
        MM_showHideLayers('in_shipping', '', 'hide');
        MM_showHideLayers('al_shipping', '', 'hide');
        
        */

    MM_showHideLayers('other_address_radio', '', 'hidden');

    MM_showHideLayers('info_form', '', 'show');
    document.frmPayment.firstname2.value = document.frmPayment.firstname.value;
    document.frmPayment.lastname2.value = document.frmPayment.lastname.value;
    document.frmPayment.company2.value = document.frmPayment.company.value;
    document.frmPayment.address3.value = document.frmPayment.address1.value;
    document.frmPayment.address4.value = document.frmPayment.address2.value;
    document.frmPayment.city2.value = document.frmPayment.city.value;
    document.frmPayment.state3.value = document.frmPayment.state1.value;
    document.frmPayment.zip3.value = document.frmPayment.zip1.value;
    document.frmPayment.zip4.value = document.frmPayment.zip2.value;
    document.frmPayment.ziptext2.value = document.frmPayment.ziptext.value;
    document.frmPayment.phone_number2.value = document.frmPayment.phone_number.value;
    document.frmPayment.email_address2.value = document.frmPayment.email_address.value;

    document.frmPayment.firstname2.readOnly = true;
    document.frmPayment.lastname2.readOnly = true;
    document.frmPayment.company2.readOnly = true;
    document.frmPayment.address3.readOnly = true;
    document.frmPayment.address4.readOnly = true;
    document.frmPayment.city2.readOnly = true;
    document.frmPayment.country2.disabled = true;
    document.frmPayment.state2.disabled = true;
    document.frmPayment.state3.readOnly = true;
    document.frmPayment.zip3.readOnly = true;
    document.frmPayment.zip4.readOnly = true;
    document.frmPayment.ziptext2.readOnly = true;
    document.frmPayment.phone_number2.readOnly = true;
    document.frmPayment.email_address2.readOnly = true;
    

    document.frmPayment.firstname2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.lastname2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.company2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.address3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.address4.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.city2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.state3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.zip3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.zip4.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.ziptext2.style.cssText = "color:#999999;background-color:#E3E3E3;width:100px;";
    document.frmPayment.phone_number2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.email_address2.style.cssText = "color:#999999;background-color:#E3E3E3";

    //$('calculate_button').disabled = true;

    if (document.frmPayment.country.value != 'United States') {
        $('ship_select').style.display = "block";
     //   ship_calculate();
    }

}

else if (c == 4) {

    //Previous Shipping Address
    /*
    MM_showHideLayers('billing_continue', '', 'hide');
    MM_showHideLayers('other_address_radio', '', 'show');
    MM_showHideLayers('info_form', '', 'show');
    MM_showHideLayers('state_us_layer', '', 'show');
    MM_showHideLayers('state_in_layer', '', 'hide');
    MM_showHideLayers('zip_code_us_layer', '', 'show');
    MM_showHideLayers('country_layer', '', 'hide');
    MM_showHideLayers('zip_code_in_layer', '', 'hide');
    MM_showHideLayers('us_shipping', '', 'show');
    MM_showHideLayers('in_shipping', '', 'hide');
    MM_showHideLayers('al_shipping', '', 'hide');
        
    */

    MM_showHideLayers('other_address_radio', '', 'hidden');

    MM_showHideLayers('info_form', '', 'show');

    var url = '/order/Order_Billing_Info.asp';
    var myAjax = new Ajax.Request(
            url, { method: 'post', parameters: 'cmd=PS', onComplete: call_msg_billing2 }
            );
            
            
    

    document.frmPayment.firstname2.readOnly = true;
    document.frmPayment.lastname2.readOnly = true;
    document.frmPayment.company2.readOnly = true;
    document.frmPayment.address3.readOnly = true;
    document.frmPayment.address4.readOnly = true;
    document.frmPayment.city2.readOnly = true;
    document.frmPayment.country2.disabled = true;
    document.frmPayment.state2.disabled = true;
    document.frmPayment.state3.readOnly = true;
    document.frmPayment.zip3.readOnly = true;
    document.frmPayment.zip4.readOnly = true;
    document.frmPayment.ziptext2.readOnly = true;
    document.frmPayment.phone_number2.readOnly = true;
    document.frmPayment.email_address2.readOnly = true;


    document.frmPayment.firstname2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.lastname2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.company2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.address3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.address4.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.city2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.state3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.zip3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.zip4.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.ziptext2.style.cssText = "color:#999999;background-color:#E3E3E3;width:100px;";
    document.frmPayment.phone_number2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.email_address2.style.cssText = "color:#999999;background-color:#E3E3E3";
    
    //$('calculate_button').disabled = true;

    if (document.frmPayment.country.value != 'United States') {
        $('ship_select').style.display = "none";
        $('shpping_price').value = "0"
       // ship_calculate();
    }

}

else if (c == 5) { 
    //Registered Address
    /*
    
    MM_showHideLayers('billing_continue', '', 'hide');
    MM_showHideLayers('other_address_radio', '', 'show');
    MM_showHideLayers('info_form', '', 'show');
    MM_showHideLayers('state_us_layer', '', 'show');
    MM_showHideLayers('state_in_layer', '', 'hide');
    MM_showHideLayers('zip_code_us_layer', '', 'show');
    MM_showHideLayers('country_layer', '', 'hide');
    MM_showHideLayers('zip_code_in_layer', '', 'hide');
    MM_showHideLayers('us_shipping', '', 'show');
    MM_showHideLayers('in_shipping', '', 'hide');
    MM_showHideLayers('al_shipping', '', 'hide');
        
    */

    MM_showHideLayers('other_address_radio', '', 'hidden');

    MM_showHideLayers('info_form', '', 'show');
    MM_showHideLayers('info_form', '', 'show');

    var url = '/order/Order_Billing_Info.asp';
    var myAjax = new Ajax.Request(
            url, { method: 'post', parameters: 'cmd=RI', onComplete: call_msg_billing2 }
            );
            

    document.frmPayment.firstname2.readOnly = true;
    document.frmPayment.lastname2.readOnly = true;
    document.frmPayment.company2.readOnly = true;
    document.frmPayment.address3.readOnly = true;
    document.frmPayment.address4.readOnly = true;
    document.frmPayment.city2.readOnly = true;
    document.frmPayment.country2.disabled = true;
    document.frmPayment.state2.disabled = true;
    document.frmPayment.state3.readOnly = true;
    document.frmPayment.zip3.readOnly = true;
    document.frmPayment.zip4.readOnly = true;
    document.frmPayment.ziptext2.readOnly = true;
    document.frmPayment.phone_number2.readOnly = true;
    document.frmPayment.email_address2.readOnly = true;


    document.frmPayment.firstname2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.lastname2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.company2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.address3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.address4.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.city2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.state3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.zip3.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.zip4.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.ziptext2.style.cssText = "color:#999999;background-color:#E3E3E3;width:100px;";
    document.frmPayment.phone_number2.style.cssText = "color:#999999;background-color:#E3E3E3";
    document.frmPayment.email_address2.style.cssText = "color:#999999;background-color:#E3E3E3";

    $('calculate_button').disabled = true;


    if (document.frmPayment.country.value != 'United States') {
        $('ship_select').style.display = "block";
        //ship_calculate();
    }

} 

else if (c == 3) {

        /*
        MM_showHideLayers('billing_continue', '', 'hide');
        MM_showHideLayers('other_address_radio', '', 'show');
        MM_showHideLayers('info_form', '', 'show');
        MM_showHideLayers('state_us_layer', '', 'show');
        MM_showHideLayers('state_in_layer', '', 'hide');
        MM_showHideLayers('zip_code_us_layer', '', 'show');
        MM_showHideLayers('country_layer', '', 'hide');
        MM_showHideLayers('zip_code_in_layer', '', 'hide');
        MM_showHideLayers('us_shipping', '', 'show');
        MM_showHideLayers('in_shipping', '', 'hide');
        MM_showHideLayers('al_shipping', '', 'hide');
        */

MM_showHideLayers('other_address_radio', '', 'show');

MM_showHideLayers('info_form', '', 'show');
        document.frmPayment.firstname2.value = "";
        document.frmPayment.lastname2.value = "";
        document.frmPayment.company2.value = "";
        document.frmPayment.address3.value = "";
        document.frmPayment.address4.value = "";
        document.frmPayment.city2.value = "";
        document.frmPayment.state3.value = "";
        document.frmPayment.zip3.value = "";
        document.frmPayment.zip4.value = "";
        document.frmPayment.ziptext2.value = "";
        document.frmPayment.phone_number2.value = "";
        document.frmPayment.email_address2.value = "";


        document.frmPayment.firstname2.readOnly = false;
        document.frmPayment.lastname2.readOnly = false;
        document.frmPayment.company2.readOnly = false;
        document.frmPayment.address3.readOnly = false;
        document.frmPayment.address4.readOnly = false;
        document.frmPayment.city2.readOnly = false;
        document.frmPayment.state3.readOnly = false;
        document.frmPayment.zip3.readOnly = false;
        document.frmPayment.zip4.readOnly = false;
        document.frmPayment.ziptext2.readOnly = false;
        document.frmPayment.phone_number2.readOnly = false;
        document.frmPayment.email_address2.readOnly = false;
        document.frmPayment.country2.disabled = false;


        document.frmPayment.firstname2.style.cssText = "";
        document.frmPayment.lastname2.style.cssText = "";
        document.frmPayment.company2.style.cssText = "";
        document.frmPayment.address3.style.cssText = "";
        document.frmPayment.address4.style.cssText = "";
        document.frmPayment.city2.style.cssText = "";
        document.frmPayment.state3.style.cssText = "";
        document.frmPayment.zip3.style.cssText = "";
        document.frmPayment.zip4.style.cssText = "";
        document.frmPayment.ziptext2.style.cssText = "width:100px;";
        document.frmPayment.phone_number2.style.cssText = "";
        document.frmPayment.email_address2.style.cssText = "";

        document.frmPayment.country2.disabled = false;
        document.frmPayment.state2.disabled = false;
        $('calculate_button').disabled = false;
        

    }
    
     else {
        return;
    }
}

function call_msg_billing2(result) {

    var frm = document.frmPayment;
    var idx = frm.country.selectedIndex;
    var idx2 = frm.state.selectedIndex;

    var msg = result.responseText.split("||");
    var firstname = msg[11];
    var lastname = msg[12];
    var company = msg[5];
    var address = msg[1];
    var address2 = msg[2];
    var city = msg[3];
    var state = msg[4];
    var country = msg[0];
    var zip = msg[6];
    var zip1 = msg[7];
    var zip2 = msg[8];
    var phone = msg[9];
    var email = msg[10];

    if (country == "") {
        $('firstname2').value = firstname;
        $('lastname2').value = lastname;
        $('company2').value = company;
        $('address3').value = address;
        $('address4').value = address2;
        $('city2').value = city;
        $('ziptext2').value = zip;
        $('zip3').value = zip1;
        $('zip4').value = zip2;
        $('state3').value = state;
        $('phone_number2').value = phone;
        $('email_address2').value = email;
        frm.state2.value = state;
        fnSwitchStateShipping3();
    } else {
        $('firstname2').value = firstname;
        $('lastname2').value = lastname;
        $('company2').value = company;
        $('address3').value = address;
        $('address4').value = address2;
        $('city2').value = city;
        $('ziptext2').value = zip;
        $('zip3').value = zip1;
        $('zip4').value = zip2;
        $('state3').value = state;
        $('phone_number2').value = phone;
        $('email_address2').value = email;
        frm.state2.value = state;
        frm.country2.value = country;
        fnSwitchStateShipping3();

    }
    if (country != "United States") {
        $('ship_select').style.display = "block";
       // ship_calculate();
    }

}

/* checkout1 - other adress type */
function other_add_radio(c) {

    var frm = document.frmPayment;
    for (var i = 0; i < frm.shipping_cost.length; i++) {
        frm.shipping_cost[i].checked = false;

    }

    $('ship_select').style.display = "none";
    $('ship_select2').style.display = "none";
    $('shpping_price').value = "0";

    
    if (c == 1) {
        MM_showHideLayers('state_us_layer', '', 'show');
        MM_showHideLayers('state_in_layer', '', 'hide');
        MM_showHideLayers('state_us_terri', '', 'hide');
        MM_showHideLayers('zip_code_us_layer', '', 'show');
        MM_showHideLayers('country_layer', '', 'hide');
        MM_showHideLayers('zip_code_in_layer', '', 'hide');
        MM_showHideLayers('us_shipping', '', 'show');
        MM_showHideLayers('in_shipping', '', 'hide');
        MM_showHideLayers('al_shipping', '', 'hide');
        document.getElementById("zip3").style.display = "";
        document.getElementById("zip4").style.display = "";
        document.getElementById("zip_dash2").style.display = "";
        document.getElementById("ziptext2").style.display = "none";
        
    } else if (c == 2) {
        MM_showHideLayers('state_us_layer', '', 'hide');
        MM_showHideLayers('state_in_layer', '', 'show');
        MM_showHideLayers('state_us_terri', '', 'hide');
        MM_showHideLayers('zip_code_us_layer', '', 'hide');
        MM_showHideLayers('country_layer', '', 'show');
        MM_showHideLayers('zip_code_in_layer', '', 'show');
        MM_showHideLayers('us_shipping', '', 'hide');
        MM_showHideLayers('in_shipping', '', 'show');
        MM_showHideLayers('al_shipping', '', 'hide');
        document.getElementById("zip3").style.display = "none";
        document.getElementById("zip4").style.display = "none";
        document.getElementById("zip_dash2").style.display = "none";
        document.getElementById("ziptext2").style.display = "";

    } else if (c == 3) {
   
        MM_showHideLayers('state_us_layer', '', 'hide');
        MM_showHideLayers('state_in_layer', '', 'hide');
        MM_showHideLayers('state_us_terri', '', 'show');
        MM_showHideLayers('zip_code_us_layer', '', 'hide');
        MM_showHideLayers('country_layer', '', 'hide');
        MM_showHideLayers('zip_code_in_layer', '', 'show');
        MM_showHideLayers('us_shipping', '', 'hide');
        MM_showHideLayers('in_shipping', '', 'hide');
        MM_showHideLayers('al_shipping', '', 'show');
        document.getElementById("zip3").style.display = "none";
        document.getElementById("zip4").style.display = "none";
        document.getElementById("zip_dash2").style.display = "none";
        document.getElementById("ziptext2").style.display = "";
        document.frmPayment.country2.value = "United States"
    } else {
        return;
    }
    
}

/* checkout1 S½`function */
function member_type(c) {
    if (c == 1) {
        MM_showHideLayers('platinum_member', '', 'show');
        MM_showHideLayers('silver_member', '', 'hide');
    } else if (c == 2) {
        MM_showHideLayers('platinum_member', '', 'hide');
        MM_showHideLayers('silver_member', '', 'show');
    } else {
        return;
    }
}




function login_use() {
    alert('you must create an account or sign in before this service use!');
	 location.href = "/myaccount/login.asp";
}



////////////////////////////DOM append start//// 20090625 dom innerTEXT append
function append(parent,elem){
	var elems=checkElem(elem);

	for(var i=0;i<=elems.length-1;i++){
		parent.appendChild(elems[i]);
	}
}
function before(parent, before, elem)
{
	if(elem ==null){
		elem=before;
		before=parent;
		parent=before.parentNode;
	}
	var elems=checkElem(elem);

	for(var i =elems.length-1;i>0;i--){
		parent.insertBefore(elems[i],before);
	}
}


function checkElem(a){
	var r=[];
	if(a.constructor !=Array) a=[a];
	for( var i =0;i<a.length;i++){
		if(a[i].constructor==String)
		{
			var div=document.createElement("div");
			div.innerHTML=a[i];

			for(var j=0;j<div.childNodes.length;j++)
				r[r.length]=div.childNodes[j];
		}
		else if(a[i].length){
			for(var j=0;j<a[i].length;j++){	
				r[r.length]=a[i][j];
			}
		}
		else{
			r[r.length]=a[i];
		}
	return r;	
	}
}
///-------------DOM append end--------------------//////

//// dom empty start /// element delete all child node
function empty(elem){
	while(elem.firstChild){
		remove(elem.firstChild);
	}
}
function remove(elem)
{
	if(elem) elem.parentNode.removeChild(elem);
}
///--------------dom empty end------------------------////


/* my_account04 - show_content*/
function toggle_content(curr_con) {
    $(curr_con).style.display = $(curr_con).style.display == "block" ? "none" : "block";
    return;
}


/*-- »?±¤º¸ Ģ· --*/
function printIt(){

 var sw=screen.width;
 var sh=screen.height;
 var w=850;
 var h=600;
 var xpos=(sw-w)/2; 
 var ypos=(sh-h)/2; 
 
 var rptHeader="<html><head><meta http-equiv='Content-Type' content='text/html; charset=utf-8' /><title></title><link href='../css/style.css' rel='stylesheet' type='text/css' /><link rel='stylesheet' href='../css/gallery.css' type='text/css'></head><center><body>";
rptHeader = rptHeader + "<li><div name='upper' style='height:375px;'>";
rptContent=$("goods_detail").innerHTML+"</div></li><p><div name='under' style='height:150px;'>" + $("shopnkeyword").innerHTML;

 var rptTail="</div></body></center></html>";
 rptContent=rptHeader +  rptContent + rptTail;
//  rptContent=  rptContent;
 rptWin=window.open("","rpt","width=" + w +",height="+ h +",top=" + ypos + ",left="+ xpos +",status=yes,scrollbars=yes");
 rptWin.document.open();
 rptWin.document.write(rptContent);
 rptWin.document.close();
 rptWin.print();
 rptWin.close();
}

/* faq - show_content*/
function toggle_content1(curr_con, curr_img) {
    toggle_content(curr_con);
    if ($(curr_con).style.display == 'none') {
        $(curr_img).src = '/images/bullet/right_pink.gif';
    } else {
        $(curr_img).src = '/images/bullet/down_pink.gif';
    }
    return;
}

function request_restock(param1, param2) {
    	window.open('/product/request_pop.asp?productcode='+param1+"&productname="+param2, 'restock', 'width=350; height=320');
	}
	
	
	if (document.images) {
    // create "on" array and populate with Image objects
    var onImgArray = new Array( );
	
    onImgArray["newarrivals"] = new Image(81,23);
	onImgArray["newarrivals"].src = "/images/header/menu01_on.gif";
	
    onImgArray["restock"] = new Image(70,23);
	onImgArray["restock"].src = "/images/header/menu02_on.gif";
	
    onImgArray["category"] = new Image(74,23);
	onImgArray["category"].src = "/images/header/menu03_on.gif";
	
	onImgArray["style"] = new Image(50,23);
	onImgArray["style"].src = "/images/header/menu04_on.gif";
	
    onImgArray["color"] = new Image(55,23);	
	onImgArray["color"].src = "/images/header/menu05_on.gif";
	
	onImgArray["special"] = new Image(80,23);
	onImgArray["special"].src = "/images/header/menu06_on.gif";
	
	onImgArray["soldout"] = new Image(55,23);
	onImgArray["soldout"].src = "/images/header/menu07_on.gif";
	
	onImgArray["account"] = new Image(62,23);
	onImgArray["account"].src = "/images/header/menu_my_account_on.gif";
	
	onImgArray["blog"] = new Image(44,23);
	onImgArray["blog"].src = "/images/header/menu_my_blog_on.gif";
	
	onImgArray["rss"] = new Image(21,23);
	onImgArray["rss"].src = "/images/header/menu_rss_on.gif";
	
	onImgArray["shopbag"] = new Image(84,23);
	onImgArray["shopbag"].src = "/images/header/menu_shopping_bag_on.gif";
	
	onImgArray["join"] = new Image(39,12);
	onImgArray["join"].src = "/images/header/btn_join_on.gif";
	
	onImgArray["lostpass"] = new Image(93,12);
	onImgArray["lostpass"].src = "/images/header/btn_lost_password_on.gif";
	
  
    // create "off" array and populate with Image objects
    var offImgArray = new Array( );
	
    offImgArray["newarrivals"] = new Image(81,23);
	offImgArray["newarrivals"].src = "/images/header/menu01_off.gif";
	
    offImgArray["restock"] = new Image(70,23);
	offImgArray["restock"].src = "/images/header/menu02_off.gif";
	
    offImgArray["category"] = new Image(74,23);
	offImgArray["category"].src = "/images/header/menu03_off.gif";
	
	offImgArray["style"] = new Image(50,23);
	offImgArray["style"].src = "/images/header/menu04_off.gif";
	
    offImgArray["color"] = new Image(55,23);	
	offImgArray["color"].src = "/images/header/menu05_off.gif";
	
	offImgArray["special"] = new Image(80,23);
	offImgArray["special"].src = "/images/header/menu06_off.gif";
	
	offImgArray["soldout"] = new Image(55,23);
	offImgArray["soldout"].src = "/images/header/menu07_off.gif";
	
	offImgArray["account"] = new Image(62,23);
	offImgArray["account"].src = "/images/header/menu_my_account_off.gif";
	
	offImgArray["blog"] = new Image(44,23);
	offImgArray["blog"].src = "/images/header/menu_my_blog_off.gif";
	
	offImgArray["rss"] = new Image(21,23);
	offImgArray["rss"].src = "/images/header/menu_rss_off.gif";
	
	offImgArray["shopbag"] = new Image(84,23);
	offImgArray["shopbag"].src = "/images/header/menu_shopping_bag_off.gif";
	
	offImgArray["join"] = new Image(39,12);
	offImgArray["join"].src = "/images/header/btn_join_off.gif";
	
	offImgArray["lostpass"] = new Image(93,12);
	offImgArray["lostpass"].src = "/images/header/btn_lost_password_off.gif";
}


function imageOn(imgName) {
    if (document.images) {
        document.images[imgName].src = onImgArray[imgName].src;
    }
}
function imageOff(imgName) {
    if (document.images) {
        document.images[imgName].src = offImgArray[imgName].src;
    }
}

//-- index.asp -- search input & page go input clone --//
function page_copy(param1, param2)
{
		var text = $J("input.go_to_page");
		if(param1=='1')
		{
				text[1].value=param2;
		}
		else
		{
				text[0].value=param2;
		}
}

function search_copy(param1, param2)
{
		var text = $J("input.search");
		if(param1=="1")
		{
				text[2].value=param2;
		}
		else
		{
				text[1].value=param2;
		}
}

function fnMoneyType(v) {
       v = Math.round(parseFloat(v) * 100).toString();
        while (v.length < 3) v = "0" + v;
        return "$" + v.substring(0, v.length-2) + "." + v.substring(v.length-2, v.length);
} 
//-- index.asp -- search input & page go input clone --//