jQuery('.main-slideshow').resizenow();
Cufon.replace('#mid-section ul li a,.section_title', { fontFamily: 'Avenir LT Std', hover: 'true'});
jQuery(window).load(function() {
	jQuery('#mid-section ul li').each(function(){
			jQuery(this).animate({marginLeft: "0px"}, 500*(jQuery(this).index()+1)/2, "easeOutCubic");
	})
	counter = 1 ;
	loadImages(".main-slideshow",6);
	//Start Sliding images
	sliderInt=setInterval(function(){
		if(counter>2){
			clearInterval(sliderInt);	
			jQuery('.main-slideshow img').css("position","absolute");		
			jQuery('.main-slideshow img:gt(0)').hide();
			setInterval(function(){
			  jQuery('.main-slideshow :first-child').fadeOut()
				 .next('img').fadeIn()
				 .end().appendTo('.main-slideshow');},
			  7500);
		}
	},1000);
});
jQuery(window).bind("resize", function(){
	jQuery('.main-slideshow').resizenow();
});
jQuery(function(){
	loadImages = function(container,total){
		var img = new Image();
	    jQuery(img).load(function () {
		  if(counter<total){
			  counter ++;
			  loadImages(container,total);
		  }
		  jQuery(this).hide();
		  jQuery(container).append(this);
		  jQuery(container).resizenow();
		  if(counter==1)
			  jQuery(this).fadeIn();		  
	 	  else		  	
			  jQuery(this).show();
		  jQuery(container).resizenow(); 	
		})
		.error(function () {})
		.attr('src', "images/main-slideshow/"+ counter +".jpg");
	};
});
