function changeToHome() {
	scroll(0,0);
	$("#contact_block").fadeIn(200);
	$("#contact_txt").fadeIn(200);
	$("#intro_txt").fadeIn(200);
	$('#header').animate({
	height: '195px'
	}, 200, function() {
		$("#filmPage").load("pages/none.html");
		$("#filmPage").hide();
		$("#main").show();
	});

}

function changeToFilm(filmPage) {
	scroll(0,0);
	$("#main").hide();
	$("#filmPage").show();
	$("#filmPage").load(filmPage);
	$("#contact_block").fadeOut(100);
	$("#contact_txt").fadeOut(100);
	$("#intro_txt").fadeOut(100);
	$('#header').animate({
	height: '90px'
	}, 300, function() {
});

}

// Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i = 0; i < hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars;
}

function gotoVariablePage() {

	var pageVar = getUrlVars()[0];
	
	switch(pageVar)
	{
		case "glengaryross":
		  //execute code block 2
			changeToFilm("pages/glengaryross.html");
		  break;
		case "shakenandslurred":
		  //execute code block 1
			changeToFilm("pages/shakenandslurred.html");
		  break;
		case "covchemicals":
		  //execute code block 2
			changeToFilm("pages/covchemicals.html");
		  break;
		case "handlewithcare":
		  //execute code block 2
			changeToFilm("pages/handlewithcare.html");
		  break;
		case "drunksanta":
		  //execute code block 2
			changeToFilm("pages/drunksanta.html");
		  break;
		case "hisformen":
		  //execute code block 2
			changeToFilm("pages/hisformen.html");
		  break;
		case "motiongraphics":
		  //execute code block 2
			changeToFilm("pages/motiongraphics.html");
		  break;
		case "404":
		  //execute code block 2
			changeToFilm("pages/error404.html");
		  break;
		default:
		  //code to be executed if n is different from case 1 and 2
	}
	getTweet();

}

function getTweet() {
	var username='rapidpics'; // set user name
	var format='json'; // set format, you really don't have an option on this one
	var url='http://api.twitter.com/1/statuses/user_timeline/'+username+'.'+format+'?callback=?'; // make the url
	
		$.getJSON(url,function(tweet){ // get the tweets
			$("#latestTweet").html("<a href='http://www.twitter.com/rapidpics' target='_blank'>@rapidpics:</a> "+tweet[0].text); // get the first tweet in the response and place it inside the div
		});	
}

