// JavaScript Document
$(document).ready(function(){
						   
	jQuery('#mycarousel').jcarousel();
						   
  $('label').labelOver('over-apply');
						   
   $('#property_img img').jScale({w:'246px'});
   $('#property_img').wrapInner("<a></a>");
   $('#property_img a').attr('href', $('#property_img img').attr('src'));
   $('#property_img a').addClass("thickbox");
   tb_init('a.thickbox, area.thickbox, input.thickbox');
						   
   $("#property_slide a").click(function(event){
										 
	var img = new Image();
  
    // wrap our new image in jQuery, then:
    $(img)
    // once the image has loaded, execute this code
    .load(function () {
      // set the image hidden by default    
      $(this).hide();
    
      // with the holding div #loader, apply:
      $('#property_img')
	    .wrapInner("<a></a>")
        // remove the loading class (so no background spinner), 
        .removeClass('loading');
		
	  $('#property_img a')
        // then insert our image
        .html(this)
		.attr('href', $('#property_img img').attr('src'))
		.addClass("thickbox");
    
      // fade our image in to create a nice effect
      $(this).fadeIn();
	  
	  tb_init('a.thickbox, area.thickbox, input.thickbox');
    })
	
    
    // if there was an error loading the image, react accordingly
    .error(function () {
      // notify the user that the image could not be loaded
    })
    
    // *finally*, set the src attribute of the new image to our image
    .attr('src', $(this).attr('href'))
	.jScale({w:'246px'});

	 
	return false;
	
   });
   
   $('.pending').append("<img class='pending_banner' src='lib/img/pending_banner.png' />");
   
// Loop over each .sold.
$( "li.sold" ).each(
					
 function(){
 
// Append the sold class
 
 	$(this).append("<img class='sold_banner' src='lib/img/sold_banner.png' />");
	var soldurl = $(this).find("a").attr("href");
	$(this).find('.sold_banner').wrap("<a href=" + soldurl + "></a>");
 }
 );

$( "li.pending" ).each(
					
 function(){
 
// Append the sold class
 
 	$(this).append("<img class='pending_banner' src='lib/img/pending_banner.png' />");
	var pendingdurl = $(this).find("a").attr("href");
	$(this).find('.pending_banner').wrap("<a href=" + pendingdurl + "></a>");
 }
 );
 
 $( "li.leased" ).each(
					
 function(){
 
// Append the sold class
 
 	$(this).append("<img class='leased_banner' src='lib/img/leased_banner.png' />");
	var pendingdurl = $(this).find("a").attr("href");
	$(this).find('.leased_banner').wrap("<a href=" + pendingdurl + "></a>");
 }
 );
 
   
 });
 
 
 
