var jQ = jQuery.noConflict();

jQ(document).ready(function(){
	
	// Initiate potato menu
	//jQ('#navigation-1').ptMenu();
	
	// this initialises the demo scollpanes on the page.
	jQ('#pane2').jScrollPane({scrollbarWidth:7,showArrows:true});
	jQ('#pane3').jScrollPane({scrollbarWidth:7,showArrows:true});
	jQ('#pane4').jScrollPane({scrollbarWidth:7,showArrows:true});
	jQ('#pane5').jScrollPane({scrollbarWidth:7,showArrows:true});

	// Validate forms
	jQ('#contactform').validate();
	jQ('#callbackform').validate();
	jQ('#forwardform').validate();
	
	// Enlarge images
	jQ('.small-image img').click(function(){
		var src = jQ(this).attr('longdesc');
		jQ('.big-image img').attr('src', src);
	});

	// Frontpage carousel
	jQ("#gallery").carouFredSel({
	    items       : 1,
	    delay			: 2500,
	    direction   : "left",
	    auto      	: {
	        fx              : "scroll",
	        //easing        : "swing",
	        delay			: 2500,
	        duration        : 750,
	        pauseOnHover    : true,
   		},
	});
	
	// Navigation carousel
	jQ(".gallery-arrow-left").click(function() {
	    jQ("#gallery").trigger("prev");
	    return false;
	});
	
	// Navigation carousel
	jQ(".gallery-arrow-right").click(function() {
	    jQ("#gallery").trigger("next");
	    return false;
	});

	


});

// Ticker function
jQ(function(){
	var ticker = function(){
		setTimeout(function(){
			jQ('#ticker ul li:first').animate( {marginTop: '-35px'}, 800, function(){
				jQ(this).detach().appendTo('#ticker ul').removeAttr('style');
			});
			ticker();
		}, 4000);
	};
	ticker();
});

