$(window).load(function () {

	var contentHidden = false;
	
	$(' #loading ').css("display", "none");	

	$(' #standard_page ').animate({"right": "+=850px"}, 1000, "easeInOutExpo");
	$(' #left_content_wrapper ').animate({"left": "+=600px"}, 1000, "easeInOutExpo");

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

		(contentHidden == true) ? contentHidden = false : contentHidden = true;
	
		if (contentHidden == true) {

		$(' #standard_page, #menu ').animate({"right": "-=850px"}, 1000, "easeInOutExpo");
		$(' #left_content_wrapper ').animate({"left": "-=600px"}, 1000, "easeInOutExpo");
		$(' #footer ').fadeTo("slow", 0);
		
		} else {

		$(' #standard_page ').animate({"right": "+=850px"}, 1000, "easeInOutExpo");
		$(' #left_content_wrapper ').animate({"left": "+=600px"}, 1000, "easeInOutExpo");
		$(' #footer ').fadeTo("slow", 1);
		
		}

	});
	
	contactForm();
	
	shortcodeAnims();
	
	menuAnims();
	
				$(' .portfolio_post, .portfolio_post_two, .portfolio_post_three, .portfolio_post_one ').hover(function () {

			$(this).find("a.portfolio_post_title, a.portfolio_post_title_three, a.portfolio_post_title_two, a.portfolio_post_title_one").stop().fadeTo("medium",1);
			$(this).find("div.portfolio_post_image img").stop().fadeTo("slow", 0.9);

			}, function () {

			$(this).find("a.portfolio_post_title, a.portfolio_post_title_three, a.portfolio_post_title_two, a.portfolio_post_title_one").stop().fadeTo("medium",0);
			$(this).find("div.portfolio_post_image img").stop().fadeTo("slow", 1);

			}).find("a.portfolio_post_title, a.portfolio_post_title_three, a.portfolio_post_title_two, a.portfolio_post_title_one").fadeTo(0,0);

	
});

// CONTACT FORM AJAX REQUEST

function contactForm () {

$(' #contact_form ').submit(function () {

$(' #result_box ').html('');

$(' #submit ').attr('value', '...');

var _cfname = $(' #name ').val();
var _cfemail = $(' #email ').val();
var _cfphone = $(' #phone ').val();
var _cfmessage = $(' #message ').val();
var emailValResult = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
var result = "";

if (_cfname == name_val || _cfemail == email_val || _cfphone == phone_val || _cfmessage == message_val) {

result = ("<div class='error_box'>" + error_message_fields + '</div>').toString();

$(' #result_box ').fadeTo(0,0).append(result).fadeTo("slow", 1);
$(' #submit ').attr('value', submit_label);

return false;

} else if (!emailValResult.test(_cfemail)) {

result = ("<div class='error_box'>" + error_message_email + '</div>').toString();

$(' #result_box ').fadeTo(0,0).append(result).fadeTo("slow", 1);
$(' #submit ').attr('value', submit_label);

return false;

}

$.get(sendMail, {name:$(' #name ').val(), email:$(' #email ').val(), phone:$(' #phone ').val(), message: $(' #message ').val(), admin_email:admin_email, subject_email:subject_email, success_message:success_message},

function(data){

result = ("<div class='success_box'>" + data + '</div>').toString();

$(' #submit ').attr('value', submit_label);
$(' #result_box ').fadeTo(0,0).append(result).fadeTo("slow", 1);

});	

return false;

});

}

// SHORTCODE ANIMS

function shortcodeAnims () {

$(' a.single_lightbox, a.button, #portfolio_page_image a ').hover(function () {

$(this).stop().fadeTo(400, 0.7);

}, 

function () {

$(this).stop().fadeTo(400, 1);

});

}

// MENU ANIMS

function menuAnims () {

$(' #menu ul li ').hover(function () {

	if($(this).find('ul')) {

		$(this).find('ul').css("display", "block");

	}

},

function () {

	if($(this).find('ul')) {

		$(this).find('ul').css("display", "none");

	}

});


}
