var homePage = {
	init : function() {
		homePage.tabsFeatured.init();
		homePage.photoGalleryBreaker.init();
		
		//homePage.photoGallery.init();
		
	},
	
	bindings : {
		init : function() {
							
 
			
		}
	},
	
	
	tabsFeatured : {
		init : function() {
	$('#featured-section h2 a').click(function() {
				$('#featured-section h2 a').each(function(){
					  $(this).removeClass('active')
				});
				$('#featured-section ul').hide();
					  $(this).addClass('active')
				$( $(this).attr('href') ).show();
				return false;
			});
			$('#featured-section h2:first a').click();
		}
	},
				photoGalleryBreaker : {
		init : function() {
			//$('#breaker-photo-gallery #breaker-photo-holder img').load(function(){
			//$(this).css('width',$(this).width()+'px');	
				//});
			$('#breaker-photo-gallery .lst-thumbs-holder .lst-thumbs').width($('#breaker-photo-gallery .lst-thumbs-holder .lst-thumbs li').size()*130);
			$('#breaker-photo-gallery .lst-thumbs-holder').jScrollPane();
			$('#breaker-photo-gallery .lst-thumbs a').click(function() {
				var current_item =$(this).parent().parent();
				var ind=current_item.index();
				$('#breaker-photo-gallery .lst-thumbs li').removeClass('current-item');
				current_item.addClass('current-item');
				$('#breaker-photo-gallery #breaker-photo-holder img').attr('src',$(this).attr('href'));
				$('#breaker-photo-gallery #breaker-photo-holder .photo-label').text($(this).text());
				$('#breaker-photo-gallery #breaker-photo-holder a').css('visibility','visible');
				if(ind==0){
					//$('#breaker-photo-gallery #breaker-photo-holder div .btn-prior').css('visibility','hidden');
				}else{
					//if(($('#breaker-photo-gallery .lst-thumbs li').size()-1)==ind){
						//$('#breaker-photo-gallery #breaker-photo-holder div .btn-next').css('visibility','hidden');
					//}
				}
				return false;
			});
			$('#breaker-photo-gallery #breaker-photo-holder div .btn-next').click(function(){
				var el=$('#breaker-photo-gallery .lst-thumbs li.current-item').next().find('a');
				if(el.size()==0){
					$('#breaker-photo-gallery .lst-thumbs li:first').find('a').click();
				}else{el.click()}
//				$('#breaker-photo-gallery .lst-thumbs li.current-item').next().find('a').click();
			});
			$('#breaker-photo-gallery #breaker-photo-holder div .btn-prior').click(function(){
			var el=$('#breaker-photo-gallery .lst-thumbs li.current-item').prev().find('a');
				if(el.size()==0){
					$('#breaker-photo-gallery .lst-thumbs li:last').find('a').click();
				}else{el.click()}

				});
				

			$('#breaker-photo-gallery ul li:first a').click();
			$('#breaker-photo-gallery ul li a.destaque').click();
		}
	}

}

$(document).ready(function() {
	homePage.init();
	//$('#home-breaker img').load(function(){
	//$(this).css('width',$(this).width()+'px');	
	//});
});
