$(document).ready(function(){
						   
//Begin LazyLoad
	$('img').lazyload({ 
		placeholder : 'images/grey.gif',
		effect : 'fadeIn'
	});
//End LazyLoad

//Begin Activebar2
	if ( $.browser.msie6 ) { 
		$('<div></div>').html('This page may not be displayed correctly in this browser. You are strongly encouraged to update to a current release of <a href="http://mozilla.org/firefox">Firefox</a>')
			.activebar({
				'font': 'Verdana',
				'fontSize':'14px',
				'icon': 'http://www.tgrayimages.com/wp-content/themes/tg2/images/activebar-information.png',
				'button':'http://www.tgrayimages.com/wp-content/themes/tg2/images/activebar-closebtn.png',
				'url': 'http://mozilla.org/firefox'
			});
		}
//End Activebar2

//begin contact pricing form
	$('.error').hide();
	$('input.text-input').css({backgroundColor:"#FFFFFF"});
	$('input.text-input').focus(function(){
		$(this).css({backgroundColor:"#FDC975"});
	});
	$('input.text-input').blur(function(){
		$(this).css({backgroundColor:"#FFFFFF"});
	});
	
	
function stripSpaces(x) { return x.replace(/^\W+/,''); }


	
	
	// validate and process form
	$(".pricebutton1").click(function() {
		var name = $('#name').val(),
			email = $('#email').val(),
			message = $('#message').val();
			
			name = name.replace(/^\s*|\s*$/g,'');
			message = message.replace(/^\s*|\s*$/g,'');
	
	//Error Count
		var error_count=0;
		
		//Regex Strings
		var name_regex = /^([a-zA-Z0-9_ ])+$/,
			email_regex = /^([a-z0-9_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/;
		
			//Test Username
			if(!name_regex.test(name)) {
				$("label#name_error").show();
				$("input#name").focus();
				error_count += 1;
				return false;
			}
			
			//Test Email
			if(!email_regex.test(email)) {
				$("label#email_error").show();
				$("input#email").focus();
				error_count += 1;
				return false;
			}
			
			//Blank Comment?
			if(message == '') {
				$("label#message_error").show();
				$("input#message").focus();
				error_count += 1;
				return false;
			}
			
			//No Errors?
			if(error_count == 0) {
				$.ajax({
					type: "post",
					url: "http://www.tgrayimages.com/wp-content/themes/tg2/js/send.php",
					data: "name=" + name + "&email=" + email + "&message=" + message,
					error: function() {
						$('#message_form').html("<div id='message' style='height:300px;margin-bottom:50px;'></div>");
						$('#message').html("<h3>There was an error with your message!</h3>")
						.append("<p>Please try again.</p>")
						.hide()
						.fadeIn(1500);
					},
					success: function () {
						$('#message_form').html("<div id='message' style='height:300px;margin-bottom:50px;'></div>");
						$('#message').html("<h3>Your message has been submitted!</h3>")
						.append("<p>Tony will be in touch soon.</p>")
						.hide()
						.fadeIn(1500);
					}				
				});	
			}
			
			else {
                $('.error').show();
            }
			
		return false;
	});
	
	
	// validate and process form
  $(".pricebutton").click(function() {
		
		// first hide any error messages
		$('.error').hide();
		
		var name = $("input#name").val();
		if (name == "") {
			$("label#name_error").show();
			$("input#name").focus();
			return false;
		}
		var email = $("input#email").val();
		if (email == "") {
			$("label#email_error").show();
			$("input#email").focus();
			return false;
		}
		var message = $("textarea#message").val();
			if (message == "") {
			$("label#message_error").show();
			$("input#message").focus();
			return false;
		}
		
		var dataString = $("form").serialize();
		//alert (dataString);return false;
		
		$.ajax({
			type: "POST",
			url: "http://www.tgrayimages.com/wp-content/themes/tg2/js/processpricingform.php",
			data: dataString,
			success: function() {
				$('#message_form').html("<div id='message' style='height:300px;margin-bottom:50px;'></div>");
				$('#message').html("<h3>Your pricing request has been submitted!</h3>")
				.append("<p>We will be in touch soon.</p>")
				.hide()
				.fadeIn(1500);
						//, function() {
					//$('#message').append("<img id='checkmark' src='images/check.png' />");
				//});
			}
		});
		return false;
	});
//end contact pricing form


//Rounded Corners
$('#content_gallery_summary .post').corner('7px');
$('#content_gallery_summary .post .galleryThumbnail').corner('7px');
//$('img').corner('7px');
$('.footer-column').corner('7px');



}); 
