﻿/// <reference path="../js/jquery-vsdoc.js" />
$(function() {
    var $YeallowBand = $(".YellowBand");
    var YellowBandHeight = $YeallowBand.height();
    var $WhiteCanvas = $(".white_canvas");
    var WhiteCanvasHeight = $WhiteCanvas.height();
    if (WhiteCanvasHeight != YellowBandHeight) {
        $YeallowBand.height(WhiteCanvasHeight);
    }
    //LeftMenu

    $("div[id$=LeftMenu] > table").each(function() {
        $(this).next("div").andSelf().wrapAll("<div class='LeftSubMenuPad'></div>");
    });
    $("div.LeftSubMenuPad").before("<div class='LeftSubMenuSep'></div>");
    $(".LeftSubMenuPad:has(.LeftSelected)").css(
    {
        "background-image": "url(files/design/selleft.gif)",
        "background-position": "right top",
        "background-repeat": "repeat-y"
    });

    $('.LeftMenu tr').find('>td:last>a').css(
        {
            "display": "block"//,"padding-right": "22px"
        });
    //Popup
    $("a[href*=popup.aspx]").live("click", function(Event) {
        Event.preventDefault();
        popUpW($(this).attr("href"));
        return false;
    })
    var oldVal = '';
    $('input.sbsEmail').focus(function() {
        if ($(this).val().indexOf('@') < 0) {
            oldVal = $(this).val();
            $(this).val('')
        }
    }).blur(function() {
    if ($(this).val().indexOf('@') < 0) {
        $(this).val(oldVal)
    } 
    });
});

var popUpW = function(Uri, w, h) {
    w = (w) ? w : 865;
    h = (h) ? h : 640;
    var l = $(window).width() / 2 - w / 2;
    var t = $(window).height() / 2 - h / 2 - 50;
    var opt = "left=" + l + ",top=" + t + ",height=" + h + ",width=" + w + ",status=yes,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no";
    window.open(Uri, "", opt);
    return false;
}
