/***********************************************************************

Author:     Arno Hoogma
URL:        http://www.4rn0.nl

***********************************************************************/


if (typeof window.jQuery != 'undefined') {

	$(function() {
		
		if ($.browser == 'msie') {
			animateNav();
		}
		
		setContentHeight();	

		$(window).resize(function() {
			setContentHeight();	
		});
		
		$("a[rel='external']").attr('target', '_blank');
		
	});


	/**
	 *
	 **/
	function animateNav()
	{
		
		$('#submenu li')
		.animate( { color: 'red' }, 2000)
		.animate( { color: 'yellow' }, 2000)
		.animate( { color: 'red' }, 2000)
		.animate( { color: 'black' }, 2000);
		
		window.setInterval('animateNav()', 6000);
		
	}


	/**
	 *
	 **/
	function setContentHeight()
	{
		
		var correction = ($.browser == 'msie' && $.browser.version != '7.0') ? 188 : 195;

		if ($(window).height() > $('body').height()){
			var contentHeight = $(window).height() - correction;
		}
		else {
			var contentHeight = $('body').height() - correction;
		}
		
		$('#canvas, #content').height( parseInt(contentHeight) + 'px' );

		// var windowHeight;
		// var contentHeight;
		// var heightDif = document.all ? 188 : 195;
		// 
		// var bodyHeight = document.body.offsetHeight;
		// var contentHeight;
		// var browser;
		// 
		// if( typeof( window.innerWidth ) == 'number' ) {
		// 	//Non-IE
		// 	browser = "mozilla";
		// 	windowHeight = window.innerHeight;
		// } 
		// else if(document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight )) {
		// 	//IE 6+ in 'standards compliant mode'
		// 	browser = "ie6";
		// 	// if (typeof document.body.style.maxHeight == "undefined") {
		// 	// 	heightDif = 195;
		// 	// }		
		// 	windowHeight = document.documentElement.clientHeight;
		// } 
		// else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		// 	//IE 4 compatible
		// 	browser = "ie4";
		// 	windowHeight = document.body.clientHeight;
		// }
		// // Calculate content height
		// if (windowHeight > bodyHeight){
		// 	contentHeight = windowHeight - heightDif;
		// }
		// else {
		// 	contentHeight = bodyHeight- heightDif;
		// }
		// 
		// document.getElementById('canvas').style.height = parseInt(contentHeight) + 'px';
		// document.getElementById('content').style.height = parseInt(contentHeight) + 'px';

	}

}