	$(document).ready(
		function(){

			startGallery();
			startItemList();
			bindContactUs();
			
			
			


	});



	var maxImages=0;
	var thisImage=0;
	var imagesObj;
	
	function startGallery(){
		imagesObj=$('.gallery img');
		maxImages=imagesObj.length;
		gallery();
	}
	
	function gallery(){
		if($('.gallery').hasClass('gallery-active')){
			thisObj=imagesObj.eq(thisImage);
			imagesObj.stop().fadeTo('slow',0);
			thisObj.stop().fadeTo('slow',1);
			thisImage++;
			if(thisImage>=maxImages){
				thisImage=0;
			}
		}
		setTimeout('gallery()',4000);
		
	}
	
	var maxItems=0;
	var thisItem=0;
	var itemsObj;
	
	function startItemList(){
		itemsObj=$('#isotope').find('.iso-fade-scroll li');
		itemsObj.css({position:'absolute',top:'77px'});
		maxItems=itemsObj.length;
		itemList();
	}
	
	function itemList(){
		//if($('.gallery').hasClass('gallery-active')){
			thisItemObj=itemsObj.eq(thisItem);
			itemsObj.stop().fadeTo('slow',0);
			thisItemObj.stop().fadeTo('slow',1);
			//itemsObj.stop().hide();
			//thisItemObj.stop().show();			
			thisItem++;
			if(thisItem>=maxItems){
				thisItem=0;
			}
		//}
		setTimeout('itemList()',4000);
		
	}
	
	
	function bindContactUs(){
		$('#main').find('#contact-us button').click(function(){
			comlist=new Object();
			comlist['name']=$('#contact-us #name').val();
			comlist['email']=$('#contact-us #email').val();
			comlist['comment']=$('#contact-us #comment').val();
			$('#main').find('#contact-us').text('Sending comment...');
			$('#main').find('#contact-us').load('../sections/_sendcontactmail.php',comlist);
			return false;
		});
		
	}
