onload = function(){
	initSifr();
	sizeContent();
	pageHit();
}



/*function sizeContent(){

	var leftFill = document.getElementById('leftFill');
	var midFill = document.getElementById('midFill');
	var leftMenu = document.getElementById('leftMenu');
	var midContent = document.getElementById('midContent');
	
	var leftHeight = document.getElementById('leftMenu').offsetHeight;
	var midHeight = document.getElementById('midContent').offsetHeight;

	if(leftHeight < midHeight){
		
		fill = midHeight - leftHeight;
		leftFill.style.height = fill +"px";
		
	}
	
	if(leftHeight > midHeight){
		
		fill = leftHeight - midHeight;
		midFill.style.height = fill +"px";
		
	}
	
}*/

function sizeContent(){

	if(document.getElementById('smallboxtop')){
		var leftFill 	= document.getElementById('leftFill');
		var midFill 	= document.getElementById('midFill');
		var leftMenu 	= document.getElementById('smallboxtop');
		var midContent 	= document.getElementById('bigboxtop');
	
		var leftHeight 	= document.getElementById('smallboxtop').offsetHeight;
		var midHeight 	= document.getElementById('bigboxtop').offsetHeight;
	
		if(leftHeight < midHeight){
			fill = midHeight - leftHeight;
			leftFill.style.height = fill +"px";	
		}
		
		if(leftHeight > midHeight){	
			fill = leftHeight - midHeight;
			midFill.style.height = fill +"px";	
		}
	}
}


// sIFR
function initSifr(){
	
	if(typeof sIFR == "function"){
		
		sIFR.replaceElement(named({sSelector:"h2.front", sWmode: "transparent", sFlashSrc:"sifr/sifr.swf", sColor:"#D53E2E", sLinkColor:"#7E7E7E", sBgColor:"#fff"}));
		sIFR.replaceElement(named({sSelector:"h2.kennisbank", sWmode: "transparent", sFlashSrc:"sifr/sifr.swf", sColor:"#797D7F", sLinkColor:"#7E7E7E", sBgColor:"#fff"}));
		sIFR.replaceElement(named({sSelector:"h3.titlekennisbank", sWmode: "transparent", sFlashSrc:"sifr/sifr.swf", sColor:"#C52C27", sLinkColor:"#7E7E7E", sBgColor:"#fff"}));

	}

}

function showWindow(id) {
	//$(".block").draggable();
	//$(".screenshow").draggable();
	document.getElementById(id).style.display = "block";
}

function closeWindow(id) {
    document.getElementById(id).style.display = "none";
}


function pageHit(){

  p = escape(document.location.href);
  rfr = escape(document.referrer);
  if (rfr == "undefined"){ rfr = "";}
  sx = screen.width;
  sy = screen.height;
  sc = (navigator.appName.indexOf("Microsoft") > -1) ? screen.colorDepth : screen.pixelDepth;
  src = 'stats.php?p=' + p + '&rfr=' + rfr + '&sx=' + sx + '&sy=' + sy + '&sc=' + sc;
  src = '<img style="position:absolute;left:-10px;top:-10px;" src="' + src + '" width="1" height="1" border="0" alt="" />';
  document.getElementById('counter').innerHTML = src;  
  
}

// jQuery functies
$(document).ready(function(){
    // Videos
    $('.ytVideoContainer').each(function(){
        t = $(this);
       
        iWidth = 226;

        sUrl = t.find('a').attr('href');

        if(sUrl.indexOf('youtube') > -1) {
            sUrl = sUrl.replace('/watch?v=', '/v/');
            sUrl = sUrl.replace('nl.youtube.com', 'www.youtube.com');
            sUrl += '&hl=nl&fs=1&rel=0';

            iHeight = iWidth * 0.755;
            iHeight = Math.ceil(iHeight);

            sCode = '<object width="'+ iWidth +'" height="'+ iHeight +'"><param name="movie" value="'+ sUrl +'"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"></param><embed src="'+ sUrl +'" type="application/x-shockwave-flash" allowfullscreen="true" wmode="transparent" width="'+ iWidth +'" height="'+ iHeight +'"></embed></object>';
            sCode = unescape(sCode).replace(/\+/g, ' ');

            t.html('<span>' + sCode + '</span>');
        }

        if(sUrl.indexOf('vimeo') > -1) {
            sUrl = sUrl.replace('vimeo.com/', 'vimeo.com/moogaloop.swf?clip_id=');
            sUrl += '&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=&amp;fullscreen=1';

            iHeight = iWidth * 0.755;
            iHeight = Math.ceil(iHeight);

            sCode = '<object width="'+ iWidth +'" height="'+ iHeight +'"><param name="allowfullscreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="movie" value="'+ sUrl +'"></param><embed src="'+ sUrl +'" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="'+ iWidth +'" height="'+ iHeight +'"></embed></object>';
            sCode = unescape(sCode).replace(/\+/g, ' ');

            t.css('height', iHeight).html('<span>' + sCode + '</span>');
        }

    });
});