//KENTS MACHINE
//var secureURLStart = "https://www.keysforrent.com/";
//var URLStart = "http://www.keysforrent.com/";


//PROD VIA IP
//var secureURLStartCotCon = "https://www.cottageconnection.com";
//var URLStartCotCon = "http://www.cottageconnection.com";
//LOCAL VIA IP
var secureURLStartCotCon = "https://localhost:8443/CottageConnection";
var URLStartCotCon = "http://localhost:8080/CottageConnection";

//CHADS LOCAL PC
var secureURLStart = "https://localhost:8443/KeysForRent/";
var URLStart = "http://localhost:8080/KeysForRent/";

/* Current selected List row.*/
var selectedRow = null;

/* Current table List row.*/
var selectedTableRow = null;

/* variable for state/province code */
var stateProvCode = 99;

/* MultiUnit Rates Subwindow */
var ratesSubWin = null;
var popupWin = null;

/* MultiUnit RoomNames Subwindow */
var roomNamesSubWin = null; 

/* Hold the current listing ID */
var listingID = 0;
   
/* Hold the curretn Subunit ID */
var subUnitID = 0;

/* Hold the Current Room ID */
var roomId = 0;

/* Hold the owner ID */
var ownerId = 0;

var curTarget = null;

var oldTableRow = 0;

var submitOnLoadTarget = null;

var amensSelected = "";

/**
 * Framework Module JavaScript Library
 */
 
function doOnLoad()
{
  doCommonOnLoad();
}

function onLoad()
{
  doCommonOnLoad();
}

function showPromoInfo()
{
  /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
  setResponseURL("freepromoinfo.jsp?fwModuleName=genKfrentOpen");
 
  submitForm(window, "fwForm");
}

function setSelectedRow(tableRow, rowCount)
{
    xCount = 0;
    /* Reset the class of the current selectedRow.*/
    if(selectedRow != null)
    {
      selectedRow.className = "listData";
    }//if(selectedRow != null)

    /* Select the clicked row.*/
    if(tableRow != null)
    {
   
      selectedRow = tableRow;
      selectedRow.className = "listDataSelected";
    }//if(tableRow != null)
 }
 
/**
 * LOGOFF script
 */
function loadExitPage()
{
var m_sURL = "";
/* Close the module instance by calling fwmodulecontrollerservlet.*/
if(args != null)
{
var m_sURL = "fwmodulecontrollerservlet?fwModuleName="
+ args["fwModuleName"] + "&fwModuleAction=close";
top.location = m_sURL;
}//if(args != null)

top.window.location.replace('exit.jsp');
}

/**
 * Process the passwordDefault onKeyPress event.
 * This function is IE specific.
 */
function doPasswordOnKeyPress()
{
   if (navigator.appName == "Microsoft Internet Explorer")
   {
	var currKeyCode = window.event.keyCode;

	  /* Key code for Enter is 13.*/
	  if (currKeyCode == 13)
	  {
	    logon();
	  }//if (currKeyCode == 13)
   }
}//function doPasswordOnKeyPress()

function doPasswordOnKeyPressRA()
{
  var currKeyCode = window.event.keyCode;

  /* Key code for Enter is 13.*/
  if (currKeyCode == 13)
  {
    logonReservationAcceptance();
  }//if (currKeyCode == 13)
}//function doPasswordOnKeyPress()

//NEW
function openRequestOwnerInfo()
{
  ownID = document.getElementById("dsPropertyListingByListingId-OWNER_ID").value;
  listingId = document.getElementById("dsPropertyListingByListingId-LISTING_ID").value;
  submitForm(window, "fwForm");
  location_window =  window.open("requestOwnerInfo.jsp?fwModuleName=genKfrent&extownid="+ownID+"&extListingId="+listingId,"locate","toolbar=no,location=no,menubar=no,scrollbars=yes,height=500,width=616");  
	  if(!location_window){
	     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
	  } 
}
//NEW CHACHI
function requestOwnerInfo()
{
  var segment = 'MultiUnitAdmin.requestOwnerInfo()';
  buildScriptSegment(segment);  
  submitForm(window, "fwForm");
  window.close();
  opener.focus();  
}

function loadMyAvailability()
{
  listID = document.getElementById("dsPropertyListingByListingId-LISTING_ID").value;
  subUnitID = "0";
  roomID = "0";
  var pb = window.open("myAvailability.jsp?fwModuleName=genKfrent&extLID="+listID+"&extStatus=0&extSID="+subUnitID+"&extClassName=&extRoomID="+roomID,'','toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,height=520,width=620');
  if(!pb){
     alert('We have detected that you are using popup blocking software. In order to access the availability calendar, you must disable your popup blocker for this site.'); 
  }
}
function sortListingInventory()
{
  ownerId = document.getElementById("extOwnerId").value;
  selSort = document.getElementById("extSort").value;
  selBeds = document.getElementById("extBeds").value;
  extCalendarFrom = ""; extCalendarTo = "";
  if(document.getElementById("extCalendarFrom"))
  {
    extCalendarFrom = "";
    if(document.getElementById("extCalendarFrom").value.length > 0)
    { 
      if((document.getElementById("extCalendarFrom").value.indexOf("/") < 0) || (document.getElementById("extCalendarFrom").value.length < 10))
      {
        alert("Please enter the departure date in the following format mm/dd/yyyy");
        return;
      }
       extCalendarFrom = document.getElementById("extCalendarFrom").value;
       extCalendarFrom = formatToMySQL(extCalendarFrom);
    }

  }
  else
  {
   extCalendarFrom = "";
  }
  if(document.getElementById("extCalendarTo"))
  {
    extCalendarTo = "";
    if(document.getElementById("extCalendarTo").value.length > 0)
    {
      if((document.getElementById("extCalendarTo").value.indexOf("/") < 0) || (document.getElementById("extCalendarTo").value.length < 10))
      {
        alert("Please enter the arrival date in the following format mm/dd/yyyy");
        return;
      }    
       extCalendarTo = document.getElementById("extCalendarTo").value;
       extCalendarTo = formatToMySQL(extCalendarTo);
    }
  }
  else
  {
   extCalendarTo = "";
  } 
  if(document.getElementById("extCity"))
  {
    extCityIdx = document.fwForm.extCity.selectedIndex;
    extCity = document.fwForm.extCity.options[extCityIdx].value;
  }
  else
  {
    extCity="";
  }  
  arg1="F";arg2="F";arg3="F";arg4="F";arg5="F";arg6="F";arg7="F";arg8="F";arg9="F";arg10="F";arg11="F";arg12="F";arg13="F";arg14="F";arg15="F";arg16="F";arg17="F";arg18="F";arg19="F";arg20="F";arg21="F";arg22="F";arg23="F";arg24="F";
  
  if(document.getElementsByName("extCbx-amenity_id")[0].checked) arg1 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[1].checked) arg2 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[2].checked) arg3 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[3].checked) arg4 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[4].checked) arg5 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[5].checked) arg6 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[6].checked) arg7 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[7].checked) arg8 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[8].checked) arg9 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[9].checked) arg10 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[10].checked) arg11= "T";
  if(document.getElementsByName("extCbx-amenity_id")[11].checked) arg12 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[12].checked) arg13 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[13].checked) arg14 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[14].checked) arg15 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[15].checked) arg16 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[16].checked) arg17 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[17].checked) arg18 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[18].checked) arg19 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[19].checked) arg20 = "T"; 
  if(document.getElementsByName("extCbx-amenity_id")[20].checked) arg21 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[21].checked) arg22 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[22].checked) arg23 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[23].checked) arg24 = "T";    
  setResponseURL("managementListings.jsp?extOID="+ownerId+"&extPageNo=1&extSort="+selSort+"&extBeds="+selBeds+"&extCity="+extCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&ext1="+arg1+"&ext2="+arg2+"&ext3="+arg3+"&ext4="+arg4+"&ext5="+arg5+"&ext6="+arg6+"&ext7="+arg7+"&ext8="+arg8+"&ext9="+arg9+"&ext10="+arg10+"&ext11="+arg11+"&ext12="+arg12+"&ext13="+arg13+"&ext14="+arg14+"&ext15="+arg15+"&ext16="+arg16+"&ext17="+arg17+"&ext18="+arg18+"&ext19="+arg19+"&ext20="+arg20+"&ext21="+arg21+"&ext22="+arg22+"&ext23="+arg23+"&ext24="+arg24);
  submitForm(window, "fwForm");  
}
function sortListingInventoryHoodRiver()
{
  ownerId = document.getElementById("extOwnerId").value;
  selSort = document.getElementById("extSort").value;
  selBeds = document.getElementById("extBeds").value;
  extCalendarFrom = ""; extCalendarTo = "";
  if(document.getElementById("extCalendarFrom"))
  {
    extCalendarFrom = "";
    if(document.getElementById("extCalendarFrom").value.length > 0)
    { 
      if((document.getElementById("extCalendarFrom").value.indexOf("/") < 0) || (document.getElementById("extCalendarFrom").value.length < 10))
      {
        alert("Please enter the departure date in the following format mm/dd/yyyy");
        return;
      }
       extCalendarFrom = document.getElementById("extCalendarFrom").value;
       extCalendarFrom = formatToMySQL(extCalendarFrom);
    }

  }
  else
  {
   extCalendarFrom = "";
  }
  if(document.getElementById("extCalendarTo"))
  {
    extCalendarTo = "";
    if(document.getElementById("extCalendarTo").value.length > 0)
    {
      if((document.getElementById("extCalendarTo").value.indexOf("/") < 0) || (document.getElementById("extCalendarTo").value.length < 10))
      {
        alert("Please enter the arrival date in the following format mm/dd/yyyy");
        return;
      }    
       extCalendarTo = document.getElementById("extCalendarTo").value;
       extCalendarTo = formatToMySQL(extCalendarTo);
    }
  }
  else
  {
   extCalendarTo = "";
  } 
  if(document.getElementById("extCity"))
  {
    extCityIdx = document.fwForm.extCity.selectedIndex;
    extCity = document.fwForm.extCity.options[extCityIdx].value;
  }
  else
  {
    extCity="";
  }  
  arg1="F";arg2="F";arg3="F";arg4="F";arg5="F";arg6="F";arg7="F";arg8="F";arg9="F";arg10="F";arg11="F";arg12="F";arg13="F";arg14="F";
  
  if(document.getElementsByName("extCbx-amenity_id")[0].checked) arg1 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[1].checked) arg2 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[2].checked) arg3 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[3].checked) arg4 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[4].checked) arg5 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[5].checked) arg6 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[6].checked) arg7 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[7].checked) arg8 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[8].checked) arg9 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[9].checked) arg10 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[10].checked) arg11= "T";
  if(document.getElementsByName("extCbx-amenity_id")[11].checked) arg12 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[12].checked) arg13 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[13].checked) arg14 = "T";
 
  setResponseURL("managementListingsHoodRiver.jsp?extOID="+ownerId+"&extPageNo=1&extSort="+selSort+"&extBeds="+selBeds+"&extCity="+extCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&ext1="+arg1+"&ext2="+arg2+"&ext3="+arg3+"&ext4="+arg4+"&ext5="+arg5+"&ext6="+arg6+"&ext7="+arg7+"&ext8="+arg8+"&ext9="+arg9+"&ext10="+arg10+"&ext11="+arg11+"&ext12="+arg12+"&ext13="+arg13+"&ext14="+arg14);
  submitForm(window, "fwForm");  
}
function formatToMySQL(targetDate) {
//alert("in formatNewDate function");
  var mm, dd, yyyy;
  // Return the target date in "mm/dd/yyyy" format.

  yyyy = targetDate.substring(6,10);
  dd = targetDate.substring(3,5);
  mm = targetDate.substring(0,2);

  return yyyy + "-" + mm + "-" + dd;
}
function sortListingInventoryIFRAME()
{
  ownerId = document.getElementById("extOwnerId").value;
  selSort = document.getElementById("extSort").value;
  selBeds = document.getElementById("extBeds").value;
  if(document.getElementById("extVersionNo"))
  {
    versionNo = "_"+document.getElementById("extVersionNo").value;
  }
  else
  { versionNo = "";}  
  if(document.getElementById("fwPageRows"))
  {
    pageSize = document.getElementById("fwPageRows").value;
  }
  else
  { pageSize = "10";} 
  if(document.getElementById("extSH"))
  {
    SH = document.getElementById("extSH").value;
  }
  else
  { SH = "509";}   
  if(document.getElementById("extImgW"))
  {
    imgW = document.getElementById("extImgW").value;
  }
  else
  { imgW = "ON";}   
  extCalendarFrom = ""; extCalendarTo = "";
  arg1="F";arg2="F";arg3="F";arg4="F";arg5="F";arg6="F";arg7="F";arg8="F";arg9="F";arg10="F";arg11="F";arg12="F";arg13="F";arg14="F";arg15="F";arg16="F";arg17="F";arg18="F";arg19="F";arg20="F";arg21="F";arg22="F";arg23="F";arg24="F"

  if(document.getElementById("extCalendarFrom"))
  {
    extCalendarFrom = "";
    if(document.getElementById("extCalendarFrom").value.length > 0)
    { 
      if((document.getElementById("extCalendarFrom").value.indexOf("/") < 0) || (document.getElementById("extCalendarFrom").value.length < 10))
      {
        alert("Please enter the departure date in the following format mm/dd/yyyy");
        return;
      }
       extCalendarFrom = document.getElementById("extCalendarFrom").value;
       extCalendarFrom = formatToMySQL(extCalendarFrom);
    }

  }
  else
  {
   extCalendarFrom = "";
  }
  if(document.getElementById("extCalendarTo"))
  {
    extCalendarTo = "";
    if(document.getElementById("extCalendarTo").value.length > 0)
    {
      if((document.getElementById("extCalendarTo").value.indexOf("/") < 0) || (document.getElementById("extCalendarTo").value.length < 10))
      {
        alert("Please enter the arrival date in the following format mm/dd/yyyy");
        return;
      }    
       extCalendarTo = document.getElementById("extCalendarTo").value;
       extCalendarTo = formatToMySQL(extCalendarTo);
    }
  }
  else
  {
   extCalendarTo = "";
  } 
  if(document.getElementById("extCity"))
  {
    extCityIdx = fwForm.extCity.selectedIndex;
    extCity = fwForm.extCity.options[extCityIdx].value;
  }
  else
  {
    extCity="";
  }
  //if(document.getElementsByName("extCbx-amenity_id")[0].checked) arg1 = "T";
  
  var amens = "";
if(document.getElementById("extCbx-amenity_id1"))
{
  if(document.getElementById("extCbx-amenity_id1").checked){ amens = amens+ ",1"; }
  }
if(document.getElementById("extCbx-amenity_id3"))
{
  if(document.getElementById("extCbx-amenity_id3").checked){ amens = amens+ ",3"; }
  }  
if(document.getElementById("extCbx-amenity_id5"))
{
  if(document.getElementById("extCbx-amenity_id5").checked){ amens = amens+ ",5"; }
  } 
if(document.getElementById("extCbx-amenity_id6"))
{
  if(document.getElementById("extCbx-amenity_id6").checked){ amens = amens+ ",6"; }
  }   
if(document.getElementById("extCbx-amenity_id8"))
{
  if(document.getElementById("extCbx-amenity_id8").checked){ amens = amens+ ",8"; }
  } 
if(document.getElementById("extCbx-amenity_id9"))
{
  if(document.getElementById("extCbx-amenity_id9").checked){ amens = amens+ ",9"; }
  } 
if(document.getElementById("extCbx-amenity_id10"))
{
  if(document.getElementById("extCbx-amenity_id10").checked){ amens = amens+ ",10"; }
  } 
if(document.getElementById("extCbx-amenity_id53"))
{
  if(document.getElementById("extCbx-amenity_id53").checked){ amens = amens+ ",53"; }
  }   
if(document.getElementById("extCbx-amenity_id54"))
{
  if(document.getElementById("extCbx-amenity_id54").checked){ amens = amens+ ",54"; }
  }
if(document.getElementById("extCbx-amenity_id55"))
{
  if(document.getElementById("extCbx-amenity_id55").checked){ amens = amens+ ",55"; }
  }
if(document.getElementById("extCbx-amenity_id64"))
{
  if(document.getElementById("extCbx-amenity_id64").checked){ amens = amens+ ",64"; }
  }
if(document.getElementById("extCbx-amenity_id65"))
{
  if(document.getElementById("extCbx-amenity_id65").checked){ amens = amens+ ",65"; }
  }
if(document.getElementById("extCbx-amenity_id66"))
{
  if(document.getElementById("extCbx-amenity_id66").checked){ amens = amens+ ",66"; }
  } 
if(document.getElementById("extCbx-amenity_id67"))
{
  if(document.getElementById("extCbx-amenity_id67").checked){ amens = amens+ ",67"; }
  }  
if(document.getElementById("extCbx-amenity_id68"))
{
  if(document.getElementById("extCbx-amenity_id68").checked){ amens = amens+ ",68"; }
  } 
if(document.getElementById("extCbx-amenity_id69"))
{
  if(document.getElementById("extCbx-amenity_id69").checked){ amens = amens+ ",69"; }
  } 
if(document.getElementById("extCbx-amenity_id70"))
{
  if(document.getElementById("extCbx-amenity_id70").checked){ amens = amens+ ",70"; }
  } 
if(document.getElementById("extCbx-amenity_id71"))
{
  if(document.getElementById("extCbx-amenity_id71").checked){ amens = amens+ ",71"; }
  } 
if(document.getElementById("extCbx-amenity_id72"))
{
  if(document.getElementById("extCbx-amenity_id72").checked){ amens = amens+ ",72"; }
  } 
if(document.getElementById("extCbx-amenity_id73"))
{
  if(document.getElementById("extCbx-amenity_id73").checked){ amens = amens+ ",73"; }
  } 
if(document.getElementById("extCbx-amenity_id74"))
{
  if(document.getElementById("extCbx-amenity_id74").checked){ amens = amens+ ",74"; }
  } 
if(document.getElementById("extCbx-amenity_id75"))
{
  if(document.getElementById("extCbx-amenity_id75").checked){ amens = amens+ ",75"; }
  } 
if(document.getElementById("extCbx-amenity_id76"))
{
  if(document.getElementById("extCbx-amenity_id76").checked){ amens = amens+ ",76"; }
  } 
if(document.getElementById("extCbx-amenity_id77"))
{
  if(document.getElementById("extCbx-amenity_id77").checked){ amens = amens+ ",77"; }
  }  
if(document.getElementById("extCbx-amenity_id78"))
{
  if(document.getElementById("extCbx-amenity_id78").checked){ amens = amens+ ",78"; }
  }    
//extOID=992&extImgW=ON&extSH=3300&extPageSize=15&extVersionNo=v2wCITY&extCity=&extCalendarFrom=&extCalendarTo=&extPageNo=1&extSort=&extBeds=&extAmens=1,3,4
  setResponseURL("managementListingsIFRAME"+versionNo+".jsp?extOID="+ownerId+"&extImgW="+imgW+"&extSH="+SH+"&extPageNo=1&extVersionNo="+document.getElementById("extVersionNo").value+"&extPageSize="+pageSize+"&extSort="+selSort+"&extBeds="+selBeds+"&extCity="+extCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extAmens="+amens);
  submitForm(window, "fwForm");  
}
function sortListingInventoryIFRAMEDO()
{
  ownerId = document.getElementById("extOwnerId").value;
  if(document.getElementById("extVersionNo"))
  {
    versionNo = "_"+document.getElementById("extVersionNo").value;
  }
  else
  { versionNo = "";}  
  if(document.getElementById("fwPageRows"))
  {
    pageSize = document.getElementById("fwPageRows").value;
  }
  else
  { pageSize = "10";} 
  if(document.getElementById("extSH"))
  {
    SH = document.getElementById("extSH").value;
  }
  else
  { SH = "509";}   
  if(document.getElementById("extImgW"))
  {
    imgW = document.getElementById("extImgW").value;
  }
  else
  { imgW = "ON";}   
  extCalendarFrom = ""; extCalendarTo = "";
   if(document.getElementById("extCalendarFrom"))
  {
    extCalendarFrom = "";
    if(document.getElementById("extCalendarFrom").value.length > 0)
    { 
      if((document.getElementById("extCalendarFrom").value.indexOf("/") < 0) || (document.getElementById("extCalendarFrom").value.length < 10))
      {
        alert("Please enter the departure date in the following format mm/dd/yyyy");
        return;
      }
       extCalendarFrom = document.getElementById("extCalendarFrom").value;
       extCalendarFrom = formatToMySQL(extCalendarFrom);
    }

  }
  else
  {
   extCalendarFrom = "";
  }
  if(document.getElementById("extCalendarTo"))
  {
    extCalendarTo = "";
    if(document.getElementById("extCalendarTo").value.length > 0)
    {
      if((document.getElementById("extCalendarTo").value.indexOf("/") < 0) || (document.getElementById("extCalendarTo").value.length < 10))
      {
        alert("Please enter the arrival date in the following format mm/dd/yyyy");
        return;
      }    
       extCalendarTo = document.getElementById("extCalendarTo").value;
       extCalendarTo = formatToMySQL(extCalendarTo);
    }
  }
  else
  {
   extCalendarTo = "";
  } 

  setResponseURL("managementListingsIFRAME"+versionNo+".jsp?extOID="+ownerId+"&extImgW="+imgW+"&extSH="+SH+"&extPageNo=1&extVersionNo="+document.getElementById("extVersionNo").value+"&extPageSize="+pageSize+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo);
  submitForm(window, "fwForm");  
}
function openReservation(listingID)
  {
    location_window =  window.open("http://www.keysforrent.com/resPT1.jsp?fwModuleName=genKfrent&extLID="+listingID+"&extStatus=0&extSID=0&extClassName=&extRoomID=0&extBC=0","locate","scrollbars=yes,location,height=580,width=772");
    if(!location_window){
       alert('We have detected that you are using popup blocking software. In order to begin your secure online reservation, you must disable your popup blocker for this site.');
    }    
  }
  
function showSelectedListings()
{

  selSubregion = document.getElementById("dsPropertyListing-SUBREGION_CODE").value;
  
  noOfBedrooms = document.getElementById("extBedrooms").value;
  
  if (noOfBedrooms == "ANY")
  {  
    //alert("any selected");
  }
  
  if (selSubregion == "*")
  {
    /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
    setResponseURL("rental_listingsALL.jsp?fwModuleName=genKfrent");  
  }
  else
  {
    /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
    setResponseURL("rental_listings.jsp?fwModuleName=genKfrent");
  }
    

  
  if (noOfBedrooms == "ANY")
  { 
  	/* Build the script segment.*/
  	var segment3 = 'DynamicSearchRentals.dynamicSQLbuilder()';
  	buildScriptSegment(segment3);  
  }
  else
  {
     /* Build the script segment.*/
     //alert("sending number of bedrooms = " + noOfBedrooms);
      var segment13 = 'DynamicSearchRentals.dynamicSQLbuilderAdvanced("'+noOfBedrooms+'")';
      buildScriptSegment(segment13);
     }
  /* Save the buffer.*/
  //executeQuery("dsRentalSearch");
  submitForm(window, "fwForm");  
}

function showSelectedListingsAV()
{

  selAirport = document.getElementById("dsPropertyListing-AIRPORT_CODE").value;
  
  
  if (selAirport == "*")
  {
    /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
    setResponseURL("rental_listingsALL.jsp?fwModuleName=genKfrent");  
  }
  else
  {
    /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
    setResponseURL("rental_listings.jsp?fwModuleName=genKfrent");
  }
    
  	/* Build the script segment.*/
  	var segment3 = 'DynamicSearchRentals.dynamicSQLbuilder()';
  	buildScriptSegment(segment3);  

 
  
  /* Save the buffer.*/
  //executeQuery("dsRentalSearch");
  submitForm(window, "fwForm");  
}

function showFeatureOnClick(rowNo, tableRow)
{
  
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }
  /* Set the selected row */
  setSelectedRow(tableRow);
  
  
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("extdsPropertyListingByFeature-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("extdsPropertyListingByFeature-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("extdsPropertyListingByFeature-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("extdsPropertyListingByFeature-LISTING_ID"+rowNo).value);

  setQueryParam("dsMultiUnit", "argListingId", document.getElementById("extdsPropertyListingByFeature-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("extdsPropertyListingByFeature-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);

  executeQuery("dsRatesDetail");  
  //NEW CHAD
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("extdsPropertyListingByFeature-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");  
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  
  setResponseURL("kfrMyRentalListing.jsp?fwModuleName=genKfrent&extSender=home");
  /* Submit form on Main page.*/
  submitForm(window, "fwForm");
    

}//function showFeatureOnClick(dataSet, rowNo)

function doBrowseRowOnClick(stateProvinceCode,rentalTypeNo)
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }
  setResponseURL("browse_rental_listings.jsp?extPageNo=1");  

  setQueryParam("dsRentalBrowse", "argStateProvinceCode", stateProvinceCode);
  setQueryParam("dsRentalBrowse", "argRentalTypeNo", rentalTypeNo);
 
  executeQuery("dsRentalBrowse");
 
  submitForm(window, "fwForm");
}

function doBrowseRowOnClickNonUS(nationCode,rentalTypeNo)
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }
  setResponseURL("browse_rental_listingsNonUS.jsp");  
  //alert("going to browse with codes " + nationCode + " and " + rentalTypeNo);

  setQueryParam("dsRentalBrowseNonUS", "argNationCode", nationCode);
  //setQueryParam("dsRentalBrowse", "argRentalTypeNo", rentalTypeNo);
 
  executeQuery("dsRentalBrowseNonUS");
 
  submitForm(window, "fwForm");
}

function doBrowseDiscountsRowOnClick(stateProvinceCode,rentalTypeNo,dayAmt)
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }
  setResponseURL("browse_discount_rental_listings.jsp");
  //alert("going to browse with codes " + stateProvinceCode + " and " + rentalTypeNo);

  setQueryParam("dsRentalBrowseDiscounts", "argStateProvinceCode", stateProvinceCode);
  setQueryParam("dsRentalBrowseDiscounts", "argRentalTypeNo", rentalTypeNo);
  setQueryParam("dsRentalBrowseDiscounts", "argSpan1", dayAmt);
  setQueryParam("dsRentalBrowseDiscounts", "argSpan2", dayAmt);
  
  executeQuery("dsRentalBrowseDiscounts");
 
  submitForm(window, "fwForm");
}

function showSelectedOnClick(rowNo, tableRow)
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }  
  /* Set the selected row */
  setSelectedRow(tableRow);
  
  
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("extdsRentalSearch-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("extdsRentalSearch-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("extdsRentalSearch-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("extdsRentalSearch-LISTING_ID"+rowNo).value);

  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("extdsRentalSearch-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  setQueryParam("dsMultiUnit", "argListingId", document.getElementById("extdsRentalSearch-LISTING_ID"+rowNo).value);

  executeQuery("dsRatesDetail");
  //NEW CHAD
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("extdsRentalSearch-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");
  executeQuery("dsMultiUnit");
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  

  /* Submit form on Main page.*/
  submitForm(window, "fwForm");
  location_window =  window.open("MyRentalListing.jsp?fwModuleName=genKfrent","locate","scrollbars=yes,location,height=580,width=772");  
  if(!location_window){
     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
  }
}//function showSelectedOnClick(dataSet, rowNo)

function showSelectedOnClickALL(rowNo, tableRow)
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }  
  /* Set the selected row */
  setSelectedRow(tableRow);
  
  
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("extdsRentalSearchALL-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("extdsRentalSearchALL-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("extdsRentalSearchALL-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("extdsRentalSearchALL-LISTING_ID"+rowNo).value);

  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("extdsRentalSearchALL-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);

  executeQuery("dsRatesDetail"); 
  //NEW CHAD
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("extdsRentalSearchALL-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");  
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  

  /* Submit form on Main page.*/
  submitForm(window, "fwForm");
  location_window =  window.open("MyRentalListing.jsp?fwModuleName=genKfrent","locate","scrollbars=yes,location,height=580,width=772");  
  if(!location_window){
     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
  }
}//function showSelectedOnClickALL(dataSet, rowNo)

function showBrowseOnClick(rowNo, tableRow)
{
   if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  } 
  /* Set the selected row */
  setSelectedRow(tableRow);
  
  
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("extdsRentalBrowse-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("extdsRentalBrowse-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("extdsRentalBrowse-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("extdsRentalBrowse-LISTING_ID"+rowNo).value);

  setQueryParam("dsMultiUnit", "argListingId", document.getElementById("extdsRentalBrowse-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("extdsRentalBrowse-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  //NEW
  setQueryParam("dsRatesDetailMU", "argListingId", document.getElementById("extdsRentalBrowse-LISTING_ID"+rowNo).value);

  executeQuery("dsRatesDetail"); 
  //NEW CHAD
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("extdsRentalBrowse-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  executeQuery("dsRatesDetailMU");
  
//  setResponseURL("MyRentalListing.jsp?fwModuleName=genKfrent");
  setResponseURL("MyRentalListing.jsp");
  
  /* Submit form on Main page.*/
  submitForm(window, "fwForm");
//  location_window =  window.open("MyRentalListing.jsp?fwModuleName=genKfrent","locate","scrollbars=yes,location,height=580,width=772");  
//  if(!location_window){
//     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
//  }
}//function showBrowseOnClick(dataSet, rowNo)

//NEW CHAD 2004-02-13
function showBrowseOnClickNonUS(rowNo, tableRow)
{
   if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  } 
  /* Set the selected row */
  setSelectedRow(tableRow);
  
  
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("extdsRentalBrowseNonUS-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("extdsRentalBrowseNonUS-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("extdsRentalBrowseNonUS-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("extdsRentalBrowseNonUS-LISTING_ID"+rowNo).value);

  setQueryParam("dsMultiUnit", "argListingId", document.getElementById("extdsRentalBrowseNonUS-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("extdsRentalBrowseNonUS-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  //NEW
  setQueryParam("dsRatesDetailMU", "argListingId", document.getElementById("extdsRentalBrowseNonUS-LISTING_ID"+rowNo).value);

  executeQuery("dsRatesDetail"); 
  //NEW CHAD
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("extdsRentalBrowseNonUS-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform"); 
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  executeQuery("dsRatesDetailMU");
  

  /* Submit form on Main page.*/
  submitForm(window, "fwForm");
  location_window =  window.open("MyRentalListing.jsp?fwModuleName=genKfrent","locate","scrollbars=yes,location,height=580,width=772");  
  if(!location_window){
     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
  }
}//function showBrowseOnClickNonUS(dataSet, rowNo)

function loadBrowseDiscountsDatasets()
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }
    fromDate = document.getElementById("extdateFrom").value;
    toDate = document.getElementById("extdateTo").value;
    
    fromDateD = new Date(fromDate);
    toDateD = new Date(toDate);
    dateTodayD = new Date();
    difference = Math.abs(toDateD.getTime() - fromDateD.getTime());
    daysUntilReservation = Math.abs(dateTodayD.getTime() - toDateD.getTime());
    daysDiff = (difference / (1000 * 60 * 60 * 24)) + 1;  
    daysUntilReservation = (daysUntilReservation / (1000 * 60 * 60 * 24)) + 1; 
    //make sure we are rounded
    daysDiff = Math.round(daysDiff);
  daysUntilReservation = Math.round(daysUntilReservation);
  
  setResponseURL("browse_discount_listings.jsp?fwModuleName=genKfrent&extDUR="+daysUntilReservation);

  setQueryParam("dsBrowseVacationRentalsDiscounts", "argSpan1", daysUntilReservation);
  setQueryParam("dsBrowseVacationRentalsDiscounts", "argSpan2", daysUntilReservation);
  executeQuery("dsBrowseVacationRentalsDiscounts");  
  
  //load the features
  executeQuery("dsPropertyListingByFeature");
  //make sure all datasets are reset and cleared.
 
  submitForm(window, "fwForm");    

}

function loadFeatures()
{
  //load the features
  executeQuery("dsPropertyListingByFeature");
  
  submitForm(window, "fwForm");    

}

function loadSearch()
{
  setResponseURL("search_listings.jsp");
  //load the features
  executeQuery("dsPropertyListingByFeature");
  
  submitForm(window, "fwForm");    
}
function getCotConListings(ownerId)
{
  var selIndex1 = document.getElementById("extCity").selectedIndex;
  var argCity = document.getElementById("extCity").options[selIndex1].value;
  if((argCity == "unimportant") || (argCity == "No Preference")) { argCity = ""; }
  
  var argPriceRange = "";
  var selIndex2 = 0;
  var selIndex3 = 0;
  var argBeds = 0;
  if (document.getElementById("extPriceRange"))
  {
    selIndex2 = document.getElementById("extPriceRange").selectedIndex;
    argPriceRange = document.getElementById("extPriceRange").options[selIndex2].value;
  }
  if(argPriceRange == "unimportant") { argPriceRange = ""; }
  selIndex3 = document.getElementById("extBeds").selectedIndex;
  argBeds = document.getElementById("extBeds").options[selIndex3].value;
  //alert("argBeds = " + argBeds);
  if((argBeds == "unimportant") || (argBeds == "No Preference")) { argBeds = ""; }
  if(document.getElementById("extProp"))
  {
    var selIndex4 = document.getElementById("extProp").selectedIndex;
    var listingID = document.getElementById("extProp").options[selIndex4].value;  
  }
  if(listingID == "") { listingID = 0;}
  argWF="0";argAP = "0";argTA = "0";argLF = "0";
  if(document.getElementById("extWF"))
  {
	  if(document.getElementById("extWF").checked)
	  {
	    argWF = "1";
	  } else { argWF = "0"; }
	  if(document.getElementById("extAP").checked)
	  {
	    argAP = "1";
	  } else { argAP = "0"; }
	  if(document.getElementById("extTA").checked)
	  {
	    argTA = "1";
	  } else { argTA = "0"; }
	  if(document.getElementById("extLF").checked)
	  {
	    argLF = "1";
	  } else { argLF = "0"; }
   }
  extAmens = "";
  if(document.getElementById("extSpecAmens"))
  {
    extAmens = document.getElementById("extSpecAmens").options[document.getElementById("extSpecAmens").selectedIndex].value
    if((extAmens == "unimportant") || (extAmens == "No Preference")) { extAmens = ""; }
  }
  fromDate = document.getElementById("extCalendarFrom").value;
  toDate = document.getElementById("extCalendarTo").value;
  //alert("post1 ");
  if(fromDate != "--ANY--")
  {
    //alert("fromDate = " +fromDate);
    extCalendarFrom = document.getElementById("extCalendarFrom").value;
    if(document.getElementById("extCalendarFrom").value.indexOf("/") > 0)
    {
      extCalendarFrom = formatToMySQL(fromDate);
    }
    //alert("extCalendarFrom = " +extCalendarFrom);
  } else { extCalendarFrom = ""; }
  //alert("extCalendarFrom = " + extCalendarFrom);
  if(toDate != "--ANY--")
  {
    extCalendarTo = document.getElementById("extCalendarTo").value;
    if(document.getElementById("extCalendarTo").value.indexOf("/") > 0)
    {
      extCalendarTo = formatToMySQL(toDate);
    }
  } else { extCalendarTo = ""; }
 if(ownerId == "1169")
 {
  setResponseURL("managementListingsIFRAME_h_and_h_NS.jsp?extOID="+ownerId+"&extImgW=ON&extSH=2000&extPageSize=10&extVersionNo=h_and_h_NS&extCity="+argCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPageNo=1&extPriceRange="+argPriceRange+"&extWaterFrontView="+argWF+"&extLakeFront="+argLF+"&extAllowPets="+argAP+"&extTuckedAway="+argTA+"&extBeds="+argBeds+"&extInit=0&extLID="+listingID+"&extAmens="+extAmens+"#head");
 }
 else if(ownerId == "1689")
 {
  setResponseURL("managementListingsIFRAME_LakeErie.jsp?extOID="+ownerId+"&extImgW=ON&extSH=2000&extPageSize=10&extVersionNo=LakeErie&extCity="+argCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPageNo=1&extPriceRange="+argPriceRange+"&extWaterFrontView="+argWF+"&extLakeFront="+argLF+"&extAllowPets="+argAP+"&extTuckedAway="+argTA+"&extBeds="+argBeds+"&extInit=0&extLID="+listingID+"&extAmens="+extAmens+"#head");
 }
  else if(ownerId == "1687")
  {
   setResponseURL("managementListingsIFRAME_JoHankS.jsp?extOID="+ownerId+"&extImgW=ON&extSH=2000&extPageSize=10&extVersionNo=LakeErie&extCity="+argCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPageNo=1&extPriceRange="+argPriceRange+"&extWaterFrontView="+argWF+"&extLakeFront="+argLF+"&extAllowPets="+argAP+"&extTuckedAway="+argTA+"&extBeds="+argBeds+"&extInit=0&extLID="+listingID+"&extAmens="+extAmens+"#head");
 }
  else if(ownerId == "1009")
  {
   setResponseURL("managementListingsIFRAME_CROG.jsp?extOID="+ownerId+"&extImgW=ON&extSH=2000&extPageSize=10&extVersionNo=h_and_h_NS&extCity="+argCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPageNo=1&extPriceRange="+argPriceRange+"&extWaterFrontView="+argWF+"&extLakeFront="+argLF+"&extAllowPets="+argAP+"&extTuckedAway="+argTA+"&extBeds="+argBeds+"&extInit=0&extLID="+listingID+"&extAmens="+extAmens+"#head");
  }
  else if(ownerId == "1011")
  {
    setResponseURL("managementListingsIFRAME_CROG_BL.jsp?extOID="+ownerId+"&extImgW=ON&extSH=2000&extPageSize=10&extVersionNo=h_and_h_NS&extCity="+argCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPageNo=1&extPriceRange="+argPriceRange+"&extWaterFrontView="+argWF+"&extLakeFront="+argLF+"&extAllowPets="+argAP+"&extTuckedAway="+argTA+"&extBeds="+argBeds+"&extInit=0&extLID="+listingID+"&extAmens="+extAmens+"#head");
 }
   else if(ownerId == "1762")
   {
     setResponseURL("managementListingsIFRAME_MountainEsc.jsp?extOID="+ownerId+"&extImgW=ON&extSH=2000&extPageSize=10&extVersionNo=MountainEsc&extCity="+argCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPageNo=1&extPriceRange="+argPriceRange+"&extWaterFrontView="+argWF+"&extLakeFront="+argLF+"&extAllowPets="+argAP+"&extTuckedAway="+argTA+"&extBeds="+argBeds+"&extInit=0&extLID="+listingID+"&extAmens="+extAmens+"#head");
 }
 else
 {
  setResponseURL("managementListingsCotConnection.jsp?extOID="+ownerId+"&extImgW=ON&extSH=2000&extPageSize=50&extVersionNo=v2wCITY&extCity="+argCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPageNo=1&extPriceRange="+argPriceRange+"&extWaterFrontView="+argWF+"&extLakeFront="+argLF+"&extAllowPets="+argAP+"&extTuckedAway="+argTA+"&extBeds="+argBeds+"&extInit=0&extLID="+listingID+"&extAmens="+extAmens+"#head");
 } 
  //submitForm(window, "fwForm");
  submitFormList(window, "fwForm");
}

function filterToSingleMapPoint(argListingId,argOwnerId)
{
  setResponseURL("myGoogleMashupBasic.jsp?extListingId="+argListingId+"&extOwnerId="+argOwnerId+"&extRooms=99&extTownCity=unimportant&extCalendarFrom=&extCalendarTo=&extPintype=both");
  
  submitForm(window, "fwForm");
}
function filterGmap()
{
  ownerId = document.getElementById("extOwnerId").value;
  var selIndex4 = document.getElementById("extCity").selectedIndex;
  var extCity = document.getElementById("extCity").options[selIndex4].value;  
  if((extCity == "--ANY--") || (extCity == "")) { extCity = "unimportant";}
  var selIndex3 = document.getElementById("extBeds").selectedIndex;
  var argBeds = document.getElementById("extBeds").options[selIndex3].value;
  if(argBeds == "unimportant") { argBeds = "99"; }
  fromDate = document.getElementById("extCalendarFrom").value;
  toDate = document.getElementById("extCalendarTo").value;
  if(fromDate != "--ANY--")
  {
    //alert("fromDate = " +fromDate);
    extCalendarFrom = formatToMySQL(fromDate);
    //alert("extCalendarFrom = " +extCalendarFrom);
  } else { extCalendarFrom = ""; }
  if(toDate != "--ANY--")
  {
    extCalendarTo = formatToMySQL(toDate);
  } else { extCalendarTo = ""; }
  setResponseURL("myGoogleMashup.jsp?extOwnerId="+ownerId+"&extRooms="+argBeds+"&extTownCity="+extCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPintype=both");
  submitForm(window, "fwForm");
}
function filterGmapSimple()
{
  ownerId = document.getElementById("extOwnerId").value;
  extCity = "unimportant";
  var selIndex3 = document.getElementById("extBeds").selectedIndex;
  var argBeds = document.getElementById("extBeds").options[selIndex3].value;
  if(argBeds == "unimportant") { argBeds = "99"; }
  fromDate = document.getElementById("extCalendarFrom").value;
  toDate = document.getElementById("extCalendarTo").value;
  if(fromDate != "--ANY--")
  {
    //alert("fromDate = " +fromDate);
    extCalendarFrom = formatToMySQL(fromDate);
    //alert("extCalendarFrom = " +extCalendarFrom);
  } else { extCalendarFrom = ""; }
  if(toDate != "--ANY--")
  {
    extCalendarTo = formatToMySQL(toDate);
  } else { extCalendarTo = ""; }
  setResponseURL("myGoogleMashupTesting.jsp?extOwnerId="+ownerId+"&extRooms="+argBeds+"&extTownCity="+extCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extPintype=both");
  submitForm(window, "fwForm");
}
function getCotConListingsQS()
{
  var selIndex4 = document.getElementById("extProp").selectedIndex;
  var listingID = document.getElementById("extProp").options[selIndex4].value;  
  if(listingID == "") { listingID = 0;}

  fromDate = document.getElementById("extCalendarFrom").value;
  toDate = document.getElementById("extCalendarTo").value;
  
    if(document.getElementById("extCalendarFrom").value.length > 0)
    { 
      if((document.getElementById("extCalendarFrom").value.indexOf("/") < 0) || (document.getElementById("extCalendarFrom").value.length < 10))
      {
        alert("Please enter the Start Date in the following format mm/dd/yyyy");
        return;
      }
       extCalendarFrom = document.getElementById("extCalendarFrom").value;
       extCalendarFrom = formatToMySQL(extCalendarFrom);
    }   else { extCalendarFrom = ""; }
    if(document.getElementById("extCalendarTo").value.length > 0)
    { 
      if((document.getElementById("extCalendarTo").value.indexOf("/") < 0) || (document.getElementById("extCalendarTo").value.length < 10))
      {
        alert("Please enter the End Date in the following format mm/dd/yyyy");
        return;
      }
       extCalendarTo = document.getElementById("extCalendarTo").value;
       extCalendarTo = formatToMySQL(extCalendarTo);
    }   else { extCalendarTo = ""; }    
  
//5-14-11  window.parent.location.replace(URLStartCotCon+"/search2.asp?extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extLID="+listingID+"&noParm=1#head");
  window.parent.location.replace("search2.asp?extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extLID="+listingID+"&noParm=1#head");

  //window.parent.location.replace(URLStartCotCon+"/search.htm?extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"#head");
}
function doSearchRowOnClick(argProv)
{
      rentalTypeNo = document.getElementById("extRentalTypeNo").value;
      selNation =  document.getElementById("extNationCode").value;
      setResponseURL("search_listings2.jsp?extState="+argProv+"&extRentalTypeNo="+rentalTypeNo+"&extNation="+selNation);
      
      setQueryParam("dsAirports", "argNationCode", selNation);
      setQueryParam("dsAirports", "argStateProvinceCode", argProv);
      setQueryParam("dsRentalSubregions", "argNationCode", selNation);
      setQueryParam("dsRentalSubregions", "argStatesProvinces", argProv);
      setQueryParam("dsRentalSubcategories", "argRentalTypeNo", rentalTypeNo); 
      setQueryParam("dsAmenities", "argRentalTypeNo", rentalTypeNo);      
      
      executeQuery("dsAirports");
      executeQuery("dsRentalSubregions");
      //chad//sortDataSet("dsRentalSubregions", "SUBREGION_NAME ASC");
      executeQuery("dsRentalSubcategories");
      //sortDataSet("dsRentalSubcategories", "DESCRIPTION ASC");
      executeQuery("dsAmenities");
      //load the features
      executeQuery("dsPropertyListingByFeature");   
      submitForm(window, "fwForm");
}

function checkNation(argCd, argName)
{

      
      needState = false;
    switch(argCd)
    {
    case '1':
       //us
       needState = true;
       break;   
    case '2':
       //canada
       needState = true;
       break;
    case '3':
       stateProvCode = 62;
       break;    
    case '4':
       //CARRIBEAN HAS STATES/ISLANDS
       needState = true;
       break;   
    case '5':
       stateProvCode = 90;
       break;
    case '6':
       stateProvCode = 91;
       break;
    case '7':
       stateProvCode = 92;
       break;       
    case '8':
       stateProvCode = 93;
       break;
    case '9':
       stateProvCode = 94;
       break;
    case '10':
       stateProvCode = 95;
       break;
    case '11':
       stateProvCode = 96;
       break;       
    case '12':
       stateProvCode = 97;
       break;  
    case '13':
       stateProvCode = 98;
       break;       
    case '14':
       stateProvCode = 99;
       break;  
    case '15':
       //central america has states
       needState = true;
       break;
    case '16':
       stateProvCode = 105;
       break;
    case '17':
       stateProvCode = 106;
       break;       
    case '18':
       stateProvCode = 107;
       break;
    case '19':
       stateProvCode = 108;
       break;
    case '20':
       stateProvCode = 109;
       break;
    case '21':
       stateProvCode = 110;
       break;       
    case '22':
       stateProvCode = 111;
       break;  
    case '23':
       stateProvCode = 112;
       break;       
    case '24':
       stateProvCode = 113;
       break;  
    case '25':
       stateProvCode = 114;
       break;
    case '26':
       stateProvCode = 115;
       break;
    case '27':
       stateProvCode = 116;
       break;       
    case '28':
       stateProvCode = 117;
       break;
    case '29':
       stateProvCode = 118;
       break;
    case '30':
       stateProvCode = 119;
       break;
    case '31':
       stateProvCode = 120;
       break;       
    case '32':
       stateProvCode = 121;
       break;  
    case '33':
       stateProvCode = 122;
       break;       
    case '34':
       stateProvCode = 123;
       break;  
    case '36':
       stateProvCode = 124;
       break;     
    case '37':
       stateProvCode = 132;
       break; 
    case '38':
       stateProvCode = 128;
       break; 
    case '39':
       stateProvCode = 129;
       break; 
    case '40':
       stateProvCode = 130;
       break; 
    case '41':
       stateProvCode = 131;
       break;   
    case '42':
       stateProvCode = 132;
       break;         
    default:
      break;
   } 
   //alert("after case");
      //CHAD NEW 2004-02-06
      if ((needState) && (argCd > 1)){
      //then then return state regions
        setResponseURL("kfrSelectProvince.jsp?extRentalTypeNo=1&extNation="+argCd+"&extNationName="+argName);
        setQueryParam("dsStatesProvinces", "argNationCode", argCd);
        executeQuery("dsStatesProvinces");
        submitForm(window, "fwForm");
        return;
        }
      if ((needState == false) && (argCd > 1))
          {
           //then this is a nation with no states or regions..go right to select amenities
           setResponseURL("kfrSearch.jsp?extState="+stateProvCode+"&extNation="+argCd+"&extNationName="+argName);
           }

      if (argCd > 1)
      {
      setQueryParam("dsRentalSubregions", "argNationCode", argCd);
      setQueryParam("dsRentalSubregions", "argStatesProvinces", stateProvCode);
      setQueryParam("dsRentalSubcategories", "argRentalTypeNo", 1); 
      setQueryParam("dsAmenities", "argRentalTypeNo", 1);     
      setQueryParam("dsStatesProvincesByStateCode", "argStateCode", stateProvCode);
      executeQuery("dsStatesProvincesByStateCode");      

      executeQuery("dsRentalSubregions");
      //chad//sortDataSet("dsRentalSubregions", "SUBREGION_NAME ASC");
      executeQuery("dsRentalSubcategories");
      //sortDataSet("dsRentalSubcategories", "DESCRIPTION ASC");
      executeQuery("dsAmenities");
      //load the features
      executeQuery("dsPropertyListingByFeature");      
   
      submitForm(window, "fwForm");
      }
}

function loadBrowseDatasets()
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }
  //alert("load browse");
  setResponseURL("browse_listings.jsp");
  executeQuery("dsBrowseVacationRentals");
  executeQuery("dsBrowseVacationRentalsNonUS");

  executeQuery("dsListingCount");
  
  //load the features
  executeQuery("dsPropertyListingByFeature");
  //make sure all datasets are reset and cleared.
  clearDataSet("dsPropertyOwner");
  clearDataSet("dsPropertyListingByOwner");
  clearDataSet("dsRatesDetail");  
  submitForm(window, "fwForm");    

}

function vacancyDiscounts()
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }
  setResponseURL("chooseDiscountDates.jsp");
  //load the features
  executeQuery("dsPropertyListingByFeature");
  submitForm(window, "fwForm");   
}

function otherNations()
{
 //alert("other natiions");
  //this function is called after a user has logged in with a valid login
  /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
  setResponseURL("otherNationsBrowse.jsp");

  
  /* Run the query to get new nations/countries */
  executeQuery("dsBrowseVacationRentalsNonUS");
   
  submitForm(window, "fwForm");

}

function loadQuery(argType)
{
  var queryType = argType;
  var rentalTypeNo;
  var nationCD;
   rentalTypeNo = document.getElementById("extdsRentalType-RENTAL_DESCRIPTION").value;
   //alert("arg type = " + argType);
    if(rentalTypeNo == "")
    {
      alert("Please select a rental type first.");
      return false; 
    }
    nationCD = document.getElementById("extdsNations-NATION_NAME").value;
    if(nationCD == "")
    {
      alert("Please select a Nation first.");
      return false; 
    }
    //alert("rental type = " + rentalTypeNo + "nationCD = " + nationCD);
    if ((argType == 'Browse') && (nationCD == 1)) 
    {
       setResponseURL("browse_listings.jsp?extNationCode="+nationCD+"&extRentalType="+rentalTypeNo);
  	executeQuery("dsBrowseVacationRentals");
  	executeQuery("dsBrowseVacationRentalsNonUS");
  	executeQuery("dsListingCount");       
    }
    else if((queryType == 'Browse') && (nationCD != 1))
      {
        //alert("Currently there are no listings in the Nation selected. Please select another Nation.");
             otherNations();
             return;
      }
      else
      {
        if (nationCD == 1)
        { 
        //alert("loading search_listingsST.jsp");        
           setResponseURL("search_listingsST.jsp?extNationCode="+nationCD+"&extRentalType="+rentalTypeNo);
        }
        else
        {
	  checkNation();
	  return;
	}
        
      }
      submitForm(window, "fwForm");      
 }
 

function loadQueryUSA(){
      setResponseURL("kfrSearch.jsp?extState=0&extNationName=USA");
setQueryParam("dsAmenities", "argRentalTypeNo", 1);
executeQuery("dsAmenities");
      submitForm(window, "fwForm");      
}
function getClickedBrowsePage(pageNo)
{
  rowNo = 1;
  if(pageNo > 1)
  {
    rowNo = (pageNo-1) * 10 + 1;
  }
  //alert("setting page to " + pageNo + ", rowNo = "+rowNo);
  setRow("dsRentalBrowse", rowNo);
  setResponseURL("browse_rental_listings.jsp?extPageNo="+pageNo);
  submitForm(window, "fwForm");
}
function getClickedSearchPage(pageNo)
{
  rowNo = 1;
  if(pageNo > 1)
  {
    rowNo = (pageNo-1) * 10 + 1;
  }
  setRow("dsRentalSearch", rowNo);
  setResponseURL("kfrSearchResults.jsp?extPageNo="+pageNo);
  submitForm(window, "fwForm");
}
function getSearchPageClient(pageNo)
{
  rowNo = 1;
  if(pageNo > 1)
  {
    rowNo = (pageNo-1) * 10 + 1;
  }
  setRow("dsRentalSearch", rowNo);
  ownerId = document.getElementById("extOwnerId").value;
  selSort = document.getElementById("extSort").value;
  extCalendarFrom = ""; extCalendarTo = "";
  if(document.getElementById("extCalendarFrom"))
  {
    extCalendarFrom = "";
    if(document.getElementById("extCalendarFrom").value.length > 0)
    { 
      if((document.getElementById("extCalendarFrom").value.indexOf("/") < 0) || (document.getElementById("extCalendarFrom").value.length < 10))
      {
        alert("Please enter the departure date in the following format mm/dd/yyyy");
        return;
      }
       extCalendarFrom = document.getElementById("extCalendarFrom").value;
       extCalendarFrom = formatToMySQL(extCalendarFrom);
    }

  }
  else
  {
   extCalendarFrom = "";
  }
  if(document.getElementById("extCalendarTo"))
  {
    extCalendarTo = "";
    if(document.getElementById("extCalendarTo").value.length > 0)
    {
      if((document.getElementById("extCalendarTo").value.indexOf("/") < 0) || (document.getElementById("extCalendarTo").value.length < 10))
      {
        alert("Please enter the arrival date in the following format mm/dd/yyyy");
        return;
      }    
       extCalendarTo = document.getElementById("extCalendarTo").value;
       extCalendarTo = formatToMySQL(extCalendarTo);
    }
  }
  else
  {
   extCalendarTo = "";
  } 
  if(document.getElementById("extCity"))
  {
    extCityIdx = document.fwForm.extCity.selectedIndex;
    extCity = document.fwForm.extCity.options[extCityIdx].value;
  }
  else
  {
    extCity="";
  }  
  arg1="F";arg2="F";arg3="F";arg4="F";arg5="F";arg6="F";arg7="F";arg8="F";arg9="F";arg10="F";arg11="F";arg12="F";arg13="F";arg14="F";arg15="F";arg16="F";arg17="F";arg18="F";arg19="F";arg20="F";arg21="F";arg22="F";arg23="F";arg24="F"

  if(document.getElementsByName("extCbx-amenity_id")[0].checked) arg1 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[1].checked) arg2 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[2].checked) arg3 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[3].checked) arg4 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[4].checked) arg5 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[5].checked) arg6 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[6].checked) arg7 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[7].checked) arg8 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[8].checked) arg9 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[9].checked) arg10 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[10].checked) arg11= "T";
  if(document.getElementsByName("extCbx-amenity_id")[11].checked) arg12 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[12].checked) arg13 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[13].checked) arg14 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[14].checked) arg15 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[15].checked) arg16 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[16].checked) arg17 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[17].checked) arg18 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[18].checked) arg19 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[19].checked) arg20 = "T"; 
  if(document.getElementsByName("extCbx-amenity_id")[20].checked) arg21 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[21].checked) arg22 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[22].checked) arg23 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[23].checked) arg24 = "T";    
  setResponseURL("managementListings.jsp?extOID="+ownerId+"&extPageNo="+pageNo+"&extSort="+selSort+"&extCity="+extCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&ext1="+arg1+"&ext2="+arg2+"&ext3="+arg3+"&ext4="+arg4+"&ext5="+arg5+"&ext6="+arg6+"&ext7="+arg7+"&ext8="+arg8+"&ext9="+arg9+"&ext10="+arg10+"&ext11="+arg11+"&ext12="+arg12+"&ext13="+arg13+"&ext14="+arg14+"&ext15="+arg15+"&ext16="+arg16+"&ext17="+arg17+"&ext18="+arg18+"&ext19="+arg19+"&ext20="+arg20+"&ext21="+arg21+"&ext22="+arg22+"&ext23="+arg23+"&ext24="+arg24);
  submitForm(window, "fwForm");
}
function getSearchPageClientHR(pageNo)
{
  rowNo = 1;
  if(pageNo > 1)
  {
    rowNo = (pageNo-1) * 10 + 1;
  }
  setRow("dsRentalSearch", rowNo);
  ownerId = document.getElementById("extOwnerId").value;
  selSort = document.getElementById("extSort").value;
  extCalendarFrom = ""; extCalendarTo = "";
  if(document.getElementById("extCalendarFrom"))
  {
    extCalendarFrom = "";
    if(document.getElementById("extCalendarFrom").value.length > 0)
    { 
      if((document.getElementById("extCalendarFrom").value.indexOf("/") < 0) || (document.getElementById("extCalendarFrom").value.length < 10))
      {
        alert("Please enter the departure date in the following format mm/dd/yyyy");
        return;
      }
       extCalendarFrom = document.getElementById("extCalendarFrom").value;
       extCalendarFrom = formatToMySQL(extCalendarFrom);
    }

  }
  else
  {
   extCalendarFrom = "";
  }
  if(document.getElementById("extCalendarTo"))
  {
    extCalendarTo = "";
    if(document.getElementById("extCalendarTo").value.length > 0)
    {
      if((document.getElementById("extCalendarTo").value.indexOf("/") < 0) || (document.getElementById("extCalendarTo").value.length < 10))
      {
        alert("Please enter the arrival date in the following format mm/dd/yyyy");
        return;
      }    
       extCalendarTo = document.getElementById("extCalendarTo").value;
       extCalendarTo = formatToMySQL(extCalendarTo);
    }
  }
  else
  {
   extCalendarTo = "";
  } 
  if(document.getElementById("extCity"))
  {
    extCityIdx = document.fwForm.extCity.selectedIndex;
    extCity = document.fwForm.extCity.options[extCityIdx].value;
  }
  else
  {
    extCity="";
  }  
  arg1="F";arg2="F";arg3="F";arg4="F";arg5="F";arg6="F";arg7="F";arg8="F";arg9="F";arg10="F";arg11="F";arg12="F";arg13="F";arg14="F";arg15="F";arg16="F";arg17="F";arg18="F";arg19="F";arg20="F";arg21="F";arg22="F";arg23="F";arg24="F"

  if(document.getElementsByName("extCbx-amenity_id")[0].checked) arg1 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[1].checked) arg2 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[2].checked) arg3 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[3].checked) arg4 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[4].checked) arg5 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[5].checked) arg6 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[6].checked) arg7 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[7].checked) arg8 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[8].checked) arg9 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[9].checked) arg10 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[10].checked) arg11= "T";
  if(document.getElementsByName("extCbx-amenity_id")[11].checked) arg12 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[12].checked) arg13 = "T";
  if(document.getElementsByName("extCbx-amenity_id")[13].checked) arg14 = "T";
  
  setResponseURL("managementListingsHoodRiver.jsp?extOID="+ownerId+"&extPageNo="+pageNo+"&extSort="+selSort+"&extCity="+extCity+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&ext1="+arg1+"&ext2="+arg2+"&ext3="+arg3+"&ext4="+arg4+"&ext5="+arg5+"&ext6="+arg6+"&ext7="+arg7+"&ext8="+arg8+"&ext9="+arg9+"&ext10="+arg10+"&ext11="+arg11+"&ext12="+arg12+"&ext13="+arg13+"&ext14="+arg14+"&ext15="+arg15+"&ext16="+arg16+"&ext17="+arg17+"&ext18="+arg18+"&ext19="+arg19+"&ext20="+arg20+"&ext21="+arg21+"&ext22="+arg22+"&ext23="+arg23+"&ext24="+arg24);
  submitForm(window, "fwForm");
}
function getSearchPageClientIFRAME(pageNo,argURL)
{
  arg1="F";arg2="F";arg3="F";arg4="F";arg5="F";arg6="F";arg7="F";arg8="F";arg9="F";arg10="F";arg11="F";arg12="F";arg13="F";arg14="F";arg15="F";arg16="F";arg17="F";arg18="F";arg19="F";arg20="F";arg21="F";arg22="F";arg23="F";arg24="F"
  rowNo = 1;
  if(document.getElementById("extVersionNo"))
  {
    versionNo = "_"+document.getElementById("extVersionNo").value;
  }
  else
  { versionNo = "";}  
  if(document.getElementById("fwPageRows"))
  {
    pageSize = document.getElementById("fwPageRows").value;
  }
  else
  { pageSize = "10";}  
  if(document.getElementById("extSH"))
  {
    SH = document.getElementById("extSH").value;
  }
  else
  { SH = "509";} 
  if(document.getElementById("extImgW"))
  {
    imgW = document.getElementById("extImgW").value;
  }
  else
  { imgW = "ON";}   
  if(pageNo > 1)
  {
    rowNo = (pageNo-1) * pageSize + 1;
  }
  //alert("setting rowNo to ="+rowNo);
  setRow("dsRentalSearch", rowNo);
  ownerId = document.getElementById("extOwnerId").value;
  selSort = document.getElementById("extSort").value;
  beds = document.getElementById("extBeds").value;
  if(beds == "unimportant") { beds = ""; }
  extCalendarFrom = ""; extCalendarTo = "";
  if(document.getElementById("extCalendarFrom"))
  {
    if(document.getElementById("extCalendarFrom").value.length > 7)
    {  
      alert("true");
       extCalendarFrom = document.getElementById("extCalendarFrom").value;
       extCalendarFrom = formatToMySQL(extCalendarFrom);
    }
  }
  else
  {
   extCalendarFrom = "";
  }
  if(document.getElementById("extCalendarTo"))
  {
    if(document.getElementById("extCalendarTo").value.length > 7)
    {
       extCalendarTo = document.getElementById("extCalendarTo").value;
       extCalendarTo = formatToMySQL(extCalendarTo);
    }
  } 
  else
  {
   extCalendarTo = "";
  }  
  if(document.getElementById("extCity"))
  {
    //extCityIdx = fwForm.extCity.selectedIndex;
    //extCity = fwForm.extCity.options[extCityIdx].value;
  extCityIdx = document.getElementById("extCity").selectedIndex;
  extCity = document.getElementById("extCity").options[extCityIdx].value;
    
  }
  else
  {
    extCity="";
  }  
var amens = "";
if(document.getElementById("extCbx-amenity_id1"))
{
  if(document.getElementById("extCbx-amenity_id1").checked){ amens = amens+ ",1"; }
  }
if(document.getElementById("extCbx-amenity_id3"))
{
  if(document.getElementById("extCbx-amenity_id3").checked){ amens = amens+ ",3"; }
  }  
if(document.getElementById("extCbx-amenity_id5"))
{
  if(document.getElementById("extCbx-amenity_id5").checked){ amens = amens+ ",5"; }
  } 
if(document.getElementById("extCbx-amenity_id6"))
{
  if(document.getElementById("extCbx-amenity_id6").checked){ amens = amens+ ",6"; }
  }   
if(document.getElementById("extCbx-amenity_id8"))
{
  if(document.getElementById("extCbx-amenity_id8").checked){ amens = amens+ ",8"; }
  } 
if(document.getElementById("extCbx-amenity_id9"))
{
  if(document.getElementById("extCbx-amenity_id9").checked){ amens = amens+ ",9"; }
  } 
if(document.getElementById("extCbx-amenity_id10"))
{
  if(document.getElementById("extCbx-amenity_id10").checked){ amens = amens+ ",10"; }
  } 
if(document.getElementById("extCbx-amenity_id53"))
{
  if(document.getElementById("extCbx-amenity_id53").checked){ amens = amens+ ",53"; }
  }   
if(document.getElementById("extCbx-amenity_id54"))
{
  if(document.getElementById("extCbx-amenity_id54").checked){ amens = amens+ ",54"; }
  }
if(document.getElementById("extCbx-amenity_id55"))
{
  if(document.getElementById("extCbx-amenity_id55").checked){ amens = amens+ ",55"; }
  }
if(document.getElementById("extCbx-amenity_id64"))
{
  if(document.getElementById("extCbx-amenity_id64").checked){ amens = amens+ ",64"; }
  }
if(document.getElementById("extCbx-amenity_id65"))
{
  if(document.getElementById("extCbx-amenity_id65").checked){ amens = amens+ ",65"; }
  }
if(document.getElementById("extCbx-amenity_id66"))
{
  if(document.getElementById("extCbx-amenity_id66").checked){ amens = amens+ ",66"; }
  } 
if(document.getElementById("extCbx-amenity_id67"))
{
  if(document.getElementById("extCbx-amenity_id67").checked){ amens = amens+ ",67"; }
  }  
if(document.getElementById("extCbx-amenity_id68"))
{
  if(document.getElementById("extCbx-amenity_id68").checked){ amens = amens+ ",68"; }
  } 
if(document.getElementById("extCbx-amenity_id69"))
{
  if(document.getElementById("extCbx-amenity_id69").checked){ amens = amens+ ",69"; }
  } 
if(document.getElementById("extCbx-amenity_id70"))
{
  if(document.getElementById("extCbx-amenity_id70").checked){ amens = amens+ ",70"; }
  } 
if(document.getElementById("extCbx-amenity_id71"))
{
  if(document.getElementById("extCbx-amenity_id71").checked){ amens = amens+ ",71"; }
  } 
if(document.getElementById("extCbx-amenity_id72"))
{
  if(document.getElementById("extCbx-amenity_id72").checked){ amens = amens+ ",72"; }
  } 
if(document.getElementById("extCbx-amenity_id73"))
{
  if(document.getElementById("extCbx-amenity_id73").checked){ amens = amens+ ",73"; }
  } 
if(document.getElementById("extCbx-amenity_id74"))
{
  if(document.getElementById("extCbx-amenity_id74").checked){ amens = amens+ ",74"; }
  } 
if(document.getElementById("extCbx-amenity_id75"))
{
  if(document.getElementById("extCbx-amenity_id75").checked){ amens = amens+ ",75"; }
  } 
if(document.getElementById("extCbx-amenity_id76"))
{
  if(document.getElementById("extCbx-amenity_id76").checked){ amens = amens+ ",76"; }
  } 
if(document.getElementById("extCbx-amenity_id77"))
{
  if(document.getElementById("extCbx-amenity_id77").checked){ amens = amens+ ",77"; }
  }  
if(document.getElementById("extCbx-amenity_id78"))
{
  if(document.getElementById("extCbx-amenity_id78").checked){ amens = amens+ ",78"; }
  }  
  //alert("res URL = " + argURL+".jsp?extOID="+ownerId+"&extImgW="+imgW+"&extSH="+SH+"&extVersionNo="+document.getElementById("extVersionNo").value+"&extPageSize="+pageSize+"&extPageNo="+pageNo+"&extSort="+selSort+"&extCity="+extCity+"&extBeds=&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extAmens="+amens);
  setResponseURL(argURL+".jsp?extOID="+ownerId+"&extImgW="+imgW+"&extSH="+SH+"&extVersionNo="+document.getElementById("extVersionNo").value+"&extPageSize="+pageSize+"&extPageNo="+pageNo+"&extSort="+selSort+"&extCity="+extCity+"&extBeds="+beds+"&extCalendarFrom="+extCalendarFrom+"&extCalendarTo="+extCalendarTo+"&extAmens="+amens);
  //alert("extOID="+ownerId);
  //alert("extPageNo="+pageNo);

  submitForm(window, "fwForm");
}
function setState3(argStateNo)
{
  var stateNo = argStateNo;

      selNation = 1;
      setResponseURL("kfrSearch.jsp?extState="+stateNo+"&extNation=1&extNationName=USA");
      setQueryParam("dsRentalSubregions", "argNationCode", 1);
      setQueryParam("dsRentalSubregions", "argStatesProvinces", stateNo);
      setQueryParam("dsRentalSubcategories", "argRentalTypeNo", 1);
      setQueryParam("dsStatesProvincesByStateCode", "argStateCode", stateNo);
      executeQuery("dsStatesProvincesByStateCode");      
      setQueryParam("dsAmenities", "argRentalTypeNo", 1);
      executeQuery("dsAmenities");
      executeQuery("dsRentalSubcategories");
      executeQuery("dsRentalSubregions");
      executeQuery("dsPropertyListingByFeature");   
      submitForm(window, "fwForm");
}

function doSearchRowOnClick(argProv)
{
      selNation =  document.getElementById("extNationCode").value;
      selNationName =  document.getElementById("extNationName").value;
      setResponseURL("kfrSearch.jsp?extState="+argProv+"&extNation="+selNation+"&extNationName="+selNationName);
      
      setQueryParam("dsRentalSubregions", "argNationCode", selNation);
      setQueryParam("dsRentalSubregions", "argStatesProvinces", argProv);
      setQueryParam("dsRentalSubcategories", "argRentalTypeNo", 1); 
      setQueryParam("dsAmenities", "argRentalTypeNo", 1);   
      setQueryParam("dsStatesProvincesByStateCode", "argStateCode", argProv);
      executeQuery("dsStatesProvincesByStateCode");        
      
      executeQuery("dsRentalSubregions");
      executeQuery("dsRentalSubcategories");
      executeQuery("dsAmenities");
      executeQuery("dsPropertyListingByFeature");   
      submitForm(window, "fwForm");
}


function getListing(dataset, rowNo, tableRow)
{
  /* Set the selected row */
  setSelectedRow(tableRow);
  
  
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("ext"+dataset+"-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);

  setQueryParam("dsMultiUnit", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  //NEW
  setQueryParam("dsRatesDetailMU", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);

  executeQuery("dsRatesDetail"); 
  //NEW CHAD
  setQueryParam("dsPropertyOwnerByListingId","argListingId",document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  executeQuery("dsPropertyOwnerByListingId");
  
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  executeQuery("dsRatesDetailMU");
  
//  setResponseURL("MyRentalListing.jsp?fwModuleName=genKfrent");

    setResponseURL("kfrMyRentalListing.jsp?extSender=search");

    submitForm(window, "fwForm");
}

function getListingIFRAME(dataset, rowNo, tableRow, pageNo)
{
  /* Set the selected row */
  //currentURL = ??
  if(document.getElementById("extVersionNo"))
  {
    versionNo = ""+document.getElementById("extVersionNo").value;
  }
  else
  { versionNo = "";}
  pageSize = document.getElementById("fwPageRows").value;
  setSelectedRow(tableRow);
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("ext"+dataset+"-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsMultiUnit", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  setQueryParam("dsRatesDetailMU", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  executeQuery("dsRatesDetail"); 
  setQueryParam("dsPropertyOwnerByListingId","argListingId",document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  executeQuery("dsPropertyOwnerByListingId");
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  executeQuery("dsRatesDetailMU");
  //alert("version no = " +versionNo);
  setResponseURL("kfrMyRentalListingIFRAME_"+versionNo+".jsp?extSender=search&extPageNo="+pageNo+"&extVersionNo="+versionNo+"&extPageSize="+pageSize);
  submitForm(window, "fwForm");
}
function getListingIFRAME_MAP(dataset, rowNo, tableRow, pageNo)
{
  /* Set the selected row */
  //currentURL = ??
  if(document.getElementById("extVersionNo"))
  {
    versionNo = ""+document.getElementById("extVersionNo").value;
  }
  else
  { versionNo = "";}
  pageSize = document.getElementById("fwPageRows").value;
  setSelectedRow(tableRow);
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("ext"+dataset+"-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsMultiUnit", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  setQueryParam("dsRatesDetailMU", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  executeQuery("dsRatesDetail"); 
  setQueryParam("dsPropertyOwnerByListingId","argListingId",document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  executeQuery("dsPropertyOwnerByListingId");
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  executeQuery("dsRatesDetailMU");
  //alert("version no = " +versionNo);
  setResponseURL("kfrMyRentalListingIFRAME_"+versionNo+".jsp?extSender=search&extPageNo="+pageNo+"&extVersionNo="+versionNo+"&extPageSize="+pageSize+"#maparea");
  submitForm(window, "fwForm");
}
function getListingIFRAMEFeature(dataset, listingId, tableRow, pageNo)
{
  /* Set the selected row */
  //currentURL = ??
  if(document.getElementById("extVersionNo"))
  {
    versionNo = ""+document.getElementById("extVersionNo").value;
  }
  else
  { versionNo = "";}
  pageSize = document.getElementById("fwPageRows").value;
  setSelectedRow(tableRow);
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", listingId);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", "1");
  setQueryParam("dsPropertyListingByListingId", "argListingId", listingId);
  setQueryParam("dsListingFeeSetup", "argListingId", listingId);
  setQueryParam("dsMultiUnit", "argListingId", listingId);
  setQueryParam("dsRatesDetail", "argListingId", listingId);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  setQueryParam("dsRatesDetailMU", "argListingId", listingId);
  executeQuery("dsRatesDetail"); 
  setQueryParam("dsPropertyOwnerByListingId","argListingId",listingId);
  executeQuery("dsPropertyOwnerByListingId");
  setQueryParam("dsRatesDetailFreeform", "argListingId", listingId);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  executeQuery("dsRatesDetailMU");
  //alert("version no = " +versionNo);
  setResponseURL("kfrMyRentalListingIFRAME_"+versionNo+".jsp?extSender=search&extPageNo="+pageNo+"&extVersionNo="+versionNo+"&extPageSize="+pageSize);
  submitForm(window, "fwForm");
}
function getListingIFRAME_woodfield(dataset, rowNo, tableRow, pageNo)
{
  /* Set the selected row */
  setSelectedRow(tableRow);
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("ext"+dataset+"-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsMultiUnit", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  setQueryParam("dsRatesDetailMU", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  executeQuery("dsRatesDetail"); 
  setQueryParam("dsPropertyOwnerByListingId","argListingId",document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  executeQuery("dsPropertyOwnerByListingId");
  setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  executeQuery("dsRatesDetailMU");
  setResponseURL("kfrMyRentalListingIFRAME_woodfield.jsp?extSender=search&extPageNo="+pageNo);
  submitForm(window, "fwForm");
}
function getListingIFRAME_cotcon(dataset, rowNo, tableRow, pageNo)
{
  /* Set the selected row */
  setSelectedRow(tableRow);
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("ext"+dataset+"-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsPropertyOwnerByListingId","argListingId",document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  executeQuery("dsRatesDetail");
  executeQuery("dsPropertyOwnerByListingId");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  
  setResponseURL("kfrCotConnectionDetailIFRAME.jsp#head?extSender=search&extPageNo="+pageNo+"#head");
  submitFormList(window, "fwForm");
}
function getListingIFRAME_cotconNS(dataset, rowNo, tableRow, pageNo)
{
  /* Set the selected row */
  setSelectedRow(tableRow);
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById("ext"+dataset+"-RENTAL_TYPE_NO"+rowNo).value);
  setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsPropertyOwnerByListingId","argListingId",document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argListingId", document.getElementById("ext"+dataset+"-LISTING_ID"+rowNo).value);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  executeQuery("dsRatesDetail");
  executeQuery("dsPropertyOwnerByListingId");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  
  setResponseURL("kfrCotConnectionNSDetailIFRAME.jsp#head?extSender=search&extPageNo="+pageNo+"#head");
  submitFormList(window, "fwForm");
}
function getListingIFRAME_cotconFromFeature(listingId)
{
  /* Set the selected row */
  submitForm(window, "fwForm");
//5-14-11  window.parent.location.replace(URLStartCotCon+"/search3.asp?extListingId="+listingId+"#head");
  window.parent.location.replace("search3.asp?extListingId="+listingId+"#head");
  
}
function getListingIFRAME_islandwest(listingId)
{
  /* Set the selected row */
  setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", listingId);
  setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", 1);
  setQueryParam("dsPropertyListingByListingId", "argListingId", listingId);
  setQueryParam("dsListingFeeSetup", "argListingId", listingId);
  setQueryParam("dsMultiUnit", "argListingId", listingId);
  setQueryParam("dsRatesDetail", "argListingId", listingId);
  setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  setQueryParam("dsRatesDetailMU", "argListingId", listingId);
  executeQuery("dsRatesDetail"); 
  setQueryParam("dsPropertyOwnerByListingId","argListingId", listingId);
  executeQuery("dsPropertyOwnerByListingId");
  setQueryParam("dsRatesDetailFreeform", "argListingId", listingId);
  setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
  executeQuery("dsRatesDetailFreeform");
  executeQuery("dsListingFeeSetup");
  executeQuery("dsPropertyListingByListingId");
  executeQuery("dsSelectedAmenitiesByListingId");
  executeQuery("dsMultiUnit");
  executeQuery("dsRatesDetailMU");
  
  submitForm(window, "fwForm");
  window.parent.location.replace("http://localhost:8080/IslandWest/IslandWestDetailPage.htm");
  
}

function retrieveListings()
{

  selSubregion = document.getElementById("extdsPropertyListing-SUBREGION_CODE").value;
  
  noOfBedrooms = document.getElementById("extBedrooms").value;
  subcat =  document.getElementById("extdsRentalType-RENTAL_SUBCAT").value;
  //alert("subcat = " + subcat);
  
 
  //if (selSubregion == "*")
  //{
  //  /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
  //  setResponseURL("rental_listingsALL.jsp?fwModuleName=genKfrent");  
  //}
  //else
  //{
    /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
 
  //}
    

  
  //if (noOfBedrooms == "ANY")
  //{ 
  //	/* Build the script segment.*/
  //	var segment3 = 'DynamicSearchRentals.dynamicSQLbuilder()';
  //	buildScriptSegment(segment3);  
  //}
  //else
  //{
     /* Build the script segment.*/
     //alert("sending number of bedrooms = " + noOfBedrooms);
      var segment13 = 'DynamicSearchRentals.dynamicSQLbuilderAdvancedNew("'+noOfBedrooms+'")';
      buildScriptSegment(segment13);
  //   }
  /* Save the buffer.*/
  //executeQuery("dsRentalSearch");

   setResponseURL("kfrSearchResults.jsp?fwModuleName=genKfrent&extPageNo=1");

  submitForm(window, "fwForm");  
}

function searchAvailableProperties()
{


  noOfBedrooms = document.getElementById("extNUMBER_OF_BEDROOMS").value;
  lowDaily = document.getElementById("extLowDaily").value;
  highDaily = document.getElementById("extHighDaily").value;
  stateProv = document.getElementById("extStateProvinceCode").value;
  nation = document.getElementById("extNationCode").value;

  todayDateFromS = document.getElementById("extCalendarFrom").value;
if(todayDateFromS == "")
{
  alert("Please enter your desired Arrival Date.");
  return;
  }  
  todayDateFrom = "'" + todayDateFromS + "'";
  
  todayDateToS = document.getElementById("extCalendarTo").value;
if(todayDateToS == "")
{
  alert("Please enter your desired Departure Date.");
  return;
  }  
  todayDateTo = "'" + todayDateToS + "'";
  
  fromDateD = new Date(todayDateFromS);
  toDateD = new Date(todayDateToS);
  dateTodayD = new Date();

  difference = Math.abs(toDateD.getTime() - fromDateD.getTime());
  daysUntilReservation = Math.abs(dateTodayD.getTime() - toDateD.getTime());
  daysDiff = (difference / (1000 * 60 * 60 * 24)) + 1;  
  daysUntilReservation = (daysUntilReservation / (1000 * 60 * 60 * 24)) + 1; 
  //make sure we are rounded
  daysDiff = Math.round(daysDiff);
  daysUntilReservation = Math.round(daysUntilReservation);
  
  fromDate = "'" + todayDateFromS + "'";
  toDate = "'" + todayDateToS + "'";
  //alert("From date = " + todayDateFromS + " and To date = " + todayDateToS);

    setResponseURL("kfrSearchResultsAvailable.jsp?fwModuleName=genKfrent&extPageNo=1");

setQueryParam("dsSearchAvailable","argFromDate",todayDateFromS);
setQueryParam("dsSearchAvailable","argToDate",todayDateToS);
setQueryParam("dsSearchAvailable","argMinStay",daysDiff);
setQueryParam("dsSearchAvailable","argLowDaily",lowDaily);
setQueryParam("dsSearchAvailable","argHighDaily",highDaily);
setQueryParam("dsSearchAvailable","argStateProv", stateProv);
setQueryParam("dsSearchAvailable","argNation", nation);
setQueryParam("dsSearchAvailable","argFromDate2",todayDateFromS);
setQueryParam("dsSearchAvailable","argToDate2",todayDateToS);
setQueryParam("dsSearchAvailable","argMinStay2",daysDiff);
setQueryParam("dsSearchAvailable","argLowDaily2",lowDaily);
setQueryParam("dsSearchAvailable","argHighDaily2",highDaily);
setQueryParam("dsSearchAvailable","argStateProv2", stateProv);
setQueryParam("dsSearchAvailable","argNation2", nation);
executeQuery("dsSearchAvailable");

  submitForm(window, "fwForm");

}

function retrieveListingById()
{
    setResponseURL("kfrSearchResults.jsp?fwModuleName=genKfrent&extPageNo=1");
    argListingID = document.getElementById("extListingID").value;
    if(argListingID == "")
    {
      alert("Please enter a listing ID.");
      return;
      }
    //alert("Listing ID = " + argListingID); 
      var segment13 = 'DynamicSearchRentals.dynamicSQLbuilderByListingID("'+argListingID+'")';
      buildScriptSegment(segment13);
      submitForm(window, "fwForm");
}
function setState2(argStateNo)
{
  var stateNo = argStateNo;
      //open the next search page
      //rentalTypeNo = document.fwForm.elements[5].value;
      rentalTypeNo = document.getElementById("extdsRentalType-RENTAL_TYPE_NO").value;
      //selNation = document.getElementById("extdsNations-NATION_NAME").value; 
      selNation = 1;
      //alert("rental type = " + rentalTypeNo + "state = " + stateNo);
      if (rentalTypeNo == 3) 
      {
        setResponseURL("search_listings2AV.jsp?extState="+stateNo+"&extRentalTypeNo="+rentalTypeNo+"&extNation="+selNation);
      }
      else
      {
        setResponseURL("search_listings2.jsp?extState="+stateNo+"&extRentalTypeNo="+rentalTypeNo+"&extNation="+selNation);
      }      
      setQueryParam("dsAirports", "argNationCode", 1);
      setQueryParam("dsAirports", "argStateProvinceCode", stateNo);
      setQueryParam("dsRentalSubregions", "argNationCode", 1);
      setQueryParam("dsRentalSubregions", "argStatesProvinces", stateNo);
      setQueryParam("dsRentalSubcategories", "argRentalTypeNo", rentalTypeNo); 
      setQueryParam("dsAmenities", "argRentalTypeNo", rentalTypeNo);      
      
      executeQuery("dsAirports");
      executeQuery("dsRentalSubregions");
      //chad//sortDataSet("dsRentalSubregions", "SUBREGION_NAME ASC");
      executeQuery("dsRentalSubcategories");
      //sortDataSet("dsRentalSubcategories", "DESCRIPTION ASC");
      executeQuery("dsAmenities");
      //load the features
      executeQuery("dsPropertyListingByFeature");   
      submitForm(window, "fwForm");
}

function setState(argStateNo)
{
  var stateNo = argStateNo;
  var rentalTypeNo
    //if(document.fwForm.elements[5].value == "")
    rentalTypeNo = document.getElementById("extdsRentalType-RENTAL_DESCRIPTION").value;
    if(rentalTypeNo == "") 
    {
      alert("Please select a rental type first.");
      return false;
    }
    else
    {
      //open the next search page
      //selNation = document.getElementById("extdsNations-NATION_NAME").value; 
      selNation = 1;
      //alert("rental type = " + rentalTypeNo + "state = " + stateNo);
      if (rentalTypeNo == 3) 
      {
        setResponseURL("search_listings2AV.jsp?extState="+stateNo+"&extRentalTypeNo="+rentalTypeNo+"&extNation="+selNation);
      }
      else
      {
        setResponseURL("search_listings2.jsp?extState="+stateNo+"&extRentalTypeNo="+rentalTypeNo+"&extNation="+selNation);
      }      
      setQueryParam("dsAirports", "argNationCode", 1);
      setQueryParam("dsAirports", "argStateProvinceCode", stateNo);
      setQueryParam("dsRentalSubregions", "argNationCode", 1);
      setQueryParam("dsRentalSubregions", "argStatesProvinces", stateNo);
      setQueryParam("dsRentalSubcategories", "argRentalTypeNo", rentalTypeNo); 
      setQueryParam("dsAmenities", "argRentalTypeNo", rentalTypeNo);      
      
      executeQuery("dsAirports");
      executeQuery("dsRentalSubregions");
      //chad//sortDataSet("dsRentalSubregions", "SUBREGION_NAME ASC");
      executeQuery("dsRentalSubcategories");
      //sortDataSet("dsRentalSubcategories", "DESCRIPTION ASC");
      executeQuery("dsAmenities");
      //load the features
      executeQuery("dsPropertyListingByFeature");   
      submitForm(window, "fwForm");
    }
}

function openMapQuestWindowS(rowNo)
{
  address = document.getElementById("extdsRentalSearch-ADDRESS1"+rowNo).value;
  csz = document.getElementById("extdsRentalSearch-CITY"+rowNo).value + '+' + document.getElementById("extdsRentalSearch-STATE"+rowNo).value + '+' + document.getElementById("extdsRentalSearch-ZIPCODE"+rowNo).value;
  if ((address == "") || (csz == ""))
  {
    alert("Sorry, the rental address is incomplete and/or MapIt cannot find the specified address.");
    return;
    }
  theURL = 'http://maps.yahoo.com/py/maps.py?&addr=' + address + '&csz=' + csz;
  var pb = window.open(theURL,'','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
  if(!pb){
     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
  }
}

function openCalendar(rowNo, dsToUse)
{
  var calLink = document.getElementById(dsToUse+"-CALENDAR_HTTP_LINK"+rowNo).value;
  var pb = window.open(calLink,'','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
  if(!pb){
     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
  }
}

function openMapQuestWindow(rowNo)
{
  address = document.getElementById("extdsRentalBrowse-ADDRESS1"+rowNo).value;
  csz = document.getElementById("extdsRentalBrowse-CITY"+rowNo).value + '+' + document.getElementById("extdsRentalBrowse-STATE"+rowNo).value + '+' + document.getElementById("extdsRentalBrowse-ZIPCODE"+rowNo).value;
  theURL = "http://maps.yahoo.com/py/maps.py?&addr=" + address + "&csz=" + csz;
  if ((address == "") || (csz == ""))
  {
    alert("Sorry, the rental address is incomplete and/or MapIt cannot find the specified address.");
    return;
    }

  var pb = window.open(theURL,'','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes');
  if(!pb)
  {
     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
  }
}  

function showReserveOnClick(rowNo, dsToUse)
{
  if(submitInProcess == true)
  {
    alert("If you have received this message then please RELOAD the page and let PLEASE allow time for the page to load to completion.  Thank You!");
    return;
  }  
  	/* Set the row.*/
  	setRow("dsRentalSearch", rowNo);  
  	//alert("-SPACE_AVAILABLE_LISTING = " + document.getElementById(dsToUse+"-SPACE_AVAILABLE_LISTING"+rowNo).value);
  	//alert("-ONLINE_RESERVABLE = " + document.getElementById(dsToUse+"-ONLINE_RESERVABLE"+rowNo).value);
  	//alert("-MULTIUNIT_FLAG = " + document.getElementById(dsToUse+"-MULTIUNIT_FLAG"+rowNo).value);
  if (document.getElementById(dsToUse+"-SPACE_AVAILABLE_LISTING"+rowNo).value == "1")
  {
      //CHAD need new code for space available reservationsI
  	setQueryParam("dsRatesDetail", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
  	setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  	
  	setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
        setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);

        executeQuery("dsListingFeeSetup");
        executeQuery("dsPropertyListingByListingId");        
	executeQuery("dsRatesDetail");
	setResponseURL("MyAvailableDatesSpaceAvail.jsp?fwModuleName=genKfrent&extSubUnitId=0");
  	submitForm(window, "fwForm");
  	//location_window =  window.open("MyAvailableDatesSpaceAvail.jsp?fwModuleName=genKfrent&extSubUnitId=0","locate","scrollbars=yes,location,height=560,width=778");  
     //if(!location_window)
     //{
     //  alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
     //}
  }
 if ((document.getElementById(dsToUse+"-ONLINE_RESERVABLE"+rowNo).value == "1") && (document.getElementById(dsToUse+"-MULTIUNIT_FLAG"+rowNo).value == "1"))
  {
    
  	setQueryParam("dsSelectedAmenitiesByListingId", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
  	setQueryParam("dsSelectedAmenitiesByListingId", "argRentalTypeNo", document.getElementById(dsToUse+"-RENTAL_TYPE_NO"+rowNo).value);
  	setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
  	setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);

  	setQueryParam("dsMultiUnit", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
  	setQueryParam("dsRatesDetail", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
  	setQueryParam("dsRatesDetail", "argSubUnitId", 0);
	
  	executeQuery("dsRatesDetail"); 
     //NEW CHAD
     setQueryParam("dsRatesDetailFreeform", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
     setQueryParam("dsRatesDetailFreeform", "argSubUnitId", 0);
     executeQuery("dsRatesDetailFreeform");  	
  	executeQuery("dsListingFeeSetup"); 
  	executeQuery("dsPropertyListingByListingId");
  	executeQuery("dsSelectedAmenitiesByListingId");
  	executeQuery("dsMultiUnit");
  

  	/* Submit form on Main page.*/
  	setResponseURL("MyRentalListing.jsp?fwModuleName=genKfrent#avail");
  	submitForm(window, "fwForm");
  	//alert("going to open MyRentalListing");
  	//location_window =  window.open("MyRentalListing.jsp?fwModuleName=genKfrent#avail","locate","scrollbars=yes,location,height=560,width=778"); 
	//  if(!location_window){
	//     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
	//  }
	  return;
  }  
  if ((document.getElementById(dsToUse+"-ONLINE_RESERVABLE"+rowNo).value == "1") && (!document.getElementById(dsToUse+"-MULTIUNIT_FLAG"+rowNo).value == "0") &&((document.getElementById(dsToUse+"-SPACE_AVAILABLE_LISTING"+rowNo).value == "0") ||(document.getElementById(dsToUse+"-SPACE_AVAILABLE_LISTING"+rowNo).value == "")))
  {

  	//setResponseURL("MyAvailableDatesPM.jsp?fwModuleName=genKfrent&extSubUnitId=0");
  
  	setQueryParam("dsCheckDateRangesNonMulti", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
  	setQueryParam("dsCheckDateRangesNonMulti", "argSubUnitId", 0);
  	setQueryParam("dsRatesDetail", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
  	setQueryParam("dsRatesDetail", "argSubUnitId", 0);
  	setQueryParam("dsListingFeeSetup", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);
        setQueryParam("dsPropertyListingByListingId", "argListingId", document.getElementById(dsToUse+"-LISTING_ID"+rowNo).value);

        executeQuery("dsListingFeeSetup");
        executeQuery("dsPropertyListingByListingId");        
 	executeQuery("dsCheckDateRangesNonMulti");
	executeQuery("dsRatesDetail");
	setResponseURL("MyAvailableDatesPM.jsp?fwModuleName=genKfrent&extSubUnitId=0");
  	submitForm(window, "fwForm");
  	//alert("going to open MyAvailableDatesPM");
  	//location_window =  window.open("MyAvailableDatesPM.jsp?fwModuleName=genKfrent&extSubUnitId=0","locate","scrollbars=yes,location,height=560,width=778");  
	//  if(!location_window){
	//     alert('We have detected that you are using popup blocking software. In order to access this portion of KeysForRent, you must disable your popup blocker.'); 
        //   }	
  }

}//function showReserveOnClick()

function reserveProp()
{ 
//************************************
//
listingId = document.getElementById("dsPropertyListingByListingId-LISTING_ID").value;
subUnitId = 0;
var extDataset = 'dsPropertyListingByListingId';
//alert("subunit selected = " + subUnitId);

  if (document.getElementById("dsPropertyListingByListingId-SPACE_AVAILABLE_LISTING").value == "1")
  {
    //CHAD need new code for space available reservationsI
	setResponseURL("MyAvailableDatesSpaceAvail.jsp?fwModuleName=genKfrent&extSubUnitId=0&extDataset="+extDataset);
        setQueryParam("dsRatesDetail", "argListingId", listingId);
	setQueryParam("dsRatesDetail", "argSubUnitId", subUnitId);

	executeQuery("dsRatesDetail");  
  }
  else
  {
	setResponseURL("MyAvailableDatesPM.jsp?fwModuleName=genKfrent&extSubUnitId=0&extDataset="+extDataset);

	setQueryParam("dsCheckDateRangesNonMulti", "argListingId", listingId);
	setQueryParam("dsCheckDateRangesNonMulti", "argSubUnitId", subUnitId);
	setQueryParam("dsRatesDetail", "argListingId", listingId);
	setQueryParam("dsRatesDetail", "argSubUnitId", subUnitId);

	executeQuery("dsCheckDateRangesNonMulti");
	executeQuery("dsRatesDetail");
	//executeQuery("dsRoomsBySubUnitID");
}

submitForm(window, "fwForm");


//************************************
}
function checkAvail(rowNo)
{
//************************************
//
listingId = document.getElementById("dsPropertyListingByListingId-LISTING_ID").value;
subUnitId = document.getElementById("dsMultiUnit-SUBUNIT_ID"+rowNo).value;

//alert("subunit selected = " + subUnitId);

	setResponseURL("MyAvailableDates.jsp?fwModuleName=genKfrent&extSubUnitId="+subUnitId);

	setQueryParam("dsCheckDateRanges", "argListingId", listingId);
	setQueryParam("dsCheckDateRanges", "argSubUnitId", subUnitId);
	setQueryParam("dsListingFeeSetup", "argListingId", listingId);
	setQueryParam("dsRatesDetail", "argListingId", listingId);
	setQueryParam("dsRatesDetail", "argSubUnitId", subUnitId);
	setQueryParam("dsRoomsBySubUnitID", "argListingId", listingId);
	setQueryParam("dsRoomsBySubUnitID", "argSubUnitId", subUnitId);

	executeQuery("dsCheckDateRanges");
	executeQuery("dsListingFeeSetup");
	executeQuery("dsRatesDetail");
	executeQuery("dsRoomsBySubUnitID");

submitForm(window, "fwForm");


//************************************
}



function getAvailableRooms(rowNo)
{
//************************************

  listingId = document.getElementById("dsCheckDateRanges-LISTING_ID").value;
  subUnitId = document.getElementById("dsCheckDateRanges-SUBUNIT_ID").value;
  roomId = document.getElementById("dsRoomsBySubUnitID-ROOM_NAME").value;
  extNoOfAdults = document.fwForm.extNoOfAdults.value;
  extNoOfChildren = document.fwForm.extNoOfChildren.value;
  noOfPeople = parseInt(extNoOfAdults) + parseInt(extNoOfChildren);
  extHandicapped = "no";
  extHearingImpaired = "no";
  if (document.fwForm.extHandicapped[0].checked)
  {
      extHandicapped = "yes";
  }
  if (document.fwForm.extHearingImpaired[0].checked)
  {
      extHearingImpaired = "yes";
  }

  needPetDep = "NO";
  //alert("room ID = " + roomId);
  fromDate = document.getElementById("extdateFrom").value;
  toDate = document.getElementById("extdateTo").value;
  if(document.fwForm.extgroup2[0].checked)
  { 
    needPetDep = "YES";
  }
  
  fromDateD = new Date(fromDate);
  toDateD = new Date(toDate);
  //we are colleting the depart date...so set it to day before
  toDateD.setDate(toDateD.getDate() - 1);  
  dateTodayD = new Date();
  difference = Math.abs(toDateD.getTime() - fromDateD.getTime());
  daysUntilReservation = Math.abs(dateTodayD.getTime() - toDateD.getTime());
  daysDiff = (difference / (1000 * 60 * 60 * 24)) + 1;  
  daysUntilReservation = (daysUntilReservation / (1000 * 60 * 60 * 24)) + 1; 
  //make sure we are rounded
  daysDiff = Math.round(daysDiff);
  daysUntilReservation = Math.round(daysUntilReservation);
  //alert("new TO date = " + toDateD + " days difference = " + daysDiff);
  
  var day = toDateD.getDate();
  var month = toDateD.getMonth()  + 1;
  var year = toDateD.getFullYear();

  toDate = month + '/' + day + '/' + year;

  fromDate = "'" + fromDate + "'";
  toDate = "'" + toDate + "'";
  setResponseURL("MyAvailableDatesAR.jsp?fwModuleName=genKfrent&extNoOfAdults="+extNoOfAdults+"&extNoOfChildren="+extNoOfChildren+"&extHandicapped="+extHandicapped+"&extHearingImpaired="+extHearingImpaired+"#entryPoint");
  
  //clearDataSet("dsGetAvailableRooms");
  /* Build the script segment.*/
  var segment13 = 'MultiUnitAdmin.getAvailableRooms2("'+listingId+'","'+subUnitId+'","'+fromDate+'","'+toDate+'","'+daysDiff+'","'+roomId+'","'+daysUntilReservation+'","'+needPetDep+'","'+noOfPeople+'")';
  buildScriptSegment(segment13); 

  setQueryParam("dsListingFeeSetup", "argListingId", listingId);
  setQueryParam("dsCheckDateRanges", "argListingId", listingId);
  setQueryParam("dsCheckDateRanges", "argSubUnitId", subUnitId);
  setQueryParam("dsRatesDetail", "argListingId", listingId);
  setQueryParam("dsRatesDetail", "argSubUnitId", subUnitId);
  setQueryParam("dsRoomsBySubUnitID", "argListingId", listingId);
  setQueryParam("dsRoomsBySubUnitID", "argSubUnitId", subUnitId);  

  executeQuery("dsListingFeeSetup");
  executeQuery("dsCheckDateRanges");
  executeQuery("dsRatesDetail");
  executeQuery("dsRoomsBySubUnitID");  

  submitForm(window, "fwForm");

}

function loadAllOwner(argOwnerID)
{
  setQueryParam("dsPropertyListingByOwnerMU","argOwnerId",argOwnerID);
  executeQuery("dsPropertyListingByOwnerMU");
  setResponseURL("allRentalListingsByOwner.jsp");
  submitForm(window, "fwForm");
  
}

function showPropertyOnClick(rowNo, tableRow)
{
  listId = document.getElementById("extdsPropertyListingByOwnerMU-LISTING_ID"+rowNo).value;
  rentalTypeNo = document.getElementById("extdsPropertyListingByOwnerMU-RENTAL_TYPE_NO"+rowNo).value;
  subUnitId = "0";
  setResponseURL("kfrRentalListingAdmin.jsp?extListingId="+listId+"&extSubUnitId="+subUnitId+"&extRentalTypeNo="+rentalTypeNo);

  /* Submit form on Main page.*/
  submitForm(window, "fwForm");
  

}//function showPropertyOnClick(dataSet, rowNo)

function buildSpaceAvailableRate(rowNo)
{
//************************************

  listingId = document.getElementById("dsCheckDateRanges-LISTING_ID").value;

  extNoOfAdults = document.fwForm.extNoOfAdults.value;
  extNoOfChildren = document.fwForm.extNoOfChildren.value;

  var extHearingImpaired = "no";
  var extHandicapped = "no";
  noOfPeople = parseInt(extNoOfAdults) + parseInt(extNoOfChildren);
  //EVAL
  //alert("no of people = " + noOfPeople); 
  if (document.fwForm.extHandicapped[0].checked)
  {
      extHandicapped = "yes";
  }
  if (document.fwForm.extHearingImpaired[0].checked)
  {
      extHearingImpaired = "yes";
  }

  needPetDep = "NO";
  //alert("room ID = " + roomId);
  fromDate = document.getElementById("extdateFrom").value;
  toDate = document.getElementById("extdateTo").value;
  if(document.fwForm.extgroup2[0].checked)
  { 
    needPetDep = "YES";
  }
  
  fromDateD = new Date(fromDate);
  toDateD = new Date(toDate);
    var day = toDateD.getDate();
    var month = toDateD.getMonth()  + 1;
    var year = toDateD.getFullYear();
    rawToDate = "'"+month + '/' + day + '/' + year+"'";

  //we are colleting the depart date...so set it to day before
  toDateD.setDate(toDateD.getDate() - 1);
  dateTodayD = new Date();
  difference = Math.abs(toDateD.getTime() - fromDateD.getTime());
  daysUntilReservation = Math.abs(dateTodayD.getTime() - toDateD.getTime());
  daysDiff = (difference / (1000 * 60 * 60 * 24)) + 1;  
  daysUntilReservation = (daysUntilReservation / (1000 * 60 * 60 * 24)) + 1; 
  //make sure we are rounded
  daysDiff = Math.round(daysDiff);
  daysUntilReservation = Math.round(daysUntilReservation);
  //alert("new TO date = " + toDateD + " days difference = " + daysDiff);
  
  var day = toDateD.getDate();
  var month = toDateD.getMonth()  + 1;
  var year = toDateD.getFullYear();
  toDate = month + '/' + day + '/' + year;
//*** NEW CODE FOR MY SQL
  var day = toDateD.getDate();
  var month = toDateD.getMonth()  + 1;
  var year = toDateD.getFullYear();
  toDate = year + '-' + month + '-' + day;
  day = fromDateD.getDate();
  month = fromDateD.getMonth()  + 1;
  year = fromDateD.getFullYear();
  fromDate = year + '-' + month + '-' + day;
  //**** END NEW CODE
   
  fromDate = "'" + fromDate + "'";
  toDate = "'" + toDate + "'";

  setResponseURL("MyAvailableDatesSpaceAvailAR.jsp?fwModuleName=genKfrent&extNoOfAdults="+extNoOfAdults+"&extNoOfChildren="+extNoOfChildren+"&extHandicapped="+extHandicapped+"&extFromDate="+fromDate+"&extToDate="+rawToDate+"&extHearingImpaired="+extHearingImpaired+"#entryPoint");
  

  /* Build the script segment.*/
  var segment13 = 'MultiUnitAdmin.buildSpaceAvailableRate("'+listingId+'","'+fromDate+'","'+toDate+'","'+daysDiff+'","'+daysUntilReservation+'","'+needPetDep+'","'+noOfPeople+'")';
  buildScriptSegment(segment13); 

  setQueryParam("dsListingFeeSetup", "argListingId", listingId);
  setQueryParam("dsRatesDetail", "argListingId", listingId);
  setQueryParam("dsRatesDetail", "argSubUnitId", "0");

  executeQuery("dsListingFeeSetup");
  executeQuery("dsRatesDetail");
 

  submitForm(window, "fwForm");


}

function getAvailableRoomsPM(rowNo)
{
//************************************

  listingId = document.getElementById("dsCheckDateRangesNonMulti-LISTING_ID").value;
  //subUnitId = document.getElementById("dsCheckDateRanges-SUBUNIT_ID").value;
  //roomId = document.getElementById("dsRoomsBySubUnitID-ROOM_NAME").value;
  extNoOfAdults = document.fwForm.extNoOfAdults.value;
  extNoOfChildren = document.fwForm.extNoOfChildren.value;

  var extHearingImpaired = "no";
  var extHandicapped = "no";
  noOfPeople = parseInt(extNoOfAdults) + parseInt(extNoOfChildren);
  //EVAL
  //alert("no of people = " + noOfPeople); 
  if (document.fwForm.extHandicapped[0].checked)
  {
      extHandicapped = "yes";
  }
  if (document.fwForm.extHearingImpaired[0].checked)
  {
      extHearingImpaired = "yes";
  }

  needPetDep = "NO";
  //alert("room ID = " + roomId);
  fromDate = document.getElementById("extdateFrom").value;
  toDate = document.getElementById("extdateTo").value;
  if(document.fwForm.extgroup2[0].checked)
  { 
    needPetDep = "YES";
  }
  
  fromDateD = new Date(fromDate);
  toDateD = new Date(toDate);
  //we are colleting the depart date...so set it to day before
  toDateD.setDate(toDateD.getDate() - 1);
  dateTodayD = new Date();
  difference = Math.abs(toDateD.getTime() - fromDateD.getTime());
  daysUntilReservation = Math.abs(dateTodayD.getTime() - toDateD.getTime());
  daysDiff = (difference / (1000 * 60 * 60 * 24)) + 1;  
  daysUntilReservation = (daysUntilReservation / (1000 * 60 * 60 * 24)) + 1; 
  //make sure we are rounded
  daysDiff = Math.round(daysDiff);
  daysUntilReservation = Math.round(daysUntilReservation);
  //alert("new TO date = " + toDateD + " days difference = " + daysDiff);
  
  var day = toDateD.getDate();
  var month = toDateD.getMonth()  + 1;
  var year = toDateD.getFullYear();
  toDate = month + '/' + day + '/' + year;

  fromDate = "'" + fromDate + "'";
  toDate = "'" + toDate + "'";

  setResponseURL("MyAvailableDatesPMAR.jsp?fwModuleName=genKfrent&extNoOfAdults="+extNoOfAdults+"&extNoOfChildren="+extNoOfChildren+"&extHandicapped="+extHandicapped+"&extHearingImpaired="+extHearingImpaired+"#entryPoint");
  
  //clearDataSet("dsGetAvailableRooms");
  /* Build the script segment.*/
  var segment13 = 'MultiUnitAdmin.getAvailableRooms1("'+listingId+'","'+fromDate+'","'+toDate+'","'+daysDiff+'","'+daysUntilReservation+'","'+needPetDep+'","'+noOfPeople+'")';
  buildScriptSegment(segment13); 

setQueryParam("dsListingFeeSetup", "argListingId", listingId);
setQueryParam("dsCheckDateRangesNonMulti", "argListingId", listingId);
setQueryParam("dsCheckDateRangesNonMulti", "argSubUnitId", "0");
setQueryParam("dsRatesDetail", "argListingId", listingId);
setQueryParam("dsRatesDetail", "argSubUnitId", "0");

executeQuery("dsListingFeeSetup");
executeQuery("dsCheckDateRangesNonMulti");
executeQuery("dsRatesDetail");
//executeQuery("dsRoomsBySubUnitID"); 

  submitForm(window, "fwForm");


}

function reserveRoom(rowNo)
{
  listingId = document.getElementById("extdsGetAvailableRoomsByRoomId-LISTING_ID"+rowNo).value;
  subUnitId = document.getElementById("extdsGetAvailableRoomsByRoomId-SUBUNIT_ID"+rowNo).value;
  roomId = document.getElementById("extdsGetAvailableRoomsByRoomId-ROOM_ID"+rowNo).value;
  dateFrom = document.getElementById("extdateFrom"+rowNo).value;
  dateTo = document.getElementById("extdateTo"+rowNo).value;
  charge = document.getElementById("extcurrentcharge"+rowNo).value;
  balanceDue = document.getElementById("extbaldue"+rowNo).value;
  roomName = document.getElementById("extroomName"+rowNo).value;
  deposit = document.getElementById("extdeposit"+rowNo).value;
  tax = document.getElementById("exttax"+rowNo).value; 
  additionalPartyFee = document.getElementById("extadditionalPartyFee"+rowNo).value;
  
  extDepOnly  = document.getElementById("extDepOnly"+rowNo).value;
  extPetDep  = document.getElementById("extPetDep"+rowNo).value;
  extUtilityDep  = document.getElementById("extUtilityDep"+rowNo).value;
  extOtherFee1  = document.getElementById("extOtherFee1"+rowNo).value;
  extOtherFee2  = document.getElementById("extOtherFee2"+rowNo).value; 
  extOtherFee3  = document.getElementById("extOtherFee3"+rowNo).value; 
  extCleaningFee = document.getElementById("extCleaningFee"+rowNo).value;
  extTotalReservationTax  = document.getElementById("extTotalReservationTax"+rowNo).value;
  extApplicationFee = document.getElementById("extApplicationFee"+rowNo).value;
  extRentalTax = document.getElementById("extRentalTax"+rowNo).value;
  extRefAmt = document.getElementById("extRefAmt"+rowNo).value;
  extTotDisc = document.getElementById("extTotDisc"+rowNo).value;
  extNoOfAdults = document.fwForm.extNoOfAdults.value;
  extNoOfChildren = document.fwForm.extNoOfChildren.value;
  extHandicapped = 0;
  extHearingImpaired = 0;
  if (document.fwForm.extHandicapped[0].checked)
  {
      extHandicapped = 1;
  }
  if (document.fwForm.extHearingImpaired[0].checked)
  {
      extHearingImpaired = 1;
  }  

  
  
  rentalChargeType = "DEPOSIT";  
  if ((deposit == 0) || (deposit == '0.00'))
  {
     rentalChargeType = "PAID IN FULL";
     charge = balanceDue;
  } 

  dateFromMQ = dateFrom.substring(1,(dateFrom.length -1));
  //alert("date to with quotes = " + dateTo);
  dateToMQ = dateTo.substring(1,(dateTo.length -1));

  fromDateD = new Date(dateFromMQ);
  toDateD = new Date(dateToMQ);  
  fromDateD.setDate(fromDateD.getDate() - 1);
  //CHAD NEW DATE SETUP
  //toDateD.setDate(toDateD.getDate() + 1);
  toDateD.setDate(toDateD.getDate());
  //alert("new from date = " + fromDateD);
  fromDateS = formatNewDate(fromDateD);
  toDateS = formatNewDate(toDateD);
  fromDateMinusOne = "'" + fromDateS + "'";
  toDatePlusOne = "'" + toDateS + "'";  
  
 
//5-14-11   setResponseURL(secureURLStart+"MyReservationCCInfo.jsp?fwModuleName=genKfrent&extListingId="+listingId+"&extSubUnitId="+subUnitId+"&extChargeType="+rentalChargeType+"&extRoomId="+roomId+"&extBalDue="+balanceDue+"&extCleaningFee="+extCleaningFee+"&extDeposit="+deposit+"&extTax="+tax+"&extRentalCharge="+charge+"&extArrivalDate="+dateFromMQ+"&extDepartureDate="+dateToMQ+"&extRoomName="+roomName+"&extArrivalDateWQ="+dateFrom+"&extDepartDateWQ="+dateTo+"&extArrivalDateMO="+fromDateMinusOne+"&extDepartDatePO="+toDatePlusOne+"&extDepOnly="+extDepOnly+"&extPetDep="+extPetDep+"&extUtilityDep="+extUtilityDep+"&extOtherFee1="+extOtherFee1+"&extOtherFee2="+extOtherFee2+"&extTotalReservationTax="+extTotalReservationTax+"&extApplicationFee="+extApplicationFee+"&extRentalTax="+extRentalTax+"&extNoOfAdults="+extNoOfAdults+"&extNoOfChildren="+extNoOfChildren+"&extHandicapped="+extHandicapped+"&extHearingImpaired="+extHearingImpaired+"&extadditionalPartyFee="+additionalPartyFee+"&extRefAmt="+extRefAmt+"&extTotDisc="+extTotDisc);
   setResponseURL("MyReservationCCInfo.jsp?extListingId="+listingId+"&extSubUnitId="+subUnitId+"&extChargeType="+rentalChargeType+"&extRoomId="+roomId+"&extBalDue="+balanceDue+"&extCleaningFee="+extCleaningFee+"&extDeposit="+deposit+"&extTax="+tax+"&extRentalCharge="+charge+"&extArrivalDate="+dateFromMQ+"&extDepartureDate="+dateToMQ+"&extRoomName="+roomName+"&extArrivalDateWQ="+dateFrom+"&extDepartDateWQ="+dateTo+"&extArrivalDateMO="+fromDateMinusOne+"&extDepartDatePO="+toDatePlusOne+"&extDepOnly="+extDepOnly+"&extPetDep="+extPetDep+"&extUtilityDep="+extUtilityDep+"&extOtherFee1="+extOtherFee1+"&extOtherFee2="+extOtherFee2+"&extTotalReservationTax="+extTotalReservationTax+"&extApplicationFee="+extApplicationFee+"&extRentalTax="+extRentalTax+"&extNoOfAdults="+extNoOfAdults+"&extNoOfChildren="+extNoOfChildren+"&extHandicapped="+extHandicapped+"&extHearingImpaired="+extHearingImpaired+"&extadditionalPartyFee="+additionalPartyFee+"&extRefAmt="+extRefAmt+"&extTotDisc="+extTotDisc);

  
   setQueryParam("dsCCBatch", "argListingId", listingId);
   setQueryParam("dsCCBatch", "argSubUnitId", subUnitId);
   setQueryParam("dsCCBatch", "argRoomId", roomId);
 
   executeQuery("dsCCBatch");
   appendRow("dsCCBatch");

 
  /* Submit the Form */
  submitForm(window, "fwForm");
}

function logon()
{
   logonpage() 
}

function logonReservationAcceptance()
{
 
   userName = document.getElementById("extUserName2").value;
   pswd = document.getElementById("extPassword2").value;
   recType = "<> 'BALANCE DUE'";
   

//5-14-11   setResponseURL(secureURLStart+"reservationAcceptance.jsp?fwModuleName=genKfrent&extOwnerId="+ownerId);
   setResponseURL("reservationAcceptance.jsp?extOwnerId="+ownerId);
   
    var segment14b = 'MultiUnitAdmin.resetCCBatchForReservationAcceptance("'+userName+'","'+pswd+'","'+recType+'")';
    buildScriptSegment(segment14b); 

   submitForm(window, "fwForm");     
}
//chad new
function sendNoticeOnClick()
{
  ownerId = document.getElementById("dsPropertyListingByListingId-OWNER_ID").value;
  listingId = document.getElementById("dsPropertyListingByListingId-LISTING_ID").value;
  propAddress = document.getElementById("dsPropertyListingByListingId-ADDRESS1").value;
  propCity = document.getElementById("dsPropertyListingByListingId-CITY").value;
    var segment14b = 'MultiUnitAdmin.sendNoticeOnClick("'+ownerId+'","'+listingId+'","'+propAddress+'","'+propCity+'")';
    buildScriptSegment(segment14b); 

   submitForm(window, "fwForm");
}

function logonpage()
{
  	/* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
  	setResponseURL("Welcome.jsp?extFilter=");
  	setQueryParam("dsLogon", "argUserName", document.fwForm.extUserName2.value);
  	setQueryParam("dsLogon", "argPassword", document.fwForm.extPassword2.value);
  	setQueryParam("dsHouseKeepingLogin", "argUserName", document.fwForm.extUserName2.value);
  	setQueryParam("dsHouseKeepingLogin", "argPassword", document.fwForm.extPassword2.value);  
  	setQueryParam("dsOwnerListingCount", "argUserName", document.fwForm.extUserName2.value);
  	setQueryParam("dsOwnerListingCount", "argPassword", document.fwForm.extPassword2.value);  
  	setQueryParam("dsOwnerListingCountMU", "argUserName", document.fwForm.extUserName2.value);
  	setQueryParam("dsOwnerListingCountMU", "argPassword", document.fwForm.extPassword2.value); 
  	setQueryParam("dsPropertyListingByOwnerMUuserid", "argUserId", document.fwForm.extUserName2.value);
        setQueryParam("dsPropertyListingByOwnerMUuserid", "argPassword", document.fwForm.extPassword2.value); 
  	setQueryParam("dsPropertyListingByOwnerMUuserid", "argBed1", "1");
        setQueryParam("dsPropertyListingByOwnerMUuserid", "argBed2", "1");
        arg3="";
        arg4="";
         
        /* Save the buffer.*/
  	executeQuery("dsLogon");
  	executeQuery("dsHouseKeepingLogin");
  	executeQuery("dsOwnerListingCount"); 
  	executeQuery("dsOwnerListingCountMU");  
  	executeQuery("dsPropertyListingByOwnerMUuserid");
   	var segment1 = 'checkSessionTimeout.setSessionApp()';
        buildScriptSegment(segment1);
        submitForm(window, "fwForm"); 
}

function maLogon()
{
  /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/
  setResponseURL("_CKC.jsp");
  
  setQueryParam("dsLogonMA", "argUserName", document.fwForm.extUserName2.value);
  setQueryParam("dsLogonMA", "argPassword", document.fwForm.extPassword2.value);

    
  /* Save the buffer.*/
  executeQuery("dsLogonMA");

  submitForm(window, "fwForm"); 
}

function registerUser()
{
  insertRowMS()
}

function insertRowMS()
{
  /* Set Response URL to List. This is the page that will be returned from the server after the submit.*/

    setResponseURL("register_pt1.jsp?fwModuleName=genKfrent");
  
  clearDataSet("dsPropertyOwner"); 
  /* If the query returns no rows, then append a row.*/
  appendIfNoRow("dsPropertyOwner");
  
  submitForm(window, "fwForm");
}


function doBrowseList()
{
  setResponseURL("browse_rental_listings.jsp?extPageNo=1");
  
  /* Submit form on Main page.*/
  submitForm(window, "fwForm");
}
