<!--

var overImg = null;
var normImg = null;

var loadDone = false;

////////////////////////////////////////////////////////////////////////

/* function for body.onLoad */

function initPage() {
	preloadMenu(7);
	loadDone = true;
}

////////////////////////////////////////////////////////////////////////

/* functions for menu and other images */
function preloadMenu(count) {
	overImg = new preloadImages(count,'/data/images/menu/menu-','-on.gif')
	normImg = new preloadImages(count,'/data/images/menu/menu-','-off.gif')
}

function preloadImages(length, path, type) {
    for(var i = 1; i <= length; i++) {
	this[i]= new Image();
	this[i].src= path + i + type;
    }
    return this;
}

function rollOn(num) {
    if(loadDone && document.images) { 
	eval('document.images["m-'+num+'"].src='+'overImg[num].src')
    }
}

function rollOff(num) {
    if(loadDone && document.images){
	eval('document.images["m-'+num+'"].src='+'normImg[num].src')
    }
}

function sizeImg(obj, _width) {
    var tmpImg = new Image();
    tmpImg.src = obj.src;
    if (tmpImg.width > _width) { obj.width = _width; }
}

////////////////////////////////////////////////////////////////////////

/* function to open print\email window */

function PrinterFriendly(url) {
    var width = 700,
        height = 550;

    remote = window.open("http://" + getDomainName() + url, "opener", "scrollbars=1,resizable=1,toolbar=1,left=" + ((screen.availWidth  - width) / 2) + ",top=" + ((screen.availHeight  - height) / 2) + ",width=" + width + ",height=" + height);

    if (remote.opener == null) remote.opener = window;
}

function getDomainName() {
	var url = window.location.href;
	var end = url.indexOf("/", 7);
	if (end == -1) { end = url.length; }
	return url.substring(7, end);
}

/* function that show tip on your status bar when you take mouse over print\email link */
function showText(obj) {
    obj.onmouseout = function() { window.status = ""; }
    window.status = obj.innerText;
}

////////////////////////////////////////////////////////////////////////

/* functions that check different forms for correct information */

function checkRegForm(formobj) {
    with(formobj) {
	if (email.value.length == 0) { alert("Please, enter your email."); email.focus(); return false; }
	if (!checkEmail(email.value)) { alert("Please, enter valid email address."); email.focus(); return false; }
	if (cemail.value.length == 0) { alert("Please, confirm your email."); cemail.focus(); return false; }
	if (email.value != cemail.value) { alert("Email confirmation failed."); cemail.focus(); return false; }
    }

    return true;
}



function checkEmail(email) {
    var myRegExp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
    return myRegExp.test(email);
}
//-->
