/* not a mistake - fire event once elements are actually loaded */
$(window).load(function(){
	$('#big-splash').show();
	$('#big-splash-over').delay(2000).fadeOut(2000);
});
		
$(document).ready(function() {
   
   $('#menu-main-menu').superfish({
		autoArrows:    false,               // if true, arrow mark-up generated automatically = cleaner source code at expense of initialisation performance 
		dropShadows:   false,               // completely disable drop shadows by setting this to false 
		disableHI:     false,              // set to true to disable hoverIntent detection 
		onInit:        function(){ $('#nav').show(); }
	});
   


	
	// default basic slideshow settings
	var slideOptions = { 	timeout:       5000,	speed:         1000};
	
	// static, paged slideshow
	if ( $('.single-ndproject, .single-ndplace, .single-ndproduct').length ) {
		
		var total = $( '#splash img').length;
		if( total > 1 ) {
			// adjust defaults
			slideOptions.timeout = 0;
		
			// add controls
			// slideOptions.pager = '#pager_nav';
			slideOptions.nowrap = 1;
			
			slideOptions.prev = '#prev_btn';
		
			slideOptions.next = '#next_btn';
			
			slideOptions.after = onAfter;
			
			// add the pager DIV
			$('#project_title').append('<div id="pager_nav_wrap"><div id="pager_nav" ><span id="counter">1</span> of '+total+'</div></div>');

			//add some buttons too:
			$('#pager_nav_wrap').prepend('<a href="#" title="previous" id="prev_btn">&lt;</a>').append('<a href="#" title="next" id="next_btn">&gt;</a>');
		
		}
		
	
		
	}
	//callback for the pager counter above
	function onAfter(curr, next, opts){
		$('#counter').text((opts.currSlide + 1));
	}

	
	// Runs both types of slideshow.
	$('#splash').cycle( slideOptions );
	
	$('.wpcf7-form input:text, .wpcf7-form textarea').each(function() {
		var labelTxt = jQuery(this).parents('p').find('label').text();
		jQuery(this)
			.val(labelTxt)
			.addClass('faint')
			.focus(function () {
				if (jQuery(this).val() === labelTxt) {
					jQuery(this).val('').removeClass('faint');
				}
			})
			.blur(function () {
					if (jQuery(this).val() === '') {
						jQuery(this).val(labelTxt).addClass('faint');
					}
			});


	});	
   
});


