// res_property0012.js
// version 2.0
// 25Jan 2004
// bharris@wyndham.com


function showProperties()
	{
	//var propWin = window.open("lib/properties_select0010.htm","prop","height=256,width=320,menubar=0,directories=0,status=0,toolbar=0,scrollbars=1,left=128,top=128,alwaysRaised=1")
	propWin = window.open("/rates/PropertyList.jsp","prop","height=256,width=320,menubar=0,directories=0,status=0,toolbar=0,scrollbars=1,left=128,top=128,alwaysRaised=1");
	//propWin.document.write(xProp);
	//propWin.document.close();
	propWin.focus();
	}

function validatebrnum()
{
	
	if (document.formProperty.LastName.value.length <=0  && document.formProperty.ByReqNum.value.length > 0)
	{
	   alert("The following information is missing or incorrect:\n  * Last Name" );
	   colorMissingFields2("LastName");
		return false;
	}
	return true;
}

function validatebrname()
{
	
	if (document.formProperty.LastName.value.length > 0 && document.formProperty.ByReqNum.value.length <= 0 )
	{
	   alert("The following information is missing or incorrect:\n  * Wyndham ByRequest Member Number" );
       		colorMissingFields2("ByReqNum");
		return false;
	}
      return true;
}
	
function submitProp()
	{
	
	document.formProperty.submit();
	
	}
	function colorMissingFields2(fdName)
	{
	  var path = eval("document.formProperty." +fdName+ ".style");
		path.backgroundColor = '#FFFFCC';
	}
	
function validateProp() 
	{
	if (document.formProperty.proLabel.value=="Click to select" )
		{
		alert("Please select a property.");
		colorMissingFields2("proLabel");
		}
	else
		{
		 	if (!checkDate(document.formProperty.lstDay.options[document.formProperty.lstDay.selectedIndex].value,document.formProperty.lstMonth.options[document.formProperty.lstMonth.selectedIndex].value,document.formProperty.lstYear.options[document.formProperty.lstYear.selectedIndex].value,false)) 
          	{   			
   			alert("The date you have selected is in the past. Please select another date.");
   			colorMissingFields2("lstDay");
   			colorMissingFields2("lstMonth");
   			colorMissingFields2("lstYear");
   			return;
   	        }
   	        if (!checkDate(document.formProperty.xDepDay.options[document.formProperty.xDepDay.selectedIndex].value,document.formProperty.xDepMonth.options[document.formProperty.xDepMonth.selectedIndex].value,document.formProperty.xDepYear.options[document.formProperty.xDepYear.selectedIndex].value,false)) 
	        {    			
   			alert("The date you have selected is in the past. Please select another date.");
   			colorMissingFields2("xDepDay");
   			colorMissingFields2("xDepMonth");
   			colorMissingFields2("xDepYear");
   			return;
        	}
           if(!compareDate(document.formProperty.lstDay.options[document.formProperty.lstDay.selectedIndex].value,document.formProperty.lstMonth.options[document.formProperty.lstMonth.selectedIndex].value,document.formProperty.lstYear.options[document.formProperty.lstYear.selectedIndex].value,document.formProperty.xDepDay.options[document.formProperty.xDepDay.selectedIndex].value,document.formProperty.xDepMonth.options[document.formProperty.xDepMonth.selectedIndex].value,document.formProperty.xDepYear.options[document.formProperty.xDepYear.selectedIndex].value))
    	  {  
    	    alert("Please enter a departure date that is after the arrival date.");
    	    colorMissingFields2("xDepDay");
   			colorMissingFields2("xDepMonth");
   			colorMissingFields2("xDepYear");    	    
    	    return;
          	}
		 if (document.formProperty.ByReqNum.value == "Number")
	    {
		   document.formProperty.ByReqNum.value = "";
	    }
	    if (document.formProperty.LastName.value == "Last Name")
	    {
		  document.formProperty.LastName.value = "";
	    }
		 if (validatebrnum() && validatebrname())
		  submitProp();
		} 
	}