$(document).ready(function(){  
													 
  $('#rent').css('background-image', 'url(/images/bg-inactive.png)');
	
  if($.fn.placeholder) {
    $('.placeholder').placeholder();
  }

  $('#propertySearch .tabList').each(function(){

	var searchForm = $(this).siblings('#propertySearchForm');
    var content = searchForm.children('.tabContent').children();

    var tabs = $(this).find('li');

    tabs.removeClass('active').eq(0).addClass('active');

    tabs.click(function(){

      tabs.removeClass('active');

      $(this).addClass('active')
			
	    var lease = $('#leaseType').val(this.id);
			
	    if (this.id == 'buy')
			{
			  $('#propertySearch').css('background-image', 'url(/images/for-sale-bg.jpg)');
				$('#rent').css('background-image', 'url(/images/bg-inactive.png)');
				$('#buy').css('background-image', 'url(/images/header-property-search-tab.png)');
			}
			else
			{
		    $('#propertySearch').css('background-image', 'url(/images/to-let-bg.jpg)');
				$('#buy').css('background-image', 'url(/images/bg-inactive.png)');
				$('#rent').css('background-image', 'url(/images/header-property-search-tab.png)');
			}
		
      content.css('display', 'none').eq($(this).prevAll().length).css('display', 'block');

    });

  });
	
	$('div.cycle').cycle({
		fx: 'scrollHorz',
		speed: 400, 
		timeout: 0,
		next: '.button.next',
		prev: '.button.prev'
	});

});
