Cufon.replace('h1,h2,h3,.menu a');

function formatText(index, panel) { return index + ""; }

$(document).ready(function() {
	$.tools.validator.localize("nl", {
		':email'  		: 'Voer een geldig e-mailadres in',
		':number' 		: 'Voer alleen getallen in',
		'[required]' 	: 'Voer een waarde in'
	});

	$("#commentForm").validator({lang: 'nl', position: 'top right'});
	
	$("a.anchorlink").anchorAnimate();

	$(".tweet").tweet({
		username: "kneep_nl",
		join_text: "auto",
		avatar_size: 32,
		count: 8,  
		auto_join_text_default: "- ",
		auto_join_text_ed: "ik",
		auto_join_text_ing: "ik ben",
		auto_join_text_reply: "reageerde ik op",
		auto_join_text_url: "was ik aan het bekijken",
		loading_text: "tweets laden..."
	});
	
	$origTwitterHeight = $("#twitter").height();
	
	$("#twitter_btn").click(function(){
		if (!$("#twitter").hasClass('animated')) {
			$("#twitter").animate({ height: "575px" }, 2000);
			$("#twitter").addClass('animated');
			$("#twitter_btn span").html('Lees minder tweets');
		}
		else {
 			$("#twitter").animate({ height: $origTwitterHeight }, 1000);
 			$("#twitter").removeClass('animated');
 			$("#twitter_btn span").html('Lees meer tweets');
		}
	});

	$('.anythingSlider').anythingSlider({
		easing: "easeInOutExpo",        // Anything other than "linear" or "swing" requires the easing plugin
		autoPlay: true,                 // This turns off the entire FUNCTIONALY, not just if it starts running or not.
		delay: 4000,                    // How long between slide transitions in AutoPlay mode
		startStopped: false,            // If autoPlay is on, this can force it to start stopped
		animationTime: 600,             // How long the slide transition takes
		hashTags: true,                 // Should links change the hashtag in the URL?
		buildNavigation: true,          // If true, builds and list of anchor links to link to each slide
		pauseOnHover: true,             // If true, and autoPlay is enabled, the show will pause on hover
		startText: "",             // Start text
		stopText: "",               // Stop text
		navigationFormatter: formatText       // Details at the top of the file on this use (advanced use)
	});
	
	$(".pinocchio").middleBoxButton("Bezoek de website", "http://www.pinocchioshoes.nl", "_blank");
	$(".fabio").middleBoxButton("Bezoek de website", "http://www.fabiotacito.nl", "_blank");						
	$(".min").middleBoxButton("Bezoek de website", "http://www.managementinstituut.nl", "_blank");
	$(".dip").middleBoxButton("Bezoek de website", "http://www.dip.nl", "_blank");
	$(".mamaalice").middleBoxButton("Bezoek de website", "http://www.mamaalice.nl", "_blank");
	$(".bert").middleBoxButton("Bezoek de website", "http://www.bertsieraden.nl", "_blank");
	
	
		
	
	/*$("#tabs").tabs({ fx: { opacity: 'toggle' } });*/
	$("ul.css-tabs").tabs("div.css-panes > div", {effect: 'ajax', history: true});

	$("#formLeft .input-bg").hover(function() { $(this).addClass("active"); }, function() { $(this).removeClass("active"); });
	$("#formLeft input").focus(function() { $(this).parent().addClass("active"); });
	$("#formLeft input").blur(function() { $("#formLeft .input-bg").removeClass("active"); });
	$("#formRight .message-bg").hover(function() { $(this).addClass("active"); }, function() { $(this).removeClass("active"); });
	$("#formRight textarea").focus(function() { $(this).parent().addClass("active"); });
	$("#formRight textarea").blur(function() { $("#formRight .message-bg").removeClass("active"); });
	
	// main vertical scroll
	$("#main").scrollable({
	
		// basic settings
		vertical: true,
	
		// up/down keys will always control this scrollable
		keyboard: 'static',
	
		// assign left/right keys to the actively viewed scrollable
		onSeek: function(event, i) {
			horizontal.eq(i).data("scrollable").focus();
		}
	
	// main navigator (thumbnail images)
	}).navigator("#main_navi");
	
	// horizontal scrollables. each one is circular and has its own navigator instance
	var horizontal = $(".scrollable").scrollable({ circular: true, next: ".item" }).navigator(".navi");
	
	
	// when page loads setup keyboard focus on the first horzontal scrollable
	horizontal.eq(0).data("scrollable").focus();

});	

