//Username and Password default text
$(document).ready(function () {
    var username = $('#txtUsername');
    var password = $('#txtPassword');
    var search_service = $('#search_service');
    ChangeDefaultText();

    //Change mouseover/out Username text textbox
    username.focus(function () {
        if (username.val() == this.title) {
            username.val("");
        }
    });
    username.blur(function () {
        if (username.val() == "") {
            username.val(this.title);
        }
    });
    username.blur();

    //Change mouseover/out Password text textbox
    password.focus(function () {
        if (password.val() == this.title) {
            password.val("");
        }
    });
    password.blur(function () {
        if (password.val() == "") {
            password.val(this.title);
        }
    });
    password.blur();

    //Change mouseover/out Find Service text textbox
    search_service.focus(function () {
        if (search_service.val() == this.title) {
            search_service.val("");
        }
    });
    search_service.blur(function () {
        if (search_service.val() == "") {
            search_service.val(this.title);
        }
    });
    search_service.blur();

    //Change tabs on click
    $(".tabs li").click(function () {
        //deactivte tabs first
        DeactivateTabs();

        //remove and add class for the li
        $(this).removeClass("tab_noactive");
        $(this).addClass("tab_active");
    });

    function DeactivateTabs() {
        //remove and add class for the li
        $(".tabs li").removeClass("tab_active");
        $(".tabs li").addClass("tab_noactive");
    }

    function ChangeDefaultText() {
        $(".tabs > li").click(function () {
            var whichelement = $(this).attr("id");
            //alert(whichelement);
            var textVal = "";
            switch (whichelement) {
                case "tab_home": textVal = "What type of household service do you require?"; break;
                case "tab_auto": textVal = "What type of auto service do you require?"; break;
                case "tab_life": textVal = "What type of life service do you require?"; break;
                case "tab_health": textVal = "What type of health service do you require?"; break;
                case "tab_business": textVal = "What type of business service do you require?"; break;
                default: textVal = "What type of household service do you require?"; break;
            }

            $("#selectedCategory").val(whichelement); //setting current selected value for transfering to other page

            //alert(textVal);
            $("#search_service").val(textVal);
            $("#search_service").attr("title", textVal);
        });
    }
});
