﻿$(document).ready(function() {
    $("#howtohear").change(function() {
        if ($("#howtohear").val() == "Other") {
            $("#howtohearotherdiv").show();
        }
        else {
            $("#howtohearotherdiv").hide();
        }
    })
    $("#downloadabrochure").click(function() {
        var container = $("#divDownloadBrochure");
        if ($(this).is(':checked')) {
            container.slideDown(500, null);
        }
        else {
            container.slideUp(500, null);
        }
    })
    var getlink = function(str1, spliter) {
        var sindex = str1.indexOf(spliter);
        if (sindex <= -1) return "#";
        return str1.substring(sindex + 1, str1.length)
    }
    $("#enquirycarehome").change(function() {
        $("#brochureLink").attr("href", getlink($(this).val(), "*"));
    })
    $("#enquirycarehome").change(); //init
});
