function display_both(){
var xml = "majliss_links.xml";
var tabel_id = "de_tabel_left";
display(0,4,1, xml,tabel_id);
var xml = "majliss_rechts.xml";
var tabel_id = "de_tabel_right";
display(0,2,1, xml,tabel_id);
var xml = "majliss_photo_du_jour.xml";
var tabel_id = "de_tabel_photo_du_jour";
display(0,1,1, xml,tabel_id);
}


function display(start_image,number_of_images,col_count,xml_file,tabel_id)
{
var xmlDoc=null;
var x;
var a;
var cell_counter=0;
var image_margin=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;

x=xmlDoc.getElementsByTagName("IMAGE");
}

 
var xml_file;
var tabel_id;
var start_image;
var number_of_images;
var col_count;
var number_name;
var aa=TDoY();
//alert(xml_file);


cell_counter= 0;
xmlDoc.load(xml_file);
//alert(TDoY());
//var aa=TDoY();
// keep the fotos two days the same
//if(Math.ceil(aa/2) > Math.floor(aa/2))
// {  num = 2* aa - 12;
                 //alert(aa +"odd " + Math.ceil(aa/2) + "    "  + Math.floor(aa/2));
// }
//else
//{  num = 2* aa - 14;
//                //alert(aa +"even" + Math.ceil(aa/2) + "    "  + Math.floor(aa/2));
//}
//every day 4 new pictures
//num = 4*(TDoY())-944 + start_image ;
//alert("num= " + num +"----" + "   length= " + x.length + "  TDoY = "  + aa);
switch(xml_file)
{
case "majliss_links.xml" :
//every day 4 new pictures
num = 4*(TDoY())-1216 + start_image ;
//alert("LINKS  num= " + num +"----" + "   length= " + x.length + "  TDoY = "  + aa);
  number_name=" ";
  the_class_name= "small_image_left";
  display_comment=1;
  break
case "majliss_rechts.xml":
//every day 4 new pictures
num = 2*(TDoY())-606+ start_image ;
//alert("RECHTS num= " + num +"----" + "   length= " + x.length + "  TDoY = "  + aa);
  number_name= "A";
  the_class_name= "small_image_right";
  display_comment=1;
  break
  case "majliss_photo_du_jour.xml":
//every day 4 new pictures
num = (TDoY())-306+ start_image ;
//alert("RECHTS num= " + num +"----" + "   length= " + x.length + "  TDoY = "  + aa);
  number_name= "";
  the_class_name= "majliss_photo_du_jour";
  display_comment=0;
  break
default:
  number_name = "";
}

if(num >= x.length)num=0;
//alert(num);
start_image=num ;
        // get the reference for the body
		var body = document.getElementById(tabel_id);
        // creates a <table> element and a <tbody> element
        var tbl     = document.createElement("table");
		tbl.border="0";
        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;
						
            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 my_div = document.createElement("div");
				var photo_num = Math.abs(start_image)+1;
				txt1="Photo N&#186; " + (photo_num) + number_name; //verschil maken tuuduen linker enrechter namen
				if(display_comment){my_div.innerHTML=txt1;}
				var small_image = document.createElement("img");
				small_image.style.cursor='pointer';
				//small_image.vspace = 15;
				small_image.className=the_class_name;
				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+"','"+xml_file+"')");
				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);
        // load the proverbes;

}
function setCookie(value,xml_name)
{
var xml_name;
var exdate=new Date();
var expiredays = 1;
var c_name="mbarchid";
exdate.setDate(exdate.getDate()+expiredays);
document.cookie=c_name+ "=" +escape(value)+"xxx"+escape(xml_name)+ "yyy"+ ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
switch (xml_name) {
  case "majliss_photo_du_jour.xml":
  my_window=window.open("majliss_foto_du_jour.html","_self");
  break

  default:
  my_window=window.open("majliss_foto.html","_blank","width=800,height=800,titlebar=no, scrollbars=yes,resizable=yes, fullscreen=no,top=10,left=20");
}

}
function DayOfYear(D)
{
 var t = +D, d = new Date(t)
d.setMonth(0, 0) // Previous Dec 31, same time
return Math.round((t-d)/864e5) /* Round allows Summer Time */
}

function TDoY() { return DayOfYear(new Date()); }

function show_popup(num) {
var num;
day = new Date();
id = day.getTime();
url="image" + num + ".html";
eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=950,height=875');");
}

