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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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 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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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];}
}


/*to validate contact us inquiry form in general_contactus_inquiry.asp*/
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;
			}
	}



////////BEGINNING OF DATE VALIDATION////////////////////////////////////
/**
 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;
var errMsgDate='';
var empty='';
function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		errMsgDate='The Format for Date Should be : mm/dd/yyyy. \n';
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		errMsgDate='Please Enter a Valid Month. \n';
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		errMsgDate='Please Enter a Valid Day. \n';
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		errMsgDate='Please Enter a Valid 4 digit Year Between '+minYear+' and '+maxYear+'. \n';
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		errMsgDate='Please Enter a Valid Date. \n';
		return false
	}
return true
}

//Function to call for validating Date
function ValidateDate(datevalue){
	var dt=datevalue
	if (isDate(dt)==false)
		{
			return errMsgDate;
		}
	else
		{
			return empty;
		}
 }
////////////END OF DATE VALIDATION/////////////////////////////////////////


function sel_cat()
{
window.document.form1.action = "category_select.asp" ;
window.document.form1.submit();
}

function sel_cat_type()
{
window.document.form1.action = "category_type_select.asp" ;
window.document.form1.submit();
}

function sel_port_cat()
{
window.document.form1.action = "portal_category_select.asp" ;
window.document.form1.submit();
}

function sel_port_cat_type()
{
window.document.form1.action = "portal_category_type_select.asp" ;
window.document.form1.submit();
}

function sel_event_cat()
{
window.document.form2.action = "event_category_select.asp" ;
window.document.form2.submit();
}
function sel_event_type()
{
window.document.form2.action = "event_type_select.asp" ;
window.document.form2.submit();
}

function sub_forms()
{
window.document.main_event_form.action="event_list.asp";
window.document.main_event_form.submit();
}
function validate()
{
var x = new Date(window.document.callingform.startdate.value);
var y = new Date(window.document.callingform.enddate.value);

if (window.document.callingform.startdate.value == "")
{
return ! alert("Please enter an arrival date.")
}
if (window.document.callingform.enddate.value == "")
{
return ! alert("Please enter a detapture date. If You are departing the same day, select the Next day")
}
if (x > y)
{
return ! alert("departure date cannot be less than arrival date")
}
if (window.document.callingform.startdate.value == window.document.callingform.enddate.value)
{
return ! alert("departure date cannot be same arrival date")
}
}


function validate_res_cl()
{
if (window.document.callingform.Promo_Client_ID.value == "")
{
document.callingform.Promo_Client_ID.focus();
document.callingform.Promo_Client_ID.style.backgroundColor = "ffffcc"
return ! alert("Please select a property.")
}

var x = new Date(window.document.callingform.startdate.value);
var y = new Date(window.document.callingform.enddate.value);

if (window.document.callingform.startdate.value == "")
{
return ! alert("Please enter an arrival date.")
}
if (window.document.callingform.enddate.value == "")
{
return ! alert("Please enter a detapture date. If You are departing the same day, select the Next day")
}
if (x > y)
{
return ! alert("departure date cannot be less than arrival date")
}
if (window.document.callingform.startdate.value == window.document.callingform.enddate.value)
{
return ! alert("departure date cannot be same arrival date")
}
}

function validate_empform()
    {
	
       if (window.document.emp_form.Job_Title.value == "")
       {
          window.document.emp_form.Job_Title.focus();
          window.document.emp_form.Job_Title.style.backgroundColor = "ffffcc"
          return !(alert ("please select a job position."));
       }   
	
       if (window.document.emp_form.First_Name.value == "")
       {
          window.document.emp_form.First_Name.focus();
          window.document.emp_form.First_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter First Name"));
       }   
       if (window.document.emp_form.Last_Name.value == "")
       {
          window.document.emp_form.Last_Name.focus();
		  window.document.emp_form.Last_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter last name"));
	   }
		if (window.document.emp_form.Email.value == "")
       {
          window.document.emp_form.Email.focus();
		  window.document.emp_form.Email.style.backgroundColor = "ffffcc"
          return !(alert ("please enter an email address"));
	   }
		if (window.document.emp_form.Address_1.value == "")
       {
          window.document.emp_form.Address_1.focus();
		  window.document.emp_form.Address_1.style.backgroundColor = "ffffcc"
          return !(alert ("please enter address"));
	   }
		if (window.document.emp_form.City.value == "")
       {
          window.document.emp_form.City.focus();
		  window.document.emp_form.City.style.backgroundColor = "ffffcc"
          return !(alert ("please enter a city"));
	   }
		if (window.document.emp_form.State.value == "")
       {
          window.document.emp_form.State.focus();
		  window.document.emp_form.State.style.backgroundColor = "ffffcc"
          return !(alert ("please select a state"));
	   }
		if (window.document.emp_form.Zip_Code.value == "")
       {
          window.document.emp_form.Zip_Code.focus();
		  window.document.emp_form.Zip_Code.style.backgroundColor = "ffffcc"
          return !(alert ("please enter zipcode"));
	   }
	   if (window.document.emp_form.Country.value == "")
       {
          window.document.emp_form.Country.focus();
		  window.document.emp_form.Country.style.backgroundColor = "ffffcc"
          return !(alert ("please select Country"));
	   }

	   if (window.document.emp_form.SS_number.value == "")
       {
          window.document.emp_form.SS_number.focus();
		  window.document.emp_form.SS_number.style.backgroundColor = "ffffcc"
          return !(alert ("please enter your social security number"));
	   }


		if (window.document.emp_form.Phone_Area_Code.value == "")
       {
          window.document.emp_form.Phone_Area_Code.focus();
		  window.document.emp_form.Phone_Area_Code.style.backgroundColor = "ffffcc"
          return !(alert ("please enter the area code"));
	   }

		if (window.document.emp_form.Phone_1.value == "")
       {
          window.document.emp_form.Phone_1.focus();
		  window.document.emp_form.Phone_1.style.backgroundColor = "ffffcc"
          return !(alert ("please enter phone number"));
	   }
		if (window.document.emp_form.Phone_2.value == "")
       {
          window.document.emp_form.Phone_2.focus();
		  window.document.emp_form.Phone_2.style.backgroundColor = "ffffcc"
          return !(alert ("please enter phone number"));
	   }
var cmts;
cmts = window.document.emp_form.Qualifications.value;
cmts = cmts.replace(/"/g,"''");
window.document.emp_form.Qualifications.value = cmts;
}


function Validate_Group_Form()
{
      if (window.document.group_form.First_Name.value == "")
       {
          window.document.group_form.First_Name.focus();
          window.document.group_form.First_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter First Name"));
       }   
       if (window.document.group_form.Last_Name.value == "")
       {
          window.document.group_form.Last_Name.focus();
		  window.document.group_form.Last_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter last name"));
	   }
		if (window.document.group_form.Email.value == "")
       {
          window.document.group_form.Email.focus();
		  window.document.group_form.Email.style.backgroundColor = "ffffcc"
          return !(alert ("please enter an email address"));
	   }


		if (window.document.group_form.Email.value != "")
		{
		errMsg=ValidateEmail(window.document.group_form.Email.value);
		if (errMsg != "")
		{
         window. document.group_form.Email.focus();
		 window. document.group_form.Email.style.backgroundColor = "ffffcc"
         return ! alert ("please enter a valid email address");
		//  return false;
		}	
		}
	   
		if (window.document.group_form.Company_Name.value == "")
       {
          window.document.group_form.Company_Name.focus();
		  window.document.group_form.Company_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter your company/organization name"));
	   }
	   
		if (window.document.group_form.Address_1.value == "")
       {
          window.document.group_form.Address_1.focus();
		  window.document.group_form.Address_1.style.backgroundColor = "ffffcc"
          return !(alert ("please enter address"));
	   }
		if (window.document.group_form.City.value == "")
       {
          window.document.group_form.City.focus();
		  window.document.group_form.City.style.backgroundColor = "ffffcc"
          return !(alert ("please enter a city"));
	   }
		if (window.document.group_form.State.value == "")
       {
          window.document.group_form.State.focus();
		  window.document.group_form.State.style.backgroundColor = "ffffcc"
          return !(alert ("please select a state"));
	   }
		if (window.document.group_form.Zip_Code.value == "")
       {
          window.document.group_form.Zip_Code.focus();
		  window.document.group_form.Zip_Code.style.backgroundColor = "ffffcc"
          return !(alert ("please enter zipcode"));
	   }
	   if (window.document.group_form.Country.value == "")
       {
          window.document.group_form.Country.focus();
		  window.document.group_form.Country.style.backgroundColor = "ffffcc"
          return !(alert ("please select Country"));
	   }
	   if (window.document.group_form.Phone_AreaCode.value == "")
       {
          window.document.group_form.Phone_AreaCode.focus();
		  window.document.group_form.Phone_AreaCode.style.backgroundColor = "ffffcc"
          return !(alert ("please enter an area code"));
	   }
	   if (window.document.group_form.Phone_1.value == "")
       {
          window.document.group_form.Phone_1.focus();
		  window.document.group_form.Phone_1.style.backgroundColor = "ffffcc"
          return !(alert ("please enter a phone number"));
	   }
	   if (window.document.group_form.Phone_2.value == "")
       {
          window.document.group_form.Phone_2.focus();
		  window.document.group_form.Phone_2.style.backgroundColor = "ffffcc"
          return !(alert ("please enter a phone number"));
	   }
	   
	   if (window.document.group_form.Group_Name.value == "")
       {
          window.document.group_form.Group_Name.focus();
		  window.document.group_form.Group_Name.style.backgroundColor = "ffffcc"
          return !(alert ("please enter a Group Name"));
	   }
	   
	   if (window.document.group_form.Group_Type.value == "")
       {
          window.document.group_form.Group_Type.focus();
		  window.document.group_form.Group_Type.style.backgroundColor = "ffffcc"
          return !(alert ("please select a Group Type"));
	   }
	   
	   if (window.document.group_form.Preference.value == "")
       {
          window.document.group_form.Preference.focus();
		  window.document.group_form.Preference.style.backgroundColor = "ffffcc"
          return !(alert ("please select a Preference"));
	   }


	   if (window.document.group_form.Arrival_Date.value == "")
       {
          window.document.group_form.Arrival_Date.focus();
		  window.document.group_form.Arrival_Date.style.backgroundColor = "ffffcc"
          return !(alert ("please enter an Arrival Date"));
	   }


	   if (window.document.group_form.Arrival_Date.value != "")
       {
				alertmsg =ValidateDate(document.group_form.Arrival_Date.value);
							if (alertmsg != "" )
				{
				window.document.group_form.Arrival_Date.focus();
				window.document.group_form.Arrival_Date.style.backgroundColor = "ffffcc";
				  return !(alert (alertmsg));
				}

		}
		
	   if (window.document.group_form.Departure_Date.value == "")
       {
          window.document.group_form.Departure_Date.focus();
		  window.document.group_form.Departure_Date.style.backgroundColor = "ffffcc"
          return !(alert ("please enter a Departure Date"));
	   }


	   if (window.document.group_form.Departure_Date.value != "")
       {
				alertmsg =ValidateDate(document.group_form.Departure_Date.value);
							if (alertmsg != "" )
				{
				window.document.group_form.Departure_Date.focus();
				window.document.group_form.Departure_Date.style.backgroundColor = "ffffcc";
				  return !(alert (alertmsg));
				}

		}



var x = new Date(window.document.group_form.Arrival_Date.value);
var y = new Date(window.document.group_form.Departure_Date.value);
if (x > y)
{
window.document.group_form.Departure_Date.focus();
window.document.group_form.Departure_Date.style.backgroundColor = "ffffcc";
return ! alert("departure date cannot be less than arrival date")
}



	   if (window.document.group_form.Alt_Arrival_Date.value != "")
       {
				alertmsg =ValidateDate(document.group_form.Alt_Arrival_Date.value);
							if (alertmsg != "" )
				{
				window.document.group_form.Alt_Arrival_Date.focus();
				window.document.group_form.Alt_Arrival_Date.style.backgroundColor = "ffffcc";
				  return !(alert (alertmsg));
				}

		}


	   if (window.document.group_form.Alt_Departure_Date.value != "")
       {
				alertmsg =ValidateDate(document.group_form.Alt_Departure_Date.value);
							if (alertmsg != "" )
				{
				window.document.group_form.Alt_Departure_Date.focus();
				window.document.group_form.Alt_Departure_Date.style.backgroundColor = "ffffcc";
				  return !(alert (alertmsg));
				}

		}
	   
var a = new Date(window.document.group_form.Alt_Arrival_Date.value);
var b = new Date(window.document.group_form.Alt_Departure_Date.value);
if (a > b)
{
window.document.group_form.Alt_Departure_Date.focus();
window.document.group_form.Alt_Departure_Date.style.backgroundColor = "ffffcc";
return ! alert("Alternate departure date cannot be less than alternate arrival date")
}
	   
	   var comString ;
	   comString= new String(window.document.group_form.Comments.value);
	   if (comString.length > 4000)
       {
          window.document.group_form.Comments.focus();
		  window.document.group_form.Comments.style.backgroundColor = "ffffcc"
          return !(alert ("the maximum for the the comments field is 4000 characters"));
	   }

	   
}

function sub_btn(btn)
{
document.group_form.Btn.value = btn;
}