﻿/// <reference path="jquery-1.4.1-vsdoc.js" />

$(function () {

    // setup handlers for text fields, init fields
    $(".jToggleInput")
        .each(function () {
            if ($(this).val() == $(this).attr("title"))
                $(this).addClass("Blur");
            else if ($(this).val() == "") {
                $(this).addClass("Blur");
                $(this).val($(this).attr("title"));
            }
            else
                $(this).removeClass("Blur");
        })
        .focus(function () {
            if ($(this).val() == $(this).attr("title")) {

                $(this).val("");
                $(this).removeClass("Blur");
            }
        })
        .blur(function () {
            if ($(this).val() == "") {
                $(this).val($(this).attr("title"));
                $(this).addClass("Blur");
            }
        });
    // setup dropdown handler too
    $(".jToggleSelect")
        .each(function () {
            if ($(this).val() == "")
                $(this).addClass("Blur");
            else
                $(this).removeClass("Blur");
        })
        .change(function () {
            if ($(this).val() == "")
                $(this).addClass("Blur");
            else
                $(this).removeClass("Blur");
        });

    // hack external links,
    // we cannot have target="_blank" in xhtml strict, so ensure all external links here open in a new window
    $('a[rel=external]').click(function () {
        window.open(this.href);
        return false;
    });

});