
var ie4 = (document.all) ? true : false;
var ns4 = (document.layers) ? true : false;
var ns6 = (document.getElementById && !document.all) ? true : false;

function allez(showit,str1,itm){
partdone = false;
alldone = false;
if (showit) {
	alert(str1);
	itm.focus();
	}
}
var alldone = true;
var partdone = true;


function check_dets(showit,theForm)
{  
  if (theForm.r_Name.value == "")
  {
    allez(showit,"Please enter a value for the \"Name\" field.",theForm.r_Name);
    if (showit) return (false);
  }

  if (theForm.re_eMail.value == "")
  {
    allez(showit,"Please enter a value for the \"Email\" field.",theForm.re_eMail);
    if (showit) return (false);
  }

  if (theForm.re_eMail.value.length > 50)
  {
    allez(showit,"Please enter at most 50 characters in the \"Email\" field.",theForm.re_eMail);
    if (showit) return (false);
  }

  if (!emailCheck (theForm.re_eMail.value,showit,theForm.re_eMail))
  {
	if (showit) return (false);
	}

  if (theForm.re_eMail.value !=  theForm.eMail2.value)
  {
    allez(showit,"\"Email\" and \"Confirm Email\" must be the same",theForm.eMail2);
    if (showit) return (false);
  }

  if (theForm.r_Phone.value == "")
  {
    allez(showit,"Please provide a daytime Phone number.",theForm.r_Phone);
    if (showit) return (false);
  }
  
  if (theForm.r_Message.value == "")
  {
    allez(showit,"Please enter a Message.",theForm.r_Message);
    if (showit) return (false);
  }
  
  if (theForm.r_captcha.value.length != "6")
  {
    allez(showit,"Please enter all 6 Letters and Numbers in the image into the \"Security Code\" field.",theForm.r_captcha);
    if (showit) return (false);
  }  

   check_light();
   return (true);
}

function reFresh() {
  location.reload(true)
}

function CountChars(whichform, len, disp) {
			var mystr;
			mystr = whichform.value;
			if (mystr.length > len ){
				allez(showit,'We\'re sorry, but you are only allowed to enter a maximum of '+len+' characters in this field.');
				return(0);
			} 
			else {
				disp.value = len - mystr.length
			}
			return(1);
		}	
		


function check_light () {
  var objImgStyle = document.getElementById('light');
  if (partdone) {
	objImgStyle.src = "on.gif"; 
	objImgStyle.alt = "All required fields have been completed"
    currentPaneStyle = 0;
	}
	else {
	objImgStyle.src = "off.gif"; 
	objImgStyle.alt = "Not all required fields have been completed"
	currentPaneStyle = 1;
	}
	partdone = true;
}



// useful for dynamically showing and hiding divs

var currentPaneStyle = 0;

function showPane(div)
{
var paneId =  div.id;
  if(currentPaneStyle != 0) {
	if (ie4) {
	    var objPaneStyle = document.getElementById(paneId).style;
		objPaneStyle.display ="none";
//		document.all[paneId].style.visibility = "hidden";
		}
	if (ns4) {
		document.layers[paneId].visibility = "hide";
		}
	if (ns6) {
		document.getElementById([paneId]).style.display = "none";
		}
    }
var paneId =  div.id;    
if (div != "hide") {
	if (ie4) {
	    var objPaneStyle = document.getElementById(paneId).style;
		objPaneStyle.display ="block";
	}
	if (ns4) {
		document.layers[paneId].visibility = "show";
		}
	if (ns6) {
		document.getElementById([paneId]).style.display = "block";
		}
currentPaneStyle = objPaneStyle;
}
}


