<!-- cufon text -->
Cufon.replace('.main_content h1,h2,h3,h4',{fontFamily:'Aller',fontWeight :'700'});

jQuery(document).ready(function() {

	jQuery('.two').pickled();
	jQuery('.one').jdPicker({
		date_format:'dd/mm/YYYY'
	});

	<!-- nivo slider  -->
	jQuery('#slider').nivoSlider({
		effect:	'random', //Specify sets like: 'fold,fade,sliceDown'
		slices: 10,
		animSpeed: 500,
		pauseTime: 3000,
		startSlide: 0, //Set starting Slide (0 index)
		directionNav: true, //Next/Prev
		directionNavHide: true, //Only show on hover
		keyboardNav: true, //Use left / right arrows
		pauseOnHover: true, //Stop animation while hovering
		manualAdvance: false, //Force manual transitions
		captionOpacity: 0.0 //Universal caption opacity
	});

	jQuery('#clients').cycle({
		fx: 'blindY',
		speed: 1000,
		timeout: 3000,
		delay: -2000
	});

	jQuery.fn.maphilight.defaults = {
		fill: true,
		fillColor: '0086DE',
		fillOpacity: 0.4,
		stroke: true,
		strokeColor: '333333',
		strokeOpacity: 1,
		strokeWidth: 3,
		fade: true,
		alwaysOn: false
	}

	jQuery(function() {
		jQuery('.map').maphilight({});
	});

	jQuery('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});

	jQuery('form#contactForm').submit(function() {
		jQuery('form#contactForm .error').remove();
		var hasError = false;
		jQuery('.requiredField').each(function() {
			if(jQuery.trim($(this).val()) == '') {
				var labelText = jQuery(this).prev('label').text();
				$(this).parent().append('<span class="error">You forgot to enter your '+labelText+'.</span>');
				hasError = true;
			} else if($(this).hasClass('email')) {
				var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
				if(!emailReg.test(jQuery.trim($(this).val()))) {
					var labelText = jQuery(this).prev('label').text();
					jQuery(this).parent().append('<span class="error">You entered an invalid '+labelText+'.</span>');
					hasError = true;
				}
			}
		});
		if(!hasError) {
			jQuery('form#contactForm li.buttons button').fadeOut('normal', function() {
				jQuery(this).parent().append('<img src="/wp-content/themes/td-v3/images/template/loading.gif" alt="Loading&hellip;" height="31" width="31" />');
			});
			var formInput = $(this).serialize();
			jQuery.post($(this).attr('action'),formInput, function(data){
				jQuery('form#contactForm').slideUp("fast", function() {				   
					jQuery(this).before('<p class="thanks"><strong>Thanks!</strong> Your email was successfully sent. I check my email all the time, so I should be in touch soon.</p>');
				});
			});
		}
		return false;
	});

	jQuery(function() {
		// OPACITY OF BUTTON SET TO 50%
		jQuery(".fade").css("opacity","0.5");
		// ON MOUSE OVER
		jQuery(".fade").hover(function () {
			// SET OPACITY TO 100%
			jQuery(this).stop().animate({
				opacity: 1.0
			}, "slow");
		},
		// ON MOUSE OUT
		function () {
			// SET OPACITY BACK TO 50%
			jQuery(this).stop().animate({
				opacity: 0.5
			}, "slow");
		});
	});
	jQuery(function() {
		// OPACITY OF BUTTON SET TO 50%
		jQuery("#text p").css("opacity","0.5");
		// ON MOUSE OVER
		jQuery("#text p").hover(function () {
			// SET OPACITY TO 1000%
			jQuery(this).stop().animate({
				opacity: 1.0
			}, "slow");
		},
		// ON MOUSE OUT
		function () {
			// SET OPACITY BACK TO 50%
			jQuery(this).stop().animate({
				opacity: 0.5
			}, "slow");
		});
	});
	jQuery(function() {
		// OPACITY OF BUTTON SET TO 50%
		jQuery("#div").css("opacity","0.5");
		// ON MOUSE OVER
		jQuery("#div").hover(function () {
			// SET OPACITY TO 100%
			jQuery(this).stop().animate({
				opacity: 1.0
			}, "slow");
		},
		// ON MOUSE OUT
		function () {
			// SET OPACITY BACK TO 50%
			jQuery(this).stop().animate({
				opacity: 0.5
			}, "slow");
		});
	});
});

