
	//set a cookie
	function SetCookie(cookieName,cookieValue,nDays) {
	 var today = new Date();
	 var expire = new Date();
	 if (nDays==null || nDays==0) nDays=1;
	 expire.setTime(today.getTime() + 3600000*24*nDays);
	 document.cookie = cookieName+"="+escape(cookieValue)
					 + ";expires="+expire.toGMTString();
	}
	
	//read the cookie
	function ReadCookie(cookieName) {
	 var theCookie=""+document.cookie;
	 var ind=theCookie.indexOf(cookieName);
	 if (ind==-1 || cookieName=="") return ""; 
	 var ind1=theCookie.indexOf(';',ind);
	 if (ind1==-1) ind1=theCookie.length; 
	 return unescape(theCookie.substring(ind+cookieName.length+1,ind1));
	}
	
	function setRecipient(form) {
		//var form=document.FeedBack;
		domain = 'lp-associates.com';	
		form.recipient.options[form.recipient.selectedIndex].value = form.recipient.options[form.recipient.selectedIndex].value + '@' + domain; 
		return true;
	}
	
	function setRecipientLink(name,domain) {	
	Mail = "mailto:" + name + "@" + domain + "?subject=Contact from LAPA website";
	window.location.href=Mail;
	}
	
	function setRecipientTest(form) {
		//var form=document.FeedBack;
		domain = 'lp-associates.com';	
		form.recipient.options[form.recipient.selectedIndex].value = form.recipient.options[form.recipient.selectedIndex].value + '@' + domain; 
		//emailAddress = form.recipient.value + '@' + 'lp-associates.com';
		alert("recipient: " + form.recipient.options[form.recipient.selectedIndex].value);	
		return false;
	}
	
	// Simple Browser Check
	var ns4 = (document.layers) ? 1 : 0;
	var ie4 = (document.all) ? 1 : 0;
	var ns6 = (document.getElementById && !document.all) ? 1 : 0;
	
	// Browser Window Dimensions
	function winWid(){
	   return (ns4||ns6) ? window.innerWidth : document.body.clientWidth;
	}
	function winHei(){
	   return (ns4||ns6) ? window.innerHeight : document.body.clientHeight;
	}
	
	// Adjust the table width to fit screen
	function setTableWidth(tableID) {
		var displaywidth = winWid();
		if (displaywidth < 750) {
			document.getElementById(tableID).style.width="100%";
		} else {
			document.getElementById(tableID).style.width="750";
		}
	}
	
	function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function contact(name,subject)
{
	Mail = "mailto:" + name + "@" + "lp-associates.com" + "?subject=" + subject;
	window.location.href=Mail;
}

function ENewsletterPro_JoinForm_Validator(theForm)
{
	var emailVal = theForm.Email.value
  
   if (emailVal == "")
  {
    alert("Please enter your e-mail address.");
    theForm.Email.focus();
    return (false);
  }
  
  //make sure email address is in correct format. 
  
  if ((emailVal.indexOf('@')==-1) || (emailVal.indexOf('.')==-1))
  {
      alert("The e-mail address \'" + theForm.Email.value + "\' is not in a correct format.\n Please try again."
   );
   		return false;
   }
  
 
  if (emailVal.length < 7)
  {
    alert("Please enter at least 7 characters in the e-mail address field.");
    theForm.Email.focus();
    return (false);
  }
  if (emailVal.length > 255)
  {
    alert("Please enter at most 255 characters in the e-mail address field.");
    theForm.Email.focus();
    return (false);
  }
          
  if (theForm.Email2.value == "")
  {
    alert("Please retype your e-mail address.");
    theForm.Email.focus();
    return (false);
  }
  
  if (emailVal.toLowerCase() != theForm.Email2.value.toLowerCase())
  {				
       alert('The e-mail address you retyped does not match.');
	   theForm.Email.focus();
       return false;
   }
   
  return (true);
}
