﻿$(document).ready(function()
{
    formatJobTable();
    formatSearchTextBox();
});

function search()
{
    var textbox = $("#s");
    var value = textbox.attr("value");
    textbox.attr("value", value == "Job Keywords" ? "" : value);

    textbox = $("#l");
    value = textbox.attr("value");
    textbox.attr("value", value == "Location" ? "" : value);
}

function formatSearchTextBox()
{
    $("#s").focus(function()
    {
        var textbox = $(this);
        var value = textbox.attr("value");

        textbox.attr("value", value == "Job Keywords" ? "" : value);
    });

    $("#s").blur(function()
    {
        var textbox = $(this);
        var value = textbox.attr("value");

        textbox.attr("value", value == "" ? "Job Keywords" : value);
    });

    $("#l").focus(function()
    {
        var textbox = $(this);
        var value = textbox.attr("value");

        textbox.attr("value", value == "Location" ? "" : value);
    });

    $("#l").blur(function()
    {
        var textbox = $(this);
        var value = textbox.attr("value");

        textbox.attr("value", value == "" ? "Location" : value);
    });

}

function formatJobTable()
{
    var table = $(".JobListTable");
    var index = 0;

    $("tr", table).each(function()
    {
        if (index < 1)
        {
            index++;
            return;
        }

        var row = $(this);

        $("a", row).click(function()
        {
            window.location = $(this).attr("href");
            return false;
        });

        row.mouseover(function()
        {
            row.addClass("ActiveRow");
        });

        row.mouseout(function()
        {
            row.removeClass("ActiveRow");
        });

        row.click(function()
        {
            window.location = $("a", row).attr("href");
        });

        index++;
    });
}