

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,gnm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  if (args[3] != '') {
  for (i=0; i<(args.length-2); i+=3) { gnm=args[i+1]; test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='Missing information - '+gnm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='Missing information - '+gnm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num)
			  errors+='Missing Information - '+gnm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += 'Missing information - '+gnm+' is required.\n'; }
  } if (errors) alert('The following information is required for successful submission:\n'+errors);
  }
  document.MM_returnValue = (errors == '');
}

function expColpse(idNum) {

	var targUL = document.getElementById("collapse"+idNum);
	var targLink = document.getElementById("exAction"+idNum);
	if ( targUL.style.display == "block" ) {
		
		targUL.style.display = "none";
		targLink.innerHTML = "View";
	}
	else {
		targUL.style.display = "block";
		targLink.innerHTML = "Hide";
	}
}
function confirmSubmit()
{
var agree=confirm("Do you actually want to delete this?");
if (agree)
	return true ;
else
	return false ;
}
function confirmSend()
{
var accept1=confirm("Please confirm that you wish to submit this?");
if (accept1)
	return true ;
else
	return false ;
}
function showhide(id,trigID){
	if (document.getElementById){
		obj = document.getElementById(id);
		trigger = document.getElementById(trigID);
		if (obj.style.display == "none"){
			obj.style.display = "block";
			trigger.innerHTML = "[Hide User Fields]";
		} else {
			obj.style.display = "none";
			trigger.innerHTML = "[Show User Fields]";
		}
	}
}
function clearThis(fieldID) {
	if (fieldID.defaultValue == fieldID.value)
		fieldID.value = ""
	}
function addFieldOptions(iAmThis,b) {
		var displayTarg = document.getElementById(b);
		if (iAmThis == 'Maestro') {
			displayTarg.style.display = 'block';
		}
		else {
			displayTarg.style.display = 'none';
		}
	}
function updateForm(selId,optNo,siteName) {

	var selChoice = document.getElementById(selId);
	var selChoiceTarg = document.getElementById("contact_"+selId);
	var selSubject = document.getElementById('contactSubject');
	selChoiceTarg.value = selChoice.options[optNo].text;
	selSubject.value = selChoice.options[optNo].text+" - "+siteName+" Website";
}
function liCollapse(spanId) {
	var targSpan = document.getElementById(spanId);
	var targLi = document.getElementById("li_"+spanId);
	if ( targLi.style.display == "block" ) {
		targLi.style.display = "none";
		targSpan.innerHTML = "[READ]";
	}
	else {
		targLi.style.display = "block";
		targSpan.innerHTML = "[CLOSE]";
	}
}
function ddCollapse(ddspanId) {
	var targddSpan = document.getElementById(ddspanId);
	var targddLi = document.getElementById("dt_"+ddspanId);
	if ( targddLi.style.display == "block" ) {
		targddLi.style.display = "none";
		targddSpan.innerHTML = "[READ]";
	}
	else {
		targddLi.style.display = "block";
		targddSpan.innerHTML = "[CLOSE]";
	}
}
function checkConfirms(chkEmail,chkPassword) {
var emailCheck1 = document.getElementById(chkEmail).value;
var emailCheck2 = document.getElementById(chkEmail+"2").value;
var pWordCheck1 = document.getElementById(chkPassword).value;
var pWordCheck2 = document.getElementById(chkPassword+"2").value;
var checkerMe = true;
if (emailCheck1 != null) {
	if (emailCheck1 != emailCheck2) {
		alert("Email and Confirm Email fields do not match. Please retype");
		checkerMe = false;
		}
	}
if (pWordCheck1 != null) {
	if (pWordCheck1 != pWordCheck2) {
		alert("Password and Confirm Password fields do not match. Please retype");
		checkerMe = false;
		}
	}
if (checkerMe == true) {
	return true;
	} else {
	return false;
	}
}
function checkTerms(checkpls) {
	if (document.getElementById(checkpls).checked == true) { 
		return true; 
		} else { 
		alert('Please confirm that you have read and agree to the Terms and Conditions.'); 
		return false; 
	}
}
