$(function() {

    $(".expandable").hide();

    $(".expandable_link").click(function() {

        var strGenericID = this.id.substring(1, this.id.length);

        if ($("#div" + strGenericID).is(":visible")) {
            //this panel is open
            $("#div" + strGenericID).slideToggle("slow", function() { end_scroll_up("#a" + strGenericID) });
        } else {
            //this panel is closed
            $("#a" + strGenericID).css("background-position", "0px -30px");
            $("#div" + strGenericID).slideToggle("slow");

        }
        return false;
    });

    function end_scroll_up(element) {
        $(element).css("background-position", "0px 0px");
    }

    $("#aQuoteRequest").click(function() {
        $("#divQuoteRequest").slideToggle("slow");
        return false;
    });
    $("#aQuoteCancel").click(function() {
        $("#divQuoteRequest").slideToggle("slow");
        return false;
    });

    $("#ctl00_ContentPlaceHolder1_btnQuoteRequest").click(function() {
        var returnVal = true;
        if ($("#ctl00_ContentPlaceHolder1_txtQuoteName").val() == "") {
            $("#ctl00_ContentPlaceHolder1_txtQuoteName").css("border", "1px solid red");
            returnVal = false;
        }
        if ($("#ctl00_ContentPlaceHolder1_txtQuoteEmail").val() == "") {
            $("#ctl00_ContentPlaceHolder1_txtQuoteEmail").css("border", "1px solid red");
            returnVal = false;
        }
        return returnVal;
    });

    //set up rollovers for side images (right)
    $("#aLiveExEwec").mouseover(function() {
        $("#aLiveExEwec").css("background-position", "-220px 0px");
    });
    $("#aLiveExEwec").mouseout(function() {
        $("#aLiveExEwec").css("background-position", "0px 0px");
    });

    $("#aLiveExIpex").mouseover(function() {
        $("#aLiveExIpex").css("background-position", "-220px 0px");
    });
    $("#aLiveExIpex").mouseout(function() {
        $("#aLiveExIpex").css("background-position", "0px 0px");
    });

    //set up rollover for quote request:
    $("#aQuoteRequest").mouseover(function() {
        $("#aQuoteRequest").css("background-position", "0px 0px");
    });
    $("#aQuoteRequest").mouseout(function() {
        $("#aQuoteRequest").css("background-position", "0px -140px");
    });

    //set up rollover for Download Sponsorship
    $("#aDownloadSponsorship").mouseover(function() {
        $("#aDownloadSponsorship").css("background-position", "0px 0px");
    });
    $("#aDownloadSponsorship").mouseout(function() {
        $("#aDownloadSponsorship").css("background-position", "0px -140px");
    });

});
