/*** JAVASCRIPT FUNCTIONS ***/

/* START FUNCTIONS */

/* END FUNCTIONS */

/* START MASTER DOM  */
jQuery(document).ready(function($){ // MASTER DOM

	if(!$.browser.msie) $("nav ul li, #features-wrap ul li, #social-icons ul li").hover(function() {$(this).siblings().stop().fadeTo(400,0.4);}, function() { $(this).siblings().stop().fadeTo(400,1); }); // add opacity highlight to list items
	
	// show slideshow butons only on hover
	$(".slide-btns").css({display: 'none'});
	$(".slide-wrap").hover(function() {$(".slide-btns", this).stop().fadeTo(400, 1);}, function() {$(".slide-btns", this).stop().fadeOut(400, 0);}); 
	// end show slideshow buttons only on hover
	
	$('span .wpcf7-validates-as-required').parent().after('<em>*</em>'); // add <em>*</em> to all required CF7 form fields
	
	$("#features-wrap li:last-child").addClass('last-child'); // add .last-child class to front page features
	
	//form input default text
	$('#s').focus(function () {
		if ($(this).val() == $(this)[0].defaultValue) {
				 $(this).val("");
			 }
		}).blur(function() {
			if ($(this).val() == "") {
				 $(this).val($(this)[0].defaultValue);
			 }
		 });
	$('input[type="text"], textarea').focus(function () {
		if ($(this).val() == $(this)[0].defaultValue) {
				 $(this).val("");
			 }
		}).blur(function() {
			if ($(this).val() == "") {
				 $(this).val($(this)[0].defaultValue);
			 }
		 });		 
	//end form input default text

	// BACK TO TOP BUTTON	
	$("#back-top").hide(); // hide #back-top first
	
	// fade in #back-top
	$(function () {
		$(window).scroll(function () {
			if ($(this).scrollTop() > 250) {
				$('#back-top').fadeIn();
			} else {
				$('#back-top').fadeOut();
			}
		});

		// scroll body to 0px on click
		$('#back-top a').click(function () {
			$('body,html').animate({
				scrollTop: 0
			}, 800);
			return false;
		});
	});
	// END BACK TO TOP BUTTON

// -- MENUS --	

$("nav ul.menu li ul li:has(ul)").find("a:first").append(" &raquo; "); // add arrows to any list items that have children


	$(function(){ // Chris Coyier's css menu functionality
		$("nav#main-nav ul li").hover(function(){
			$(this).addClass("hover");
			$('ul:first',this).css('visibility', 'visible');	
		}, function(){
			$(this).removeClass("hover");
			$('ul:first',this).css('visibility', 'hidden');
		});
	}); // end Chris Coyier's menu

// -- end MENUS --
	
	// disable empty link jumping
	$('a[href=#]').click(function(){
		return false;															  	
	});//end empty link jumping
	
	
}); // END MASTER DOM
/* END MASTER DOM */
