﻿$(document).ready(function(){
    $("#stateOtherMailing").hide();
    $("#countryOtherMailing").hide();
    
    $("#stateOtherLit").hide();
    $("#countryOtherLit").hide()
    
    $("#tradeshowDetailsRedirect").hide();
    $("#companyTypeOtherRedirect").hide();
    
    $("#tradeshowDetails").hide();
    $("#companyTypeOther").hide()
    
    $("#radTradeshowRadYes").click(function(){
        $("#tradeshowDetails").show(); 
    });
    
    $("#radTradeshowRadNo").click(function(){
        $("#tradeshowDetails").hide();
    });
    
    $("#ddlCompanyType").change(function(){
        var companyType;
        companyType = $("#ddlCompanyType").val();
        if (companyType == "Other (Please Specify Below)") {
            $("#companyTypeOther").show();
        }
        else {
            $("#companyTypeOther").hide();
        }
    });
    
    $("#ddlStateMailing").change(function(){
        var stateMail;
        stateMail = $("#ddlStateMailing").val();
        if (stateMail == "Other (Please Specify Below)") {
            $("#stateOtherMailing").show();
        }
        else {
            $("#stateOtherMailing").hide();
        }
    });
    $("#ddlCountryMailing").change(function(){
        var countryMail;
        countryMail = $("#ddlCountryMailing").val();
        if (countryMail == "Other (Please Specify Below)") {
            $("#countryOtherMailing").show();
        }
        else {
            $("#countryOtherMailing").hide();
        }
    });
    $("#ddlStateLit").change(function(){
        var stateLit;
        stateLit = $("#ddlStateLit").val();
        if (stateLit == "Other (Please Specify Below)") {
            $("#stateOtherLit").show();
        }
        else {
            $("#stateOtherLit").hide();
        }
    });
    $("#ddlCountryLit").change(function(){
        var countryLit;
        countryLit = $("#ddlCountryLit").val();
        if (countryLit == "Other (Please Specify Below)") {
            $("#countryOtherLit").show();
        }
        else {
            $("#countryOtherLit").hide();
        }
    });

    $("#chkCompleteBinder").click(function(){
        $(".litCheckbox").each(function() {
            this.checked = $("#chkCompleteBinder").is(":checked");
            this.disabled = this.checked;
        });
        $(".litDDL").each(function() {
            this.disabled = $("#chkCompleteBinder").is(":checked");
        });
    });

    $("#ddlCompleteBinder").change(function(){
        $(".litDDL").val($(this).val());
    });
    
    $("#ddlStateRedirect").change(function(){
        if ($(this).val() == "Other (Please Specify Below)") {
            $("#stateOtherRedirect").show();
        }
        else {
            $("#stateOtherRedirect").hide();
        }
    });
    $("#ddlCountryRedirect").change(function(){
        if ($(this).val() == "Other (Please Specify Below)") {
            $("#countryOtherRedirect").show();
        }
        else {
            $("#countryOtherRedirect").hide();
        }
    });
    $("#ddlCompanyTypeRedirect").change(function(){
        if ($(this).val() == "Other (Please Specify Below)") {
            $("#companyTypeOtherRedirect").show();
        }
        else {
            $("#companyTypeOtherRedirect").hide();
        }
    });
    
    $("#radTradeshowRadYesRedirect").click(function(){
        $("#tradeshowDetailsRedirect").show(); 
    });
    
    $("#radTradeshowRadNoRedirect").click(function(){
        $("#tradeshowDetailsRedirect").hide();
    });
});