Date.format = 'yyyy-mm-dd';

$(document).ready(function() { 
		
    $(document).pngFix();
    
	$('.slideshow ul').innerfade({
		speed: 'slow',
		timeout: 5000,
		type: 'sequence',
		containerheight: '225px'
	});
	
	
	$('.cycle').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});

		
	$('a.fancybox_text').fancybox({
		ajax : {
			type : 'POST'
			},
		padding : 5,
		width : 400
	});

	$('a.fancybox_img').fancybox({
		'transitionIn': 'fade',
		'transitionOut': 'fade',
		'speedIn': 600, 
		'speedOut': 200
	});
	
	$('form input, form select, form textarea').bind('focus', function(){
		$('div').removeClass('highlight');
		$(this).parent('div').addClass('highlight');
	});

	$('form input.placeholder').bind('focus', function(){
		$(this).removeClass('placeholder').attr('value','');
	});

// FIX: This needs to be activated but the client config needs to extend the function for specific forms
// 	$('form.validate').validate({
// 		success: function(label) {
// 			label.text('Okay').addClass('valid');
// 		}
// 	});

	$('img.help[title]').qtip({
		content: {
			text: function() {
				// Retrieve title attribute from content element
				return $(this).attr('title');
			}
		}
	});

	$('.confirmation').addClass('fadein');
	
	$('.fadein').fadeIn(2000);
	
	$('.validate').validate({
		rules: {
			cv: {
				accept: "doc|docx|pdf"
			},
			email_confirm: {
				required: true,
				equalTo: '#email',
				email: true
			}
		},
		messages: {
			cv: "Please upload your CV in PDF or Word format"
// 			email_confirm: "Please make sure your email confirmation matches your email"
		}
	});
		
	$('label.error').fadeIn();
		
		
	// Activate datepicker on #date_of_birth
	$('input.date_iso').datepicker();

}); 


