
//replace fonts
Cufon.replace('h1', {hover: true});
Cufon.replace('h2', {hover: true});
Cufon.replace('h3', {hover: true});
Cufon.replace('h4', {hover: true});

$(document).ready(function() {
	//home hero cycle
    $('#homeHero').cycle({
		fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		speed: 500,
		timeout: 5000,
		pause:false,
    	pager:'#homeHeroControls',
		pagerClick:function(event){
    		$("#homeVideo").flowplayer(0).unload();
    		$('#homeHero').cycle('resume');
    	}
	});

	//home video
	$("#homeVideo").flowplayer("/wp-content/themes/dinosaursunearthed/js/flowplayer/flowplayer.commercial-3.2.5.swf", {
		key: '#$062fe0719d8fe8c8d42'
	});
	$("#homeVideo").flowplayer().each(function(){
		this.onBeforeClick(function () {
			$('#homeHero').cycle('pause');
		});
	});
	
	//home video cta button
	$('#homeHeroSlide1 .cta').click(function(event){
		$('#homeHero').cycle('pause');
		$("#homeVideo").flowplayer(0).play();
		event.preventDefault();
	});

	//start image gallery
	$('.gallery').galleria({
		show_info:true
	});
	
	$(".galleryVideo").flowplayer("/wp-content/themes/dinosaursunearthed/js/flowplayer/flowplayer.commercial-3.2.5.swf", {
		clip: {
			autoPlay: false,
			autoBuffering: false
		},
		key: '#$062fe0719d8fe8c8d42'
	});
	

});



//placeholder fix for non-html5 browsers
$('[placeholder]').focus(function() {
	var input = $(this);
	if (input.val() == input.attr('placeholder')) {
		input.val('');
		input.removeClass('placeholder');
	}
}).blur(function() {
	var input = $(this);
	if (input.val() == '') {
		input.addClass('placeholder');
		input.val(input.attr('placeholder'));
	}
}).blur().parents('form').submit(function() {
	$(this).find('[placeholder]').each(function() {
		var input = $(this);
		if (input.val() == input.attr('placeholder')) {
			input.val('');
		}
	})
});

