/* 

	----- SPATIKA.COM -----
	GLOBAL JavaScript Functions
	Developed by Thamil Selvan (June 15, 2004)
	WWW.ALPHYN.COM
	selvan@alphyn.com, ptselvan@yahoo.com

*/

function goTo(page) {
	location.href = page;
}

function doClear(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
}

function setText(theText) {
	if (theText.value == "") {
		theText.value = theText.defaultValue;
	}
}

function selectText(theBox)
{
	if(theBox&&theBox.value)theBox.select();
}

function popUp(URL, w, h) {
	win = window.open(URL, 'untitled', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=0,width=' + w +',height='+ h +',left=80,top = 80');
	win.focus();
}

function isEmailValid(address) {
	if (address != '' && address.search) {
      if (address.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) return true;
      else return false;
	}
   // dont allow empty strings
	else return false;
}
// for newsletter subscription
function validateEmail(addressInput) {
	var errMsg = "Your email address appears to be incorrect. \nPlease correct it and resubmit.";
	if (!isEmailValid(addressInput.value)) {
		alert (errMsg);
		addressInput.focus();
		return false;
	}
	return true;
}

