function toggleForm(tcObjId) {
	var loObj = document.getElementById(tcObjId) ;
	if (loObj.className.indexOf('show') == -1) {
		if (document.all) {HideOnTops();}
		loObj.className += 'show' ;

		var loI = loObj.getElementsByTagName("input");
		var lnX = 0 ;
		while ( lnX < loI.length && loI.item(lnX).getAttribute("type") != 'text' ) {lnX++} ;
		if (lnX < loI.length) { loI.item(lnX).focus(); }
		/*
		ADD_DHTML(tcObjId+SCALABLE);
		dd.elements[ loObj.id ].maximizeZ();
		*/
		}
	else {
		loObj.className = loObj.className.replace(/show/g,'') ;
		if (document.all) {ShowOnTops();}
		}
	return false;
	} /* toggleForm(tcObjId) */	
	
function vfRC(toFormObj) {
	if (toFormObj.RCFirstName.value.replace(/ /g,'')=='') {
		alert("Please enter your first name");
		toFormObj.RCFirstName.focus();
		return false;
		}
	if (toFormObj.RCLastName.value.replace(/ /g,'')=='') {
		alert("Please enter your last name");
		toFormObj.RCLastName.focus();
		return false;
		}
	/* RCTitle */
	/* RCCompany */	
	if (toFormObj.RCAddress.value.replace(/ /g,'')=='') {
		alert("Please enter your street address");
		toFormObj.RCAddress.focus();
		return false;
		}
	if (toFormObj.RCCity.value.replace(/ /g,'')=='') {
		alert("Please enter your city");
		toFormObj.RCCity.focus();
		return false;
		}
	if (toFormObj.RCState.value.replace(/ /g,'')=='') {
		alert("Please enter your state");
		toFormObj.RCState.focus();
		return false;
		}
	if (toFormObj.RCZip.value.replace(/ /g,'')=='') {
		alert("Please enter your zip code");
		toFormObj.RCZip.focus();
		return false;
		}

	var lcEmail = toFormObj.RCEmail.value;
	if (lcEmail != "") {
		if (lcEmail.indexOf("@") < 0 || 
				lcEmail.indexOf(".") < 0 ) {
			alert("Invalid Email");
			toFormObj.RCEmail.focus();
			return false;
			} /* if(@.) */
		} /* if("") */

	/* RCFax */

	} /* vfRC(toFormObj) */

function vfEAL(toFormObj) {
	if (toFormObj.EALFrom.value.replace(/ /g,'')=='') {
		alert("Please enter your 'From' email address");
		toFormObj.EALFrom.focus();
		return false;
		}
		
	var lcEmail = toFormObj.EALFrom.value;
	if (lcEmail != "") {
		if (lcEmail.indexOf("@") < 0 || 
				lcEmail.indexOf(".") < 0 ) {
			alert("Invalid 'From' Email");
			toFormObj.EALFrom.focus();
			return false;
			} /* if(@.) */
		} /* if("") */		
		
	if (toFormObj.EALTo.value.replace(/ /g,'')=='') {
		alert("Please enter a 'To' email address");
		toFormObj.EALTo.focus();
		return false;
		}

	var lcEmail = toFormObj.EALTo.value;
	if (lcEmail != "") {
		if (lcEmail.indexOf("@") < 0 || 
				lcEmail.indexOf(".") < 0 ) {
			alert("Invalid 'To' Email");
			toFormObj.EALTo.focus();
			return false;
			} /* if(@.) */
		} /* if("") */		

	if (toFormObj.EALSubject.value.replace(/ /g,'')=='') {
		alert("Please enter a 'Subject'");
		toFormObj.EALSubject.focus();
		return false;
		}
	if (toFormObj.EALMessage.value.replace(/ /g,'')=='') {
		alert("Please enter a message");
		toFormObj.EALMessage.focus();
		return false;
		}
		
	} /* vfEAL(toFormObj) */
	
	
/* select/object controls b/c MS renders these objects at z-index: >100 */
	/* hideElement & showElement were ripped from www.microsoft.com's main page */
	function hideElement(elmID) {
		if( document.all ){
			for (i = 0; i < document.all.tags(elmID).length; i++) {
				obj = document.all.tags(elmID)[i];
				if (! obj || ! obj.offsetParent) continue;

				/* Find the element's offsetTop and offsetLeft relative to the BODY tag. */
				objLeft   = obj.offsetLeft;
				objTop    = obj.offsetTop;
				objParent = obj.offsetParent;
				while (objParent.tagName.toUpperCase() != "BODY") {
					objLeft  += objParent.offsetLeft;
					objTop   += objParent.offsetTop;
					objParent = objParent.offsetParent;
					} /* while(..) */
				/* Adjust the element's offsetTop relative to the dropdown menu */
				x = 0 /* these lines added because x and y */
				y = 0 /* weren't defined */
				objTop = objTop - y;
		
				obj.style.visibility = "hidden";
				} /* for(i) */
			}
		} /* hideElement(elmID) */
		
	function showElement(elmID)	{
		if( document.all ){
			for (i = 0; i < document.all.tags(elmID).length; i++) {
				obj = document.all.tags(elmID)[i];
				if (! obj || ! obj.offsetParent) continue;
				obj.style.visibility = "";
				} /* for(i) */
			}	
		} /* showElement(elmID) */

	function HideOnTops() 	{
			hideElement("SELECT");
			hideElement("OBJECT");
		} /* HideOnTops() */
	function ShowOnTops()	{
			showElement("SELECT");
			showElement("OBJECT");
		} /* ShowOnTops() */

function toggleSM(toObj) {
	return false;
	}	
	
	
function initializePage() {
	var loForms = document.getElementsByTagName("form");
	for ( var lnI = 0; lnI < loForms.length; lnI++ ) {
		if (loForms[lnI].className.match(/xval/gi) ) {
			}
		else {
			var loInputs = loForms[lnI].getElementsByTagName("INPUT");
			var lnJ = 0;
			var lnContinue = 1;
			while (lnJ < loInputs.length && lnContinue==1) {
				if ( loInputs[lnJ].className.match(/m(in|ax)val/gi) ||
					loInputs[lnJ].className.match(/required/gi) ||
					loInputs[lnJ].className.match(/email/gi) 
					) {
					CMNaddEvent(loForms[lnI], 'submit', checkFormInputs );	
					lnContinue = 0;
					} /* if( ..match()..) */
				lnJ++;
				} /* while(..) */
			} /* if( .match(/xval/gi) ) */
		} /* for(lnI) */	
	} /* initializePage() */
	
function checkFormInputs(e) {
	var llRV = true;
	
	var laTags = ["input","select"];
	for (lcTag in laTags) {
		if (llRV) {
			if (e.srcElement) {
				var loInputs = e.srcElement.getElementsByTagName("INPUT");
				}
			else {
				var loInputs = this.getElementsByTagName("INPUT");
				}

			var lnJ = 0;
			while (lnJ < loInputs.length && llRV ) {
				var loI = loInputs[lnJ];
				if (loI.className != "") {
					var laClasses = loI.className.split(" ");
					for (lnK = 0; lnK < laClasses.length; lnK++){
						if (llRV) {
							var lcName = laClasses[lnK].split(":")[0];
							var lcValue = laClasses[lnK].split(":")[1];
							
							switch (lcName.toLowerCase() ) {
								case "minval" :
									if (loI.value=="" || parseInt(loI.value) < parseInt(lcValue) ){
										alert("You must enter at least " + lcValue) ;
										loI.select();
										loI.focus();
										llRV = false;
										} /* if(..) */
									break;
								case "maxval" :
									if (loI.value=="" || parseInt(loI.value) > parseInt(lcValue) ){
										alert("You must enter less than " + lcValue) ;
										loI.select();
										loI.focus();
										llRV = false;
										} /* if(..) */
									break;
								case "required" :
									if (loI.value==""){
										alert("You must enter a value for required fields");
										loI.select();
										loI.focus();
										llRV = false;
										}
									break;
								case "email" :
									if (loI.value.indexOf("@") < 0 || 
											loI.value.indexOf(".") < 0 ) {
										alert("Invalid Email Address");
										loI.select();
										loI.focus();
										llRV = false;
										}
									break ;
								} /* switch (lcName) */
							} /* if (llRV) */
						} /* for(lnK) */
					} /* if (loI.className!="") */
				lnJ++
				} /* while(..) */
			} /* if(llRV) */	
		} /* for(lcTag in laTags) */
	if (e && e.preventDefault && llRV==false) { e.preventDefault(); } // DOM style		
	return llRV;
	} /* checkformInputs() */
	
function checkValue() {
	var laClasses = this.className.split(" ");
	for (var lnI = 0; lnI < laClasses.length; lnI++) {
		var lcName = laClasses[lnI].split("-")[0].toLowerCase();
		var lcValue = laClasses[lnI].split("-")[1];
		switch (lcName) {
			case "minval" :
				if (parseInt(this.value) < parseInt(lcValue) ){
					alert("You must enter at least " + lcValue) ;
					this.select();
					this.focus();
					return false;
					}
			case "maxval" :
				if (parseInt(this.value) > parseInt(lcValue) ){
					alert("You must enter less than " + lcValue) ;
					this.select();
					this.focus();
					return false;
					}
			
			} /* switch (lcName) */
		} /* for (lnI) */
	} /* checkValue() */
	
function CMNaddEvent(obj, evType, fn){ 

 if (obj.addEventListener){ 
   obj.addEventListener(evType, fn, false); 
   return true; 
 } else if (obj.attachEvent){ 
   var r = obj.attachEvent("on"+evType, fn); 
   return r; 
 } else { 
   return false; 
 } 
}

function onw( u, t, w, h ) { // url, title, width, height
	window.open(
		u,
		t,
		"toolbar=no," +
			"location=no," +
			"directories=no," +
			"status=no," + 
			"menubar=no," +
			"scrollbars=yes," + 
			"resizable=no," +
			"copyhistory=no," +
		"width=" + w + "," +
		"height=" + h 
		); 
	return false;
	}

CMNaddEvent(window, 'load', initializePage);	

/* initializePage;	*/
