﻿function stretch() {
    var height = $("#main_center").innerHeight();
    if (height > 460) {
        $(".stretch").css('height', height);
    }
}

function loader(url) {
    $("#imgLoading").show();
    $('#main_center').load(url, "",
        function(responseText, textStatus, XMLHttpRequest) {
            if (textStatus == 'error') {
                $('#main_center').html(responseText);
            }
            stretch();
            $("#imgLoading").hide();          
        }
    );    
}
function showProgress(hide) {
    var img = $("#imgLoading");
    if (hide)
        img.hide();
    else
        img.show();
}

jQuery.fn.delay = function (time, func) {
    this.each(function () {
        setTimeout(func, time);
    });
    return this;
};

$(document).ready(function () {
    stretch();
    $("#nav a").click(function (event) {
        event.preventDefault();
        loader($(this).attr('href'));
    });


    swapValues = [];
    $(".wm").each(function (i) {
        swapValues[i] = $(this).val();
        $(this).focus(function () {
            if ($(this).val() == swapValues[i]) {
                $(this).val("").removeClass("watermark")
            }
        }).blur(function () {
            if ($.trim($(this).val()) == "") { $(this).val(swapValues[i]).addClass("watermark") }
        })
    })

});

