isMacAndFF = function() {
	return identifyBrowser()=="mozilla" && identifyOS()=="MacOS";
}

isIE6 = function() {
	return identifyBrowser()=="ie6";
}

identifyOS = function(){
	var OSName="Unknown OS";
	if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
	if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
	if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
	if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";	
	return OSName;
}

identifyBrowser = function() {
  var agent = navigator.userAgent.toLowerCase();

  if (typeof navigator.vendor != "undefined" && navigator.vendor == "KDE" &&
      typeof window.sidebar != "undefined")
  {
    return "kde";
  }
  else if (typeof window.opera != "undefined")
  {
    var version = parseFloat(agent.replace(/.*opera[\/ ]([^ $]+).*/, "$1"));

    if (version >= 7)
    {
      return "opera7";
    }
    else if (version >= 5)
    {
      return "opera5";
    }

    return false;
  }
  else if (typeof document.all != "undefined")
  {
    if (typeof document.getElementById != "undefined")
    {
      var browser = agent.replace(/.*ms(ie[\/ ][^ $]+).*/, "$1").replace(/ /, "");

      if (typeof document.uniqueID != "undefined")
      {
        if (browser.indexOf("5.5") != -1)
        {
          return browser.replace(/(.*5\.5).*/, "$1");
        }
        else
        {
          return browser.replace(/(.*)\..*/, "$1");
        }
      }
      else
      {
        return "ie5mac";
      }
    }

    return false;
  }
  else if (typeof document.getElementById != "undefined")
  {
    if (navigator.vendor.indexOf("Apple Computer, Inc.") != -1)
    {
      if (typeof window.XMLHttpRequest != "undefined")
      {
        return "safari1.2";
      }

      return "safari1";
    }
    else if (agent.indexOf("gecko") != -1)
    {
      return "mozilla";
    }
  }
  return false;
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

function getHomeFeature(){
	var cookieVar = "";
	if(readCookie("_home_feature")){
		cookieVar = parseInt(readCookie("_home_feature"));
		cookieVar+=1;
		if(cookieVar>3){			
			cookieVar = 1;	
		}		
	}else{
		cookieVar = 3;
	}
	createCookie("_home_feature",cookieVar,356);
	return cookieVar;	
}

var maxTextareaLength = 1000;

function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function getPathWithoutExtension(url){		
	url = url.substring(0,url.lastIndexOf(".")).substring(url.indexOf("://")+3);
	return url.indexOf("/")>=0?url.substring(url.indexOf("/")):"index";
}

function getAssetPath(anch){
	return getPathWithoutExtension(anch.getAttribute("href"));
}

function getDownloadPath(anch){
	return "/downloads/"+anch.firstChild.nodeValue.replace(/\s+/g, '');	
}

function callGATracker(path){
	//if(url.indexOf("lombardi.com")>=0 || url.indexOf("lombardisoftware.") >=0){
		urchinTracker(path);
		//urchinTracker(getPathWithoutExtension(url));
	//}	
}

function isEmail(email) {
	var filter = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
	var result = filter.test(email);
	return (result != false);
}

function isBusinessEmail(email) {
	if(email.indexOf('@hotmail.com') > 0 || email.indexOf('@yahoo.com') > 0 || email.indexOf('@gmail.com') > 0 || email.indexOf('@msn.com') > 0){
		return false;	
	}else{
		return true;
	}
}

function forceMaxLength(){
  var maxLength = parseInt(this.getAttribute('maxlength'));
  if(this.value.length > maxlength){
   this.value = this.value.substring(0,maxlength);
  }
 }

function bptSignIn() {
	var email = document.forms["bptSignInForm"].Email.value;
	var firstname = document.forms["bptSignInForm"].FirstName.value;
	var lastname = document.forms["bptSignInForm"].LastName.value;
    
   if (firstname == null || firstname == ""){
    	alert("Please enter a first name");
		document.forms["bptSignInForm"].FirstName.focus();
    }else if (lastname == null || lastname == ""){
    	alert("Please enter a last name");
		document.forms["bptSignInForm"].LastName.focus();
    }else if (email != null && isEmail(email) == false) {
		alert("Please enter a valid Email");
		document.forms["bptSignInForm"].Email.focus();
    }else {
		//alert('submit');
		document.forms["bptSignInForm"].submit();
	}
}

function swapHomeFeature(featureNum){
	if(featureNum==1){
		document.getElementById("feature-map-action").href=	"lombardi-customer-renaultf1.php";
		document.getElementById("feature-map-image").src=	imageLangPath+"body/feature-renaultf1.jpg";
	}else if (featureNum==2){
		document.getElementById("feature-map-action").href=	"blueprint-lombardi.php";
		document.getElementById("feature-map-image").src=	imageLangPath+"body/feature-blueprint.jpg";
	}else if (featureNum==3){
//		document.getElementById("feature-map-action").href=	"bpm-software-leadership.php";*/
//		document.getElementById("feature-map-image").src=	imageLangPath+"body/feature-leader.jpg";*/
		
/* 8/1/2007 - TO CHANGE THE THIRD STATIC FEATURE IMAGE, UNCOMMENT THE FOLLOWING 2 LINES (REMOVE THE //), AND
   COMMENT THE 2 LINES ABOVE BY ADDING // TO THE BEGINNING OF EACH LINE */
		 document.getElementById("feature-map-action").href=	"forrester-wave-07-sp.php";
		 document.getElementById("feature-map-image").src=	imageLangPath+"body/feature-forrester.jpg";
		
	}		
}

function openExternalWindow(url)
{
	var newWindow;
	var testVar;
	
	newWindow = window.open("/include/externalFrameset.php?url=" + escape(url),"External","height=700,width=1000,top=5,left=5");
}

function openPrintView(url)
{
	var newWindow;
	if(url.indexOf('?')>0)
	{
		url = url + "&printView=1";
	}
	else
	{
		url = url + "?printView=1";
	}
	newWindow = window.open(url,"PrintView","height=600,width=619,top=5,left=5,resizable,scrollbars");
}

 var ImgWin = " ";
 function openImageViewer(url) 
 {
 	image0=new Image();
 	image0.src=url;        
 	       
	w=image0.width;
	if(w<100)
		{w=100}
	h=image0.height;
	if(h<100)
		{h=100}
	h=h+25;
	picgif=url;
	if(ImgWin.open)  
		{ImgWin.close()}
	WinProps="width="+w+",height="+h+",location=no,status=no,directories=no,toolbar=no,scrollbars=no,menubar=no,resize=no,top=0,left=0";
	ImgWin=window.open("","winimg",config=WinProps);
	ImgWin.document.write("<HTML>");
	ImgWin.document.write("<HEAD><TITLE>Display Image</TITLE><link rel='stylesheet' type='text/css' href='/include/css/styles.css'></HEAD>");
	ImgWin.document.write("<BODY marginheight='0' marginwidth='0' leftmargin='0' topmargin='0'>");
	ImgWin.document.write("<CENTER><IMG SRC="+picgif+" BORDER='0' HSPACE=0 VSPACE=0><BR>");
	ImgWin.document.write("<span class='BodyStandard'><A HREF='#' onClick='self.close()'>Close</A></span></CENTER>");
	ImgWin.document.write("</BODY>");
	ImgWin.document.write("</HTML>");
	ImgWin.document.close();
	ImgWin.focus();
}

function openInImageWindow(e) {
	callGATracker(getAssetPath(this));
	
	var event;
	if (!e) event = window.event;
	else event = e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
	    //var newWindow = window.open(this.getAttribute('href'), '_blank');
	    
	    var tempClassName = this.className;
	    var tempClassNameArray = tempClassName.split("-");
	    var WinProps;
	    var h = 0;
	    
			tempClassNameArray[2] = tempClassNameArray[2].replace(/ /i,"");
						
			h=0+(tempClassNameArray[2]*1)+25;			
			picgif=this.getAttribute("href");
			/*if(ImgWin.open)  
				{ImgWin.close()}*/
			WinProps="width="+tempClassNameArray[1]+",height="+h+",location=no,status=no,directories=no,toolbar=no,scrollbars=no,menubar=no,resize=no,top=50,left=50";
			var newWindow = window.open("","Lombardi",config=WinProps);
			newWindow.document.write("<HTML>");
			newWindow.document.write("<HEAD><TITLE>Display Image</TITLE><link rel='stylesheet' type='text/css' href='/include/css/styles.css'></HEAD>");
			newWindow.document.write("<BODY>");
			newWindow.document.write("<CENTER><IMG SRC="+picgif+" BORDER='0' HSPACE=0 VSPACE=0><BR>");
			newWindow.document.write("<span style='font-family:arial;font-size:12px;'><A HREF='#' onClick='self.close()'>Close</A></span></CENTER>");
			newWindow.document.write("</BODY>");
			newWindow.document.write("</HTML>");
			newWindow.document.close();		
		
		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}
}		


 function openImageViewerSized(url,w,h) 
 {
 	image0=new Image();
 	image0.src=url;        
 	       
	//w=image0.width;
	//if(w<100)
	//	{w=100}
	//h=image0.height;
	//if(h<100)
	//	{h=100}
	h=h+25;
	picgif=url;
	if(ImgWin.open)  
		{ImgWin.close()}
	WinProps="width="+w+",height="+h+",location=no,status=no,directories=no,toolbar=no,scrollbars=no,menubar=no,resize=no,top=0,left=0";
	ImgWin=window.open("","winimg",config=WinProps);
	ImgWin.document.write("<HTML>");
	ImgWin.document.write("<HEAD><TITLE>Display Image</TITLE><link rel='stylesheet' type='text/css' href='/include/css/styles.css'></HEAD>");
	ImgWin.document.write("<BODY marginheight='0' marginwidth='0' leftmargin='0' topmargin='0'>");
	ImgWin.document.write("<CENTER><IMG SRC="+picgif+" BORDER='0' HSPACE=0 VSPACE=0><BR>");
	ImgWin.document.write("<span class='BodyStandard'><A HREF='#' onClick='self.close()'>Close</A></span></CENTER>");
	ImgWin.document.write("</BODY>");
	ImgWin.document.write("</HTML>");
	ImgWin.document.close();
	ImgWin.focus();
}

var FlashWin = " ";
function openFlashViewer(flashURL){
	var confirmAnswer;
	var flashCode;
	var timerVar;
	var windowProps;
	var name = flashURL;
	var width;
	var height;
	var bgcolor;
	
	//var leftVal = (screen.width - width) / 2;
	//var topVal = (screen.height - height) / 2;		
	
	switch(flashURL){
		case "fsv_main.swf":
			width=800;
			height=480;
			bgcolor="#ffffff";
			break;
	}
	
	flashCode = '	<OBJECT	classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
						'				codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' +
						'				WIDTH="' + width + '"' +
						'				HEIGHT="' + height + '"' +
						'				id="' + name + '">' +
						'		<param 	name=base' +
						'				value="/images/flash/">' +
						'		<PARAM	NAME=movie' +
						'				VALUE="/images/flash/' + flashURL + '">' +
						'		<param 	name=allowScriptAccess' +
						'				value=sameDomain>' +
						'		<PARAM	NAME=quality' +
						'				VALUE=high>' +
						'		<PARAM	NAME=bgcolor' +
						'				VALUE=' + bgcolor + '>' +
						'		<PARAM	NAME=wmode' +
						'				VALUE=opaque>' +
						'		<EMBED	src="/images/flash/' + flashURL + '"' +
						'				quality="high"' +
						'				bgcolor="' + bgcolor + '"' +
						'				WIDTH="' + width + '"' +
						'				HEIGHT="' + height + '"' +
						'				NAME="' + name + '"' +
						'				TYPE="application/x-shockwave-flash"' +
						'				PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';
	height=height+25;
	windowProps="width="+width+",height="+height+",location=no,status=no,directories=no,toolbar=no,scrollbars=no,menubar=no,resize=no,top=0,left=0";
	FlashWin=window.open("","flashWindow",config=windowProps);
	FlashWin.document.write("<HTML>");
	FlashWin.document.write("<HEAD><TITLE>Lombardi Software, Inc.</TITLE><link rel='stylesheet' type='text/css' href='/include/css/styles.css'></HEAD>");
	FlashWin.document.write("<BODY marginheight='0' marginwidth='0' leftmargin='0' topmargin='0'>");
	FlashWin.document.write(flashCode);
	FlashWin.document.write("<br><br><center><span class='BodyStandard'><A HREF='#' onClick='self.close()'>Close</A></span></CENTER>");
	FlashWin.document.write("</BODY>");
	FlashWin.document.write("</HTML>");
	FlashWin.document.close();
	FlashWin.focus();
}


function openInFlashWindow(e) {
	callGATracker(getAssetPath(this));
	
	var event;
	if (!e) event = window.event;
	else event = e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
	    //var newWindow = window.open(this.getAttribute('href'), '_blank');
	    
	    var tempClassName = this.className;
	    var tempClassNameArray = tempClassName.split("-");
	    var WinProps;
	    var h = 0;
	    var w = 0;
	    
			tempClassNameArray[2] = tempClassNameArray[2].replace(/ /i,"");
						
			//h=0+(tempClassNameArray[2]*1)+25;			
			
			w=0+(tempClassNameArray[1]*1)+30;
			h=0+(tempClassNameArray[2]*1)+30;
				
			
			var pageURL=this.getAttribute('href');
		    
		    
			var newWindow = window.open(pageURL,"Lombardi","top=1,left=1,height=" + h + ",width=" + w + ",scrollbars=0,resizable=1,toolbars=0");
	
			if (newWindow) {
				if (newWindow.focus) {
					newWindow.focus();
				}
				return false;
			}
			return true;
			
			
			//WinProps="width="+w+",height="+h+",location=no,status=no,directories=no,toolbar=no,scrollbars=no,menubar=no,resize=no,top=50,left=50";		
			
	}
}	




function getFlash(flashURL,width,height,name,bgcolor,minFlashVersion,altContent,altDestination,promptInstall){
		var confirmAnswer;
		var timerVar;
		
		flashCode = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' +
							'				codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"' +
							'				WIDTH="' + width + '"' +
							'				HEIGHT="' + height + '"' +
							'				id="' + name + '">' +
							'		<PARAM	NAME=movie' +
							'				VALUE="' + flashURL + '">' +
							'		<PARAM	NAME=quality' +
							'				VALUE=high>' +
							'		<PARAM	NAME=bgcolor' +
							'				VALUE=' + bgcolor + '>' +
							'		<PARAM	NAME=wmode' +
							'				VALUE=transparent>' +
							'		<EMBED	src="' + flashURL + '"' +
							'				quality="high"' +
							'				bgcolor="' + bgcolor + '"' +
							'				WIDTH="' + width + '"' +
							'				HEIGHT="' + height + '"' +
							'				NAME="' + name + '"' +
							'				TYPE="application/x-shockwave-flash"' +
							'				WMODE="transparent"' + 
							'				PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>';


		if(getFlashVersion() >= minFlashVersion){			
			document.write(flashCode);			
		} else {
			if(promptInstall != ""){					
				if(document.all){		
					document.write("<div id='flashContent'>"+altContent+"</div>");						
					window.setTimeout("execFlashContent('"+altContent+"','"+altDestination+"','"+promptInstall+"');",1000);			
				}else{				
					confirmAnswer = window.confirm("To view this page as it was intended, would you like to install the Macromedia Flash Player?");
					if(confirmAnswer){
						document.write(flashCode);		
					} else {
						if(promptInstall == "altContent"){
							document.write(altContent);			
						} else if(promptInstall == "altDestination"){
							document.write(altContent);
							window.location.href=altDestination;
						}
					}
				}
			} else {			
				if(altContent !=""){
					document.write(	altContent);			
				} else {
					window.location.href=altDestination;
				}
			}
		}
	}


function hideTrainingDates() {
 document.getElementById('date1').style.visibility = "hidden";
 document.getElementById('date2').style.visibility = "hidden";
 document.getElementById('date3').style.visibility = "hidden";
 document.getElementById('date4').style.visibility = "hidden";
 document.getElementById('date5').style.visibility = "hidden";
 document.getElementById('error').style.visibility = 'hidden';
 document.frm.courseDate.value="0";
}

/*ELOQUA GATED FORM FUNCTIONS BEGIN*/
function getQueryStringParamValue(strQStrParam) {
	var strURL = document.location.href;
	var strQStrParamValue = '';
            if (strURL.indexOf('?') != -1)
            {
                        strQStrParamValue = strURL.substr(strURL.indexOf('?') + 1);
                        if (strQStrParamValue.indexOf(strQStrParam) != -1)
                        {
                                    strQStrParamValue = strQStrParamValue.substr(strQStrParamValue.indexOf(strQStrParam));
                                    strQStrParamValue = strQStrParamValue.substr(strQStrParamValue.indexOf('=') + 1);
                                    if (strQStrParamValue.indexOf('&') != -1)
                                    strQStrParamValue = strQStrParamValue.substr(0, strQStrParamValue.indexOf('&'));
                                    return strQStrParamValue;

                        }else{
                                    strQStrParamValue = defaultHiddenFieldNameValue;
                                    return strQStrParamValue;
                        }
            }else{
                        strQStrParamValue = defaultHiddenFieldNameValue;
                        return strQStrParamValue;
            }
}

function setDocParameters(formName) {
	var theForm = document.forms[formName];
	theForm.elements['docid'].value = getQueryStringParamValue('docid');
}
/*ELOQUA GATED FORM FUNCTIONS END*/

function addEvent(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 removeEvent( obj, type, fn )
{
	if (obj.removeEventListener)
		obj.removeEventListener( type, fn, false );
	else if (obj.detachEvent)
	{
		obj.detachEvent( "on"+type, obj[type+fn] );
		obj[type+fn] = null;
		obj["e"+type+fn] = null;
	}
}

function pageOnLoad()
{
	if(pageName == 'bpm-training-registration')
	{
		hideTrainingDates();
	}
	
	if(pageName=='requestdemo-registration'){
		setDocParameters('2007demo_request');
	}else if(pageName=='download-registration'||pageName=='download-registration-short'){
		setDocParameters('2007reg_downloads');
	}
	
	if(printView == '1')
	{
		window.print();
	}
}

addEvent(window, 'load', pageOnLoad);	

function openInPrintWindow(e) {
	var event;
	if (!e) event = window.event;
	else event = e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
	    var pageURL=this.getAttribute('href');
	    
	    if(pageURL == '#'){
			pageURL = window.location.href;
		}
		pageURL = pageURL.replace("#","");
		if(pageURL.indexOf('?')>=0){
			pageURL+="&printView=1";	
		}else{
			pageURL+="?printView=1";	
		}
		var newWindow = window.open(pageURL,"printView","top=1,left=1,height=760,width=794,scrollbars=1,resizable=1,toolbars=0");

		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}
}	

function openInRegWindow(e) {
	//callGATracker(this.getAttribute('href'));
	callGATracker(getDownloadPath(this));	
	
	var event;
	if (!e) event = window.event;
	else event = e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
	    var pageURL=this.getAttribute('href');
	    
	    if(pageURL == '#'){
			pageURL = window.location.href;
		}
		/*
		if(pageURL.indexOf('?')>=0){
			pageURL+="&printView=1";	
		}else{
			pageURL+="?printView=1";	
		}*/
		var newWindow = window.open(pageURL,"Lombardi","width=800,height=800,left=0,top=0,scrollbars=yes, menubar=no, toolbar=no, location=no, status=no, resizable=yes");

		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}
}

function openInExtWindow(e) {
	//callGATracker(this.getAttribute('href'));	
	
	var event;
	if (!e) event = window.event;
	else event = e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
	    //var newWindow = window.open(this.getAttribute('href'), '_blank');
	    var url=this.getAttribute('href').replace(/#/gi,"~");
		
		var newWindow = window.open("/include/externalFrameset.php?url=" + url,"Lombardi","height=700,width=1000,top=5,left=5,resizable");
		
		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}	
}	

function getNewWindowLinks() {
	// Check that the browser is DOM compliant
	if (document.getElementById && document.createElement && document.appendChild) {
		// Change this to the text you want to use to alert the user that a new window will be opened
		var strNewWindowAlert = " (opens in a new window)";
		// Find all links
		var links = document.getElementsByTagName('a');
		var objWarningText;
		var link;
		for (var i = 0; i < links.length; i++) {
			link = links[i];			
			if (/\bexternal/.test(link.className)) {				
				link.onclick = openInExtWindow;					
			}else if (/\bregistration/.test(link.className)) {				
				link.onclick = openInRegWindow;					
			}else if (/\bflash/.test(link.className)) {
				link.onclick = openInFlashWindow;		
			}else if (/\bimage/.test(link.className)) {
				link.onclick = openInImageWindow;								
			}else if (/\bprintview/.test(link.className)) {
				link.onclick = openInPrintWindow;					
			}else if (/\bvalidate-submit/.test(link.className)) {	
				link.onclick = validateForm;					
			}
		}
		objWarningText = null;
	}
}

addEvent(window, 'load', getNewWindowLinks);	


function getNifty() {
	Nifty("div#pdf-1");
	Nifty("div#pdf-2");
}

addEvent(window, 'load', getNifty);	


function validateForm(e){
	
	// Check that the browser is DOM compliant	
	if (document.getElementById && document.createElement && document.appendChild) {
	
		var formInputs = document.getElementsByTagName('input');
		var formSelects = document.getElementsByTagName('select');
		var formTextareas = document.getElementsByTagName('textarea');
		
		var validateErrorMsg="";
		var validateObjectFocus;
		var formElement;
		var failedValidation;
		
		for (var i = 0; i < formInputs.length; i++) {	
			failedValidation = false;
			formElement = formInputs[i];
			// Find all elements with a class name of "required"
			if (/required\b/.test(formElement.className)) {	
				// Create an em element containing the new window warning text and insert it after the link text
				if(trim(formElement.value)==""){
					failedValidation = true;
					if(validateErrorMsg == ""){
						validateObjectFocus = formElement;	
					}
					validateErrorMsg = validateErrorMsg + "\"" + formElement.title + "\"" + " is required\n";							
				}
			}
			/*if (!failedValidation) {					
				if(formElement.name=="email"){					
					if(!isEmail(formElement.value) || !isBusinessEmail(formElement.value)){												
						failedValidation = true;
						if(validateErrorMsg == ""){
							validateObjectFocus = formElement;
						}
						validateErrorMsg = validateErrorMsg + "\"" + formElement.title + "\"" + " is not a valid business email address\n";							
					}	
				}
			}*/
			if (!failedValidation){
				if(formElement.name=="emailconfirm"){
					if(formElement.value != document.getElementById("email").value){
						failedValidation = true;
						if(validateErrorMsg == ""){
							validateObjectFocus = formElement;
						}
						validateErrorMsg = validateErrorMsg + "\"" + formElement.title + "\"" + " doesn't match the \"Email\" you entered\n";							
					}	
				}	
			}
		}
		
		for (var i = 0; i < formSelects.length; i++) {	
			failedValidation = false;
			formElement = formSelects[i];
			// Find all elements with a class name of "required"
			if (/required\b/.test(formElement.className)) {	
				// Create an em element containing the new window warning text and insert it after the link text
				if(trim(formElement.value)==""){
					failedValidation = true;
					if(validateErrorMsg == ""){
						validateObjectFocus = formElement;	
					}
					validateErrorMsg = validateErrorMsg + "\"" + formElement.title + "\"" + " is required\n";							
				}
			}
		}
		
		for (var i = 0; i < formTextareas.length; i++) {	
			failedValidation = false;
			formElement = formTextareas[i];
			// Find all elements with a class name of "required"
			if (/required\b/.test(formElement.className)) {	
				// Create an em element containing the new window warning text and insert it after the link text
				if(trim(formElement.value)==""){
					failedValidation = true;
					if(validateErrorMsg == ""){
						validateObjectFocus = formElement;	
					}
					validateErrorMsg = validateErrorMsg + "\"" + formElement.title + "\"" + " is required\n";							
				}
			}
			if(!failedValidation){
				if(formElement.value.length > maxTextareaLength){
					failedValidation=true;
					if(validateErrorMsg == ""){
						validateObjectFocus = formElement;	
					}
   					formElement.value = formElement.value.substring(0,maxTextareaLength);
   					validateErrorMsg = validateErrorMsg + "\"" + formElement.title + "\"" + " cannot exceed " + maxTextareaLength + " characters\n";
   				}  			
			}
		}
		
		if(validateErrorMsg==""){
			var pageForms = document.getElementsByTagName('form');	
			var pageForm;
			for (var i = 0; i < pageForms.length; i++) {
				pageForm = pageForms[i];			
				if (/validate\b/.test(pageForm.className)) {				
					pageForm.submit();
				}
			}			
		}else{
			validateObjectFocus.focus();
			alert(validateErrorMsg);
			return false;	
		}
	}
}

