<!--
function InitFocus()
{
    write.email.focus();
}

function check_submit()
{

  // Check if both field is filled with "something"
  // Validation check is moved to the next page 'login_ok.php' for making use of session
  if(!write.email.value) {alert("Please input your E-mail Address");write.email.focus(); return false;}

  if(write.email.value.indexOf('@') == "-1" || write.email.value.indexOf('.') == "-1") // || 
  {
      alert("Please input your email address correctly");
      write.email.value = ""; 
      write.email.focus(); 
	  return false;
  }
	
  // No error detected  
  return true;
}	 

function survey_canceled()
{
  write.email.value = "";
  write.cnt_code.value = "";
  write.card_no.value = "";
  write.email.focus();
  
  return false;
}

 function FncResultView(){
	var tb;
	
	if ( document.all ) {
		tb = eval(document.all.item("ResultTb"))
	} else {
		tb = eval(document.getElementsByName("ResultTb"))
	}

	if (survey_qualify.place.value == "101"){
		tb[0].style.display=""; tb[1].style.display="none";
	} else if (survey_qualify.place.value == "102"){
		tb[0].style.display="none"; tb[1].style.display="";
	} else {
		tb[0].style.display="none"; tb[1].style.display="none";	
	}
}
 
function survey_qualify_check_submit()
{

  if(!survey_qualify.fname.value) {alert("Please input your First Name");survey_qualify.fname.focus(); return false;}
  if(!survey_qualify.lname.value) {alert("Please input your Last Name");survey_qualify.lname.focus(); return false;}
  if(!survey_qualify.address.value) {alert("Please input your address");survey_qualify.address.focus(); return false;}
  if(!survey_qualify.city.value) {alert("Please input your city");survey_qualify.city.focus(); return false;}
  if(!survey_qualify.phone.value) {alert("Please input your Phone Number");survey_qualify.phone.focus(); return false;}

  // -----------------------------
  // Information Validation Check
  // -----------------------------
    
  // Name Check
  var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
  var temp; 
  temp = survey_qualify.lname.value.substring(0,1); 

// Customer's last name check
  for (var i=0; i<survey_qualify.lname.value.length; i++) { 
    temp = "" + survey_qualify.lname.value.substring(i, i+1); 
    if (valid.indexOf(temp) == "-1") { 
      alert("Your last name cannot include other than English characters");
      survey_qualify.lname.value = ""; 
      survey_qualify.lname.focus(); 
      return false;
    }
  } 
//  Customer's first name check
  var temp2;
  for (var i=0; i<survey_qualify.fname.value.length; i++) { 
    temp2 = "" + survey_qualify.fname.value.substring(i, i+1); 
    if (valid.indexOf(temp2) == "-1") { 
      alert("Your first name cannot include other than English characters");
      survey_qualify.fname.value = ""; 
      survey_qualify.fname.focus(); 
      return false;
    }
  } 
  
  // Phone# Check
  if(survey_qualify.phone.value.length<10||survey_qualify.phone.value.length>13) {
    alert("Please follow the phone number input format (ex.604-123-4567)");
    survey_qualify.phone.focus();
    return false;
  }
  var pvalid = "0123456789-"; 
  var temp3; 
  temp3 = survey_qualify.phone.value.substring(0,1); 

  for (var i=0; i<survey_qualify.phone.value.length; i++) { 
    temp3 = "" + survey_qualify.phone.value.substring(i, i+1); 
    if (pvalid.indexOf(temp3) == "-1") { 
      alert("Please follow the phone number input format (ex.604-123-4567)");
      survey_qualify.phone.value = ""; 
      survey_qualify.phone.focus(); 
      return false;
    }
  } 

  // Visited Day & Time Check
  if(survey_qualify.year.value == "none") {
    alert("Please select the year of Visited Day & Time");
    survey_qualify.year.focus();
    return false;
  }
  if(survey_qualify.month.value == "none") {
    alert("Please select the month of Visited Day & Time");
    survey_qualify.month.focus();
    return false;
  }
  if(survey_qualify.date.value == "none") {
    alert("Please select the day of Visited Day & Time");
    survey_qualify.date.focus();
    return false;
  }
  if(survey_qualify.time.value == "none") {
    alert("Please select the time of Visited Day & Time");
    survey_qualify.time.focus();
    return false;
  }
  if(survey_qualify.ampm.value == "none") {
    alert("Please select the AM or PM of Visited Day & Time");
    survey_qualify.ampm.focus();
    return false;
  }

  if(survey_qualify.place.value == "none") {
    alert("Please select the Visited Place");
    survey_qualify.place.focus();
    return false;
  } else {
	  // Check Radio Button of Visited Place
	   var club=0, academy=0;
	   obj_club = survey_qualify.club;
	   obj_academy = survey_qualify.academy;
   
	   if (survey_qualify.place.value == "101") {
				for (j=0; j < obj_club.length; j++) {
			       if (obj_club[j].checked) club++;
  				}
	
				if (club<1){
	  				alert("Please check for each category under the Country Club.");	
	  				return false;
  				}
		} else {	
				for (j=0; j < obj_academy.length; j++) {
			       if (obj_academy[j].checked) academy++;
  				}
	
				if (academy<1){
	  				alert("Please check for each category under the Academy.");	
	  				return false;
  				}
		}
  }
	
  // No error detected  
  return true;
}

function survey_section_check_submit()
{
  // Check Radio Button
  var checked=0;
  var checked_sec1="";
  var checked_sec2="";
  
  if(survey_section.section.value == "Club") {
  	for (j=1; j<=10; j++) {
  		switch( j )  {
				case 1: obj = survey_section.qsn101; break;
				case 2: obj = survey_section.qsn102; break;
				case 3: obj = survey_section.qsn103; break;
				case 4: obj = survey_section.qsn104; break;
				case 5: obj = survey_section.qsn105; break;
				case 6: obj = survey_section.qsn106; break;
				case 7: obj = survey_section.qsn107; break;
				case 8: obj = survey_section.qsn108; break;
				case 9: obj = survey_section.qsn109; break;
				case 10: obj = survey_section.qsn110; break;
		}
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) checked++;
    	}
   	}
    if (checked<10){
	    alert("Please select one item on the each Country Club 18 Hole Course Question.");	
		return false;
	}
  }
  
  checked=0;		
  if(survey_section.section.value == "Rog") {
  	if(!survey_section.food.value) {alert("Please input what you had to eat");survey_section.food.focus(); return false;}
  	for (j=1; j<=13; j++) {
  		switch( j )  {
				case 1: obj = survey_section.qsn111; break;
				case 2: obj = survey_section.qsn112; break;
				case 3: obj = survey_section.qsn113; break;
				case 4: obj = survey_section.qsn114; break;
				case 5: obj = survey_section.qsn115; break;
				case 6: obj = survey_section.qsn116; break;
				case 7: obj = survey_section.qsn117; break;
				case 8: obj = survey_section.qsn118; break;
				case 9: obj = survey_section.qsn119; break;
				case 10: obj = survey_section.qsn120; break;
				case 11: obj = survey_section.qsn121; break;
				case 12: obj = survey_section.qsn122; break;
				case 13: obj = survey_section.qsn123; break;
		}
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) {
				checked++;
				if ((j == 13) && (obj[i].value == "1" )) checked_sec1="N";
			}	
    	}
   	}
    if (checked<13){
	    alert("Please select one item on the each Rogues Bar & Grill Question.");	
		return false;
	}
	
	checked=0;
	if (checked_sec1 == "N"){
		obj = survey_section.sec1_1_1;
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) checked++;
    	}
		if (checked<1){
	    	alert("Please select one item under the 14th questionnaire about your answer 'No'.");	
			return false;
		}
	}
  }
  
  checked=0;		
  if(survey_section.section.value == "Banq") {
  	for (j=1; j<=9; j++) {
  		switch( j )  {
				case 1: obj = survey_section.qsn124; break;
				case 2: obj = survey_section.qsn125; break;
				case 3: obj = survey_section.qsn126; break;
				case 4: obj = survey_section.qsn127; break;
				case 5: obj = survey_section.qsn128; break;
				case 6: obj = survey_section.qsn129; break;
				case 7: obj = survey_section.qsn130; break;
				case 8: obj = survey_section.qsn131; break;
				case 9: obj = survey_section.qsn132; break;
		}
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) checked++;
    	}
   	}
    if (checked<9){
	    alert("Please select one item on the each Baquets/Weddings Question.");	
		return false;
	}
  }
  
  if(survey_section.section.value == "Range") {
  	for (j=1; j<=9; j++) {
  		switch( j )  {
				case 1: obj = survey_section.qsn133; break;
				case 2: obj = survey_section.qsn134; break;
				case 3: obj = survey_section.qsn135; break;
				case 4: obj = survey_section.qsn136; break;
				case 5: obj = survey_section.qsn137; break;
				case 6: obj = survey_section.qsn138; break;
				case 7: obj = survey_section.qsn139; break;
				case 8: obj = survey_section.qsn140; break;
				case 9: obj = survey_section.qsn141; break;
		}
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) checked++;
    	}
   	}
    if (checked<9){
	    alert("Please select one item on the each Driving Range Question.");	
		return false;
	}
  }
  
  checked=0;		
  if(survey_section.section.value == "Haz") {
  	if(!survey_section.food.value) {alert("Please input what you had to eat");survey_section.food.focus(); return false;}
  	for (j=1; j<=13; j++) {
  		switch( j )  {
				case 1: obj = survey_section.qsn142; break;
				case 2: obj = survey_section.qsn143; break;
				case 3: obj = survey_section.qsn144; break;
				case 4: obj = survey_section.qsn145; break;
				case 5: obj = survey_section.qsn146; break;
				case 6: obj = survey_section.qsn147; break;
				case 7: obj = survey_section.qsn148; break;
				case 8: obj = survey_section.qsn149; break;
				case 9: obj = survey_section.qsn150; break;
				case 10: obj = survey_section.qsn151; break;
				case 11: obj = survey_section.qsn152; break;
				case 12: obj = survey_section.qsn153; break;
				case 13: obj = survey_section.qsn154; break;
		}
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) {
				checked++;
				if ((j == 13) && (obj[i].value == "1" )) checked_sec2="N";
			}	
    	}
   	}
    if (checked<13){
	    alert("Please select one item on the each Hazards Question.");	
		return false;
	}
	
	checked=0;
	if (checked_sec2 == "N"){
		obj = survey_section.sec1_2_1;
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) checked++;
    	}
		if (checked<1){
	    	alert("Please select one item under the 14th questionnaire about your answer 'No'.");	
			return false;
		}
	}
  }
  
  checked=0;		
  if(survey_section.section.value == "Hole") {
  	for (j=1; j<=7; j++) {
  		switch( j )  {
				case 1: obj = survey_section.qsn155; break;
				case 2: obj = survey_section.qsn156; break;
				case 3: obj = survey_section.qsn157; break;
				case 4: obj = survey_section.qsn158; break;
				case 5: obj = survey_section.qsn159; break;
				case 6: obj = survey_section.qsn160; break;
				case 7: obj = survey_section.qsn161; break;
		}
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) checked++;
    	}
   	}
    if (checked<7){
	    alert("Please select one item on the each 9 Hole Course Question.");	
		return false;
	}
  }
	
  checked=0;		
  if(survey_section.section.value == "End") {
  	for (j=1; j<=11; j++) {
  		switch( j )  {
				case 1: obj = survey_section.sec4_1; break;
				case 2: obj = survey_section.sec4_2; break;
				case 3: obj = survey_section.sec4_3; break;
				case 4: obj = survey_section.sec4_4; break;
				case 5: obj = survey_section.qsn162; break;
				case 6: obj = survey_section.qsn163; break;
				case 7: obj = survey_section.qsn164; break;
				case 8: obj = survey_section.qsn165; break;
				case 9: obj = survey_section.qsn166; break;
				case 10: obj = survey_section.qsn167; break;
				case 11: obj = survey_section.sec4_5; break;
		}
		for (i=0; i < obj.length; i++) {
        	if (obj[i].checked) checked++;
    	}
   	}
    if (checked<11){
	    alert("Please select one item on the each Ending General Question.");	
		return false;
	}
	survey_section.con.value = "1";
  }
  	
  // No error detected 
  return true;
}

function ErrHandler(ErrDesc)
    {
        alert(ErrDesc);
        return false;   
    }

function hasValue(obj,type)
    {
    if (type == "TEXT" || type == "PASSWORD")
        {
        if (obj.value.length == 0) 
                return false;
        else 
                return true;
        }
    else if (type == "SELECT")
        {
        for (i=0; i < obj.length; i++)
                {
                if (obj.options[i].selected && obj.options[i].value != "")
                        return true;
                }
        return false;   
        }
    else if (type == "SINGLE_VALUE_RADIO" || type == "SINGLE_VALUE_CHECKBOX")
        {
                if (obj.checked)
                        return true;
                else
                return false;   
        }
    else if (type == "RADIO" || type == "CHECKBOX")
        {

        for (i=0; i < obj.length; i++)
                {
                if (obj[i].checked)
                        return true;
                }

        return false;   
        }
        }

function  ValidateForm(frm)
{
    if  (!hasValue(frm.Subsubject, "SELECT" )) 
        {
              if  (!ErrHandler("Subject is a required field."))
              {
              frm.Subsubject.focus();
              return false; 
              }
        }
   if  (!hasValue(frm.FirstName, "TEXT" )) 
           {
        if  (!ErrHandler("First name is a required field."))
               {
               frm.FirstName.focus();
            return false; 
            }

        }


    if  (!hasValue(frm.LastName, "TEXT" )) 

        {
        if  (!ErrHandler("Last name is a required field."))
            {
                        frm.LastName.focus();
            return false; 
            }
        }

    if  (!hasValue(frm.Email, "TEXT" )) 
        {
        if  (!ErrHandler("E-mail is a required field."))
            {
            frm.Email.focus();
            return false; 
            }
        }
        if  (!hasValue(frm.StreetAddress, "TEXT" )) 
        {
        if  (!ErrHandler("StreetAddress is a required field."))
            {
                        frm.StreetAddress.focus();
            return false; 
            }
        }
    if  (!hasValue(frm.City, "TEXT" )) 
        {
        if  (!ErrHandler("City is a required field."))
            {
                        frm.City.focus();
            return false; 
            }
        }

    if  (!hasValue(frm.Zip, "TEXT" )) 
        {
        if  (!ErrHandler("Zip/Postal Code is a required field."))
            {
                        frm.Zip.focus();
            return false; 
            }
        }
		
    if  (!hasValue(frm.Phone, "TEXT" )) 
    {
    if  (!ErrHandler("Phone is a required field."))
        {
                frm.Phone.focus();
        return false; 
        }
    }
 return true;
    }

	// VARIABLE DECLARATIONS
	var digits				  = new String("0123456789");
	var phoneNumberDelimiters = new String("()-+ ");	// non-digit characters which are allowed in phone numbers
	var digitsInNAPhoneNumber = 10;						// North American Phone Number is 10 digits
	var today				  = new Date();
	var day					  = today.getDate()
	var month				  = today.getMonth()
	var year				  = y2k(today.getYear())
	var whichOne			  = 0;
	var browser				  = navigator.appName;
			
	function CheckPhoneNumber(sPhone)
	{
		if (!isPhoneNumber(sPhone.value) && sPhone.value != "")
		{
			sPhone.value = "";
			sPhone.focus();
			alert("Please enter a valid Phone Number.");
			return false;
		}	
	if (sPhone.value.length < 10 && sPhone.value != "")
		{
			sPhone.value = "";
			sPhone.focus();
			alert("Please enter a 10 Digit Phone Number.");
		}
		return true;
	}
		
	function isPhoneNumber(sfield)
	{  
		var inputStr = sfield.toString();
		var bErr	 = true;
					
		if (sfield != "")
		{
			for (var i = 0; i < inputStr.length; i++)
			{
				var oneChar = inputStr.charAt(i)			
					
				//If the character doesn't exist in the numeric string or the accepted characters.
				if (digits.indexOf(oneChar) == -1 &&
					phoneNumberDelimiters.indexOf(oneChar) == -1)
					bErr = false;
			}
		}
					
		return bErr;
	}

	function trim(strText) 
	{ 
		// this will get rid of leading spaces 
		//alert("This is trim");
		while (strText.substring(0,1) == ' ') 
			strText = strText.substring(1, strText.length);

		// this will get rid of trailing spaces 
		while (strText.substring(strText.length-1,strText.length) == ' ')
			strText = strText.substring(0, strText.length-1);

		return strText;
	} 

	function y2k(number)    { return (number < 1000) ? number + 1900 : number; }
	function padout(number) { return (number < 10) ? '0' + number : number; }

	function restart() 
	{
		if (browser == "Netscape")
			document.Content.document.frmMain.elements["txtDate" + whichOne].value = '' + padout(month - 0 + 1) + '/' + padout(day) + '/' + year;
		else
		    document.frmMain.elements["txtDate" + whichOne].value = '' + padout(month - 0 + 1) + '/' + padout(day) + '/' + year;
	    
	    mywindow.close();
	}

	function ShowCalendar(sfield) 
	{ 
		whichOne			   = sfield;
	    mywindow			   = open('PopupCalendar.htm','Calendar','resizable=no,width=350,height=270');
	    mywindow.location.href = '../Includes/PopupCalendar.htm';
				    
	    if (mywindow.opener == null) 
			mywindow.opener = self;
	}	

	function CheckEmail(sEmail)
	{
		if (!isEmail(sEmail.value) && sEmail.value != "")
		{
			sEmail.value = "";
			sEmail.focus();
			
			alert("Please enter a valid email address.");
		}
	}
		
	function isEmail(sEmail)
	{   var i		= 1;
		var j		= 0;
	    var sLength = sEmail.length;

		for(j=0; j< sLength; j++)
		{	
			if (sEmail.charAt(j) == " ")
				return false;
		}

	    while ((i < sLength) && (sEmail.charAt(i) != "@"))
			i++
					

	    if ((i >= sLength) || (sEmail.charAt(i) != "@")) 
			return false;
	    else 
			i += 2;

	    while ((i < sLength) && (sEmail.charAt(i) != "."))
			i++
			    
	    if ((i >= sLength - 1) || (sEmail.charAt(i) != ".")) 
			return false;
	    else 
			return true;
	}

	function IsNum(sfield)
	{
		//Checks if value enter is Numeric.  If not it clears the field.
				
		if (trim(sfield.value) != "" && isNaN(sfield.value))
		{
			sfield.value = 1;
			sfield.focus();
			alert("Please enter a numeric value.");	
			return false;
		}
		
		return true;
	}
			
	function isSSN(sField) 
	{
		var strMsg1 = "Please enter valid SSN Number."
		var re	  = /^[0-9]{3}-[0-9]{2}-[0-9]{4}$/
		
		if (sField.value != "")
		{
			if (!re.test(sField.value))
			{  
				alert(strMsg1);
				sField.focus();
				return false;
			}	
		}
				
		return true;	
	}

	function IsBlank(field)
	{
		if (field.value == "")
		{
			field.focus();
			alert("Please enter a value.");
		}
	}	
		
	function CheckDate(sField) 
	{
		if (sField.value == "")
			return true;

		if (IsDate(sField) == false)
		{
			sField.value = "";
			alert("Please enter a valid date.");
			sField.focus();
			return false;
		}
		else 
			return true;
	}
		
	function IsDate(sField)
	{
		var strDate  = sField.value;
		var intDay   = "";
		var intMonth = "";
		var intYear  = "";
		var pos;
		
		pos		 = strDate.indexOf("/");
		strMonth = strDate.substr(0, pos);
		strDate  = strDate.slice(pos + 1, strDate.length)
		pos		 = strDate.indexOf("/");
		strDay	 = strDate.substr(0, pos);
		strDate  = strDate.slice(pos + 1, strDate.length)
		strYear  = strDate;
		intDay	 = parseInt(strDay, 10);
		intMonth = parseInt(strMonth, 10);
		intYear  = parseInt(strYear, 10);		

		if (isNaN(intDay)) 
			return false;

		if (isNaN(intMonth)) 
			return false;

		if (isNaN(intYear)) 
			return false;

		if (intMonth > 12 || intMonth < 1) 
			return false;		
			
		if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || 
			intMonth == 10 || intMonth == 12) && (intDay > 31 || intDay < 1)) 
			return false;
			
		if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intDay > 30 || intDay < 1)) 
			return false;

		if (intMonth == 2) 
		{
			if (intDay < 1) 
				return false;
			
			if (LeapYear(intYear) == true) 
			{
				if (intDay > 29) 
					return false;
			}
			else 
			{
				if (intDay > 28) 
					return false;
			}
		}
		
		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 DateCheck(from, to) 
	{
		if (Date.parse(from) > Date.parse(to)) 
			return true;
		else 
			return false;
	}
	
	
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//-->