// JavaScript Document
// Door Frank Anneveld

var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring,tdWidth,tdHeight;

var thisBrowser = browserDetect();
    //     pagina instellen op breedte zie ook CSS
var headerHeight = 151;
var footerHeight = 0;


function browserDetect(){

	if (checkIt('konqueror'))
	{
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser = "Safari"
	else if (checkIt('omniweb')) browser = "OmniWeb"
	else if (checkIt('opera')) browser = "Opera"
	else if (checkIt('webtv')) browser = "WebTV";
	else if (checkIt('icab')) browser = "iCab"
	else if (checkIt('msie')) browser = "Internet Explorer"
	else if (checkIt('mozilla')) browser = "Mozilla"
	else if (!checkIt('compatible'))
	{
		browser = "Netscape Navigator"
		version = detect.charAt(8);
	}
	else browser = "An unknown browser";
	
	if (!version) version = detect.charAt(place + thestring.length);
	
	if (!OS)
	{
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS = "an unknown operating system";
	}
	
    return browser;
	
	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}
}

function browserSize() {
  var tmpObj = new Object(); 
  if( typeof( window.innerWidth ) == 'number' ) {
    //geen IE
    tmpObj.myWidth = window.innerWidth;
    tmpObj.myHeight = window.innerHeight;
  } else if( document.documentElement &&
      ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ 
    tmpObj.myWidth = document.documentElement.clientWidth;
    tmpObj.myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 
    tmpObj.myWidth = document.body.clientWidth;
    tmpObj.myHeight = document.body.clientHeight;

  }
  return tmpObj;	
}

function setTDHeight() {
    tmpObj = browserSize();
    tdHeight = tmpObj.myHeight - (footerHeight + headerHeight);
    if (tmpObj.myHeight > screen.height) return false; // for MSIE
    if (tmpObj.myHeight > (footerHeight + headerHeight)) {	
		if (thisBrowser == "Internet Explorer"){
			document.getElementById("td_content").style.height = tdHeight;
			document.getElementById("id_content").style.height = tdHeight - 22;
			document.getElementById("navigatieHeight").style.height = tdHeight - 80;
		}
		if (thisBrowser == "Mozilla"){
			document.getElementById("td_content").style.height = tdHeight;
			document.getElementById("id_content").style.height = tdHeight - 22;
			document.getElementById("navigatieHeight").style.height = tdHeight - 80;
			if (document.getElementById("navigatieHeight").style.height <= '368') {
				document.getElementById("navigatieHeight").style.height = 368;
			}
		}
	}	
	document.getElementById("afbeelding").style.display = "block";
}