$(function(){		//<-- ============================================ Contact	var form = $('#contact').find('form'),		formElements = form.find('input[type!="submit"],textarea'),		formSubmitButton = form.find('[type="submit"]'),		errorNotice = $('#errors'),		successNotice = $('#success'),		loading = $('#loading'),		errorMessages = {			required: ' is a required field',			email: 'You have not entered a valid email address for the field: ',			minlength: ' must be greater than '		}				formSubmitButton.bind('click',function(){				var formok = true,					errors = [];									formElements.each(function(){					var name = this.name,						nameUC = name.ucfirst(),						value = this.value,						type = this.getAttribute('type'), //get type old school way						minLength = this.getAttribute('data-minlength');												if(name == 'name'){								if(value == ""){								this.focus();								formok = false;								errors.push(nameUC + errorMessages.required);								return false;							}						}						if(type == 'email'){ 	 							var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; 							if( !emailRegEx.test(value) ){									this.focus();								formok = false;								errors.push(errorMessages.email + nameUC);								return false;							}						}						if(minLength){							if( value.length < parseInt(minLength) ){								this.focus();								formok = false;								errors.push(nameUC + errorMessages.minlength + minLength + ' characters');								return false;							}						}				});								//if form is not valid				if(!formok){					showNotice('error',errors);				}				//if form is valid				else {					loading.show();					$.ajax({						url: form.attr('action'),						type: form.attr('method'),						data: form.serialize(),						success: function(){							showNotice('success');							form.get(0).reset();							loading.hide();						}					});				}				return false; //this stops submission off the form and also stops browsers showing default error messages			});							//other misc functions			function showNotice(type,data)			{				if(type == 'error'){					successNotice.hide();					errorNotice.find("li[id!='info']").remove();					for(x in data){						errorNotice.append('<li>'+data[x]+'</li>');						}					errorNotice.show();				}				else {					errorNotice.hide();					successNotice.show();					}			}			//add 'ucfirst' function to string			String.prototype.ucfirst = function() {				return this.charAt(0).toUpperCase() + this.slice(1);			}});	//<-- ============================================ Footer	$(function() {			$("#more").click(function(){			$("#footer").animate({				bottom:"0px"			},{				duration:700,				easing:"easeOutExpo"			});			$(this).hide(); 			$('#close').show();			return false;		});		$("#close").click(function(){			$("#footer").animate({				bottom:"-150px"			},{				duration:700,				easing:"easeOutExpo"			});			$(this).hide(); 			$('#more').show();			return false;		});});	//<-- ============================================ Twitter$.ajaxSetup({cache: true});$(function() {	$("#twitter").tweet();	});//<-- ============================================ Page Scroll$(function() {	$('.comments-count').localScroll();	$('#top').localScroll();});
