﻿/// <reference name="MicrosoftAjax.debug.js"/>
/// <reference path="jquery/jquery-1.4.2-vsdoc.js" />
/// <reference path="jquery/tinywatermark/jquery.tinywatermark-2.0.0.debug.js" />

$(function()
{
    // IE6 and before doesn't support :hover in CSS (except for anchors)
    // You must use this script to make hovers work in IE
    $('div#menu ul li').hover(function()
    {
        $(this).css({ backgroundColor: "#AFAFAF" });
        $(this).find('ul:first *').css({ visibility: "visible", display: "none" }).show();
    }, function()
    {
        $(this).css({ backgroundColor: "#CBCBCB" });
        $(this).find('ul:first *').css({ visibility: "hidden" });
    });
    
    $('div#menu ul ul ul li').hover(function()
    {
        $(this).css({ backgroundColor: "#AFAFAF" });
        $(this).find('ul:first *').css({ visibility: "visible", display: "none" }).show();
    }, function()
    {
        $(this).css({ backgroundColor: "#F5F5F5" });
        $(this).find('ul:first *').css({ visibility: "hidden" });
    });
    
    // Watermark
    $('input[placeholder]').each(function()
    {
        $(this).watermark('watermark', $(this).attr('placeholder'));
    });

    // Default button
    $('div[defaultbutton]').keypress(function(e)
    {
        if (e.keyCode === 13)
        {
            var defaultButtonId = $(this).attr('defaultbutton');
            var defaultButton = $(String.format("[id$='{0}']", defaultButtonId), this);

            if (defaultButton.length > 0)
            {
                e.preventDefault();
                defaultButton.get(0).click();
            }
        }
    });
});

//-- Notify script laoded to the script manager
if (typeof (Sys) !== "undefined") Sys.Application.notifyScriptLoaded();
