/*
 * [KH]
 * pops up a window and shows an image from session
 */
function popUp(id, src){

	html = "<html><head><title>Vergrote foto</title></head><body style='margin: 0px 0; text-align:center;' ><IMG SRC='" + src + "' id='" + id + "' BORDER=0 NAME=image onload='window.resizeTo(document.image. width,(document.image.height))'></body></html>";
	popup=window.open ('','image','toolbar=0,location=0, directories=0,menuBar=0, scrollbars=0,resizable=1, width=1, height=1'); 
	popup.document.open(); 
	popup.document.write(html); 
	popup.document.focus(); 
	popup.document.close();
}

/*
 * [KH]
 * pops up a window and shows an image from session
 */
function enlargeImage(src){

	html = "<html><head><title>Vergrote foto</title></head><body style='margin: 0px 0; text-align:center;' ><IMG SRC='" + src + "' BORDER='0' NAME='image' onload='window.resizeTo((document.image.width + 50), (document.image.height + 50))' /></body></html>";
	popup=window.open ('','image','toolbar=0,location=0, directories=0,menuBar=0, scrollbars=0,resizable=1, width=1, height=1'); 
	popup.document.open(); 
	popup.document.write(html); 
	popup.document.focus(); 
	popup.document.close();
}

/*
 * [KH]
 * pops up a window and shows the html code
 */
function popUpAnimations(sLink, sSrc){
    var html;   
    var i; 
    var sSrcArray = sSrc.split(";");
    var sLinkArray = sLink.split(";");  
   
   html = "<html><head><title>Animaties</title></head><body margin='5px' padding='5px'><div style=\"font-weight:bold;color:black;font-family:arial;text-align:left;padding:15px 0;\">Animaties</div><table border='0'><tr>";
   for(i = 0; i < sSrcArray.length - 1; i++){
        html += "<td align='center' style='border:1px solid #ccc;' width='150px'><a target='_blank' href='" + sLinkArray[i] + "'><img src='" + sSrcArray[i] + "' border='0' /></a></td>";
        if(i == sSrcArray.length - 1) html += "<td style=\"background-color:black;width:5px;\"></td>";
   } 
	html += "</tr></table></body></html>";
    var popup = window.open('','Animaties','toolbar=0,location=0, directories=0,menuBar=0, scrollbars=1,resizable=0, width=600, height=200'); 
	popup.document.open(); 
	popup.document.write(html); 
	popup.document.focus(); 
	popup.document.close();
}

/*
 * [KH]
 * changes the source of the image object with the input id
 */
function changeSource(id, src){
   var img = document.getElementById(id);
   img.src = src; 	
}

/*
 * [kh] resizes the image from the id given while keeping the proportion of the image right.
 */
function resizeImage(img, width, height){
   if(img.width > width){
        var iHProportion = img.height / img.width ;
        img.width = width;
        img.height = img.width * iHProportion;
   }
   if(img.height > height){
        var iWProportion = img.width / img.height;
        img.height = height;
        img.width = img.height * iWProportion;        
   }
}