/* Javascript Alken Maes */

function printDoc(){
    window.print();
}

function setMainPic(url){
    var mnPic = getobj('imgMain');
    
    mnPic.src = url;
    mnPic.style.display = '';
}

var arrImages;
var currentIndex;
var nextIndex;
var opacity;

function startLoop(){
var imgDv = getobj('PictureLoopControl');
var imgNodes = imgDv.childNodes;

    arrImages = new Array();
    
    for(var i=0;i<imgNodes.length;i++){
		if (String(imgNodes[i].id).toLowerCase() != "bubbeltjes") {
			arrImages.push(imgNodes[i]);
		}
    }
    
    currentIndex = Math.floor(Math.random() * arrImages.length);
    
    showPic(currentIndex);
    setInterval(fadeToNext, 4000);
}

function showPic(newIndex){
    arrImages[currentIndex].style.display = 'none';
    try{
        arrImages[currentIndex].style.opacity = 1;
    }catch(e){}
    try{
        arrImages[currentIndex].style.filter = 'alpha(opacity=100,style=0)';
    }catch(e){}
    
    arrImages[newIndex].style.display = 'block';
    try{
        arrImages[newIndex].style.opacity = 1;
    }catch(e){}
    try{
        arrImages[newIndex].style.filter = 'alpha(opacity=100,style=0)';
    }catch(e){}
    arrImages[newIndex].style.zIndex = 3;
    
    currentIndex = newIndex;
}

function fadeToNext(){
    opacity = 100;
    nextIndex = ((currentIndex + 1)==arrImages.length?0:(currentIndex + 1));
    
    arrImages[nextIndex].style.zIndex = 2;
    arrImages[nextIndex].style.display = 'block';
    
    setTimeout(dofade, 20);
}

function dofade(){
    opacity -= 3;
    
    try {
        arrImages[currentIndex].style.opacity = (opacity / 100);
    } catch (e) {}
    
    try{
        arrImages[currentIndex].style.filter = 'alpha(opacity=' + opacity + ',style=0)';
    }catch(e){}
    
    if(opacity <= 0){
        showPic(nextIndex);
    }else{
        setTimeout(dofade, 20);
    }
}

function getobj(id){
    return document.getElementById(id);
}

/* footer */
var hoog;

function getInternetExplorerVersion() {
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).

  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer') {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null) {
		rv = parseFloat(RegExp.$1);
	}
  }
  return rv;
}
function Footer() {
	var docHoog = GetHeight();
	var BodyHoog = 0; //= getBodyHeigth();
	
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version); //browserversion for non IE-browsers
	
	var ContentHoogte = 'content';
	if (browser=="Microsoft Internet Explorer") {
		if (getInternetExplorerVersion() <= 7) {
			ContentHoogte = 'content_container'; //IE7 only works with the content_container
		}
	}
	
	BodyHoog = document.getElementById(ContentHoogte).clientHeight + document.getElementById('topmenu').clientHeight + document.getElementById('footerhome').clientHeight;

	if (BodyHoog < docHoog) {		
		hoog = BodyHoog;
				
		document.getElementById('content').style.height = (document.getElementById('topmenu').style.height  + (docHoog - 93)) + "px";
	}
}

function ResizeFooter() {
	var docHoog = GetHeight();
	var BodyHoog=hoog;
		
	if (BodyHoog < docHoog) {
		document.getElementById('container').style.height = (docHoog) + "px";
	}
	else {
		document.getElementById('container').style.height = "";
	}
}
function getBodyHeigth(){
	return (document.documentElement && document.documentElement.scrollHeight) ? document.documentElement.scrollHeight: (document.body.scrollHeight > document.body.offsetHeight) ? document.body.scrollHeight: document.body.offsetHeight;
}
function GetHeight() {
  var myHeight = 0;
  if(typeof(window.innerHeight) == 'number') {
    //Non-IE
    myHeight = window.innerHeight;
  } else if(document.documentElement && document.documentElement.clientHeight) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if(document.body && document.body.clientHeight) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight;
}