﻿/// <reference path="../gallery/scripts/jquery-1.3.2-vsdoc2.js />
$(document).ready(function() {
    initPage(true);
});

function initPage(init) {
    $(".o_headstyle").hide();
    $(".o_headmaterial").hide();
    $(".o_headfinish").hide();
    $(".o_neckstyle").hide();
    $(".d_headstyle select").change(function() {
        if (this.value == "Other") {
            $(".o_headstyle").show();
        }
        else {
            $(".o_headstyle").hide();
        }
    });
    $(".d_headmaterial select").change(function() {
        if (this.value == "Other") {
            $(".o_headmaterial").show();
        }
        else {
            $(".o_headmaterial").hide();
        }
    });
    $(".d_headfinish select").change(function() {
        if (this.value == "Other") {
            $(".o_headfinish").show();
        }
        else {
            $(".o_headfinish").hide();
        }
    });
    $(".d_neckstyle select").change(function() {
        if (this.value == "Other") {
            $(".o_neckstyle").show();
        }
        else {
            $(".o_neckstyle").hide();
        }
    });
    $(".tt").hide();
    if (init) {
        $(".cc_name input").focus(function() { $(".tt_name").show(); });
        $(".cc_name input").blur(function() { $(".tt_name").hide(); });

        $(".cc_address input").focus(function() { $(".tt_address").show(); });
        $(".cc_address input").blur(function() { $(".tt_address").hide(); });

        $(".cc_address2 input").focus(function() { $(".tt_address2").show(); });
        $(".cc_address2 input").blur(function() { $(".tt_address2").hide(); });

        $(".cc_csz input").focus(function() { $(".tt_csz").show(); });
        $(".cc_csz input").blur(function() { $(".tt_csz").hide(); });
        $(".cc_csz select").focus(function() { $(".tt_csz").show(); });
        $(".cc_csz select").blur(function() { $(".tt_csz").hide(); });

        $(".cc_country select").focus(function() { $(".tt_country").show(); });
        $(".cc_country select").blur(function() { $(".tt_country").hide(); });

        $(".cc_phone input").focus(function() { $(".tt_phone").show(); });
        $(".cc_phone input").blur(function() { $(".tt_phone").hide(); });

        $(".cc_email input").focus(function() { $(".tt_email").show(); });
        $(".cc_email input").blur(function() { $(".tt_email").hide(); });

        $(".cc_headstyle input").focus(function() { $(".tt_headstyle").show(); });
        $(".cc_headstyle input").blur(function() { $(".tt_headstyle").hide(); });
        $(".cc_headstyle select").focus(function() { $(".tt_headstyle").show(); });
        $(".cc_headstyle select").blur(function() { $(".tt_headstyle").hide(); });

        $(".cc_headmaterial input").focus(function() { $(".tt_headmaterial").show(); });
        $(".cc_headmaterial input").blur(function() { $(".tt_headmaterial").hide(); });
        $(".cc_headmaterial select").focus(function() { $(".tt_headmaterial").show(); });
        $(".cc_headmaterial select").blur(function() { $(".tt_headmaterial").hide(); });

        $(".cc_headfinish input").focus(function() { $(".tt_headfinish").show(); });
        $(".cc_headfinish input").blur(function() { $(".tt_headfinish").hide(); });
        $(".cc_headfinish select").focus(function() { $(".tt_headfinish").show(); });
        $(".cc_headfinish select").blur(function() { $(".tt_headfinish").hide(); });

        $(".cc_neckstyle input").focus(function() { $(".tt_neckstyle").show(); });
        $(".cc_neckstyle input").blur(function() { $(".tt_neckstyle").hide(); });
        $(".cc_neckstyle select").focus(function() { $(".tt_neckstyle").show(); });
        $(".cc_neckstyle select").blur(function() { $(".tt_neckstyle").hide(); });

        $(".cc_length input").focus(function() { $(".tt_length").show(); });
        $(".cc_length input").blur(function() { $(".tt_length").hide(); });

        $(".cc_loft input").focus(function() { $(".tt_loft").show(); });
        $(".cc_loft input").blur(function() { $(".tt_loft").hide(); });

        $(".cc_lie input").focus(function() { $(".tt_lie").show(); });
        $(".cc_lie input").blur(function() { $(".tt_lie").hide(); });

        $(".cc_toehang input").focus(function() { $(".tt_toehang").show(); });
        $(".cc_toehang input").blur(function() { $(".tt_toehang").hide(); });

        $(".cc_alignment textarea").focus(function() { $(".tt_alignment").show(); });
        $(".cc_alignment textarea").blur(function() { $(".tt_alignment").hide(); });

        $(".cc_headweight input").focus(function() { $(".tt_headweight").show(); });
        $(".cc_headweight input").blur(function() { $(".tt_headweight").hide(); });

        $(".cc_grip input").focus(function() { $(".tt_grip").show(); });
        $(".cc_grip input").blur(function() { $(".tt_grip").hide(); });

        $(".cc_headcover input").focus(function() { $(".tt_headcover").show(); });
        $(".cc_headcover input").blur(function() { $(".tt_headcover").hide(); });

        $(".cc_cssole textarea").focus(function() { $(".tt_cssole").show(); });
        $(".cc_cssole textarea").blur(function() { $(".tt_cssole").hide(); });

        $(".cc_cstoe textarea").focus(function() { $(".tt_cstoe").show(); });
        $(".cc_cstoe textarea").blur(function() { $(".tt_cstoe").hide(); });

        $(".cc_csbumpers textarea").focus(function() { $(".tt_csbumpers").show(); });
        $(".cc_csbumpers textarea").blur(function() { $(".tt_csbumpers").hide(); });

        $(".cc_csface textarea").focus(function() { $(".tt_csface").show(); });
        $(".cc_csface textarea").blur(function() { $(".tt_csface").hide(); });

        $(".cc_cscavity textarea").focus(function() { $(".tt_cscavity").show(); });
        $(".cc_cscavity textarea").blur(function() { $(".tt_cscavity").hide(); });

        $(".cc_cspaintfill textarea").focus(function() { $(".tt_cspaintfill").show(); });
        $(".cc_cspaintfill textarea").blur(function() { $(".tt_cspaintfill").hide(); });

        $(".cc_other textarea").focus(function() { $(".tt_other").show(); });
        $(".cc_other textarea").blur(function() { $(".tt_other").hide(); });

        $(".cc_headstyle select").each(function() {
            if (this.value == "Other") {
                $(".o_headstyle").show();
            }
            else {
                $(".o_headstyle").hide();
            }
        });

        $(".cc_headmaterial select").each(function() {
            if (this.value == "Other") {
                $(".o_headmaterial").show();
            }
            else {
                $(".o_headmaterial").hide();
            }
        });

        $(".cc_headfinish select").each(function() {
            if (this.value == "Other") {
                $(".o_headfinish").show();
            }
            else {
                $(".o_headfinish").hide();
            }
        });

        $(".cc_neckstyle select").each(function() {
            if (this.value == "Other") {
                $(".o_neckstyle").show();
            }
            else {
                $(".o_neckstyle").hide();
            }
        });
    } 
    else {
        $(".cc_name input").blur(function() {
            $(".cc_name input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        $(".cc_address input").blur(function() {
            $(".cc_address input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        $(".cc_csz input").blur(function() {
            $(".cc_csz input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        $(".cc_phone input").blur(function() {
            $(".cc_phone input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        $(".cc_email input").blur(function() {
            $(".cc_email input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        
        $(".cc_headstyle input").blur(function() {
            $(".cc_headstyle input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        $(".cc_headstyle select").change(function() {
            if (this.value == "0") {
                $(this).parent().parent().parent().prev().children(".vv").show();
            }
            else {
                $(this).parent().parent().parent().prev().children(".vv").hide();
            }
        });
        $(".cc_headstyle select").each(function() {
            if (this.value == "Other") {
                $(".o_headstyle").show();
            }
            else {
                $(".o_headstyle").hide();
            }
        });

        $(".cc_headmaterial input").blur(function() {
            $(".cc_headmaterial input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        $(".cc_headmaterial select").change(function() {
            if (this.value == "0") {
                $(this).parent().parent().parent().prev().children(".vv").show();
            }
            else {
                $(this).parent().parent().parent().prev().children(".vv").hide();
            }
        });
        $(".cc_headmaterial select").each(function() {
            if (this.value == "Other") {
                $(".o_headmaterial").show();
            }
            else {
                $(".o_headmaterial").hide();
            }
        });

        $(".cc_headfinish input").blur(function() {
            $(".cc_headfinish input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        $(".cc_headfinish select").change(function() {
            if (this.value == "0") {
                $(this).parent().parent().parent().prev().children(".vv").show();
            }
            else {
                $(this).parent().parent().parent().prev().children(".vv").hide();
            }
        });
        $(".cc_headfinish select").each(function() {
            if (this.value == "Other") {
                $(".o_headfinish").show();
            }
            else {
                $(".o_headfinish").hide();
            }
        });

        $(".cc_neckstyle input").blur(function() {
            $(".cc_neckstyle input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
        $(".cc_neckstyle select").change(function() {
            if (this.value == "0") {
                $(this).parent().parent().parent().prev().children(".vv").show();
            }
            else {
                $(this).parent().parent().parent().prev().children(".vv").hide();
            }
        });
        $(".cc_neckstyle select").each(function() {
            if (this.value == "Other") {
                $(".o_neckstyle").show();
            }
            else {
                $(".o_neckstyle").hide();
            }
        });

        $(".cc_headweight input").blur(function() {
            $(".cc_headweight input").each(function() {
                if (this.value == "" || this.value == null) {
                    $(this).parent().parent().prev().children(".vv").show();
                }
                else {
                    $(this).parent().parent().prev().children(".vv").hide();
                }
            });
        });
    }
}
