$(document).ready(function(){
						   
	$.localScroll(2500,{easing:'elasout'});
	
	$('#nav_list').lavaLamp({ fx: "easeOutBack", speed: 1000, homeTop:-1, homeLeft:-1});
	
	$('a[rel^="prettyPhoto"]').prettyPhoto();
	
	//PORTFOLIO LINKS
	$('#port1').click(function () { 
      $("#portfolio_list").animate({ 
        marginTop: "0px"
      }, 500 );
	  
	  $("#portfolio_arrow").animate({ 
        marginLeft: "3px"
      }, 500 );
	  
	  return false;

    });
	
	$('#port2').click(function () { 
      $("#portfolio_list").animate({ 
        marginTop: "-250px"
      }, 500 );
	  
	  $("#portfolio_arrow").animate({ 
        marginLeft: "24px"
      }, 500 );
	  return false;

    });
	
	$('#port3').click(function () { 
      $("#portfolio_list").animate({ 
        marginTop: "-500px"
      }, 500 );
	  
	  $("#portfolio_arrow").animate({ 
        marginLeft: "48px"
      }, 500 );
	  
	  return false;

    });
	
	$('#port4').click(function () { 
      $("#portfolio_list").animate({ 
        marginTop: "-750px"
      }, 500 );
	  
	  $("#portfolio_arrow").animate({ 
        marginLeft: "72px"
      }, 500 );
	  
	  return false;

    });
	
	$('#port5').click(function () { 
      $("#portfolio_list").animate({ 
        marginTop: "-1000px"
      }, 500 );
	  
	  $("#portfolio_arrow").animate({ 
        marginLeft: "93px"
      }, 500 );
	  
	  return false;

    });


//ROUNDED CORNERS FOR PORTFOLIO
	$('.tech_box').corner("5px");
	
	
//SUBMIT FORM	
	
	//$('#bread_contact_form').ajaxForm(function() { 
    //	$('#bread_contact_form').slideUp('fast');
	//	$('#form_wrapper').html('<div style="text-align:center;">THANK YOU! Your inquiry has been sent.</div>');
	//});
	
	
	// =================================== 
	// ! Process the Email Password Form   
	// =================================== 

$('#submit_contact').click(function(){

	//capture data
	var name = $('#name').val();
	var email = $('#email').val();
	var phone = $('#phone').val();
	var message = $('#message').val();
	
	if(name==""){
		var formError = true;
		$('#name').css("background-color","#eb8e86");
	}else{
		$('#name').css("background-color","#EDEBE6");
	}
	
	if(email==""){
		var formError = true;
		$('#email').css("background-color","#eb8e86");
	}else{
		$('#email').css("background-color","#EDEBE6");
	}
	
	
	if(message==""){
		var formError = true;
		$('#message').css("background-color","#eb8e86");
	}else{
		$('#message').css("background-color","#EDEBE6");
	}	
	
	
	if(formError == true){
		alert("Please complete the highlighted fields before submitting!");
		return false;
	}
	
	else{

	//organize the data properly
	var data = 'name=' + name + '&email=' + email + '&phone=' + phone + '&message=' + message + '&action=sendEmail';
	
	//disabled all the text fields
	$('#bread_contact_form').animate({opacity:"0.25"},500, function(){
	$('#name').attr("disabled","disabled");
	$('#email').attr("disabled","disabled");
	$('#phone').attr("disabled","disabled");
	$('#message').attr("disabled","disabled");
	$('#submit_contact').attr("disabled","disabled");
	
	
	
		//start the ajax
		$.ajax({
					
			url: "../inc/sendEmail.php",	
		
			type: "POST",

			data: data,		
		
			cache: false,
		
			success: function (html) {
				
				
				if(html=="fail"){
					
					$('#bread_contact_form').animate({opacity:"1"},500);
					
					$('#name').removeAttr("disabled");
					$('#email').removeAttr("disabled");
					$('#phone').removeAttr("disabled");
					$('#message').removeAttr("disabled");
					$('#submit_contact').removeAttr("disabled");
					
					$('#name').css("background-color","#eb8e86");
					$('#email').css("background-color","#eb8e86");
					$('#phone').css("background-color","#eb8e86");
					$('#message').css("background-color","#eb8e86");
					
					alert("Server has failed to process. Please try again");
					
					return false;
					
				}
				else if(html=="success"){
					
					$('#bread_contact_form').animate({opacity:"1"},500);
					
					$('#name').removeAttr("disabled");
					$('#email').removeAttr("disabled");
					$('#phone').removeAttr("disabled");
					$('#message').removeAttr("disabled");
					$('#submit_contact').removeAttr("disabled");
					
					$('#name').val("");
					$('#email').val("");
					$('#phone').val("");
					$('#message').val("");
					$('#submit_contact').val("");
										
					alert("Thank You for your interest. We'll get back to you ASAP!");
					
					return false;
					
				}
				else{
				
					$('#name').removeAttr("disabled");
					$('#email').removeAttr("disabled");
					$('#phone').removeAttr("disabled");
					$('#message').removeAttr("disabled");
					$('#submit_contact').removeAttr("disabled");
					
					$('#name').css("background-color","#eb8e86");
					$('#email').css("background-color","#eb8e86");
					$('#phone').css("background-color","#eb8e86");
					$('#message').css("background-color","#eb8e86");
					
					alert(html);
				} 
				
			}		
		});
		
	});

return false;
	}
});

	
});