//This are all related to the resizer
function resize() {
	var currentSize = { h: g_resizer.offsetHeight, w: g_resizer.offsetWidth };
    if (currentSize.h != g_prevSize.h || currentSize.w != g_prevSize.w)	{
		g_prevSize = currentSize;
		doResize();
    }
}

function doResize()	{
	$('#resizer > img').attr({width: document.documentElement.clientWidth, height: document.documentElement.clientHeight});
}

function init()	{
	window.g_resizer = document.getElementById('resizer');
	window.g_prevSize = { h: g_resizer.offsetHeight, w: g_resizer.offsetWidth };
    setInterval(resize, 100);
}


$(document).ready( function() {
	//NAV
	//$('#nav > li > ul').parent().addClass('submenu');
	$('#nav > li').slice(3,4).addClass('long');
	$('#nav > li').slice(4).addClass('contactLink');
	
	//Projects
	$('#projects li:even').addClass('odd');
	
	//Moved all submenu appearance into js because of a bug in IE7
	$('#nav > li')
		.mouseover(function() { $(this).addClass('hover'); })
		.mouseout(function() { $(this).removeClass('hover'); });
	
	//IE
	 if($.browser.msie) { $( function() { 
		
		//IE6
		if($.browser.version == 6) {
			
			//Add some classes to inputs, for the lack of support for css type attribute
			$('input[@type=submit]').addClass('submit');
			$('input[@type=text], input[@type=password]').addClass('input_text');
			
			//Replaces transparent png's with IE's filter
			var img = document.getElementById('logo').getElementsByTagName('img')[0];
			img.src = 'fileadmin/images/transparent.gif';
			img.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='http://adviesburodocter.rodekiwi.nl/fileadmin/images/adviesburo_docter_logo.png',sizingMethod='scale')";
			//We initially hide the logo so we don't have a flicker
			$('#logo').show();
		}
		
		//TABLES
		$('table tbody tr').mouseover(function() { $(this).addClass('hover'); });
		$('table tbody tr').mouseout(function() { $(this).removeClass('hover'); });
		
	 })};
	
	//TABLES odd/even coloring
	$('table tbody tr:even').addClass('odd');
	
	//RESIZER
	$('#resizer > img').attr({width: document.documentElement.clientWidth, height: document.documentElement.clientHeight});
	init();
} );
