// JavaScript Document
var lang="FR";
var id=-1;

function importXML(name,funcName)
{
	if (document.implementation && document.implementation.createDocument)
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		xmlDoc.async = false;
		var isLoaded=xmlDoc.load(name);
		if (isLoaded==true) {
			eval(funcName);
		}
	}
	else if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function () {
			if (xmlDoc.readyState == 4) eval(funcName);
		};
		xmlDoc.load(name);
 	}
	else
	{
		alert('Your browser can\'t handle this script');
		return;
	}
	
}


function initSectors(lang)
{

	var pth="xml";
	if (lang!='FR')
		pth="../xml";
	var chaine="";
	var chaine2="";
	
	//var x = xmlDoc.getElementsByTagName('references');
	var x=xmlDoc.firstChild.firstChild;
	var z=xmlDoc.firstChild.childNodes.length;
	var y=null;
	var i=0;
	do
	{
		i++;
		chaine=chaine+"<li><a href=\"references.html?id="+i+"\">"+x.getAttribute("name"+lang)+"</a></li>";
		
		if ((i==id)||(id=="all"))
		{
			chaine2=chaine2+"<div class=\"referenceTable\">";
			chaine2=chaine2+"<p><a class=\"cat\" href=\"references.html?id="+i+"\">"+x.getAttribute("name"+lang)+"</a></p>";
			y=x.firstChild;
			for (j=0;j<x.childNodes.length;j++) 
			{
				
				chaine2=chaine2+"<table border=\"0\" cellpadding=\"5\" cellspacing=\"0\">";
				chaine2=chaine2+"<tr>";
				chaine2=chaine2+"<td rowspan=\"2\ valign=\"top\" width=\"80\">";
				if (y.getAttribute("cover")!="")
					chaine2=chaine2+"<img  style=\"border-style: dotted; border-width: 1px\" src=\""+pth+"/"+y.getAttribute("cover")+"\"/>";
				else
					chaine2=chaine2+"&nbsp;";
				chaine2=chaine2+"</td>";
				
				chaine2=chaine2+"<td valign=\"top\"><!--"+y.getAttribute("name")+"<br/>-->";
				if (y.getAttribute("url")!="")
					chaine2=chaine2+"<a href=\""+y.getAttribute("url")+"\" target=\"_blank\">";
				chaine2=chaine2+"<img border=\"0\" src=\""+pth+"/"+y.getAttribute("logo")+"\"/>";
				if (y.getAttribute("url")!="")
					chaine2=chaine2+"</a>";
				chaine2=chaine2+"</td>";
				chaine2=chaine2+"</tr>";
				chaine2=chaine2+"<tr>";
				chaine2=chaine2+"<td valign=\"top\">";
				
				if (y.getAttribute("pdf")!="")
					chaine2=chaine2+"<a href=\""+pth+"pdfs/"+y.getAttribute("pdf")+"\" style=\"margin:5px;\" target=\"_blank\">pdf</a>";
					
				if (y.getAttribute("catsiteUrl")!="")
					chaine2=chaine2+"<a href=\""+y.getAttribute("catsiteUrl")+"\"  target=\"_blank\">url</a>";
				
				chaine2=chaine2+"</td>";
				chaine2=chaine2+"</tr>";
				chaine2=chaine2+"</table>";
				y=y.nextSibling;
			}
			chaine2=chaine2+"</div>";
			document.getElementById("contenttable").innerHTML=chaine2;
		}
	x=x.nextSibling;
	}
	while (i<z);
	document.getElementById("secteurs").innerHTML=chaine;
	
}

