﻿

$(document).ready(function() {
    var imglist = $(".greyarrow[id$='_expander'], .openbutton[id$='_expander']");

    $(imglist).addClass("jqbutton");



    $(imglist).click(function() {
        //get menu id
        var menuid = $(this).attr("id").substring(0, $(this).attr("id").length - 9) + "_submenu_items";

        $("#" + menuid).slideToggle(200);

        //   window.alert($(this).attr("src").indexOf("minussign"));

        if ($(this).attr("src").indexOf("red_arrow") >= 0) {
            $(this).attr("src", "/images/icon_grey_arrow.png");
        }
        else if ($(this).attr("src").indexOf("grey_arrow") >= 0) {
            $(this).attr("src", "/images/icon_vertical_red_arrow.png");
        }
        else if ($(this).attr("src").indexOf("plussign") >= 0) {
            $(this).attr("src", "/images/global_icon_minussign.png");
        }
        else if ($(this).attr("src").indexOf("minussign") >= 0) {
            $(this).attr("src", "/images/global_icon_plussign.png");
        }

    });
});


$(document).ready(function() {
    $('.locator_form_button').mouseover(function() { setlocatorbg(true); });
    $('.locator_form_button').mousedown(function() { setlocatorbg(true); });
    $('.locator_form_button').mouseup(function() { setlocatorbg(false) });
    $('.locator_form_button').mouseout(function() { setlocatorbg(false) });

    $('#login_button').mouseover(function() { $(this).css({ backgroundPosition: "0px -26px" }) });
    $('#login_button').mouseout(function() { $(this).css({ backgroundPosition: "0px 0px" }) });

    $('.downloadbtn').mouseover(function() { $(this).css({ backgroundPosition: "0px -32px" }) });
    $('.downloadbtn').mouseout(function() { $(this).css({ backgroundPosition: "0px 0px" }) });

    $('.submitbtn').mouseover(function() { $(this).css({ backgroundPosition: "0px -27px" }) });
    $('.submitbtn').mouseout(function() { $(this).css({ backgroundPosition: "0px 0px" }) });


    $('#imbSearch').click(function() {
        document.location = 'http://www.jacksonhewitt.com/search.aspx?searchtext=' + escape($('#txtSearch').val());
        return false;
    });
    $('#imbLocate').click(function() {
        document.location = 'http://www.jacksonhewitt.com/officelocator.aspx?loc=' + escape($('#txtLocator').val());
        return false;
    });

       $("#txtLocator").keypress(function (e) {  
           if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {  
              $('#imbLocate').click();  
               return false;  
           } else {  
               return true;  
           }  
       });  
$("#txtSearch").keypress(function (e) {  
           if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {  
              $('#imbSearch').click();  
               return false;  
           } else {  
               return true;  
           }  
       });     

    
    
    
      

});

function setlocatorbg(rollover) {
    if (rollover) {
        $('#global_locatorarea_right').css({ backgroundPosition: "0px -44px" });
    } else {
        $('#global_locatorarea_right').css({ backgroundPosition: "0px 1px" });
    }
}


