﻿$(document).ready(function() {

    $("a.zoom").fancybox({
        'overlayOpacity': 0.7,
        'overlayColor': '#FFF'
    });

});


window.onload = function() {
    Init();
    try {
        $('a[rel*=external]').attr('target', '_blank');

    } catch (exception) {
    }


}

function DisallowEnter() {

    if (window.event.keyCode == 13) {
        if (event.srcElement.tagName != 'TEXTAREA') {
            event.returnValue = false;
            event.cancel = true;
            return false;
        }
    }
    return true;
}
function CheckEnter(buttonElementId) {
    if (event.which || event.keyCode) {
        if ((event.which == 13) || (event.keyCode == 13)) {
            var buttonElement = null;
            if (buttonElementId != null) {
                buttonElement = document.getElementById(buttonElementId);
            }
            if (buttonElement != null) {

                buttonElement.click();

            }
            if (event != null) {
                event.returnValue = false;
                event.cancel = true;
            }
            return false;
        }
    }
    else {
        return true
    };
}
function ShowPopup(content, width, height) {

    var scrOfX = 0, scrOfY = 0;
    if (typeof (window.pageYOffset) == 'number') {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
    } else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
    } else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
    }

    var x = document.getElementById('popup');
    var contentElement = document.getElementById('popup_content');
    var MainContentElement = document.getElementById('Content');


    contentElement.innerHTML = content;

    //get viewport's width and height
    vpWidth = screen.width;
    vpHeight = screen.height;

    //get dialog's width and height
    dialogWidth = width;
    dialogHeight = height;

    x.style.width = width;
    x.style.height = height;

    //calculate position
    dialogTop = (vpHeight / 2) - (dialogHeight / 2);
    dialogLeft = (vpWidth / 2) - (dialogWidth / 2);


    //Position the Dialog

    x.style.top = dialogTop + scrOfY - 100 + 'px';

    x.style.left = dialogLeft + 'px';
    x.style.display = 'block';


}

function ClosePopup() {
    var x = document.getElementById('popup');
    x.style.display = 'none';

}
function Init() {

    try {


        if (Load) {
            Load();
        }
    }
    catch (exception) {
    }
}
