$(function() {

 $('body.property-snapshot .overlay aside img, body.listings .overlay aside img, body.listing .overlay aside img, body.promotions .overlay aside img, body.commercial .overlay aside img ').each(function(){
       $(this).removeAttr('width');
       $(this).removeAttr('height');
   });

	
//home slideshow
    $('#gallery').cycle({
        fx:     'fade',
        speed:  1000,
        timeout: 9000,
        pager:  '.img-ind'
    });

//auto column

	$('.about #intro').columnize({width:400, lastNeverTallest: true});

//work order iframe fancybox

	$("#work-order-pop").fancybox({
		'width'				: 700,
		'height'			: '75%',
		'autoScale'			: false,
		'overlayOpacity'	: 0.9,	//Opacity of the overlay (from 0 to 1; default - 0.3)
		'overlayColor'	    :'#333',	//Color of the overlay
		'type'				: 'iframe'
	});

//overlay team
	$("a.overinitt[rel]").overlay({
			mask: {color: '#333',loadSpeed: 200,opacity: 0.9},
			fixed: false,
			left: 30,
			top: -140,
		
				// here is a callback function that is called before the overlay is clicked
				onBeforeLoad: function() {
						var imgWidth = this.getOverlay().find('p > img').width();
						var imgHeight = this.getOverlay().find('p > img').height();
						//alert(imgWidth);

						if (imgWidth<530) {
							$('.overlay > aside p').css({'width':imgWidth,'min-height':imgHeight});
							$('.overlay > article').css('width',880-imgWidth);
						} else {
							$('.overlay > aside').css({'width':'530px','min-height':imgHeight});
							$('.overlay aside p ').css({'width':'530px'});
							$('.overlay > article').css('width','350px');
						}
				},
				onLoad: function() {
					$('.ie7 #exposeMask').css('display','none');
				}
				
	});
	
	//overlay properties
		$("a.overinit[rel]").overlay({
				mask: {color: '#333',loadSpeed: 200,opacity: 0.9},
				fixed: false,
				left: 30,
				top: -140,

					// here is a callback function that is called before the overlay is clicked
					onBeforeLoad: function() {
							
							//overlay slideshow
							this.getOverlay().find('aside.slideshow p').cycle({ 
							    timeout: 5000, 
							    pager:  '.nav', 

							    // callback fn that creates a thumbnail to use as pager anchor 
							    pagerAnchorBuilder: function(idx, slide) { 
							        return '<li><a href="#"><img src="' + slide.src + '" width="140" /></a></li>'; 
							    } 
							});
							//var imgWidth = this.getOverlay().find('p > img').width();
							//var imgHeight = this.getOverlay().find('p > img').height();
							//alert(imgWidth);
							// if (imgWidth<530) {
							// 								$('.overlay > aside').css({'width':imgWidth,'min-height':imgHeight});
							// 								$('.overlay > article').css('width',880-imgWidth);
							// 							} else {
								$('.overlay .gallery-container aside.slideshow').css({'width':'530px','height':'480px', 'overflow':'hidden'});
								$('.overlay aside p ').css({'width':'530px'});
								$('.overlay > article.popdetails').css('width','350px');
							// }
							
							
									
					},
					onLoad: function() {
						$('.ie7 #exposeMask').css('display','none');
					},
					
					onClose: function() {
						this.getOverlay().find('aside.slideshow p').cycle('destroy');
					}

		});		


$('.single-post .entry-content p').cycle({ 
    timeout: 9000,
    pager:  '.nav', 

    // callback fn that creates a thumbnail to use as pager anchor 
    pagerAnchorBuilder: function(idx, slide) { 
        return '<li><a href="#"><img src="' + slide.src + '" width="140" /></a></li>'; 
    }
});


});//end





















