///////////////////////////////////////////////////////////////////////////////////////HOME SLIDER

jQuery(document).ready(function() {
	 jQuery('#slider').nivoSlider({
		effect:'fade', //Specify sets like: 'fold,fade,sliceDown'
		slices:15,
		animSpeed:600,
		pauseTime:7000,
		startSlide:0, //Set starting Slide (0 index)
		directionNav:true, //Next & Prev
		directionNavHide:true, //Only show on hover
		controlNav:true, //1,2,3...
		controlNavThumbs:true, //Use thumbnails for Control Nav
        controlNavThumbsFromRel:true, //Use image rel for thumbs
		controlNavThumbsSearch: '.jpg', //Replace this with...
		controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
		keyboardNav:true, //Use left & right arrows
		pauseOnHover:true, //Stop animation while hovering
		manualAdvance:false, //Force manual transitions
		captionOpacity:0.8, //Universal caption opacity
		beforeChange: function(){},
		afterChange: function(){},
		slideshowEnd: function(){} //Triggers after all slides have been shown
	});
});

//////////////////////////////////////////////////////////////////////////////////////////////////Hover on portfolio images

jQuery(document).ready(function(){ 
	jQuery(".thumbnail img").hover(function() {  
       jQuery(this).stop().animate({   width: '350px', height: '350px', marginTop: '-5px', marginLeft: '-5px'}, 200);  
       },function() {  
       jQuery(this).stop().animate({  width: '300px', height: '300px', marginTop: '0px',  marginLeft: '0px'}, 300);  
    }); 
 });


// jQuery(document).ready(function(){ 
// 	jQuery(".featured-project img").hover(function() {  
//        jQuery(this).stop().animate({   width: '396px', height: '240px', marginTop: '-5px', marginLeft: '-5px'}, 200);  
//        },function() {  
//        jQuery(this).stop().animate({  width: '296px', height: '210px', marginTop: '0px',  marginLeft: '0px'}, 300);  
//     }); 
//  });


//////////////////////////////////////////////////////////////////////////////////////////////////////PORTFOLIO SHOW AND HIDE HOMES & COMMERCIAL
jQuery(document).ready(function() {

 jQuery('#commercial-view').hide();
 jQuery('#all-view').hide();

  jQuery('.homes-nav a').attr('class', 'selected');
 
///Show homes
jQuery('.homes-nav a').click(function() {
    jQuery('#homes-view').fadeIn(700); 
    jQuery('#commercial-view').hide();
 	jQuery('#all-view').hide();
;
    
    jQuery('.homes-nav a').attr('class', 'selected');
    jQuery('.commercial-nav a').removeClass('selected');
	jQuery('.all-nav a').removeClass('selected');

  return false;
  });
///Show Commercial pieces
jQuery('.commercial-nav a').click(function() {
    jQuery('#commercial-view').fadeIn(700);
    jQuery('#homes-view').hide();
	jQuery('#all-view').hide();

    
    jQuery('.commercial-nav a').attr('class', 'selected');
    jQuery('.homes-nav a').removeClass('selected'); 
	jQuery('.all-nav a').removeClass('selected'); 

    return false;
  });
///////Show All pieces 
jQuery('.all-nav a').click(function() {
    jQuery('#all-view').fadeIn(700);
    jQuery('#homes-view').hide();
	jQuery('#commercial-view').hide();

    
    jQuery('.all-nav a').attr('class', 'selected');
    jQuery('.homes-nav a').removeClass('selected'); 
	jQuery('.commercial-nav a').removeClass('selected'); 

    return false;
  });  
});



////////////////////////////////////////////////////////////////////////////////////////////////////////ABOUT PROFILES
(function(jQuery){

// Creating the sweetPages jQuery plugin:
jQuery.fn.sweetPages = function(opts){
	
	// If no options were passed, create an empty opts object
	if(!opts) opts = {};
	
	var resultsPerPage = opts.perPage || 3;
	
	// The plugin works best for unordered lists, althugh ols would do just as well:
	var ul = this;
	var li = ul.find('li');
	
	li.each(function(){
		// Calculating the height of each li element, and storing it with the data method:
		var el = jQuery(this);
		el.data('height',el.outerHeight(true));
	});
	
	// Calculating the total number of pages:
	var pagesNumber = Math.ceil(li.length/resultsPerPage);
	
	// If the pages are less than two, do nothing:
	if(pagesNumber<2) return this;

	// Creating the controls div:
	var swControls = jQuery('<div class="swControls">');
	
	for(var i=0;i<pagesNumber;i++)
	{
		// Slice a portion of the lis, and wrap it in a swPage div:
		li.slice(i*resultsPerPage,(i+1)*resultsPerPage).wrapAll('<div class="swPage" />');
		
		// Adding a link to the swControls div:
		swControls.append('<a href="" class="swShowPage">'+(i+1)+'</a>');
	}

	ul.append(swControls);
	
	var maxHeight = 0;
	var totalWidth = 0;
	
	var swPage = ul.find('.swPage');
	swPage.each(function(){
		
		// Looping through all the newly created pages:
		
		var elem = jQuery(this);

		var tmpHeight = 0;
		elem.find('li').each(function(){tmpHeight+=jQuery(this).data('height');});

		if(tmpHeight>maxHeight)
			maxHeight = tmpHeight;

		totalWidth+=elem.outerWidth();
		
		elem.css('float','left').width(ul.width());
	});
	
	swPage.wrapAll('<div class="swSlider" />');
	
	// Setting the height of the ul to the height of the tallest page:
	ul.height(maxHeight);
	
	var swSlider = ul.find('.swSlider');
	swSlider.append('<div class="clear" />').width(totalWidth);

	var hyperLinks = ul.find('a.swShowPage');
	
	hyperLinks.click(function(e){
		
		// If one of the control links is clicked, slide the swSlider div 
		// (which contains all the pages) and mark it as active:

		jQuery(this).addClass('active').siblings().removeClass('active');
		
		swSlider.stop().animate({'margin-left':-(parseInt(jQuery(this).text())-1)*ul.width()},'slow');
		e.preventDefault();
	});
	
	// Mark the first link as active the first time this code runs:
	hyperLinks.eq(0).addClass('active');
	
	// Center the control div:
	swControls.css({
		// 'left':'80%',
		// 'margin-left':-swControls.width()/2
	});
	
	return this;
	
}})(jQuery);


jQuery(document).ready(function(){
	/* The following code is executed once the DOM is loaded */
	
	// Calling the jQuery plugin and splitting the
	// #holder UL into pages of 3 LIs each:
	
	jQuery('#holder').sweetPages({perPage:1});
	
	// The default behaviour of the plugin is to insert the 
	// page links in the ul, but we need them in the main container:

	var controls = jQuery('.swControls').detach();
	controls.appendTo('h1.page-title');
	
});






















































