function rollOverTxt(butId)
{
	curClass   = document.getElementById(butId).className;
	
	var reOff = /1/;
	var reOn  = /2/;
	
	
	var result = reOff.test(curClass);
	
	if (result) {
		newClass = curClass.replace(reOff,'2');
	} else {
		newClass = curClass.replace(reOn,'1');
	}
	
	changeClass(butId,newClass);
}

function changeClass(itemId,newClass)
{
	document.getElementById(itemId).className = newClass;
}

function openAWindow(URL,winName,features)
{
	window.open(URL,winName,features);
}

function resizeWin()
{
	window.resizeTo(550,550);
}

function checkNPost(theForm, site, recipient, from)
{
	site = site.toLowerCase();
	
	if (checkAppPreForm(theForm)) {
		
		openAWindow("http://www.sitesuite.com.au/cgi-bin/standard_form.cgi?fromsite=" + site + "&recipient=" + recipient + "&sender=" + from ,"appwin","scrollbars=yes,width=780,height=500");
		
		return true;
	} else {
		return false;	
	}
}


function checkPreApp(theForm) 
{

	var why = "";

	why+= isEmpty(theForm.fullname.value, "NAME");
	if (why != "") {
		alert(why);
		theForm.fullname.focus();
       		return false;
	}
		
	why+= isEmpty(theForm.phone.value, "PHONE");
	if (why != "") {
		alert(why);
		theForm.phone.focus();
       		return false;
	}
	
	if (theForm.state.value == "")
	{
		why+= "Please select the state of your residence";
	}
	if (why != "") {
		alert(why);
		theForm.state.focus();
       		return false;
	}
		
	return true;
}

function checkWholeForm(theForm) 
{

	var why = "";
				
	why+= isEmpty(theForm.firstname.value, "FIRST NAME");
	
	if (why != "") {
		alert(why);
		theForm.firstname.focus();
		return false;
	}
				
	why+= isEmpty(theForm.lastname.value, "LAST NAME");
	if (why != "") {
		alert(why);
		theForm.lastname.focus();
		return false;
	}
				
	why+= isEmpty(theForm.phone.value, "PHONE");
	if (why != "") {
		alert(why);
		theForm.phone.focus();
		return false;
	}
				
	if (theForm.state.value == "")
	{
		why+= "Please select the state of your residence";
	}
	if (why != "") {
		alert(why);
		theForm.state.focus();
       		return false;
	}
				
	return true;
}

function checkAppPreForm(theForm) 
{
	var why = "";
				
	why+= isEmpty(theForm.applicant.value, "APPLICANT");
	
	if (why != "") {
		alert(why);
		theForm.applicant.focus();
		return false;
	}
	
	why+= isEmpty(theForm.phone.value, "PHONE NUMBER");
	if (why != "") {
		alert(why);
		theForm.phone.focus();
		return false;
	}
				
	why+= isEmpty(theForm.amount.value, "AMOUNT");
	if (why != "") {
		alert(why);
		theForm.amount.focus();
		return false;
	}
				
	why+= isEmpty(theForm.purpose.value, "PURPOSE");
	
	if (why != "") {
		alert(why);
		theForm.purpose.focus();
		return false;
	}
	
	return true;
}

function isEmpty(strng, fldName) 
{
	var error = "";
	
	if (strng.length == 0) {
		error = "The " + fldName + " field has not been filled in.\n"
	}
	return error;	  
}