function imgRestore() {
	var i, x, a = document.MM_sr;
	for (i = 0; a && i < a.length && (x = a [i]) && x.oSrc; i++)
		x.src = x.oSrc;
}
function findObj(n, d) {
	var p,i,x;
	if (!d)
		d=document;
	if ((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all)
		x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById)
		x=d.getElementById(n);
	return x;
}
function imgSwap(){
	var i,j=0,x,a=imgSwap.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=findObj(a[i]))!=null) {
		document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];
	}
}
function makeRemote (localFile) {
	var remote = localFile.replace (/\\/g, '/');
	return "file://" + remote;
}
function doProduct ()
{
	if (document.forms["frmProduct"].external.checked) {
		document.getElementById("p_content").style.display = "none";
		document.getElementById("p_url").style.display = "";
	} else {
		document.getElementById("p_content").style.display = "";
		document.getElementById("p_url").style.display = "none";
	}
}
function doSendWhat ()
{
	if (document.forms["frmNewsletter"].sendwhat[0].checked) {
		document.getElementById("latest").style.display = "";
		document.getElementById("custom").style.display = "none";
		document.getElementById("custom_sub").style.display = "none";
		doArticle();
	} else if (document.forms["frmNewsletter"].sendwhat[1].checked) {
		document.getElementById("latest").style.display = "none";
		document.getElementById("choose").style.display = "none";
		document.getElementById("custom").style.display = "";
		document.getElementById("custom_sub").style.display = "";
	} else {
		document.getElementById("latest").style.display = "none";
		document.getElementById("choose").style.display = "none";
		document.getElementById("custom").style.display = "none";
		document.getElementById("custom_sub").style.display = "none";
	}
}
function doArticle ()
{
	if (document.forms["frmNewsletter"].use_latest.checked) {
		document.getElementById("choose").style.display = "none";
	} else {
		document.getElementById("choose").style.display = "";
	}
}
function openMailWin () {
	var win = window.open("", "WinMail", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=400,height=200");
	win.moveTo (Math.ceil ((window.screen.width / 2)) - 200, Math.ceil ((window.screen.height / 2)) - 75);
	return true;
}
function checkDLFields() {
  if (document.frmCPROP.email.value.length > 0) {
        return true;
  }
  else {
        alert("You must enter at least your email address, please enter it and try again.");
        return false;
  }
}
function confirmDelete(what) {
	if (confirm ("Are you sure you want to delete this " + what)) {
		return true;
	} else {
		return false;
	}
}
function blockShowHide (what) {
/*	var nextyear = new Date();
	nextyear.setFullYear (nextyear.getFullYear() + 1);
	var row = document.getElementById (what);
	if (row.style.display == "none") {
		row.style.display = "block";
		document.getElementById (what + "_img").src = "./img/sect_open.gif";
		document.cookie = what + "=" + "block; expires=" + nextyear.toGMTString();
	} else {
		row.style.display = "none";
		document.getElementById (what + "_img").src = "./img/sect_closed.gif";
		document.cookie = what + "=" + "none; expires=" + nextyear.toGMTString();
	}*/
}
function setBlocks () {
	/*var cooks = document.cookie;
	if (!setBlockDisplay (cooks, "liststat")) {
		blockShowHide ("liststat");
	}
	setBlockDisplay (cooks, "sitestat");
	setBlockDisplay (cooks, "mailstat");*/
}
function setBlockDisplay (cooks, what) {
	var pos = cooks.indexOf (what + "=");
	if (pos != -1) {
		var start = pos + (what + "=").length;
		var end = cooks.indexOf (";", start);
		
		if (end == -1)
			end = cooks.length;
		document.getElementById (what).style.display = cooks.substring (start, end);
		if (document.getElementById (what).style.display == "block") {
			document.getElementById (what + "_img").src = "./img/sect_open.gif";
		} else {
			document.getElementById (what + "_img").src = "./img/sect_closed.gif";
		}
		return true;
	} else {
		return false;
	}
}
function swapTR(oHide, oShow) {
	document.getElementById(oHide).style.display = "none";
	document.getElementById(oShow).style.display = "";
}
function doEventType(event_type) {
	if (event_type == "onCustomEvent") {
		document.getElementById("duration").style.display = "";
		document.getElementById("cus_type").style.display = "";
	} else {
		document.getElementById("duration").style.display = "none";
		document.getElementById("cus_type").style.display = "none";
	}
}
function isValidEmail(emailAddress) {
    var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((([0-1]?[0-9]{1,2}\.)|(2[0-4][0-9]\.)|(25[0-5]\.)){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
    if (!re.test(emailAddress)) {
    	return false;
    }
    return true;
}

function doProduct ()
{
	if (document.forms["frmCalculator"].external.checked) {
		document.getElementById("p_content").style.display = "none";
		document.getElementById("p_url").style.display = "";
	} else {
		document.getElementById("p_content").style.display = "";
		document.getElementById("p_url").style.display = "none";
	}
}



