/* Global Scripts */

/************************************************************/

/* Left Navigation Action */

function leftnavigationhover(callingSource) {

	var thisEvent=event.type;

	var targetTable=eval(callingSource);
	var targetArrow=eval(callingSource.name+"arrow");
	var targetAnchor=eval(callingSource.name+"anchor");

	if(thisEvent=="mouseover") {
		targetTable.className="leftnavigationhover";
		targetArrow.src="../imgs/left_navigation_arrow_on.jpg";
		targetAnchor.className="leftnavigationhover";
	}
	if(thisEvent=="mouseout") {
		targetTable.className="leftnavigation";
		targetArrow.src="../imgs/left_navigation_arrow_off.jpg";
		targetAnchor.className="leftnavigation";
	}
}

/************************************************************/

/* Verify Contact Form */

function evalContactForm(formName) {

	var theTargetForm=eval(formName);
	var theTargetInput=eval(formName+".CONTACTNAME");

	if(theTargetInput.value=="") {
		alert("Please tell us your name so that we can address you correctly."); return false;
	}

	var telEmailAddress=0;

	var theTargetInput=eval(formName+".CONTACTTELEPHONE"); if(theTargetInput.value !="") {telEmailAddress++;}
	var theTargetInput=eval(formName+".CONTACTEMAIL"); if(theTargetInput.value !="") {telEmailAddress++;}
	var theTargetInput=eval(formName+".CONTACTADDRESS"); if(theTargetInput.value !="") {telEmailAddress++;}

	if(telEmailAddress==0) {
		alert("Please provide us with at least one way to contact you."); return false;
	}

	var theTargetInput=eval(formName+".CONTACTCOMMENTS"); 

	if(theTargetInput.value=="") {
		alert("Please tell us the reason why you are contacting us."); return false;
	}

	theTargetForm.SUBMITMODE.value="SUBMIT";
	theTargetForm.submit();

	
}

/************************************************************/

/* Reset Contact Form */

function resetContactForm(formName) {

	if(window.confirm("Are you sure you wish to clear this form?")) {
	
		var theTargetInput=eval(formName+".CONTACTNAME"); theTargetInput.value='';
		var theTargetInput=eval(formName+".CONTACTTELEPHONE"); theTargetInput.value='';
		var theTargetInput=eval(formName+".CONTACTEMAIL"); theTargetInput.value='';
		var theTargetInput=eval(formName+".CONTACTADDRESS"); theTargetInput.value='';
		var theTargetInput=eval(formName+".CONTACTCOMMENTS"); theTargetInput.value='';	
	}
}	

/************************************************************/

/* Reset Proposal Form */

var personalProposalCells=new Array;

function resetProposalForm(theForm) {

	var targetForm=eval(theForm);
		
	if(window.confirm("Are you sure you want to clear this form?")) {
		for(var i=1; i<targetForm.elements.length; i++) {
				targetForm.elements[i].value="";
		}
	}
}

/************************************************************/

/* Validate Proposal Form */

function evalProposalForm(theForm) {
	var targetForm=eval(theForm);
	var numCellsCompleted=0;

	for(var i=1; i<targetForm.elements.length; i++) {
			if(targetForm.elements[i].value !="") {
						numCellsCompleted++;
			}
	}

	if(numCellsCompleted ==0) {
		alert("Please ensure you have completed all the relevant parts of this form before continuing.");
	} else {
		if(window.confirm("If you are happy to submit this form, please press OK otherwise press cancel.")) {
										targetForm.SUBMITMODE.value="SUBMIT";
										targetForm.submit();
		}
	}

}

/************************************************************/


