jQuery(document).ready(function(){

    //BACKGROUND
    $.fn.superbgimage.options = {
		id: 'supersize', // id for the containter
		z_index: 0, // z-index for the container
		inlineMode: 0, // 0-resize to browser size, 1-do not resize to browser-size
		showimage: 1, // number of first image to display
		vertical_center: 0, // 0-align top, 1-center vertical
		transition: 1, // 0-none, 1-fade, 2-slide down, 3-slide left, 4-slide top, 5-slide right, 6-blind horizontal, 7-blind vertical, 90-slide right/left, 91-slide top/down
		transitionout: 1, // 0-no transition for previous image, 1-transition for previous image
		randomtransition: 0, // 0-none, 1-use random transition (0-7)
		showtitle: 0, // 0-none, 1-show title
		slideshow: 1, // 0-none, 1-autostart slideshow
		slide_interval: 8000, // interval for the slideshow
		randomimage: 0, // 0-none, 1-random image
		speed: 'slow', // animation speed
		preload: 1 // 0-none, 1-preload images
	};

    //initalize
    $('#supersize').superbgimage();
    
    $('a.support').click(function(){
         
    });
    
    $('a.training').click(function(){

    });

    $('a.parts').click(function(){

    });
		
	//AUTOFILL
    $('#contactform').autofill({
        defaultTextColor: '#4f3331',
        activeTextColor: '#000'
    });
    $('.name').autofill({
    value: 'Name?'
    });
    $('.company').autofill({
    value: 'Company?'
    });
    $('.email').autofill({
    value: 'Email?'
    });
    $('.phone').autofill({
    value: 'Phone?'
    });
    $('.msg').autofill({
        value: 'How can we help you?'
    });

    
    //form response
	$('#contactform').submit(function(){

	var action = $(this).attr('action');

	$('.submit')
		.attr('disabled','disabled');

	$.post(action, { 
		name: $('.name').val(),
		company: $('.company').val(),
		email: $('.email').val(),
		phone: $('.phone').val(),
		msg: $('.msg').val()
	},

    function(data){
        $('#contactform .submit').attr('disabled','');
        $('.response').remove();
        $('#contactform').after('<span class="response">'+data+'</span>');
        $('.response').slideDown();
        if(data=='Sent') $('#contactform').slideUp();
    });

	return false;

	});

    //GALLERY
    $('ul#slides').jcarousel({
        wrap: 'circular'
    });

    //FANCYBOX
    $('a[rel=zoom]').fancybox({
        'transitionIn' : 'fade',
        'transitionOut' : 'fade'
    });
});

