function openwindow(popurl,name,size) {
	nieuwVenster=window.open(popurl,name,size,'menubar=no,scrollbars=no,toolbar=no,location=no,resizable=yes,directories=no');
	nieuwVenster.focus();
	return false;
}

function externalLinks() {
	//alert('ff');
    if (!document.getElementsByTagName) return;
        var anchors = document.getElementsByTagName("a");
        for (var i=0; i<anchors.length; i++) {
        var anchor = anchors[i];
        if (anchor.getAttribute("href") &&
        anchor.getAttribute("rel") == "external")
        anchor.target = "_blank";
        
    }
}

function setHeight(element,h) {
   		el = document.getElementById(element);
    	el.style.height = h +"px";
}

function resize(){ 
	var arrayPageSize = getPageSizeWithScroll();
	setHeight('greylayer', arrayPageSize[1]+125);
}

function getPageSizeWithScroll(){
	if (window.innerHeight && window.scrollMaxY) {// Firefox
		yWithScroll = window.innerHeight + window.scrollMaxY;
		xWithScroll = window.innerWidth + window.scrollMaxX;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yWithScroll = document.body.scrollHeight;
		xWithScroll = document.body.scrollWidth;
	} else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari
		yWithScroll = document.body.offsetHeight;
		xWithScroll = document.body.offsetWidth;
  	}
	arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll);
	//alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll );
	return arrayPageSizeWithScroll;
}
//alert('muha')

function loopForOpac(ids){
	for(k = 0; k<ids.length; k++){
		//if(k ==0){
		setTimeout("opacity('img"+ids[k]+"', 1, 100, 1000);", k*200);
		//}else{
			//setTimeout("opacity('img"+ids[k]+"', 1, 100, 1000);", 1000);
		//}
		
	}
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
	//alert(id)
    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
  
            timer++; 
        } 
      
       
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 

} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
	//alert(opacity)
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
    /*if(opacity==0){
    document.getElementById(id).style.display = "none";
    }*/
}