var moved = false;
var movedSubMenus = Array();
function getElementsByClassName(classname) {    
    var node = document.getElementsByTagName("body")[0];    
    var a = [];    
    var re = new RegExp('\\b' + classname + '\\b');    
    var els = node.getElementsByTagName("*");    
    for(var i=0,j=els.length; i<j; i++)        
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}
function checkHeight()
{
	/*
			var contentblock = getElementsByClassName("content")[0];
			if ( contentblock == 0 ) {
			     window.alert('content empty');
			}

    if (parseInt(navigator.appVersion)>3) 
    {
        if (navigator.appName=="Netscape") 
	{
            var windowHeight = window.innerHeight;
        }
        if (navigator.appName.indexOf("Microsoft")!=-1) 
	{
            var windowHeight = document.documentElement.clientHeight;
        }
    }
    var container = getElementsByClassName("website")[0];
    	
    if (container)
    {
	var currentHeight = container.offsetHeight;
    }
    
    if(currentHeight < windowHeight )
    {
 	var geheel = getElementsByClassName("website")[0];
	var oldHeight = geheel.offsetHeight;
	var newHeight = (windowHeight - 25);
	geheel.style.height = newHeight + "px";
	var path = window.location.pathname;
	var url = '/kantoormrvanzijl.nl/pages.php/';
	if (path != (url+'home.html') && path != '/kantoormrvanzijl.nl/' && path != url) {	
			var contentblock = getElementsByClassName("content")[0];
			var zoekenblock = getElementsByClassName("zoeken")[0];
			if ( contentblock && !zoekenblock) {
				var height = windowHeight - 412;
				if (navigator.appName=="Netscape") 
				{
				    height = windowHeight - 395;
				}
				
				if (navigator.appName.indexOf("Microsoft")!=-1) 
				{
				    height = windowHeight - 412;
				}
				if ( navigator.appVersion.indexOf("Safari") > 0 ) {
				    height = windowHeight - 425;
				}
				if ( contentblock  )
				{
				//	if ( navigator.appVersion.indexOf("Safari") <= 0 ) {
	//					contentblock.style.height = height+'px';
				//	}
				}
			
			}
			else {
			
				var footer = getElementsByClassName("footer")[0];
				var  margin = windowHeight - currentHeight - 5;
				if ( navigator.appVersion.indexOf("Safari") ) {
					margin = windowHeight - currentHeight - 5;
				}
				
				if ( footer )
				{
					footer.style.position = "relative";
					footer.style.top = margin+"px";
				}
			}
		}
	}
*/
}
function checkHeight2()
{
	/*

    if (parseInt(navigator.appVersion)>3) 
    {
        if (navigator.appName=="Netscape") 
	{
            var windowHeight = window.innerHeight;
        }
        if (navigator.appName.indexOf("Microsoft")!=-1) 
	{
            var windowHeight = document.documentElement.clientHeight;
        }
    }
    var container = getElementsByClassName("website")[0];
    	
    if (container)
    {
	var currentHeight = container.offsetHeight;
    }
    
    if(currentHeight < windowHeight )
    {
 	var geheel = getElementsByClassName("website")[0];
	var oldHeight = geheel.offsetHeight;
	var newHeight = (windowHeight - 25);
	geheel.style.height = newHeight + "px";
	if (window.location.pathname != '/kantoormrvanzijl.nl/pages.php/home.html' && (window.location.pathname != '/kantoormrvanzijl.nl/') ) {	
		var str = window.location.pathname;
		if ( str.indexOf('actueel') == -1 && str.indexOf('reactie') == -1 && str.indexOf('actueel') == -1 && str.indexOf('o_') == -1 && str.indexOf('d_') == -1) {
			var contentblock = getElementsByClassName("content")[0];
			var height = windowHeight - 412;
			if (navigator.appName=="Netscape") 
			{
			    height = windowHeight - 395;
			}
			
			if (navigator.appName.indexOf("Microsoft")!=-1) 
			{
			    height = windowHeight - 412;
			}
			if ( navigator.appVersion.indexOf("Safari") > 0 ) {
			    height = windowHeight - 425;
			}
			if ( contentblock  )
			{
			//	if ( navigator.appVersion.indexOf("Safari") <= 0 ) {
			//		contentblock.style.height = height+'px';
			//	}
			}
		}
		else if (str.indexOf('o_') != -1 || str.indexOf('d_') != -1 || str.indexOf('reactie') != -1 ) {
			var contentblock = getElementsByClassName("contentblok")[0];
			var height = windowHeight - 407;
			if (navigator.appName=="Netscape") 
			{
			    height = windowHeight - 395;
			}
			
			if (navigator.appName.indexOf("Microsoft")!=-1) 
			{
			    height = windowHeight - 412;
			}
			if ( navigator.appVersion.indexOf("Safari") > 0 ) {
			    height = windowHeight - 425;
			}
			if ( contentblock  )
			{
			//	if ( navigator.appVersion.indexOf("Safari") <= 0 ) {
		//			contentblock.style.height = height+'px';
			//	}
			}
		}
		else if (str.indexOf('actueel') != -1) {
			var contentblock = getElementsByClassName("contentblok")[0];
			var height = windowHeight - 412;
			if (navigator.appName=="Netscape") 
			{
			    height = windowHeight - 420;
			}
			
			if (navigator.appName.indexOf("Microsoft")!=-1) 
			{
			    height = windowHeight - 437;
			}
			if ( navigator.appVersion.indexOf("Safari") > 0 ) {
			    height = windowHeight - 450;
			}
			if ( contentblock  )
			{
			//	if ( navigator.appVersion.indexOf("Safari") <= 0 ) {
		//			contentblock.style.height = height+'px';
			//	}
			}
		}
		else {
			
		/*	var footer = getElementsByClassName("footer")[0];
			var  margin = windowHeight - currentHeight - 5;
			if ( navigator.appVersion.indexOf("Safari") ) {
				margin = windowHeight - currentHeight - 20;
			}
			
			if ( footer )
			{
				footer.style.position = "relative";
				footer.style.top = margin+"px";
			}
		}
	}
    }
*/
}

function positionSafariMenuBar()
{
	//check if current browser is safari
	var isSafari = navigator.appVersion.indexOf("Safari");
	if(isSafari > 0)
	{
		var menuItem0 = getElementsByClassName("MenuItem_0");
		var menuItem1 = getElementsByClassName("MenuItem_1");
		var menuItem2 = getElementsByClassName("MenuItem_2");
		var menuItem3 = getElementsByClassName("MenuItem_3");
		var menuItem4 = getElementsByClassName("MenuItem_4");

		menuItem0[0].firstChild.className = "menuSafari";	
		menuItem1[0].firstChild.className = "menuSafari";	
		menuItem2[0].firstChild.className = "menuSafari";	
		menuItem3[0].firstChild.className = "menuSafariPb";	
		menuItem4[0].firstChild.className = "menuSafari";
	}
}

onloads.push(checkHeight);
onloads.push(positionSafariMenuBar);

