$(document).ready(function() {

	$("a.photogallery").fancybox({
		'titleShow'     : false,
		'transitionIn'	: 'fade',
		'transitionOut'	: 'fade',
		'easingIn'      : 'easeOutBack',
		'easingOut'     : 'easeInBack'
	});
	



    $('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
	
    // ---------------- Contact Form Animation ---------------- //
    $('#contactForm input').focus(function(){
        $(this).animate({
            backgroundColor: '#fff',
			color:'#000'
        }, 'fast');
    });
    $('#contactForm input').blur(function(){
        $(this).animate({
            backgroundColor: '#0f5499',
			color:'#fff'
        }, 'fast');
    });
    
    $('#contactForm textarea').focus(function(){
        $(this).animate({
            backgroundColor: '#fff',
			color:'#000'
        }, 'fast');
    });
    $('#contactForm textarea').blur(function(){
        $(this).animate({
            backgroundColor: '#0f5499',
			color:'#ddd'
        }, 'fast');
    });
    
    
    
    /* ---------- Contact form ---------- */
    $("#contactForm").submit(function(){
        $('#output').html('<img alt="" src="layout/theme1/images/loading.gif" />');
        $.post('includes/ajax-mail.php', {
            require: $('[name=require]').val(),
            
			name: $('[name=name]').val(),
            email: $('[name=email]').val(),
            telephone: $('[name=telephone]').val(),
            
			premiumamount: $('[name=premiumamount]').val(),
			hullmachinery: $('[name=hullmachinery]').attr("checked"),
			pi: $('[name=pi]').attr("checked"),
			cargo: $('[name=cargo]').attr("checked"),
			liability: $('[name=liability]').attr("checked"),
			otherinsurance: $('[name=otherinsurance]').attr("checked"),
			lossofhire: $('[name=lossofhire]').attr("checked"),
			war: $('[name=war]').attr("checked")

        }, function(data){
            if (data == "ok") {
				$('#output').html("<div class=\"alert\"><div><h3>Information:</h3><ul><li>Message Sent, thanks</li></ul></div></div>").fadeIn();
				$(':input','#contactForm').not(':button, :submit, :reset, :hidden').val('').removeAttr('checked').removeAttr('selected');
			}
			else {
				$('#output').html(data).fadeIn();
			}
        });
        return false;
    });
    
	
	
	
});