// Clear/Replace Fields







function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

}



function toggle(id){

	ul = "ul_" + id;

	img = "img_" + id;

	ulElement = document.getElementById(ul);

	imgElement = document.getElementById(img);

	if (ulElement){

		if (ulElement.className == 'closed'){

			ulElement.className = "open";

			imgElement.src = "images/minus.gif";

		}else{

			ulElement.className = "closed";

			imgElement.src = "images/plus.gif";

		}

	}

}



x = '';



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,test,num,min,max,errors='',args=MM_validateForm.arguments;

  for (i=0; i<(args.length-2); i+=3) { 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+='- '+nm+' must contain an e-mail address.\n';

      } else if (test!='R') { num = parseFloat(val);

        if (isNaN(val)) errors+='- '+nm+' 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+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

  } if (errors) alert('The following error(s) occurred:\n'+errors);

  document.MM_returnValue = (errors == '');

}



function clearText(thefield) {

  if (thefield.defaultValue==thefield.value) { thefield.value = "" }

}



function replaceText(thefield) {

  if (thefield.value=="") { thefield.value = thefield.defaultValue }

}



//email this page

function toggleQc(id){

	formEl = document.getElementById(id);

	if (formEl){

		if (formEl.className == 'inactive'){

			formEl.className = "active";

		} else {

			formEl.className = "inactive";

		}

	}

}

function toggleEpage(id){

	formEl = document.getElementById(id);

	if (formEl){

		if (formEl.className == 'epageInactive'){

			formEl.className = "epageActive";

		} else {

			formEl.className = "epageInactive";

		}

	}

}

function toggleEpageLyr() {

		epageLyr = document.getElementById("epageForm");

		if (epageLyr) {

		if (epageLyr.style.visibility == 'hidden'){

			epageLyr.style.visibility = "visible";

		} else {

			epageLyr.style.visibility = "hidden";

		}

	}

}





function CheckRequiredFieldsEpage() {



		if (document.epageFormEl.epageRecipEmail.value=='') {

			alert('A valid email address for the recipient is required to use this form.');

			return false;

		}

		else if (document.epageFormEl.epageRecipEmail.value=='* Recipient’s Email') {

			alert('A valid email address for the recipient is required to use this form.');

			return false;

		}

		

		if (document.epageFormEl.epageName.value=='') {

			alert('Your name is required to use this form.');

			return false;

		}

		else if (document.epageFormEl.epageName.value=='* Your Name') {

			alert('Your name is required to use this form.');

			return false;

		}

		

		if (document.epageFormEl.epageEmail.value=='') {

			alert('A valid email address for you is required to use this form.');

			return false;

		}

		else if (document.epageFormEl.epageEmail.value=='* Your Email') {

			alert('A valid email address for you is required to use this form.');

			return false;

		}



		return true;

}

//



// email check

function emailCheck (emailStr) {var checkTLD=1;var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;var emailPat=/^(.+)@(.+)$/;var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";var validChars="\[^\\s" + specialChars + "\]";var quotedUser="(\"[^\"]*\")";var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;var atom=validChars + '+';var word="(" + atom + "|" + quotedUser + ")";var userPat=new RegExp("^" + word + "(\\." + word + ")*$");var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");var matchArray=emailStr.match(emailPat);if (matchArray==null) {alert("Email address seems incorrect (check @ and .'s)");return false;}var user=matchArray[1];var domain=matchArray[2];for (i=0; i<user.length; i++) {if (user.charCodeAt(i)>127) {alert("Ths username contains invalid characters.");return false;}}for (i=0; i<domain.length; i++) {if (domain.charCodeAt(i)>127) {alert("Ths domain name contains invalid characters.");return false;}}if (user.match(userPat)==null) {alert("The username doesn't seem to be valid.");return false;}var IPArray=domain.match(ipDomainPat);if (IPArray!=null) {for (var i=1;i<=4;i++) {if (IPArray[i]>255) {alert("Destination IP address is invalid!");return false;}}return true;}var atomPat=new RegExp("^" + atom + "$");var domArr=domain.split(".");var len=domArr.length;for (i=0;i<len;i++) {if (domArr[i].search(atomPat)==-1) {alert("The domain name does not seem to be valid.");return false;}}if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) {alert("The address must end in a well-known domain or two letter " + "country.");return false;}if (len<2) {alert("This address is missing a hostname!");return false;}return true;}








