$(document).ready(function(){
	$('#slide').cycle({
		fx: 'fade',
		speed: 750, 
	    timeout: 5000,
		rev: 0,
		random: 1
	});
	
	$(".column").equalHeights();
	
	var div = $('div.sc_menu'),
		ul = $('ul.sc_menu'),
		ulPadding = 100;
	var divWidth = div.width();
	div.css({overflow: 'hidden'});
	var lastLi = ul.find('li:last-child');
	div.mousemove(function(e){
		var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;	
		var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
		div.scrollLeft(left);
	});
	
	$('a.route').fancybox({
		'titleShow' 	: false,
		'autoDimensions': false,
		'autoScale'		: false,
		'width'			: 495,
		'height'		: 250
	});

	$('#plan input[type=submit]').click(function(){
		var googleurl = "http://maps.google.nl/maps?f=d&source=s_d&saddr=(0),(1)+(2)&daddr=Weereweg+25,+9939+Tjuchem&hl=nl";
		var plaats = $('#plaats').attr('value');
		var straat = $('#straat').attr('value');
		var nummer = $('#nummer').attr('value');
		
		plaats = plaats.replace(/\s/g,"+");
		straat = straat.replace(/\s/g,"+");
		nummer = nummer.replace(/\s/g,"+");
		
		googleurl = googleurl.replace("(0)", plaats);
		googleurl = googleurl.replace("(1)", straat);
		googleurl = googleurl.replace("(2)", nummer);
		
		window.open(googleurl);
	});
	
	$('a.webshop-btn').mouseover(function(){
		$(this).animate({'left': '455px'}, {duration: 300, queue: false});
	});
	$('a.webshop-btn').mouseout(function(){
		$(this).animate({'left': '415px'}, {duration: 300, queue: false});
	});
	
	$('.column a.btn').mouseover(function(){
		$(this).animate({'left': '72px'}, {duration: 150, queue: false});
	});
	$('.column a.btn').mouseout(function(){
		$(this).animate({'left': '62px'}, {duration: 150, queue: false});
	});
	
	$('a.fancy').fancybox({
		'titleShow' : false
	});
	/*
	$('.column a.toggle, #footer a.btn').click(function(){
		$("#contact").slideToggle(1500);
		return false;
	});
	*/
	$('#maps a.btn').click(function(){
		$('#maps').toggleClass('alt', 1000);
		return false;
	});
	
	//$('a[href$=#bottom]').bind("click", jump);
	
	$("ul.sc_menu li").click(function(){
    	window.location=$(this).find("a").attr("href");
		return false;
	});
}); 
