var arrPreload;
var agent;
var dm = "xeletrix&#46;com"
var ag = navigator.userAgent.toLowerCase();

if (ag.indexOf("opera") != -1)
	agent = "opera";
else if (ag.indexOf("gecko") != -1)
	agent = "gecko";
else
	agent = "msie";


var strDomain = self.location.hostname;
if (strDomain.indexOf(".") < strDomain.lastIndexOf("."))
{
	strDomain = strDomain.substr(strDomain.indexOf(".") + 1);
}

if (document.referrer.indexOf(strDomain) == -1 && document.cookie.indexOf("sess_refr=") == -1)
{
	var expirDate = new Date(); 
	expirDate.setTime(expirDate.getTime() + (365 * 24 * 60 * 60 * 1000)); // expires in 365 days
  
	var refDate = new Date();
	var referrer = "undefined";
	if (document.referrer != "")
	{
		referrer = document.referrer;
	}

	var strCommon = "; expires=" + expirDate.toGMTString() + "; path=/" + "; domain=" + strDomain;

	document.cookie = "sess_refr=" + escape(referrer) + strCommon;
	document.cookie = "sess_href=" + escape(window.location.href) + strCommon;
	document.cookie = "sess_date=" + escape(refDate.toGMTString()) + strCommon;
	document.cookie = "sess_agnt=" + escape(navigator.userAgent) + strCommon;
	document.cookie = "sess_lang=" + escape(navigator.userLanguage) + strCommon;
}


function PreloadImages()
{
	if (document.images == null)
		return;
	
	if (arrPreload == null) 
		arrPreload = new Array();

	var nArgCount = PreloadImages.arguments.length;
	for (var j = 0; j < nArgCount; j++) 
	{
		arrPreload[j] = new Image;
		arrPreload[j].src = PreloadImages.arguments[j];
	}
}

function LoadButtonImg(buttonName, buttonImage)
{
	var obj = document.images[buttonName];
	if (obj != null)
		obj.src = buttonImage;
}

function m(pd, pu)
{
	document.write(pu + "&#64;");
	document.write(pd);
}

function mt(pu)
{
	document.write("<a href=\"mail");
	document.write("to:");
	m(dm, pu);
	document.write("\">");
	m(dm, pu);
	document.write("<\/a>");
}


function AddHeight()
{
	if (document.images == null)
		return;
	
	var footer, menu_botm, tbl_body, tbl_menu;

	footer = document.getElementById("footer");
	if (footer == null)
		return;

	menu_botm = document.getElementById("mnbtm");
	if (menu_botm == null)
		return;

	tbl_body = document.getElementById("tbl_body");
	if (tbl_body == null)
		return;
	
	tbl_menu = document.getElementById("tbl_menu");
	if (tbl_menu == null)
		return;
	
	var menu_botm_height, footer_height;

	if (agent == "gecko")
		menu_botm_height = tbl_body.offsetHeight - tbl_menu.offsetHeight + 5;
	else
		menu_botm_height = tbl_body.clientHeight - tbl_menu.clientHeight + 5;	
	
	if (agent == "gecko")
		footer_height = document.body.offsetHeight - tbl_body.offsetHeight - 78;
	else
		footer_height = document.body.clientHeight - tbl_body.clientHeight - 78;	

	if (footer_height >= 50)
		footer.height = footer_height;
	else
		footer.height = 50;

	if (menu_botm_height >= 0)
		menu_botm.height = menu_botm_height;
	else
		menu_botm.height = 0;
}

function LoadMovie(page)
{
    window.open(page, null,'height=440,width=570,scrollbars=no,status=no,resizable=no,location=no,menubar=no,toolbar=no');
}

function LoadInstr(page)
{
    window.open(page, null,'height=350,width=600,scrollbars=no,status=no,resizable=no,location=no,menubar=no,toolbar=no');
}

function CheckNewsData(formName)
{
	if (document.forms[formName].email.value == "")
	{
		alert('Please enter your e-mail address.');
		document.forms[formName].email.focus();
		return (false);
	}
	
	return (true);
}
