if (!window.BPFlag) { // this is in order to avoid double include of this script

function CV_BP_change (prm) {
   request = getXhr();//alert (prm)
   if (prm>'') {
	strParam = encodeURI(prm);
	var url = curHost + "Press/bp/CVBPCom_chg.xml.php"; //alert ('CV_BP_change Call='+url);  
	//alert (url+'\r\n'+strParam); 
	//'http://www.cargolux.com/cvphp/PRMailing/media_request_form_res.php?action=' + curAction; //alert(url);  
	request.open("POST", url, true);
	request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	request.setRequestHeader("Content-length", strParam.length);
	request.setRequestHeader("Connection", "close");
	request.onreadystatechange = function () {changeResult(request)};
	request.send(strParam);
  }
}
function changeResult(request){
if (request.readyState == 4) 
  if (request.status == 200)    { // alert(request.responseText); 
	var xmlDoc = request.responseXML;	
	for(var i=0; i<=xmlDoc.documentElement.childNodes.length; i++) { 	  
	  xmlBindings = xmlDoc.documentElement.childNodes[i]; 
	  if (xmlBindings!=null)   
		if (xmlBindings.tagName=="status" && xmlBindings.hasChildNodes())
		   alert('Result = '+xmlBindings.firstChild.nodeValue)
	}
  } 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) {
  //document.getElementsByTagName ("div")[1].firstChild.insertData(1,head);
  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,10)=='liEvtComId')
	   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,11)=='divEvtComId'){ //alert ('nme='+nme);
	    var eleId = nme.substr(11,2); 
		if (eleId==idn) 
		 	  arrElem2[jj].className = 'Arrow-news-ssmenu_actif';
		 else arrElem2[jj].className = 'Arrow-news-ssmenu_inactif';
	  }
	}
  }
}

function callEvtCom (idComm) {
   request = getXhr();
   if (idComm>'') {
	   var url = curHost + "Press/bp/getBPCom.xml.php?iddoc="+idComm;
//alert ('Calling: '+url);  
	  request.open("GET", url, true);
	  request.onreadystatechange =  function() {  injectBPCom(request) }
	  request.send(null);
  }
}
/*function activateDivModify(mid) { // alert ('This is modification for  '+mid);
  obj = document.getElementById('admDivMod');
  obj.style.visibility = "visible";
}*/
/*function SetContent(where,what){
	obj = document.getElementById(where)
	if (obj){		//alert (obj.type)
	  if (obj.type=='text') obj.value = what
		else if (obj.type=='textarea') obj.value = what
		else obj.innerHTML = what;
	}
}*/
function SetContent(where,what){
	obj = document.getElementById(where)
	if (obj){		//alert (obj.type)
	  if (obj.type=='text') obj.value = what
		else if (obj.type=='textarea') {
				//obj.innerHTML = what;				
				//what = what.replace(/\n/g,"<br>"); alert ('avant '+what)
				editor_setHTML(where, what)	
				//alert('apres')
		}	else obj.innerHTML = what;
	}
}
/*function SetTxtArea(where,what) {
	//alert ('setting '+where+' TO \n'+what)
	// This is a function in editor.js that is pasting the text into the actual textarea.
	editor_setHTML(where, what)	
}*/
function injectBPCom(request) {
if (request.readyState == 4) 
  if (request.status == 200)    { // alert(request.responseText); 
	var xmlDoc = request.responseXML;	  
	anIdObj = xmlDoc.getElementsByTagName('BPCommunic')//alert (anIdObj.length)
	if (anIdObj.length==1) {
		anId = anIdObj[0].getAttribute('id');  //alert ('this is '+anId);
		obj = document.getElementById('CommId')
		if (obj) obj.value = anId
		obj = document.getElementById('submitBut')
		if (obj) obj.disabled = false;
		if (obj) obj.value="Update";
		obj = document.getElementById('BPComm')
		if (obj) obj.value="BPCommUpd";
		//obj = document.getElementById('admLinkMod');
		//if (obj) obj.innerHTML = ' <<a href="#" onClick="activateDivModify(' + anId + ')">Modify this "Communiqué"</a>>';
	}		
	//alert (xmlDoc.documentElement.childNodes.length)
	for(var i=0; i<=xmlDoc.documentElement.childNodes.length; i++) { 	  
	  xmlBindings = xmlDoc.documentElement.childNodes[i]; 
	  if (xmlBindings!=null)   { //alert (i+' / '+xmlBindings.tagName +' / '+ xmlBindings.hasChildNodes());
		if (!xmlBindings.hasChildNodes()) continue;
		if (xmlBindings.tagName=="PublishDate" ){ //alert (xmlBindings.firstChild.nodeValue);
		   obj = document.getElementById('date_infos_news1')
		   if (obj) obj.innerHTML = 'Luxembourg, '+xmlBindings.firstChild.nodeValue;
		   obj = document.getElementById('date_infos_news2')
		   if (obj) obj.innerHTML = 'Luxembourg, '+xmlBindings.firstChild.nodeValue;
		   obj = document.getElementById('date_infos_news3')
		   if (obj) obj.innerHTML = 'Luxembourg, '+xmlBindings.firstChild.nodeValue;
		   obj = document.getElementById('date_infos_news4')
		   if (obj) obj.innerHTML = 'Luxembourg, '+xmlBindings.firstChild.nodeValue;
		} else {  //alert (xmlBindings.tagName);
		  if (xmlBindings.tagName == 'Visibility') {
		    if (xmlBindings.firstChild.nodeValue == 'Y')
				  obj = document.getElementById('EvtCommVisY')
			 else obj = document.getElementById('EvtCommVisN')
			if (obj) obj.checked = true
		  }else if (xmlBindings.tagName == 'Title1') {
		    SetContent ('title_infos_news1', xmlBindings.firstChild.nodeValue)
		  }else if (xmlBindings.tagName == 'Title2') {
		    SetContent ('title_infos_news2', xmlBindings.firstChild.nodeValue)
		   }else if (xmlBindings.tagName == 'Title3') {
		    SetContent ('title_infos_news3', xmlBindings.firstChild.nodeValue)
		   }else if (xmlBindings.tagName == 'Title4') { 
		    SetContent ('title_infos_news4', xmlBindings.firstChild.nodeValue)
		   }else if (xmlBindings.tagName == 'Article1') {// alert (xmlBindings.firstChild.nodeValue)
		    SetContent ('texte_infos_news1', xmlBindings.firstChild.nodeValue)
		   }else if (xmlBindings.tagName == 'Article2') {
		    SetContent ('texte_infos_news2', xmlBindings.firstChild.nodeValue)
		   }else if (xmlBindings.tagName == 'Article3') {
		    SetContent ('texte_infos_news3', xmlBindings.firstChild.nodeValue)
		   }else if (xmlBindings.tagName == 'Article4') {
		    SetContent ('texte_infos_news4', xmlBindings.firstChild.nodeValue)
		   }
		}
	  }
	}	
  } else {
      var message = request.getResponseHeader("Status");
      if ((message.length == null) || (message.length <= 0)) {
        alert("Error! Request status is " + request.status);
      } else {
        alert(message);
      }
  }							
}

BPFlag = true;
} // if defined PressRelFlag