// JavaScript Document

function validateForm(contactfrm) {

// validate mandatory fields for blank entries

// Get required fields from hidden form field in contact form then convert to array for validation

var reqfields = contactfrm.required.value;
var reqarray = reqfields.split(','); 


var i = 0;
var fieldvalue = "";

for(i=0;i<=reqarray.length;i++) {

	fieldvalue = document.getElementById(reqarray[i]).value; // get field value
	
	if (fieldvalue == "") {
	
		alert("Please ensure all mandatory fields marked with an asterisk(*) are complete and then send again!"); 
		return false; 
		}

}

}


// script for hidden form field  
function showOther() {

	var selectedItem  		= document.contactfrm.leadsource.selectedIndex;
	var selectedItemValue   = document.contactfrm.leadsource.options[selectedItem].value;

	if (selectedItemValue == "Other") {

		//document.getElementById("othersource").style.visibility = "visible";
		//document.getElementById("hiddenspan").style.visibility = "visible";	
		document.getElementById("othersource").style.display = "block";	
		document.getElementById("hiddenspan").style.display = "block";	
		}
		
	else {

		//document.getElementById("othersource").style.visibility = "hidden";
		//document.getElementById("hiddenspan").style.visibility = "hidden";	
		document.getElementById("hiddenspan").style.display = "none";		
		document.getElementById("othersource").style.display = "none";
		 }	
	
	}