function validateInputs(formName) {

	var whichForm = formName;
	var z = 0;
	var formValidates = true;
	var strNote, strTmp1, strTmp2, strTmp3;


	while ((z < whichForm.elements.length) && (formValidates)) {

		//check to make sure the input is not empty, unless its title is Optional
		if ((whichForm.elements[z].value=="") && (whichForm.elements[z].title != "Optional")) {
			alert("Please provide the required information for " + whichForm.elements[z].title + ".");
			whichForm.elements[z].select();
			formValidates = false;
		}
    
	
 
  	//replace " 
  while (whichForm.elements[z].value.indexOf('"') > -1) {
			strNote = whichForm.elements[z].value;
			strTmp1 = strNote.substring(0,strNote.indexOf('"'));
			strTmp2 = strNote.substring(strNote.indexOf('"')+1,strNote.length);
			strTmp3 = strTmp1 + "&#34;" + strTmp2;
			whichForm.elements[z].value = strTmp3;
		}
		//replace ’ 
  while (whichForm.elements[z].value.indexOf('’') > -1) {
			strNote = whichForm.elements[z].value;
			strTmp1 = strNote.substring(0,strNote.indexOf('’'));
			strTmp2 = strNote.substring(strNote.indexOf('’')+1,strNote.length);
			strTmp3 = strTmp1 + "&#39;" + strTmp2;
			whichForm.elements[z].value = strTmp3;
		}
  
  
		//replace ' 
  while (whichForm.elements[z].value.indexOf("'") > -1) {
			strNote = whichForm.elements[z].value;
			strTmp1 = strNote.substring(0,strNote.indexOf("'"));
			strTmp2 = strNote.substring(strNote.indexOf("'")+1,strNote.length);
			strTmp3 = strTmp1 + "&#39;" + strTmp2;
			whichForm.elements[z].value = strTmp3;
		}
  
		//replace % 
  while (whichForm.elements[z].value.indexOf("%") > -1) {
			strNote = whichForm.elements[z].value;
			strTmp1 = strNote.substring(0,strNote.indexOf("%"));
			strTmp2 = strNote.substring(strNote.indexOf("%")+1,strNote.length);
			strTmp3 = strTmp1 + "&#37;" + strTmp2;
			whichForm.elements[z].value = strTmp3;
		}

		//replace ’ 
  while (whichForm.elements[z].value.indexOf("’") > -1) {
			strNote = whichForm.elements[z].value;
			strTmp1 = strNote.substring(0,strNote.indexOf("’"));
			strTmp2 = strNote.substring(strNote.indexOf("’")+1,strNote.length);
			strTmp3 = strTmp1 + "&#146;" + strTmp2;
			whichForm.elements[z].value = strTmp3;
		}
  
  
  
  
		z++;
	}		
	return formValidates;
}






function checkdate(objName) {
var datefield = objName;
if (chkdate(objName) == false) {
datefield.select();
alert("That date is invalid.  Please try again.");
datefield.focus();
return false;
}
else {
return true;
   }
}
function chkdate(objName) {
var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var datefield = objName;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
strMonthArray[0] = "Jan";
strMonthArray[1] = "Feb";
strMonthArray[2] = "Mar";
strMonthArray[3] = "Apr";
strMonthArray[4] = "May";
strMonthArray[5] = "Jun";
strMonthArray[6] = "Jul";
strMonthArray[7] = "Aug";
strMonthArray[8] = "Sep";
strMonthArray[9] = "Oct";
strMonthArray[10] = "Nov";
strMonthArray[11] = "Dec";
strDate = datefield.value;
if (strDate.length < 1) {
return true;
}
for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
strDateArray = strDate.split(strSeparatorArray[intElementNr]);
if (strDateArray.length != 3) {
err = 1;
return false;
}
else {
strDay = strDateArray[0];
strMonth = strDateArray[1];
strYear = strDateArray[2];
}
booFound = true;
   }
}
if (booFound == false) {
if (strDate.length>5) {
strDay = strDate.substr(0, 2);
strMonth = strDate.substr(2, 2);
strYear = strDate.substr(4);
   }
}
if (strYear.length == 2) {
strYear = '20' + strYear;
}
// US style
if (strDatestyle == "US") {
strTemp = strDay;
strDay = strMonth;
strMonth = strTemp;
}
intday = parseInt(strDay, 10);
if (isNaN(intday)) {
err = 2;
return false;
}
intMonth = parseInt(strMonth, 10);
if (isNaN(intMonth)) {
for (i = 0;i<12;i++) {
if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
intMonth = i+1;
strMonth = strMonthArray[i];
i = 12;
   }
}
if (isNaN(intMonth)) {
err = 3;
return false;
   }
}
intYear = parseInt(strYear, 10);
if (isNaN(intYear)) {
err = 4;
return false;
}
if (intMonth>12 || intMonth<1) {
err = 5;
return false;
}
if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
err = 6;
return false;
}
if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
err = 7;
return false;
}
if (intMonth == 2) {
if (intday < 1) {
err = 8;
return false;
}
if (LeapYear(intYear) == true) {
if (intday > 29) {
err = 9;
return false;
}
}
else {
if (intday > 28) {
err = 10;
return false;
}
}
}
if (strDatestyle == "US") {
datefield.value = strMonthArray[intMonth-1] + " " + intday+" " + strYear;
}
else {
datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
}
return true;
}
function LeapYear(intYear) {
if (intYear % 100 == 0) {
if (intYear % 400 == 0) { return true; }
}
else {
if ((intYear % 4) == 0) { return true; }
}
return false;
}
function doDateCheck(from, to) {
if (Date.parse(from.value) <= Date.parse(to.value)) {
//alert("The dates are valid.");
}
else {
if (from.value == "" || to.value == "") 
alert("Both dates must be entered.");
else 
alert("Start Date must occur after the Expire Date.");
return false;
   }
}

















 function peek_a_boo(divID, iState) { // 1 visible, 0 hidden
    if ( document.layers ) { //NN4+ 
      document.layers[divID].visibility = iState ? "show" : "hide"; 
    }  
    else if ( document.getElementById )	 { //gecko(NN6) + IE 5+
        document.getElementById(divID).style.visibility = iState ? "visible" : "hidden";
    }
    else if ( document.all )	{ // IE 4  
        document.all[divID].style.visibility = iState ? "visible" : "hidden";
    }
}


function details( evt,d_txt,posX,posY ) {
  var d_content = d_txt;
  document.getElementById("info_bkg").innerHTML  = d_content ;
  document.getElementById("info_txt").innerHTML  = d_content ;
  //alert(d_content);
  document.getElementById("info").style.left = (evt.clientX + document.body.scrollLeft + 100);
  document.getElementById("info").style.top  = (evt.clientY + document.body.scrollTop - 25);
  /*
  document.getElementById("info").style.left = (evt.clientX + document.body.scrollLeft + posX);
  document.getElementById("info").style.top  = (evt.clientY + document.body.scrollTop + posY);
  */
  peek_a_boo('info',1)
 }
  
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 popUpSurvey() {
  // check the cookie, to see if user has been presented the survey before
  if ((readCookie('addToNewsletter') < 1) ) {   // if the cookie is not set to 1 then
    createCookie('addToNewsletter',1,365);     // set the cookie to 1 for 365 days
    OpenNewWindow("join");  // open the survey
  } else {
    // do nothing
  }
}



function OpenNewWindow(fURL,features) {
/*------------------------------------------------------------------------------------------
  Purpose:
  *  OpenNewWindow is used only for external URLs (links not hosted internally)
  *  OpenNewWindow tracks the number of visits we send to external urls by passing links
     through 'extLinker.asp'.
  *  To view the custom report that consumes this information, navigate to 'Custom Reports' >> 
    'Top External URLs' within a IIS profile WebTrends 
--------------------------------------------------------------------------------------------
  Parameters: fURL, features
  * fURL     - the external url that the site will exit to 
               or a string name that will be used to set the exit page (and features).
  * features - <optional> the optional parameter allows the window to be customized.
               if not defined the following settings are used:
               'location=1,status=0,toolbar=0,directories=0'
  
    Customizable 'features': 
    ----------------------------------------------------------------------------------------  
    toolbar     = 0|1      Specifies whether to display the browser tool bar.   
    location    = 0|1      Specifies whether to display the browser address bar.
    directories = 0|1      Specifies whether to display the browser directories.
    status      = 0|1      Specifies whether to display the browser status bar.
    copyhistory = 0|1      Specifies whether to copy browser's history in a new window.	
    menubar     = 0|1      Specifies whether to display the browser menu bar.  
    scrollbars  = 0|1      Specifies whether the new window should have scrollbars.  
    resizable   = 0|1      Specifies whether the new window is resizable.  
    width       = pixels   Specifies the width of the new window.  
    height      = pixels   Specifies the height of the new window.  
    top         = pixels   Specifies the Y coordinate of the top left corner of the new window. 
    left        = pixels   Specifies the X coordinate of the top left corner of the new window. 
--------------------------------------------------------------------------------------------
  Usage:
  * <a href="javascript:OpenNewWindow('http://www.yahoo.com');"></a>
  * <a href="javascript:OpenNewWindow('http://www.yahoo.com','width=200,height=200,scrollbars=1');"></a>
  * <a href="javascript:OpenNewWindow('join');"></a>
  * <a href="javascript:OpenNewWindow('join','width=200,height=200,scrollbars=1');"></a>
------------------------------------------------------------------------------------------*/

  var NewWindow;  // create new window object

  /* Defined Links : Start
  ---------------------------------------------------------------------------------------*/
  /* join: */
  if (fURL == "join") {
    /* if not features were passes, set default features */
    if (features==undefined) { features="width=325,height=175,left=1,top=0,menubar=0,scrollbars=1,resizable=1,toolbar=0,status=0,location=1" }
    exit = "join_newsletter.asp"
  }
  /* Defined Links : End 
  ---------------------------------------------------------------------------------------*/

  /* set the default window features if features has not been defined */
  if (features==undefined) { features="location=1,status=1,toolbar=1,directories=1,scrollbars=1,resizable=1" }

  /* open the new window to exit URL */
  NewWindow = window.open(exit,null,features);
 
}
