<!--
function fnTrapKD(btn)
{
	if (document.all)
	{
		if (event.keyCode == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
	else if (document.getElementById)
	{
		if (event.which == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
	else if(document.layers)
	{
		if(event.which == 13)
		{
			event.returnValue=false;
			event.cancel = true;
			btn.click();
		}
	}
} 

// Used by the Popup windows for printing
function print_page () 
{
    if (!window.print) 
    {
        alert ("You web browser doesn't not support this print functionality.\nIf you are using IE on a Mac,\nyou can print by holding down your 'apple' key and then press the 'p' key.");
    }
    else
    {
    window.print();
    }
}

// used to pop up the cookie error page
function NoCookiesSupported()
{
    window.open('../nocookie.aspx','help','scrollbars=yes,width=500,height=600');
}

var submitcount=0; 

function disableSubmit() 
{ 
    if (typeof(Page_ClientValidate)=='function') 
    { 
        if (Page_ClientValidate() == true) 
        { 
            return checkSubmit(); 
        } 
        else 
        { 
            return true; 
        } 
    } 
    else 
    { 
        return checkSubmit(); 
    } 
} 


function checkSubmit() 
{ 
    if (submitcount == 0) 
    { 
        submitcount++; return true; 
    } 
    else 
    { 
        alert('The order has already been submitted.'); return false; 
    } 
} 

function emailCheck (emailStr) 
{
	/* The following pattern is used to check if the entered e-mail address
   	fits the user@domain format.  It also is used to separate the username
   	from the domain. */

	var emailPat=/^(.+)@(.+)$/

	/* The following string represents the pattern for matching all special
   	characters.  We don't want to allow special characters in the address. 
   	These characters include ( ) < > @ , ; : \ " . [ ]    */

	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"

	/* The following string represents the range of characters allowed in a 
   	username or domainname.  It really states which chars aren't allowed. */
	
	var validChars="\[^\\s" + specialChars + "\]"

	/* The following pattern applies if the "user" is a quoted string (in
   	which case, there are no rules about which characters are allowed
   	and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
   	is a legal e-mail address. */

	var quotedUser="(\"[^\"]*\")"

	/* The following pattern applies for domains that are IP addresses,
   	rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
   	e-mail address. NOTE: The square brackets are required. */

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/

	/* The following string represents an atom (basically a series of
   	non-special characters.) */
	
	var atom=validChars + '+'

	/* The following string represents one word in the typical username.
   	For example, in john.doe@somewhere.com, john and doe are words.
   	Basically, a word is either an atom or quoted string. */

	var word="(" + atom + "|" + quotedUser + ")"

	// The following pattern describes the structure of the user

	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")

	/* The following pattern describes the structure of a normal symbolic
   	domain, as opposed to ipDomainPat, shown above. */

	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")


	/* Finally, let's start trying to figure out if the supplied address is
   	valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
   	different pieces that are easy to analyze. */

	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) 
	{
  		/* Too many/few @'s or something; basically, this address doesn't
     		even fit the general mould of a valid e-mail address. */
		alert("Email address seems incorrect (check @ and .'s)")
		return false
	}

	var user=matchArray[1]
	var domain=matchArray[2]

	// See if "user" is valid 

	if (user.match(userPat)==null) 
	{
    		// user is not valid
    		alert("The username doesn't seem to be valid.")
    		return false
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
   	host name) make sure the IP address is valid. */

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
	    	// this is an IP address
	  	for (var i=1;i<=4;i++) 
	  	{
	    		if (IPArray[i]>255) 
	    		{
	        		alert("Destination IP address is invalid!")
				return false
	    		}
    		}
    		return true
	}

	// Domain is symbolic name

	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		alert("The domain name doesn't seem to be valid.")
    		return false
	}

	/* domain name seems valid, but now make sure that it ends in a
   	three-letter word (like com, edu, gov) or a two-letter word,
   	representing country (uk, nl), and that there's a hostname preceding 
   	the domain or country. */

	/* Now we need to break up the domain to get a count of how many atoms
   	it consists of. */

	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length

	if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>3) 
	{
   		// the address must end in a two letter or three letter word.
   		alert("The address must end in a three-letter domain, or two letter country.")
   		return false
	}

	
	// Make sure there's a host name preceding the domain.

	if (len<2) 
	{
   		var errStr="This address is missing a hostname!"
   		alert(errStr)
   		return false
	}

	// If we've gotten this far, everything's valid!
	return true;
}

function checkandsubmit() 
{ 
   	if (!Trim(document.frmMain.txtName.value)) 
   	{
		alert("Please enter your name.");
		document.frmMain.txtName.focus();
		return false;
	}	

	if (!emailCheck(Trim(document.frmMain.txtEmail.value))) 
	{
		//alert("Please enter your email address.");
		document.frmMain.txtEmail.focus();
		return false;
	}
	
	if (!Trim(document.frmMain.txtPhone.value)) 
	{
		alert("Please enter your phone number.");
		document.frmMain.txtPhone.focus();
		return false ;
	}
	
	if (!Trim(document.frmMain.txtQuestion.value)) 
	{
		alert("Please enter your question.");
		document.frmMain.txtQuestion.focus();
		return false ;
	}		
	document.frmMain.submit();
	return;
}

function checkInfoRequest() 
{ 
   	if (!Trim(document.frmMain.consumercontentinforequest1_txtFirstName.value)) 
   	{
		alert("Please enter your first name.");
		document.frmMain.consumercontentinforequest1_txtFirstName.focus();
		return false;
	}	
	if (!Trim(document.frmMain.consumercontentinforequest1_txtLastName.value)) 
	{
		alert("Please enter your last name.");
		document.frmMain.consumercontentinforequest1_txtLastName.focus();
		return false;
	}
	if (!emailCheck(Trim(document.frmMain.consumercontentinforequest1_txtEmail.value))) 
	{
		//alert("Please enter your email address.");
		document.frmMain.consumercontentinforequest1_txtEmail.focus();
		return false;
	}
	
	if (!Trim(document.frmMain.consumercontentinforequest1_txtAddr1.value))
	{
		alert("Please enter your address.")
		document.frmMain.consumercontentinforequest1_txtAddr1.focus();
		return false;
	}
	if (!Trim(document.frmMain.consumercontentinforequest1_txtCity.value))
	{
		alert("Please enter your city.")
		document.frmMain.consumercontentinforequest1_txtCity.focus();
		return false;
	}
	if (!Trim(document.frmMain.consumercontentinforequest1_lstStates.value))
	{
		alert("Please select your state/province.")
		document.frmMain.consumercontentinforequest1_lstStates.focus();
		return false;
	}
	if (!Trim(document.frmMain.consumercontentinforequest1_txtZip.value))
	{
		alert("Please enter your zip.")
		document.frmMain.consumercontentinforequest1_txtZip.focus();
		return false;
	}
	if (!Trim(document.frmMain.consumercontentinforequest1_lstCountries.value))
	{
		alert("Please select your country.")
		document.frmMain.consumercontentinforequest1_lstCountries.focus();
		return false;
	}
	if (!Trim(document.frmMain.consumercontentinforequest1_txtDayPhone.value))
	{
		alert("Please enter your day time phone number.")
		document.frmMain.consumercontentinforequest1_txtDayPhone.focus();
		return false;
	}
	if (document.frmMain.consumercontentinforequest1_optQuestion9_0.checked)
	{
		if (!document.frmMain.consumercontentinforequest1_optAcceptanceValue_0.checked && !document.frmMain.consumercontentinforequest1_optAcceptanceValue_1.checked)
		{
			alert("Please check 'I Agree' or 'I Disagree' to the release terms.")
			document.frmMain.consumercontentinforequest1_optAcceptanceValue_0.focus();
			return false;
		}
	}

	
	document.frmMain.submit();
	return true;
}

function checkformdata() 
{ 
   	if (!Trim(document.frmMain.txtFirstName.value)) 
   	{
		alert("Please enter your first name.");
		document.frmMain.txtFirstName.focus();
		return false;
	}	
	if (!Trim(document.frmMain.txtLastName.value)) 
	{
		alert("Please enter your last name.");
		document.frmMain.txtLastName.focus();
		return false;
	}
	if (!emailCheck(Trim(document.frmMain.txtEmailAddress.value))) 
	{
		//alert("Please enter your email address.");
		document.frmMain.txtEmailAddress.focus();
		return false;
	}
	
	if (!Trim(document.frmMain.txtDayPhone.value))
	{
		alert("Please enter your phone number.");
		document.frmMain.txtDayPhone.focus();
		return false ;
	}
		
	return true;
}

function checkresumedata() 
{ 
   	if (!Trim(document.frmResume.txtFirstName.value)) 
   	{
		alert("Please enter your first name.");
		document.frmResume.txtFirstName.focus();
		return false;
	}	
	if (!Trim(document.frmResume.txtLastName.value)) 
	{
		alert("Please enter your last name.");
		document.frmResume.txtLastName.focus();
		return false;
	}
	if (!emailCheck(Trim(document.frmResume.txtEmailAddress.value))) 
	{
		document.frmResume.txtEmailAddress.focus();
		return false;
	}
	
	if (!Trim(document.frmResume.txtDayPhone.value)) 
	{
		alert("Please enter your phone number.");
		document.frmResume.txtDayPhone.focus();
		return false ;
	}
	
	if (!Trim(document.frmResume.txtResume.value)) 
	{
		alert("Please enter your text-only resume.");
		document.frmResume.txtResume.focus();
		return false ;
	}
		
	return true;
}
// variable to hold reference to XMLHTTP object
var m_oHTTP;

function loadTarget(p_sURL) 
{
   // create instance of a new XMLHTTP object
  m_oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
  if (m_oHTTP != null) 
  {
    // specify callback for loading completion
    m_oHTTP.onreadystatechange = gotTarget;
    // open HTTP connection and send async request
    m_oHTTP.open('GET', p_sURL, true);
    m_oHTTP.send();
  }
  else 
  {
    document.all['spnError'].innerText = 'ERROR: Cannot load next page. Please close window and try again!';
  }
}

function gotTarget() {
  // see if loading is complete
  if (m_oHTTP.readyState == 4) 
  {
    // check if there was an error
    if (m_oHTTP.status == 200) 
    {
      // dump next page content into this page
      document.write(m_oHTTP.responseText);
    }
    else 
    {
      document.all['spnError'].innerText = 'ERROR: Cannot load next page. Please close window and try again!';
    }
  }
}

function checkTestimonial(siteType) 
{ 
	if(siteType == 1)
	{
   		if (!Trim(document.frmTest.TestimonialSubmission1_txtFirstName.value)) 
   		{
			alert("Please enter your first name.");
			document.frmTest.TestimonialSubmission1_txtFirstName.focus();
			return false;
		}	
		
		if (!Trim(document.frmTest.TestimonialSubmission1_txtLastName.value)) 
		{
			alert("Please enter your last name.");
			document.frmTest.TestimonialSubmission1_txtLastName.focus();
			return false;
		}

		if (Trim(document.frmTest.TestimonialSubmission1_ddlbProfDesignation.value) == "") 
		{
			alert("Please select a professional designation.")
			document.frmTest.TestimonialSubmission1_ddlbProfDesignation.focus();
			return false;
		}

		if (Trim(document.frmTest.TestimonialSubmission1_ddlbSpecialty.value) == "") 
		{
			alert("Please select a specialty.")
			document.frmTest.TestimonialSubmission1_ddlbSpecialty.focus();
			return false;
		}
			
		if (Trim(document.frmTest.TestimonialSubmission1_txtEmail.value) == "") 
		{
			alert("Please enter your email address.");
			document.frmTest.TestimonialSubmission1_txtEmail.focus();
			return false;
		}
		if (!emailCheck(Trim(document.frmTest.TestimonialSubmission1_txtEmail.value))) 
		{
			document.frmTest.TestimonialSubmission1_txtEmail.focus();
			return false;
		}

		if (!Trim(document.frmTest.TestimonialSubmission1_txtPhone.value)) 
		{
			alert("Please enter a daytime phone number.")
			document.frmTest.TestimonialSubmission1_txtPhone.focus();
			return false;
		}
			
		if (!Trim(document.frmTest.TestimonialSubmission1_txtTestimonial.value)) 
		{
			alert("Please enter your testimonial.")
			document.frmTest.TestimonialSubmission1_txtTestimonial.focus();
			return false;
		}

		if (!document.frmTest.TestimonialSubmission1_chkAcceptTerms.checked == 1) 
		{
			alert("Please check the Accept Terms check box to submit your testimonial.")
			document.frmTest.TestimonialSubmission1_chkAcceptTerms.focus();
			return false;
		}
	}
	else
	{
		if (!Trim(document.frmTest.TestimonialSubmission2_txtFirstName.value)) 
   		{
			alert("Please enter your first name.");
			document.frmTest.TestimonialSubmission2_txtFirstName.focus();
			return false;
		}	
		
		if (!Trim(document.frmTest.TestimonialSubmission2_txtLastName.value)) 
		{
			alert("Please enter your last name.");
			document.frmTest.TestimonialSubmission2_txtLastName.focus();
			return false;
		}

		if (Trim(document.frmTest.TestimonialSubmission2_ddlbProfDesignation.value) == "") 
		{
			alert("Please select a professional designation.")
			document.frmTest.TestimonialSubmission1_ddlbProfDesignation.focus();
			return false;
		}

		if (Trim(document.frmTest.TestimonialSubmission2_ddlbSpecialty.value) == "") 
		{
			alert("Please select a specialty.")
			document.frmTest.TestimonialSubmission2_ddlbSpecialty.focus();
			return false;
		}
			
		if (Trim(document.frmTest.TestimonialSubmission2_txtEmail.value) == "") 
		{
			alert("Please enter your email address.");
			document.frmTest.TestimonialSubmission2_txtEmail.focus();
			return false;
		}
		if (!emailCheck(Trim(document.frmTest.TestimonialSubmission2_txtEmail.value))) 
		{
			document.frmTest.TestimonialSubmission2_txtEmail.focus();
			return false;
		}

		if (!Trim(document.frmTest.TestimonialSubmission2_txtPhone.value)) 
		{
			alert("Please enter a daytime phone number.")
			document.frmTest.TestimonialSubmission2_txtPhone.focus();
			return false;
		}
			
		if (!Trim(document.frmTest.TestimonialSubmission2_txtTestimonial.value)) 
		{
			alert("Please enter your testimonial.")
			document.frmTest.TestimonialSubmission2_txtTestimonial.focus();
			return false;
		}

		if (!document.frmTest.TestimonialSubmission2_chkAcceptTerms.checked == 1) 
		{
			alert("Please check the Accept Terms check box to submit your testimonial.")
			document.frmTest.TestimonialSubmission2_chkAcceptTerms.focus();
			return false;
		}		
	}	
	
	return true;
}

function checkComment() 
{ 
   	if (!Trim(document.frmMain.Consumercontentcomment1_txtFirstName.value)) 
   	{
		alert("Please enter your first name.");
		document.frmMain.Consumercontentcomment1_txtFirstName.focus();
		return false;
	}
   	if (!Trim(document.frmMain.Consumercontentcomment1_txtLastName.value)) 
   	{
		alert("Please enter your last name.");
		document.frmMain.Consumercontentcomment1_txtLastName.focus();
		return false;
	}	
   	if (!emailCheck(Trim(document.frmMain.Consumercontentcomment1_txtEmailAddress.value))) 
   	{
		document.frmMain.Consumercontentcomment1_txtEmailAddress.focus();
		return false;
	}
   	if (!Trim(document.frmMain.Consumercontentcomment1_txtDayPhone.value)) 
   	{
		alert("Please enter a daytime phone number.")
		document.frmMain.Consumercontentcomment1_txtDayPhone.focus();
		return false;
	}	
   	if (!Trim(document.frmMain.Consumercontentcomment1_txtComments.value)) 
   	{
		alert("Please enter your comment.")
		document.frmMain.Consumercontentcomment1_txtComments.focus();
		return false;
	}
		
	return true;
}

function checksmileregdata() 
{ 
   	if (!Trim(document.SmileReg.txtBusinessName.value)) 
   	{
		alert("Please enter your business's name.");
		document.SmileReg.txtBusinessName.focus();
		return false;
	}

   	if (!Trim(document.SmileReg.txtFirstName.value)) 
   	{
		alert("Please enter your first name.");
		document.SmileReg.txtFirstName.focus();
		return false;
	}	
	if (!Trim(document.SmileReg.txtLastName.value)) 
	{
		alert("Please enter your last name.");
		document.SmileReg.txtLastName.focus();
		return false;
	}
	if (!Trim(document.SmileReg.txtAddress1.value)) 
	{
		alert("Please enter your address.");
		document.SmileReg.txtAddress1.focus();
		return false;
	}	
	if (!Trim(document.SmileReg.ddlbCountry.value)) 
	{
		alert("Please enter your country.");
		document.SmileReg.ddlbCountry.focus();
		return false;
	}	
	if (!Trim(document.SmileReg.txtCity.value)) 
	{
		alert("Please enter your city.");
		document.SmileReg.txtCity.focus();
		return false;
	}	
	if (!Trim(document.SmileReg.ddlbState.value)) 
	{
		alert("Please enter your state or providence.");
		document.SmileReg.ddlbState.focus();
		return false;
	}
	if (!Trim(document.SmileReg.txtZip.value)) 
	{
		alert("Please enter your zip code.");
		document.SmileReg.txtZip.focus();
		return false;
	}	
	if (!emailCheck(Trim(document.SmileReg.txtEmail.value))) 
	{
		document.SmileReg.txtEmail.focus();
		return false;
	}
	
	if (!Trim(document.SmileReg.txtDaytimePhone.value)) 
	{
		alert("Please enter your phone number.");
		document.SmileReg.txtDaytimePhone.focus();
		return false ;
	}
	
	if (!Trim(document.SmileReg.txtUserCount.value)) 
	{
		alert("Please enter the number of users in your office.");
		document.SmileReg.txtUserCount.focus();
		return false ;
	}
		
	return true;
}

function ClearList(List)
{
    for (var i = 0; i < List.options.length; i++) 
    {
        List.options[i].selected = false;

    }
}

function Trim(sString) 
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length - 1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length - 1);
	}
	return sString;
}
//-->