
/*Flash Banner*/
function flash_banner()
{
  if (document.documentElement.clientWidth != 1280)
  {
    if (document.documentElement.clientWidth < 1280)
    {
      if(document.documentElement.clientWidth < 968){
      jQuery("#mainflash").css("left", "-516px");
      }
      else{
      jQuery("#mainflash").css("left", Math.round((document.documentElement.clientWidth - 1280) / 2)-360 + "px");
      }
    }
    else
    {
      jQuery("#mainflash").css("left", Math.round((document.documentElement.clientWidth - 1280) / 2)-360 + "px");
    }

    current_width = document.documentElement.clientWidth;
  }

  setTimeout("flash_banner();", 100);
}

jQuery(document).ready(function() {
  jQuery("#mainflash").show();
  flash_banner();
});

function open_banner_search_panel() {
  jQuery('#banner_search_button').hide();
  jQuery('#banner_search_panel').css('right', '-348px');
  jQuery('#banner_search_panel').animate({ right: '0px' });
}

function close_banner_search_panel() {
  jQuery('#banner_search_panel').animate({ right: '-348px' }, 'normal', function() {
    jQuery('#banner_search_panel').css('right', '-376px');
    jQuery('#banner_search_button').show();
  });
}

jQuery(document).ready(function(){
  jQuery('#people').sSelect();
  jQuery('#property_type').sSelect();
  jQuery('#arrive').datepicker({
    dateFormat: 'yy-mm-dd'
  });
  jQuery('#people2').sSelect();
  jQuery('#property_type2').sSelect();
  jQuery('#arrive2').datepicker({
    dateFormat: 'yy-mm-dd'
  });
});

function display_arrive_datepicker() {
  jQuery('#arrive').datepicker('show');
}

function display_arrive2_datepicker() {
  jQuery('#arrive2').datepicker('show');
}

function banner_refine_search() {

  //var street_address  = jQuery('#street_address').val();
  var property_town   = jQuery('#property_town').val();
  var people      = jQuery('#people').getSetSSValue();
  var arrive          = jQuery('#arrive').val();
  var property_type   = jQuery('#property_type').getSetSSValue();

  window.location = '/properties/search?town='
                          + property_town + '&people='
                          + people + '&arrival='
                          + arrive + '&type='
                          + property_type;
}

function banner_refine_search2() {

  //var street_address  = jQuery('#street_address').val();
  var property_town   = jQuery('#property_town2').val();
  var people      = jQuery('#people2').getSetSSValue();
  var arrive          = jQuery('#arrive2').val();
  var property_type   = jQuery('#property_type2').getSetSSValue();

  window.location = '/properties/search?town='
                          + property_town + '&people='
                          + people + '&arrival='
                          + arrive + '&type='
                          + property_type;
}
