function cufon()
{
	Cufon.replace('div#navigation span', {hover: true});
	Cufon.replace('h1');
	Cufon.replace('h2');
	Cufon.replace('h2.detail');
	Cufon.replace('h6');
	Cufon.replace('div.paragraph a', {hover : true});
	Cufon.replace('div.tickets');
	Cufon.replace('li.sidebar');
	Cufon.replace('div#top span', {hover: true});
}

function checkHeight()
{
	var h = $("div#content").height()
	h = parseInt(h);
	var t = $("div#content").offset().top;
	//indien de achtergrond soms niet doorloopt, onderstaande variabele verhogen
	var marge = 250;
	h = h + t + marge;
	
	var screenH = $(document).height();
	
	if (h < screenH) {
		//height 100%
		$("div#container").css("height", "100%");
	} else {
		//height geen 100%
		$("div#container").css("height", "auto");
	}
}

$(document).ready( function() {
	
	/*$(window).resize(function(){
		checkHeight();
	});
	checkHeight();*/
	
	
	$('a.jsbutton').click(function(event){
		event.preventDefault();
	});
	$("img.gallerythumb").click(function(){
		curImage = $(this).attr('src').split("thumb_").join("");
		curAlt = $(this).attr('alt');
		$('#mainimage').fadeOut(500, replaceImage);
	});
	$('#mainimage').hover(
			function(){
				var altText = $(this).attr('alt');
				if (altText != "") {
					showTooltip(altText);
				}
			},
			function(){
				hideTooltip();
			}
		);
	cufon();
	$("#print").click(function(event){
		event.preventDefault();
		print();
	});
	
	$("#cart").click(function(event){
		event.preventDefault();
		openWin();
	});
	
	$("#videoHolder, #imageHolder").hover(
		function(){
			showTooltip($(this).attr("rel"));
		},function(){
			hideTooltip();
		}
	);
	
	$("#largetext").fontscale("body", "up", {cookie:true,unit:"em"});
	$("#smalltext").fontscale("body", "down", {cookie:true,unit:"em"});
	$("#largetext").click(function(event){
		event.preventDefault();
		cufon();
	});
	$("#smalltext").click(function(event){
		event.preventDefault();
		cufon();
	});
	$("div#title").click(function(){
		window.location = "/home";
	});
	
	$("div#all-events, div#more-news, div#more-pers").click(function(){
		window.location = $(this).attr("rel");
	});

	$("div#news ul li, div#pers ul li").click(function(){
		window.location = this.id;
	});

	$("tr.row, div#news ul li, div#pers ul li, li.sidebar, li.row").hover(
		function(){
			$(this).addClass("hover");
			cufon();
		},
		function(){
			$(this).removeClass("hover");
			cufon();
		}
	);
	
	$("div.search table tr, div#binnenkort table tr, div#detail-relations table tr, li.row").hover(
			function(){
				showTooltipThumb(this);
			}, 
			function(){
				hideTooltipThumb();
			}
	);
	$("div#binnenkort table tr, div.row").click(
		function(){
			window.location = this.id;
		}
	);
	
	$("div#blikvanger table tr").click(
		function(){
			window.location = this.id;
		}
	);
	
	$('div.tickets').hover(
			function(){
				if ($(this).hasClass('click')) {
					$(this).addClass('hover');
					cufon();
				}
			}, function() {
				if ($(this).hasClass('click')) {
					$(this).removeClass('hover');
					cufon();
				}
			}
	);
	
	$("div.tickets").click(function(){
		if ($(this).hasClass('click')) {
			window.open($(this).attr("rel"));	
		}
	});
	
	$("div.fiches table tr, div#detail-relations table tr").click(
		function(){
			var location = this.id;
			
			if (location.indexOf("http://") == -1) {
				window.location = location;
			} else {
				window.open(location);				
			}
		}
	);
});