
var xmlDoc=null;
var x;
var a;
var cell_counter=0;

if (window.ActiveXObject)
{// code for IE
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
}
else if (document.implementation.createDocument)
{// code for Mozilla, Firefox, Opera, etc.
xmlDoc=document.implementation.createDocument("","",null);
}
else
{
alert('Your browser cannot handle this script');
}
if (xmlDoc!=null)
{
xmlDoc.async=false;
xmlDoc.load("../gastenboek.xml");
x=xmlDoc.getElementsByTagName("IMAGE");
} 
function display(start_image,number_of_images,col_count) {
var start_image;
var number_of_images;
var col_count;
cell_counter= 0;
        // get the reference for the body
		var body = document.getElementById("de_tabel");

        // creates a <table> element and a <tbody> element
        var tbl     = document.createElement("table");
        var tblBody = document.createElement("tbody");
		var k=0;
        // creating all cells

        for (var j = 0; j < x.length; j++) {
            // creates a table row
						if (cell_counter >= number_of_images  || start_image >= x.length)break;
						//if (cell_counter >= Number(x.length) )break;
            var row = document.createElement("tr");

            for (var i = 0; i < col_count; i++) {
                // Create a <td> element and a text node, make the text
                // node the contents of the <td>, and put the <td> at
                // the end of the table row
				if (cell_counter >= number_of_images || start_image >= x.length)break;
                var cell = document.createElement("td");	
				//var image = document.createElement("img");
				//image.style.cursor='pointer';
				var my_div = document.createElement("div");
				//var deposter = (x[start_image].getElementsByTagName("DEPOSE")[0].childNodes[0].nodeValue);
		        //var thetext = (x[start_image].getElementsByTagName("COMM")[0].childNodes[0].nodeValue);
				//var txt = thetext +"<br />" + deposter ;
				var photo_num = Math.abs(start_image-x.length);
				txt1="Foto N&#186; " + (photo_num);
				my_div.innerHTML=txt1;
				var small_image = document.createElement("img");
				small_image.style.cursor='pointer';
				//alert(x[start_image].getElementsByTagName("SMALL")[0].childNodes[0].nodeValue);
				small_image.setAttribute("src", x[start_image].getElementsByTagName("SMALL")[0].childNodes[0].nodeValue);	
				small_image.setAttribute("alt", x[start_image].getElementsByTagName("SMALL")[0].childNodes[0].nodeValue);
				small_image.onclick=Function("setCookie('"+start_image+"')");
				//small_image.setAttribute("height", "80");
				//small_image.setAttribute("width", "150");
				//small_image.id="image_" + cell_counter;																								
				cell.appendChild(small_image);
				cell.appendChild(my_div);
                row.appendChild(cell);
				start_image++;
				cell_counter++;
								
            }
						
            // add the row to the end of the table body
            tblBody.appendChild(row);
        }


        // put the <tbody> in the <table>
        tbl.appendChild(tblBody);
        // appends <table> into <body>
        body.appendChild(tbl);
        // sets the border attribute of tbl to 2;
    }
	
function setCookie(value)
{
var exdate=new Date();
var expiredays = 0;
var c_name="advertentie";
var w;
var h;
var value;
//alert(www+"---"+hhh);
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
my_window=window.open("finike_foto.php?action='entry'", "_blank",  "titlebar=yes,scrollbars=yes, resizable=yes,fullscreen=yes");
}

