$(function()
{
	fix_height();
	menu();
	img1();
	framebreaker();
});

cufon();


function framebreaker()
{
	if (top.location != self.location) {
    top.location = self.location.href  
	}
}

function cufon()
{
	Cufon.replace('#content h3', {hover:true});
}

function img1()
{
	$('.img1 .i .thumb-over').css({'cursor' : 'pointer'});
	$('.img1 .i .thumb-over').click(function()
	{
		var href = $(this).parent().find('> a').attr('href');
		// External link //
		//window.open(href);
		
		// Internal link //
		window.location = href;
		
	});
	
	$('.img1 .i').hover(function()
	{
		$(this).find('.thumb-over').addClass('show');
	},
	function()
	{
		$(this).find('.thumb-over').removeClass('show');
	});
}

function fix_height()
{
	if($.browser.msie && $.browser.version=="6.0")
	{
		$('#background').height($(document).height());
	}
	if($('#background').height() > $('#website').height())
	{
		//$('#website').height($('#background').height());
	}
}

function menu()
{
	$('#menu ul ul li:last-child').addClass('last');
	$('#menu ul ul li:first-child').addClass('first');
	$('#menu > ul li').hover(function()
	{
		$(this).blur();
		if($(this).find('ul').size() > 0)
		{
			var ul = $(this).find('ul');
			// kijken of me moetten inklappen of uitklappen
			if(ul.height() > 0)
			{
				// inkappen
				ul.css('overflow', 'hidden').stop().animate({'height' : 0}, 200);
				ul.parent().removeClass('open');
			}
			else
			{
				// uitklappen
				var clone =  ul.clone().css({'position' : 'absolute', 'height' : 'auto', 'visibility' : 'hidden', 'z-index' : '-1'}).prependTo($(this).parent());
				var height = clone.height();
				ul.css('overflow', 'hidden').stop().animate({'height' : height}, 200);
				clone.remove();
				ul.parent().addClass('open');
			}
			return false;
		}
	});
}
