$(function() {
	//Browser Fixes
	if ($.browser.msie){
		var nVersion=jQuery.browser.version.slice(0,jQuery.browser.version.indexOf('.'));
		$('body').addClass ('ie');
		$('body').addClass ('ie'+nVersion);
		if(nVersion<=6){$('body').prepend('<a href="http://microsoft.com/windows/internet-explorer/default.aspx" target="_blank"><div id="ieWarn">A newer version of Internet Explorer is required to view this and many other websites. Please click here to upgrade to the latest version.</div></a>');}
	}
	if($("form").length){
		//Form Validation
		$.tools.validator.fn('[type=phone]','Need a real phone number',function(input,value){return (/^\(?([0-9]{3})\)?\s*[\. \-]?\s*([0-9]{3})\s*[\. \-]?\s*([0-9]{4})$/).test(value);});
		$.tools.validator.fn('[required=fullName]','Need your full name',function(input,value){return (/[A-Za-z]+\s[A-Za-z].+/).test(value);});
		$.tools.validator.localize('en',{'*':'Required','[required]':'Required',':email':'Need a real email'});
		$('form').validator({position:'top right',lang:'en',message:'<div><em/></div>'});
		//Char prevention
		$(".numVal").keypress(function(evt){if(evt.which!==8 && evt.which!==0 && evt.which!==32 && evt.which!==40 && evt.which!==41 && (evt.which<45 || evt.which>57)){return false;}});
		$(".strVal").keypress(function(evt){if(evt.which!==8 && evt.which!==0 && evt.which!==32 && evt.which!==46 && evt.which!==45 && (evt.which<65 || evt.which>90) && (evt.which<97 || evt.which>122)){return false;}});
		//Enable form
		$('input:submit').removeAttr('disabled');
	}
	//Calling twitter feed
	if($("#tweets").length){
		$("#tweets").getTwitter({userName: "gneighborhomes",numTweets: 4,loaderText: "Loading tweets...",slideIn: false,showHeading: false,showProfileLink: false});
	}
	//Testimonial
	$("#sfstest-page blockquote").addClass("clearfix");
	//Gallery fixes
		//Add back button to gallery pages
		$(".galleryBack").attr("href","javascript:history.go(-1)");
		// Style fixes
		$(".slide-frame").removeAttr("style").css("min-height","320px");
		$("#planBlock br").remove();
		$(".wppa-container").removeAttr("style");
});
