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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

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];}
}
function sel_cat()
{
form1.action = "category_select.asp" 
form1.submit()
}
function sel_cat_type()
{
form1.action = "category_type_select.asp" 
form1.submit()
}

function sel_event_cat()
{
form2.action = "event_category_select.asp" ;
form2.submit();
}
function sel_event_type()
{
form2.action = "event_type_select.asp" ;
form2.submit();
}
function validate()
{
var x = new Date(callingform.startdate.value);
var y = new Date(callingform.enddate.value);

if (callingform.startdate.value == "")
{
return ! alert("Please enter an arrival date.")
}
if (callingform.enddate.value == "")
{
return ! alert("Please enter a departure date. If You are departing the same day, select the Next day")
}
if (x > y)
{
return ! alert("Depature date cannot be less than arrival date")
}
if (callingform.startdate.value == callingform.enddate.value)
{
return ! alert("Depature date cannot be same arrival date")
}
}

function AddToFaves_hp(){
	var is_4up = parseInt(navigator.appVersion);
	var is_mac   = navigator.userAgent.toLowerCase().indexOf("mac")!=-1;
	var is_ie   = navigator.userAgent.toLowerCase().indexOf("msie")!=-1;
	var thePage = location.href;
	if (thePage.lastIndexOf('#')!=-1)
		thePage = thePage.substring(0,thePage.lastIndexOf('#'));
	if (is_ie && is_4up && !is_mac) 
		window.external.AddFavorite(thePage,document.title);
	else if (is_ie || document.images)
		booker_hp = window.open(thePage,'booker_','menubar,width=325,height=100,left=140,top=60');
	}

var errMsgEmail='';
var empty='';

function echeck(str)
	{

		var at='@';
		var dot='.';
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		
		if (str.indexOf(at)==-1)
			{
				errMsgEmail='Invalid E-mail Address. \n'
				return false
			}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
			{
				errMsgEmail='Invalid E-mail Address. \n'
				return false
			}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr)
			{
				errMsgEmail='Invalid E-mail Address. \n'
				return false
			}
		 if (str.indexOf(at,(lat+1))!=-1)
			{
				errMsgEmail='Invalid E-mail Address. \n'
				return false
			}
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)
			{
				errMsgEmail='Invalid E-mail Address. \n'
				return false
			}
		 if (str.indexOf(dot,(lat+2))==-1)
			{
				errMsgEmail='Invalid E-mail Address. \n'
				return false
			}
		 if (str.indexOf(" ")!=-1)
			{
				errMsgEmail='Invalid E-mail Address. \n'
				return false
			}
			
 		 return true					
	}

function ValidateEmail(emailvalue)
	{
		var emailID=emailvalue
	
		if ((emailID==null)||(emailID==""))
			{
				errMsgEmail='Please Enter an Email Address. \n';
				return errMsgEmail;
			}
		if (echeck(emailID)==false)
			{
			return errMsgEmail;
			}
		else
			{
				return empty;
			}
	}



function Validate_Member_Form()
{
      if (window.document.Member_Form.Member_Name.value == "")
       {
          window.document.Member_Form.Member_Name.focus();
          window.document.Member_Form.Member_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter Member Name"));
       }   

      if (window.document.Member_Form.Member_Password.value == "")
       {
          window.document.Member_Form.Member_Password.focus();
          window.document.Member_Form.Member_Password.style.backgroundColor = "ffffcc"
          return !(alert ("please enter Password"));
       }   

      if (window.document.Member_Form.C_Member_Password.value == "")
       {
          window.document.Member_Form.C_Member_Password.focus();
          window.document.Member_Form.C_Member_Password.style.backgroundColor = "ffffcc"
          return !(alert ("please confirm your password"));
       }   
		
      if (window.document.Member_Form.Member_Password.value != "" && window.document.Member_Form.C_Member_Password.value != "")
       {
	         if (window.document.Member_Form.Member_Password.value != window.document.Member_Form.C_Member_Password.value)
				{
					window.document.Member_Form.C_Member_Password.focus();
					window.document.Member_Form.C_Member_Password.style.backgroundColor = "ffffcc"
					return !(alert ("Your passwords did not match"));
				}		  
       }   

      if (window.document.Member_Form.Question_ID.value == "")
       {
          window.document.Member_Form.Question_ID.focus();
          window.document.Member_Form.Question_ID.style.backgroundColor = "ffffcc"
          return !(alert ("please select a hint question"));
       }   

      if (window.document.Member_Form.Forgot_Answer.value == "")
       {
          window.document.Member_Form.Forgot_Answer.focus();
          window.document.Member_Form.Forgot_Answer.style.backgroundColor = "ffffcc"
          return !(alert ("please enter an answer to your hint question"));
       }   

      if (window.document.Member_Form.First_Name.value == "")
       {
          window.document.Member_Form.First_Name.focus();
          window.document.Member_Form.First_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter First Name"));
       }   
       if (window.document.Member_Form.Last_Name.value == "")
       {
          window.document.Member_Form.Last_Name.focus();
		  window.document.Member_Form.Last_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter last name"));
	   }
		if (window.document.Member_Form.Email.value == "")
       {
          window.document.Member_Form.Email.focus();
		  window.document.Member_Form.Email.style.backgroundColor = "ffffcc"
          return !(alert ("please enter an email address"));
	   }


		if (window.document.Member_Form.Email.value != "")
		{
		errMsg=ValidateEmail(window.document.Member_Form.Email.value);
		if (errMsg != "")
		{
         window. document.Member_Form.Email.focus();
		 window. document.Member_Form.Email.style.backgroundColor = "ffffcc"
         return ! alert ("please enter a valid email address");
		}	
		}
	   
	/*	if (window.document.Member_Form.Company_Name.value == "")
       {
          window.document.Member_Form.Company_Name.focus();
		  window.document.Member_Form.Company_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter your company/organization name"));
	   }
	*/   
		if (window.document.Member_Form.Address_1.value == "")
       {
          window.document.Member_Form.Address_1.focus();
		  window.document.Member_Form.Address_1.style.backgroundColor = "ffffcc"
          return !(alert ("please enter address"));
	   }
		if (window.document.Member_Form.City.value == "")
       {
          window.document.Member_Form.City.focus();
		  window.document.Member_Form.City.style.backgroundColor = "ffffcc"
          return !(alert ("please enter a city"));
	   }
		if (window.document.Member_Form.State.value == "")
       {
          window.document.Member_Form.State.focus();
		  window.document.Member_Form.State.style.backgroundColor = "ffffcc"
          return !(alert ("please select a state"));
	   }

	   if (window.document.Member_Form.Country.value == "")
       {
          window.document.Member_Form.Country.focus();
		  window.document.Member_Form.Country.style.backgroundColor = "ffffcc"
          return !(alert ("please select Country"));
	   }
	   
		if (window.document.Member_Form.Zip_Code.value == "")
       {
          window.document.Member_Form.Zip_Code.focus();
		  window.document.Member_Form.Zip_Code.style.backgroundColor = "ffffcc"
          return !(alert ("please enter zipcode"));
	   }

}


function New_Member_Form_Vaildate()
{
		if (window.document.New_Member_Form.Email.value == "")
		{
				  window.document.New_Member_Form.Email.style.backgroundColor = "ffffcc";
				  window.document.New_Member_Form.Email.focus();
				  return !(alert ("you must enter your email address"));
		}
		
		if (window.document.New_Member_Form.Email.value != "")
		{
		errMsg=ValidateEmail(window.document.New_Member_Form.Email.value);
		if (errMsg != "")
		{
         window. document.New_Member_Form.Email.focus();
         window. document.New_Member_Form.Email.select();
		 window. document.New_Member_Form.Email.style.backgroundColor = "ffffcc"
         return ! alert ("please enter a valid email address");
		}	
		}
}		


function clearDefault(el) {
if (el.defaultValue==el.value) el.value = ""
}

function validate_survey_form()
{
	len = document.survey_form.Question_ID.length;
	if (isNaN(len))
	{
	qid=document.survey_form.Question_ID.value;
	qidlen = qid.length
	strlen = 12+qidlen
	 var string
	 var empty = true
	 var aInput = document.body.getElementsByTagName("INPUT");
	 for(i=0;i<aInput.length;i++)
	 {
		string = aInput[i].id.substring(0, strlen);
		strch = "Question_ID_"+qid
		if (string==strch&&aInput[i].checked==true)
		{
			empty = false
		}
	 }
			if (empty) 
			{
				return ! alert("Please Select Atleast One Answer for each of the questions");
			} 
	}
	else
	
{
for(j=0;j<len;j++)
{
qid=document.survey_form.Question_ID(j).value;
qidlen = qid.length
strlen = 12+qidlen
 var string
 var empty = true
 var aInput = document.body.getElementsByTagName("INPUT");
 for(i=0;i<aInput.length;i++)
 {
 	string = aInput[i].id.substring(0, strlen);
	strch = "Question_ID_"+qid
		if (string==strch&&aInput[i].checked==true)
		{
			empty = false
		}
 }
 		if (empty) 
		{
				return ! alert("Please Select Atleast One Answer for each of the questions");
 		} 
	}
}
}