﻿/*
    Removing problem with scrolling to the top of page after every validation, even after error
    found by javascript code.
*/
window.scrollTo = function() { }

/*
    Method removes functionality of 'enter' button - right now it has no effect :)
*/
function DefaultButtonSupport(e) {
    var event = e;
    var node = (event.target) ? event.target : ((event.srcElement) ? event.srcElement : null);

    if (!e)
        event = window.event;

    if (event.which || event.keyCode) {
        if (((event.which == 13) || (event.keyCode == 13)) && (node.type != "textarea")) {
            return false;
        }
    }
    else
        return true;
}

/*
    Method shows window without any bars and panels.
    Url - address of opened page.
*/
function PopUp(url) {
    window.open(url, "Window1", "menubar=no,width=760,height=650,toolbar=no");
    return false;
}

function ChangeImage(uniqueName) {
    $("#mainPart > img").attr("src", uniqueName);
    return false;
}

function UpdateAllCheckBoxs() {
    $(":parent.ni input[type='checkbox'],:parent.ni input[type='radio']").css
        ({ display: "inline", width: "14px", border: "1", height: "14px" });

    $(":parent.ni label").css({ display: "inline", width: "100px" });
}

function AttachWatermarkForLoginPanel(loginId, passwordId) {
    $(loginId).watermark('E-mail');
    $(passwordId).blur(function() {
        var value = $(this).val();

        if (value == '') {
            $(this).addClass('watermark-password-empty');
        } else {
            $(this).removeClass('watermark-password-empty');
        }
    });

    $(passwordId).focus(function() {
        $(this).removeClass('watermark-password-empty');
    });
}