$(document).ready(function(){


	$('#contactform').validate();


	var fadeDuration = 350;

	$('#newsContent').hide();
	$('#worksContent').hide();
	$('#bioContent').hide();
	$('#contactContent').hide();
	$('#linksContent').hide();
	$('#imprintContent').hide();
	$('#nav').hide();
	$('#brandCaption').hide();
	$('#screeningsContent').hide();
	
	



$('.navlink').click(function(){

if ($(this).hasClass('clicked') != true) {
	
	var currentID = $(this).attr('id');
	pageToOpen = currentID + "Content";
	$('.clicked').parent().animate({width:'250px', backgroundColor:'#fff'}, fadeDuration)
	$('.clicked').animate({color:'#000'}, fadeDuration);
	$('.clicked').removeClass('clicked');
	$(this).animate({color:'#fff'}, fadeDuration);
	$(this).parent().animate({width:'300px',backgroundColor:'#000'}, fadeDuration);
	$('#' + pageToOpen).show('slow').siblings().hide('fast');
	$(this).addClass("clicked").parents().siblings().children().removeClass("clicked");

}

return false;
});


/*  Here is the typewriter code   */

var char = 0;
var caption = "Ivalo Frank";
var standby;
var speed = 200;

function type() {
	$('#branding h1').html(caption.substr(0, char++));
	if(char < caption.length+1)
		setTimeout(type, speed);
	else {
		$('#brandCaption').show('slow');
		char = 0;
		caption = "";
	};
	$('#nav').show('slow');
};

type();

});

