﻿function Load() {

    GlobalLoad();
    ResizeWindow();
    $(window).bind('resize', function() {ResizeWindow();});
    
    var Browser = $.browser;
    
    if (! (Browser.msie && Browser.version == "6.0") ) {
        $(".inputdrp")
                .parent()
                .addClass("inputdrpParent")
                .each(function() {
                    $(this).html("<span class='inputdrpText'>" + $(this).find("option[selected=true]").text() + "</span>" + $(this).html());
                });
        $(".inputdrp").change(function() {
            $(this).parent().find(".inputdrpText").html($(this).find("option[selected=true]").text());
        });
        
        $(".inputdrpmini")
                .parent()
                .addClass("inputdrpParentmini")
                .each(function() {
                    $(this).html("<span class='inputdrpTextmini'>" + $(this).find("option[selected=true]").text() + "</span>" + $(this).html());
                });
        $(".inputdrp").change(function() {
            $(this).parent().find(".inputdrpTextmini").html($(this).find("option[selected=true]").text());
        });
    }
    
    $(".submit .inputbutton").hover(function() { $(this).css("background-position", "0 bottom"); }, function() { $(this).css("background-position", "0 0"); })

    $(".inputtext").focus(function() { $(this).css("background-position", "left bottom"); }).blur(function() { $(this).css("background-position", ""); });
    $(".inputtextarea").focus(function() { $(this).css("background-position", "left bottom"); }).blur(function() { $(this).css("background-position", ""); });
    $(".inputdrp").focus(function() { $(this).parent().css("background-position", "left bottom"); }).blur(function() { $(this).parent().css("background-position", ""); });
    $(".inputdrpmini").focus(function() { $(this).parent().css("background-position", "left bottom"); }).blur(function() { $(this).parent().css("background-position", ""); });

    $(".Phone").mask("(999) 999-9999");
    $(".Date").mask("99/99/9999");
    $(".Year").mask("9999");
    $(".TC").mask("99999999999");
    
}

function ResizeWindow() {
    
    if ( $(window).height() > 790 ) {
        $(".mainleft").css("min-height", ($(window).height() - 287)).css("height", ($(window).height() - 287));
        $(".mainright").css("min-height", ($(window).height() - 287)).css("height", ($(window).height() - 287));
        $(".mainfull").css("min-height", ($(window).height() - 287)).css("height", ($(window).height() - 287));
    }
}
