/* Author: 

*/
var animation_speed = 300;
$(document).ready(function(){

	$('.imageslide').hover(function(){
		// set background colour to caption background.
		var panel_no = $(this).attr('id').replace('panel', '');
		
		$('#cover' + panel_no).css({ 'top': $(this).css('height'), 'height': '0'});
	
		$('#cover' + panel_no).stop().animate({ 
			top: '170',
			height: $(this).css('height')
		}, animation_speed, function() {
		})

		$('#txtcover' + panel_no).stop().animate({ 
			top: '170',
			height: $(this).css('height')
		}, animation_speed, function() {
			$('#txtcover' + panel_no + ' h3').fadeIn(animation_speed);			
		})
	
	}, function() {
		var panel_no = $(this).attr('id').replace('panel', '');
		$('#cover' + panel_no + ' h3').fadeOut(animation_speed);			
	
		//$('#cover' + panel_no).css({ 'top': $(this).css('height'), 'height': '3'});
		$('#cover' + panel_no).stop().animate({ 
			top: $(this).css('height'),
			height: '0'
		}, animation_speed, function() {
			
		})

		$('#txtcover' + panel_no).stop().animate({ 
			top: $(this).css('height'),
			height: '0'
		}, animation_speed, function() {
			$('#txtcover' + panel_no + ' h3').fadeOut(animation_speed);			
		})
	
	});
	
	// quicklinks	
	$("#quicklinks li").hover( function(){ 
	
		if (!$(this).hasClass('active')){
			$(this).stop().animate({
				width: '240'
			});
			$(this).children('a').stop().animate({
				width: '220'
			});
		}
	}, function() {
		if (!$(this).hasClass('active')){
			$(this).stop().animate({
				width: '225'
			});
			
			$(this).children('a').stop().animate({
				width: '205'
			});
		}
	});
	

	// superfish
	
	$('header nav ul').superfish({
		autoArrows: false,
		delay:         300,
		onInit: function(){Cufon.now()}	});

	
	$('ul#products a.lightbox').lightBox();
	$('span.magnify').click(function() {
		$(this).next('a.lightbox').trigger('click');
	});

	/* form validation */
	$("#contactus").validate({
		rules: { email: "required",
				email: true},
		messages: {
			email: "Valid email address required"
		}
	});
	
	$('#submit').hover(function() {
		$(this).css('background', "url('/images/submit-hover.gif') no-repeat");
	}, function() {
		$(this).css('background', "url('/images/submit.gif') no-repeat");
	});

	$('#lightbox_submit').hover(function() {
		$(this).css('background', "url('/images/download-submit-hover.gif') no-repeat");
	}, function() {
		$(this).css('background', "url('/images/download-submit.gif') no-repeat");
	});
	
	$('#request-sample img').hover(function() {
		$(this).attr('src', '/images/request-sample-btn-hover.gif');
	}, function() {
		$(this).attr('src', '/images/request-sample-btn.gif');
	});
	

/* 	brochure dl */
	jQuery("a.launchformbutton").fancybox({
			'titlePosition'		: 'inside',
			'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'onStart' : function(obj){
				jQuery('#pdf_filename').val('/pdf/' + jQuery(obj).attr('id') + '.pdf');
			}
	});
	
	jQuery('#lightbox_form').validate();

	$('#logo').hover(function() {
		$(this).css('opacity', '0.7');
	}, function() {
		$(this).css('opacity', '1');	
	});
	
	$('#panel1').click(function() {
		window.location = '/boutique.php';
	});
	$('#panel2').click(function() {
		window.location = '/downloads.php';
	});
	$('#panel3').click(function() {
		window.location = '/service.php';
	});

	
});

