/////////////////////////////////////////////////////////////////////////////
// koelis.js
// (c) Antoine LEROY 2006
// 
// >> Provides a few functions for site architecture 
/////////////////////////////////////////////////////////////////////////////
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function showDiv(nom) {
		el = MM_findObj(nom);
		el.style.display = '';
	}
	
	function hideDiv(nom) {
		el = MM_findObj(nom);
		el.style.display = 'none';
	}
	
	////////////////////////////////////////////////////////////////////////////
	function changeImages() {
		if (document.images) {
			for (var i=0; i<changeImages.arguments.length; i+=2) {
				document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			}
		}
	}
	
	////////////////////////////////////////////////////////////////////////////
	function changeMenuImage(img_index, is_on) {
		if (document.images) {
			 var img_name="menu"+img_index;
			 var img_file="images/web/menu"+(is_on==1?"_on.gif":"_off.gif");
			 document[img_name].src = img_file;
		}
	}
	
	////////////////////////////////////////////////////////////////////////////
	// Write one menu entry
	// text is the text to write
	// i is the index of the entry, starting at 0
	function writeMenu(i, text) {
    document.write("<tr>");
    document.write("<td height='25' class='center' width='32'>");
    document.write("<img name='menu"+i+"' src='images/web/menu_off.gif' border='0'>");
    document.write("</td>");
    document.write("<td class='leftbottom'>");
    document.write("<a href='' onclick='site.changeMenuFrame("+i+");parent.main.location.reload();' ");
    document.write("onMouseOver='changeMenuImage("+i+",1);' ");
    document.write("onMouseOut='changeMenuImage("+i+",0);' ");
    document.write("class='menu'>");
    document.write(text);
    document.write("</a>");
    document.write("</td>");
    document.write("</tr>");
	}
	
	////////////////////////////////////////////////////////////////////////////
	// Write the title of menu frame i
	function writeTitle(i) {
    document.write("<!-- Title -->");
    document.write("<table border='0' cellpadding='0' cellspacing='0' width='100%'>");
  	
    document.write("<tr>");
  	document.write("<td>");											
  	document.write("<img alt='#'' src='images/web/title_mark.gif'/>");
  	sp(1);
    document.write("<span class='title'>");                   
  	document.write(site.menuFrame.menu[i]);    
  	document.write("</span>");
  	document.write("</td>");
  	/*document.write("<td>");
  	document.write("<span class='emph'>&nbsp;-&nbsp;Under Construction</span>");
  	document.write("</td>");*/
  	document.write("</tr>");
  	
  	document.write("<tr>");
  	document.write("<td  valign='top' colspan='2'>");
  	document.write("<hr/>");
  	document.write("</td>");
  	document.write("</tr>");
  	
  	document.write("</table>");
  }
  
  ////////////////////////////////////////////////////////////////////////////
	function writeBanner() {
    document.write("<map name='bannermap'>");
    document.write("<area href='javascript:site.changeOtherFrame(0);parent.main.location.reload();' alt='KOELIS Home' coords='0,20,200,70'/>");
    document.write("</map>");
    document.write("<tr>");
    document.write("<td height='98' class='center'><img usemap='#bannermap' border='0' alt='BANNER KOELIS' src='images/web/home_07.jpg'/></td>");
    document.write("</tr>");
    document.write("<tr><td height='15'></td></tr>");
	}
	
	////////////////////////////////////////////////////////////////////////////
	function writeLowerBanner() {
    	document.write("<tr>");
    	document.write("<td height='18' class='center'>");
    		document.write("<table border='0' cellpadding='0' cellspacing='0' width='730' align='center'>");
    			document.write("<tr>");
    				document.write("<td width='11'><img alt='(' src='images/web/home_08.gif'/></td>");
    				document.write("<td class='right' width='708' bgcolor='#0F5850'>");
    				document.write("<span class='fnelle'>");
    				document.write("<a href='javascript:site.changeOtherFrame(0);parent.main.location.reload();' class='fnelle'>Home</a> | ");       // Index
    				document.write("<a href='javascript:site.changeOtherFrame(1);parent.main.location.reload();' class='fnelle'>Legal Info</a> | "); // Legal
    				document.write("<a href='javascript:site.changeOtherFrame(2);parent.main.location.reload();' class='fnelle'>Contact</a>");       // Contact
    				document.write("</span></td>");
    				document.write("<td width='11'><img alt=')' src='images/web/home_09.gif'/></td>");
    			document.write("</tr>");
    		document.write("</table>");
    	document.write("</td>");
    document.write("</tr>");
	}
