if (!window.JobsFlag) { // this is in order to avoid double include of this script specially in page Job openings
function callAJob4Banner () {
/*  request = getXhr();
  var url = curHost + "WorkCargolux/getJobs.xml.php";
//alert ('callAJob4Banner Call='+url);  
  request.open("GET", url, true);
  request.onreadystatechange = function () {AddJobBanner(request)};
  request.send(null);*/
}

function AddJobBanner(request){
if (request.readyState == 4) 
  if (request.status == 200)    {  //alert(request.responseText); 
	var xmlDoc = request.responseXML;	   
//	alert("XML Root Tag Name: " + xmlDoc.documentElement.tagName);
	var xmlBindings;
	for(var i=0; i<1; i++) {
	  xmlBindings = xmlDoc.documentElement.childNodes[i]; 
	  //rest = xmlBindings.hasChildNodes();
	  //if (xmlBindings!=null) alert("Tag:"+ xmlBindings.tagName + " > "+ rest +' > '+xmlBindings.childNodes.length);
	  if (xmlBindings!=null)   { //		alert("Checking Child Nodes: " + xmlBindings.hasChildNodes);
		var idStat = xmlBindings.attributes.getNamedItem("id").nodeValue; //alert(idStat); 
		for (var j=0; j<xmlBindings.childNodes.length; j++) {
		   var xmlBindings2 = xmlBindings.childNodes[j];
		   if ( (xmlBindings2.hasChildNodes) && (xmlBindings2.tagName == 'Title')) {
			   aTitle = xmlBindings2.firstChild.nodeValue;
		   } 
		}
		document.getElementById('intituleJobs').innerHTML = aTitle
	  }	
    }

  } else {//if (request.status == 200) 
      var message = request.getResponseHeader("Status");
      if ((message.length == null) || (message.length <= 0)) {
        alert("Error! Request status is " + request.status);
      } else {
        alert(message);
      }
  }							
}

function callJobsReq () {
  request = getXhr();
  if (!request) {  alert ('getXhr is null > no press'); 
	  return false;
  }
  var url = curHost + "WorkCargolux/getJobs.xml.php";
//alert ('callJobsReq curHost='+curHost)   
  request.open("GET", url, true);
  request.onreadystatechange = function (){ injectListJobs(request)};
  request.send(null);
}

function injectListJobs (request) {
var firstIdJob = 0;
if (request.readyState == 4) 
  if (request.status == 200)    { // alert(request.responseText); 
	var str2Disp = '<ul class="ssmenu-border">';	
	var xmlDoc = request.responseXML;	
//	alert("XML Root Tag Name: " + xmlDoc.documentElement.tagName);
	var xmlBindings;
	if (!xmlDoc.documentElement.hasChildNodes) {
	  obj = document.getElementById('TaskTitle')
	  if (obj) obj.innerHTML = 'No jobs opportunities at this time';
	    else alert ('obj TaskTitle NOT FOUND')
	  obj = document.getElementById('RequireTitle')
	  if (obj) obj.innerHTML = '';
	    else alert ('obj RequireTitle NOT FOUND')
	}
	for(var i=0; i<=xmlDoc.documentElement.childNodes.length; i++) {
	  xmlBindings = xmlDoc.documentElement.childNodes[i]; 
	  //rest = xmlBindings.hasChildNodes();
	  //if (xmlBindings!=null) alert("Tag:"+ xmlBindings.tagName + " > "+ rest +' > '+xmlBindings.childNodes.length);
	  if (xmlBindings!=null)   { //		alert("Checking Child Nodes: " + xmlBindings.hasChildNodes);
		var idStat = xmlBindings.attributes.getNamedItem("id").nodeValue; //alert(idStat); 
		if (firstIdJob == 0){ firstIdJob = idStat; }//alert (firstIdStat) }// afin de faire l'affichage du premier titre.
		for (var j=0; j<xmlBindings.childNodes.length; j++) {
		   var xmlBindings2 = xmlBindings.childNodes[j];
		   if (xmlBindings2.hasChildNodes) {
			 if (xmlBindings2.tagName == 'Title') {
			   aTitle = xmlBindings2.firstChild.nodeValue;
			 }
		   } 
		}
				<!--one job title : links to center page to the div infos-news-->
		if ( (requiredJob==0) && (firstIdJob == idStat)  ||
		     (requiredJob!=0) && (requiredJob == idStat) )  curActif = '';
		  else  curActif = 'in'
		str2Disp = str2Disp + '<li id="liJobId' + i + '" class="news-ssmenu_'+curActif+'actif" onclick="activateThisLi(this,'+i+')">\n';
		str2Disp = str2Disp + '	<a href="#" onclick="callAJob(\''+idStat+'\')"> \n';
		str2Disp = str2Disp + ' 	<div id="divJobId' + i + '" class="Arrow-news-ssmenu_'+curActif+'actif">'+aTitle+'</div>\n';								
		str2Disp = str2Disp + '</a>\n';		
		str2Disp = str2Disp + '</li>\n';
				<!-- end of one job -->
	  }	
	}
    str2Disp = str2Disp + '</ul>\n';  //alert ("Jobs: " + str2Disp);
    obj = document.getElementById('textenews_ssmenu')
	if (obj) obj.innerHTML = str2Disp;
	  else alert ('obj textenews_ssmenu NOT FOUND')
												
    if (requiredJob==0)
	  callAJob(firstIdJob);
	 else
	  callAJob(requiredJob);
  } else {
      var message = request.getResponseHeader("Status");
      if ((message.length == null) || (message.length <= 0)) {
        alert("Error! Request status is " + request.status);
      } else {
        alert(message);
      }
  }							
}

function activateThisLi(thisLi, idn) {
  var arrElem = document.getElementsByTagName("li");   
  for (var jj=0;jj<arrElem.length;jj++) {
    if (arrElem[jj].id) {
	  nme = arrElem[jj].id; 
      if (nme.substr(0,7)=='liJobId')
	   arrElem[jj].className = 'news-ssmenu_inactif';
	}
  }
  thisLi.className='news-ssmenu_actif';
  
  var arrElem2 = document.getElementsByTagName("div"); 
  for (var jj=0;jj<arrElem2.length;jj++) {
    if (arrElem2[jj].id) {
	  var nme = arrElem2[jj].id; 
      if (nme.substr(0,8)=='divJobId'){ //alert ('nme='+nme);
	    var eleId = nme.substr(8,2); 
		if (eleId==idn) 
		 	  arrElem2[jj].className = 'Arrow-news-ssmenu_actif';
		 else arrElem2[jj].className = 'Arrow-news-ssmenu_inactif';
	  }
	}
  }
}
function callAJob (idJob) {
  request = getXhr();
  if (idJob>'') {
	  var url = curHost + "WorkCargolux/getJobs.xml.php?jid="+idJob;
//alert ('callAJob Call='+url);  
	  request.open("GET", url, true);
	  request.onreadystatechange = function () {injectAJob()};
	  request.send(null);
  }
}
function injectAJob() {
if (request.readyState == 4) 
  if (request.status == 200)    { //alert(request.responseText); 
	var xmlDoc = request.responseXML;	   
	for(var ii=0; ii<=xmlDoc.documentElement.childNodes.length; ii++) { 
	  var xmlBindings = xmlDoc.documentElement.childNodes[ii]; 
	  if (xmlBindings!=null)   {
	    if (xmlBindings.tagName == 'Title') { // alert (xmlBindings.firstChild.nodeValue);
		   obj = document.getElementById('title_infos_news')
		   if (obj && xmlBindings.hasChildNodes()) obj.innerHTML = xmlBindings.firstChild.nodeValue;
		} else if (xmlBindings.tagName == 'Description') { // alert (xmlBindings.firstChild.nodeValue);
		   obj = document.getElementById('divDescription');
		   if (obj && xmlBindings.hasChildNodes()) obj.innerHTML = xmlBindings.firstChild.nodeValue;
		} else if (xmlBindings.tagName == 'Tasks') { // alert (xmlBindings.firstChild.nodeValue);
		   obj = document.getElementById('divTasks')
		   if (obj && xmlBindings.hasChildNodes()) {
		 	var arrTask=xmlBindings.firstChild.nodeValue.split("@");
			var strTask = "<UL>";
			for (var j=0; j<arrTask.length; j++) 
			  strTask += "<LI>" + arrTask[j] + "</LI>";
			strTask += "</UL>";
			obj.innerHTML = strTask;
		   }
		} else if (xmlBindings.tagName == 'Requirement') { // alert (xmlBindings.firstChild.nodeValue);
		   obj = document.getElementById('divRequirement')
		   if (obj && xmlBindings.hasChildNodes()) {
		 	var arrReq=xmlBindings.firstChild.nodeValue.split("@");
			var strReq = "<UL>";
			for (var j=0; j<arrReq.length; j++) 
			  strReq += "<LI>" + arrReq[j] + "</LI>";
			strReq += "</UL>";
			obj.innerHTML = strReq;
		   }
		} 
	  }// if (xmlBindings!=null)
	}// for 	
  } else {//if (request.status == 200) 
      var message = request.getResponseHeader("Status");
      if ((message.length == null) || (message.length <= 0)) {
        alert("Error! Request status is " + request.status);
      } else {
        alert(message);
      }
  }							
}


JobsFlag = true;
} // if defined JobsFlag
