<!--



// dateFld Functions

function SetDay(fldname, seldate, selshow) {
	HidePLayer('layer_'+fldname, true);
	whichDog = parent.document.getElementById(fldname);
	whichDog.value = seldate;
	whichDog = parent.document.getElementById('show_'+fldname);
	whichDog.value = selshow;
}

function findPosX(obj) {
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x) curleft += obj.x;
	return curleft;
}

function findPosY(obj) {
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y) curtop += obj.y;
	return curtop;
}

function HidePLayer(divname) {
	whichDog = parent.document.getElementById(divname);
	whichDog.style.display = "none";
}

function ChangeStyle(el, newclass) {
	el.className = newclass;
}

function SetFrSrc(fld) {
	whichDog = document.getElementById(fld);
	fr = document.getElementById('if_'+fld);
	fr.src = 'epay/src/plxforms.php?s=calendar&fld='+fld+'&sel='+whichDog.value;
}





// numField Functions

var stubfld, stublimit, stoptimer, chcounter, stupstep;

function CheckNumLimit(fld, from, to) {
	whichDog = document.getElementById(fld);
	val = whichDog.value;
	if ((to!=0) && (val>to)) whichDog.value = to;
	if (val<from) whichDog.value = from;
}

function numeralsOnly(evt) {
	evt = (evt) ? evt : event;
	var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ?
	evt.keyCode : ((evt.which) ? evt.which : 0));
	if (charCode > 31 && (charCode < 48 || charCode > 57)) return false;
	return true;
}

function NumUp() {
	whichDog = document.getElementById(stubfld);
	val = parseInt(whichDog.value)+stupstep;
	if ((stublimit!=0) && (val>stublimit)) return;
	 whichDog.value = val;
}

function FastNumUp() {
	if (!stoptimer) {
		NumUp();
		chcounter++;
		tm = 1;
		if (chcounter < 1000) tm = 10;
		if (chcounter < 500) tm = 15;
		if (chcounter < 100) tm = 20;
		if (chcounter < 50) tm = 50;
		if (chcounter < 30) tm = 100;
		setTimeout('FastNumUp()', tm);
	}
}

function StartNumUp(fld, to, step) {
	stubfld = fld;
	stublimit = to;
	stupstep = step;
	stoptimer = false;
	chcounter = 1;
	NumUp();
	setTimeout('FastNumUp()', 1000);
}

function EndTimer() {
	stoptimer = true;
}

function NumDown() {
	whichDog = document.getElementById(stubfld);
	val = parseInt(whichDog.value)-stupstep;
	if (val<stublimit) return;
	 whichDog.value = val;
}

function FastNumDown() {
	if (!stoptimer) {
		NumDown();
		chcounter++;
		tm = 1;
		if (chcounter < 1000) tm = 10;
		if (chcounter < 500) tm = 15;
		if (chcounter < 100) tm = 20;
		if (chcounter < 50) tm = 50;
		if (chcounter < 30) tm = 100;
		setTimeout('FastNumDown()', tm);
	}
}

function StartNumDown(fld, from, step) {
	stubfld = fld;
	stublimit = from;
	stupstep = step;
	stoptimer = false;
	chcounter = 1;
	NumDown();
	setTimeout('FastNumDown()', 1000);
}





// Misc Functions

function ShowFloatLayer(divname) {
	document.getElementById(divname).style.visibility = "visible";
}
function HideFloatLayer(divname) {
	document.getElementById(divname).style.visibility = "hidden";
}
function ShowHideLayer(divname) {
	whichDog = document.getElementById(divname);
	if (whichDog.style.display == "none") whichDog.style.display = "block";
	else  whichDog.style.display = "none";
}


function ShowLayer(divname) {
	document.getElementById(divname).style.display = "block";
}
function HideLayer(divname) {
	document.getElementById(divname).style.display = "none";
}
function ShowHideFloatLayer(divname) {
	whichDog = document.getElementById(divname);
	if (whichDog.style.visibility == "hidden") whichDog.style.visibility = "visible";
	else  whichDog.style.visibility = "hidden";
}


// Form Validation Functions

function checkPassword (strng, lenfrom, lento) {
	var error = "";
	if (strng == "") error = "You didn't enter a password.";
    var illegalChars = /[\W_]/; // allow only letters and numbers
    if ((strng.length < lenfrom) || (strng.length > lento)) error = "The password is the wrong length.";
    else if (illegalChars.test(strng)) error = "The password contains illegal characters.";
	//else if (!((strng.search(/(a-z)+/)) && (strng.search(/(A-Z)+/)) && (strng.search(/(0-9)+/))))  error = "The password must contain at least one uppercase letter, one lowercase letter, and one numeral.";
	return error;
}

function checkUsername(strng, lenfrom, lento) {
	var error = "";
	if (strng == "") error = "You didn't enter a username.";
	else {
		var illegalChars = /[\W_]/;
		if ((strng.length < lenfrom) || (strng.length > lento)) error = "The username is the wrong length.";
		else if (illegalChars.test(strng)) error = "The username contains illegal characters.";
		//else if (!((strng.search(/(a-z)+/)) && (strng.search(/(A-Z)+/)) && (strng.search(/(0-9)+/))))  error = "The password must contain at least one uppercase letter, one lowercase letter, and one numeral.";
	}
	return error;
}

function checkEmail(strng) {
	var error = "";
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(strng))) error = "Please enter a valid email address.";
	else {
		var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/
		if (strng.match(illegalChars))  error = "The email address contains illegal characters.";
	}
	return error;
}


function checkPhone(strng, maxlength) {
	var error = "";
	var stripped = strng.replace(/[\(\)\.\-\ ]/g, '');
	if (isNaN(parseInt(stripped))) error = "The phone number contains illegal characters.";
	else if (!(stripped.length > maxlength)) error = "The phone number is the wrong length.";
	return error;
}


function checkDropdown(choice) {
    var error = "";
    if (choice == 0) error = "You didn't choose an option from the drop-down list.";
	return error;
} 


function isEmpty(strng) {
	// use with [combo].selectedIndex
	var error = "";
	if (strng.length == 0) error = "The mandatory text area has not been filled in."
	return error;	  
}

-->