function setOn(obj,container,tagId){

li = obj.parentNode;
ul = li.parentNode;
lists = ul.getElementsByTagName("li");
for(i=0;i<lists.length;i++)
if(lists[i].className != 'admin')
lists[i].className='';

if(li.className != 'admin')
li.className='on';

divs = $(container).getElementsByTagName("div");

for(i=0;i<divs.length;i++){
 if(divs[i].getAttribute("ong") == 'Y')
  divs[i].style.display='none';
}

showZone(tagId);

}


function SelectCss(obj,id){
lists = $(id).getElementsByTagName('li');
for(i=0; i < lists.length; i++){
 li = lists[i];
 li.className='';
}
obj.className='on';
}

function shw(id,id2){
   new Effect.toggle($(id),'blind');
   $(id2).style.display='none'
}

function setValuesList(id, formname){
var s = "";
var list = $(id).getElementsByTagName("li");
for(i=0; i< list.length; i++){
li = list[i];
val = li.getAttribute("pui-autocomplete:value")
if(val){
s += val+"####";
}
}
$('uid').value=s;
//document.forms["adminForm"]["uid"].value=s;
}

function isValidForm(form){
    oList = form.getElementsByTagName("input");
    for(i=0; i<oList.length; i++){
     input = oList[i];
     if(input.className == 'required' && input.value == ''){
      alert("Veuillez saisir les informations obligatoires!")
      return false;
     }
     if(input.className == 'required_born_date' && !isDate(input.value, 18)){
      alert(input.getAttribute("label"))
      return false;
     }
     if(input.className == 'required_date' && !isDate(input.value, 0)){
      alert(input.getAttribute("label"))
      return false;
     }
    }

    oList = form.getElementsByTagName("select");
    for(i=0; i<oList.length; i++){
     input = oList[i];
     if(input.className == 'required' && input.value == ''){
      alert("Veuillez saisir les informations obligatoires!")
      return false;
     }
    }

    oList = form.getElementsByTagName("textarea");
    for(i=0; i<oList.length; i++){
     input = oList[i];
     if(input.className == 'required' && input.value == ''){
      alert("Veuillez saisir les informations obligatoires!")
      return false;
     }
    }

    return true;
  }

  function isValidForm2(form, msg){
    oList = form.getElementsByTagName("input");
    for(i=0; i<oList.length; i++){
     input = oList[i];
     if(input.className == 'required' && input.value == ''){
      alert(msg)
      return false;
     }
     if(input.className == 'required_born_date' && !isDate(input.value, 18)){
      alert(input.getAttribute("label"))
      return false;
     }
     if(input.className == 'required_date' && !isDate(input.value, 0)){
      alert(input.getAttribute("label"))
      return false;
     }
    }

    oList = form.getElementsByTagName("select");
    for(i=0; i<oList.length; i++){
     input = oList[i];
     if(input.className == 'required' && input.value == ''){
      alert(msg)
      return false;
     }
    }

    oList = form.getElementsByTagName("textarea");
    for(i=0; i<oList.length; i++){
     input = oList[i];
     if(input.className == 'required' && input.value == ''){
      alert(msg)
      return false;
     }
    }

    return true;
  }

  
var dtCh= "-";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr, min){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strDay=dtStr.substring(0,pos1)
	var strMonth=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		return false
	}
	if(min > 0 && (new Date().getFullYear() - year) < 18){
                return false
	}

return true
}



function arrayToString(arr){
   var str = "";
   /* one item on list */
   if(arr.checked == true){
    str = arr.value;
   }else{

   for(var index = 0; index < arr.length; index++){
      if(arr[index].checked == true)
       str += arr[index].value+",";
   }
   str = str.substring(0, str.length - 1);
   }
   return str;
}


function reload(tagid){
eval($(tagid).getAttribute('reload'))
}


function changeStyle(obj, oldclass, type){
  switch(type){
   case 'on': obj.className='on';break;
   case 'out': obj.className=oldclass;break;
  }
}


function itx(id,obj){
 pane = document.getElementById(id);
 panesList = pane.getElementsByTagName("div");
 for(i=0; i < panesList.length; i++){
  curr = panesList[i];
  $(curr).className="off";
 }
 obj.className="on";
 rURL(obj.getAttribute("url"),"he_c");
}

function itxStatic(id,obj){
 pane = document.getElementById(id);
 panesList = pane.getElementsByTagName("div");
 for(i=0; i < panesList.length; i++){
  curr = panesList[i];
  $(curr).className="off";
 }
 obj.className="on";
 i = obj.getAttribute("show");
 panes = document.getElementById('panes');
 panesx = panes.getElementsByTagName("div");
 for(i=0; i < panesx.length; i++){
  curr = panesx[i];
  if(curr.id.indexOf("pane") != -1)
     curr.style.display='none';
 }
 shown = document.getElementById('pane' + obj.getAttribute("show"));
 shown.style.display='block';

}

function ctx(id,obj){
 pane = document.getElementById(id);
 panesList = pane.getElementsByTagName("div");
 for(i=0; i < panesList.length; i++){
  curr = panesList[i];
  $(curr).className="off";
 }
 obj.className="on";
 $(obj.getAttribute("on")).style.display="block";
 $(obj.getAttribute("off")).style.display="none";
}

function gtx(id,obj){
 pane = document.getElementById(id);
 panesList = pane.getElementsByTagName("div");
 for(i=0; i < panesList.length; i++){
  curr = panesList[i];
  if($(curr).className == "on" || $(curr).className == "off")
  $(curr).className="off";
 }
 obj.className="on";
}

function sinitTabs(id, actif){
 pane = document.getElementById("container-sm");
 panesList = pane.getElementsByTagName("td");
 for(i=0; i < panesList.length; i++){
  curr = panesList[i];
  contentui = curr.getAttribute("contentui");
  if(contentui){
  $(contentui).style.display='none';
  $(curr).className="off";
  }
 }
 $($(actif).getAttribute("contentui")).style.display='block';
 $(actif).className="on";
 document.forms[$(actif).getAttribute("form")]['tab'].value=actif;
}


function yesNoRadioToShowDiv(form, yes)
{
  if(form[0].checked == true && form[0].value == yes)
   document.getElementById('showUsers').style.display = 'block';
  else
   document.getElementById('showUsers').style.display = 'none';

}

function openLink(linkToSend, width, height)
{
x = (window.Event) ? e.pageX : event.clientX;
y = (window.Event) ? e.pageY : event.clientY;
y=y-350;
var features  ='width='+width+', height='+height+',directories=0,location=0,menubar=0,left='+x+ ',top='+ y +',scrollbars=yes,status=0,toolbar=0,resizable=0';
window.open(linkToSend,'Cat',features)
}

function openLinkHs(linkToSend, width, height)
{
var features  ='width='+width+', height='+height+',directories=0,location=0,menubar=0,scrollbars=yes,status=0,toolbar=0,resizable=yes';
window.open(linkToSend,'Cat',features)
}


function removeSelected(form){
  var removeOptions = new Array();
    for(var index = 0; index < form.options.length; index++){
     if(form.options[index].selected == true){
      removeOptions[removeOptions.length] = form.options[index];
     }
    }
    for(var index = 0; index < removeOptions.length; index++){
     form.options[removeOptions[index].index] = null;
  }
}

function selectAll(form){
    for(var i = 0; i < form.options.length; i++)
      form.options[i].selected=true;

}

function addme (text, value, form){
var selectList=form;
var fnd = 0;
for (n=0;n<selectList.length;n++){
if(selectList.options[n].text == text){
selectList.options[n].selected =true
fnd = 1;
}}
if (!fnd)
{
 var oOption = parent.document.createElement("OPTION");
 oOption.text=text;
 oOption.value=value;
 oOption.selected =true
 selectList.options.add(oOption)
}
}

function openerAddMe (text, value, form){
var selectList=form;
var fnd = 0;
for (n=0;n<selectList.length;n++){
if(selectList.options[n].text == text){
selectList.options[n].selected =true
fnd = 1;
}}
if (!fnd)
{
 var oOption = opener.document.createElement("OPTION");
 oOption.text=text;
 oOption.value=value;
 oOption.selected =true
 selectList.options.add(oOption)
}
}

var panes = new Array();

function setupPanes(containerId, defaultTabId, liID) {
  // go through the DOM, find each tab-container
  // set up the panes array with named panes
  // find the max height, set tab-panes to that height
  panes[containerId] = new Array();
  var maxHeight = 0; var maxWidth = 0;
  var container = document.getElementById(containerId);
  var paneContainer = container.getElementsByTagName("div")[0];
  var paneList = paneContainer.childNodes;
  for (var i=0; i < paneList.length; i++ ) {
    var pane = paneList[i];
    if (pane.nodeType != 1) continue;
    if (pane.offsetHeight > maxHeight) maxHeight = pane.offsetHeight;
    if (pane.offsetWidth  > maxWidth ) maxWidth  = pane.offsetWidth;
    panes[containerId][pane.id] = pane;
    pane.style.display = "none";
  }
    document.getElementById(defaultTabId).onclick();
    document.getElementById(liID).className="selected";
}

function showPane(paneId, activeTab) {
  // make tab active class
  // hide other panes (siblings)
  // make pane visible

    for (var con in panes) {
    activeTab.blur();
    activeTab.className = "tab-active";
    if (panes[con][paneId] != null) { // tab and pane are members of this container
      var pane = document.getElementById(paneId);
      pane.style.display = "block";
      var container = document.getElementById(con);
      var tabs = container.getElementsByTagName("ul")[0];
      var tabList = tabs.getElementsByTagName("a")
      for (var i=0; i<tabList.length; i++ ) {
        var tab = tabList[i];
      }
      for (var i in panes[con]) {
        var pane = panes[con][i];
        if (pane == undefined) continue;
        if (pane.id == paneId) continue;
        if (pane.style != undefined)
        pane.style.display="none";
      }
      var uobj=document.getElementById("first-tab");
      var ulist=uobj.getElementsByTagName("li");
      for(var x=0; x<ulist.length; x++){
        ulist[x].className="";
      }
    }
  }
  return false;    
}

function SwitchRub(masterdiv, obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById(masterdiv).getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "block"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

function affectCheckedValue(formobj, toformobj)
{
 if(formobj)
 {
 if(!formobj.length)
  {
    if(formobj.checked)
    { toformobj.value=formobj.value;
      return true;
    }

  }else{
  for(i=0; i<formobj.length; i++)
  {
    if(formobj[i].checked)
    { toformobj.value=formobj[i].value;
      return true;
    }

  }}
 }
   return false;
}

 function closeZone(zone1, zone2)
 {
   $(zone1).style.display = "none";
   $(zone2).style.display = "none";
   return true;
 }

 function showOneZone(zone1, zone2)
 {
   $(zone1).style.display = "block";
   $(zone2).style.display = "none";
   return true;
 }

 function show_zone(zone1, zone2)
 {
   $(zone1).style.display = "block";
   $(zone2).style.display = "none";
   return true;
 }

 function showIZ(zone)
 {
   if($(zone).style.display == "block")
     $(zone).style.display = "none";
   else 
     $(zone).style.display = "block";
   return true;
 }

 function showZone(zone1)
 {
   $(zone1).style.display = "block";
   return true;
 }

  function shObjs(zone1, ref)
 {
     var tagList = document.body.getElementsByTagName("div");
     for (var i=0; i<tagList.length; i++ ) {
       if(tagList[i].id.indexOf(ref) != -1){
        tagList[i].innerHTML="";
       }
    }
    $(zone1).style.display = "block";
    return true;
 }

 function showDZone(zone1, zone2)
 {
   $(zone1).style.display = "block";
   $(zone2).style.display = "block";
   return true;
 }

 function disableZone(zone1)
 {
   $(zone1).style.display = "none";
   return true;
 }

 function disableDZone(zone1, zone2)
 {
   $(zone1).style.display = "none";
   $(zone2).style.display = "none";
   return true;
 }

 function showZoneCondition(value, url, zone1, zone2)
 {
   if(value != '-1' && value != '*')
   {
    $(zone1).style.display = "block";
    retrieveURL(url, zone2);
   }else{
    $(zone1).style.display = "none";
   }
  return true;
 }


 /*  FCK Editor */
 function getFCK_Object(name, lang, width, height){

  var oFCKeditor = new FCKeditor( name );
  oFCKeditor.BasePath = BasePath;
  oFCKeditor.Config["DefaultLanguage"] = lang;
  oFCKeditor.Width    = width;
  oFCKeditor.Height   = height;
  return oFCKeditor;
 }

function initEditor(){
 oFCKeditor.ReplaceTextarea();
}

function initEditor_2(ofCk1, ofCk2){
 ofCk1.ReplaceTextarea();
 ofCk2.ReplaceTextarea();
}

/** pop-it menu */
function showmenu(e, which, optWidth){
if (!document.all&&!document.getElementById)
return
clearhidemenu()
menuobj=ie5? document.all.popitmenu : document.getElementById("popitmenu")
menuobj.innerHTML=which
menuobj.style.width=(typeof optWidth!="undefined")? optWidth : defaultMenuWidth
menuobj.contentwidth=menuobj.offsetWidth
menuobj.contentheight=menuobj.offsetHeight
eventX=ie5? event.clientX : e.clientX
eventY=ie5? event.clientY : e.clientY
//Find out how close the mouse is to the corner of the window
var rightedge=ie5? iecompattest().clientWidth-eventX : window.innerWidth-eventX
var bottomedge=ie5? iecompattest().clientHeight-eventY : window.innerHeight-eventY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.contentwidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX-menuobj.contentwidth+"px" : window.pageXOffset+eventX-menuobj.contentwidth+"px"
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? iecompattest().scrollLeft+eventX+"px" : window.pageXOffset+eventX+"px"
//same concept with the vertical position
if (bottomedge<menuobj.contentheight)
menuobj.style.top=ie5? iecompattest().scrollTop+eventY-menuobj.contentheight+"px" : window.pageYOffset+eventY-menuobj.contentheight+"px"
else
menuobj.style.top=ie5? iecompattest().scrollTop+event.clientY+"px" : window.pageYOffset+eventY+"px"
menuobj.style.visibility="visible"
return false
}

function contains_ns6(a, b) {
//Determines if 1 element in contained in another- by Brainjar.com
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function hidemenu(){
if (window.menuobj)
menuobj.style.visibility="hidden"
}

function dynamichide(e){
if (ie5&&!menuobj.contains(e.toElement))
hidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
hidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
if (window.delayhide)
clearTimeout(delayhide)
}

function initpopmenu(){
 var ie5=document.all && !window.opera
 var ns6=document.getElementById
 if (ie5||ns6)
 document.write('<div id="popitmenu" onMouseover="clearhidemenu();" onMouseout="dynamichide(event)"></div>')
 if (ie5||ns6)
 document.onclick=hidemenu
}

function initpopmenu2(){
 var ie5=document.all && !window.opera
 var ns6=document.getElementById
 if (ie5||ns6)
 document.onclick=hidemenu
}


function bodyOnLoad() {
  new Rico.Effect.Round( null, 'roundNormal' );
  new Rico.Effect.Round( null, 'roundCompact', {compact:true} );
  for ( var i = 0 ; i < onloads.length ; i++ )
    onloads[i]();
  }
  
 function showhide(id){
	if ($){
	 obj = $(id);
	if (obj.style.display == "none"){
	  obj.style.display = "";
        } else {
	  obj.style.display = "none";
	}
       }
 }

function addConcatValue(value, object){
  
  object.value=object.value+value;
}
 
 
 
function viewPanel(paneId, activeTag) {

  var tagList = $(paneId).getElementsByTagName("div");
  for (var i=0; i<tagList.length; i++ ) {
        tagList[i].style.display='none';
    }
  $(activeTag).style.display='block';
  return false;    
}


 function getSFirst(Chaine){
    var first = Chaine.substring(0, Chaine.indexOf('-', 0));
    return first;
 }

 function getSLast(Chaine){
    var first = Chaine.substring(Chaine.indexOf('-', 0)+1, Chaine.length);
    return first;
 }

 function getStrFirst(Chaine, sep){
    var first = Chaine.substring(0, Chaine.indexOf(sep, 0));
    return first;
 }

 function getStrLast(Chaine, sep){
    var first = Chaine.substring(Chaine.indexOf(sep, 0)+1, Chaine.length);
    return first;
 }


function openNewWindow(formName)
{
var obj = $(formName);
if(obj == null)
 obj = document.forms[formName];
var params = Form.serialize(obj);
linkToSend = getPostbackURL(formName) + '?' + params
obj = window.open(linkToSend,'Select','width=1000,height=600,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,copyhistory=yes,resizable=yes')
obj.focus()
}
 
 
function getPostbackURL(formname) {
  return (window.document.forms[formname].action);
}
function getPostbackOURL(formname) {
  return (opener.document.forms[formname].action);
}


function setWidth(imgid, width) {
  if(width > 0)
   document.getElementsByTagName("img")[imgid].width=width
}

function setHeight(imgid, height) {
 if(height > 0)
  document.getElementsByTagName("img")[imgid].height=height
}


function initFieldsImg(formname, fieldname, wh) {
 document.forms[formname][fieldname].value='';
 document.getElementsByTagName("img")[fieldname].src='tools/images/transparent.gif';
 document.getElementsByTagName("img")[fieldname].removeAttribute("width");
 document.getElementsByTagName("img")[fieldname].removeAttribute("height");
 if(wh == 'true'){
 document.forms[formname]['width'].value='0';
 document.forms[formname]['height'].value='0';
 }
}



 function ViewPanel(value){
   if(value != ''){
    $(value).style.display='block';
   }
 }
 
function showArea(id, icon){ 
	obj = $(id);
	a=$(icon);
	if (obj.style.display == "none"){
	obj.style.display = "";
	a.src=modifiedurl+"/tools/images/01_minus.gif";
	obj.className="alink-active";
	return "block";
	} else {
	obj.style.display = "none";
	a.src=modifiedurl+"/tools/images/01_plus.gif";
	obj.className="alink";
	return "hide";
	}
 } 
 
 
 function showDiv(divID, imgID){
 obj = $(divID);
 a = $(imgID);

 if (obj.style.display == "none"){
 obj.style.display = "";
 a.src=modifiedurl+"/tools/images/01_minus.gif";
 } else {
 obj.style.display = "none";
 a.src=modifiedurl+"/tools/images/01_plus.gif";
 }
 return false;
}

function showhide01(id,icon){ 
	if (document.getElementById){ 
	obj = document.getElementById(id);
	a=document.getElementById(icon); 
	if (obj.style.display == "none"){ 
	obj.style.display = ""; 
	a.src=modifiedurl+"/tools/icons/arrowdown_blue16.gif";
	return "block";
	} else {
	obj.style.display = "none";
	a.src=modifiedurl+"/tools/icons/arrowright_blue16.gif";
	return "hide";
	}
	}
 }
 
 
function set(form, toName, value){
document.forms[form][toName].value=value;
}

function set2(form1, form2, objectName, objectName2){
document.forms[form1][objectName].value=document.forms[form2][objectName2].value;
}

 
 
 function initValues(id, value){
   var tab = document.getElementsByTagName("input");
   for (var i=0; i < tab.length; i++ ) {
    if(tab[i].id == id)
    tab[i].value=value
  }
 }
 
function getVal(form, name){
 return document.forms[form][name].value

}
  var winHeight = screen.availHeight;
  var winWidth  = screen.availWidth;
  var detect = navigator.userAgent.toLowerCase();
  var OS,browser,version,total,thestring;


function getScreenRes(){

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "IE"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "an unknown operating system";
}

 return winWidth;
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function autoCompItem(form, name0, value0, name1, value1, name2, value2, name3, value3, name4, value4, name5, value5 )
{
 document.forms[form][name0].value=value0;
 document.forms[form][name1].value=value1;
 document.forms[form][name2].value=value2;
 document.forms[form][name3].value=value3;
 document.forms[form][name4].value=value4;
 document.forms[form][name5].value=value5;
}

function shown(id){
 if($(id).style.display == 'block')
  $(id).style.display = 'none';
 else
  $(id).style.display = 'block';
}




function checkUncheckAll(org, form, field)
{
if(document.forms[form][field]){
 if(document.forms[form][field].length){
 for (i = 0; i < document.forms[form][field].length; i++)

	if(document.forms[form][org].checked == true)
	document.forms[form][field][i].checked = true ;
	else
	document.forms[form][field][i].checked = false ;
 }else{
	if(document.forms[form][org].checked == true)
        document.forms[form][field].checked=true
	else
        document.forms[form][field].checked=false
 }
}
}


 function actSelect(form, name1, name2, name3)
 {
   document.forms[form][name1].disabled="";
   document.forms[form][name2].disabled="true";
   document.forms[form][name3].disabled="true";
   return true;
 }



 function getAjxKeyValue(form)
 {
   var _5 = "0";
   keyvalue = "_keyvalue";
   var _l = document.forms[form][keyvalue];
   if(_l){
   if(_l.length>1){
   for(var index = 0; index < _l.length; index++){
    if(_l[index].checked)
     return _l[index].value;
   }
   }else{
    if(_l.checked)
     return _l.value;
   }
   }
   return _5;
 }

 function sendAjxForm(form, trs, tagid, key)
 {
  $(tagid).innerHTML='';
  keyname = "_keyname";
  if(key) keyname = "_keyname"+key;
  $(keyname).value=getAjxKeyValue(form);
  if(document.forms[form]['trs'])
   document.forms[form]['trs'].value=trs;
  if(document.forms[form]['trsm'])
   document.forms[form]['trsm'].value=trs;
  if((trs != 'ins' && $(keyname).value != '0') || trs == 'ins')
   sendForm2(form, tagid);
 }

 function dblank(tagid)
 {
  $(tagid).innerHTML='';
 }

 function sendAjxForm2(key)
 {
  var keyresult = "_resultto";
  var keyform = "_keyform";
  var keydisplayTagFrame = "displayTagFrame";
  var keyrbodycontent = "rbodycontent";
  if(key) keyresult = keyresult+key;
  if(key) keyform = keyform+key;
  if(key) keydisplayTagFrame = keydisplayTagFrame+key;
  if(key) keyrbodycontent = keyrbodycontent+key;
  if($(keyresult).value == 'list'){
   sendForm2($(keyform).value, keydisplayTagFrame);
   dblank(keyrbodycontent);
  }
  if($(keyresult) && $(keyresult).value == 'form')
   sendForm2($(keyform).value, keyrbodycontent);
  if($(keyresult) && $(keyresult).value == 'reload'){
   sendAsync($(keyform).value);
   setTimeout("reloadAjaxtabs('maintab')", 100);
  }

 }

  function sendAjxForm3(key)
 {
  var keyresult = "_resultto";
  var keyform = "_keyform";
  var keydisplayTagFrame = "displayTagFrame";
  var keyrbodycontent = "rbodycontent";
  if(key) keyresult = keyresult+key;
  if(key) keyform = keyform+key;
  if(key) keydisplayTagFrame = keydisplayTagFrame+key;
  if(key) keyrbodycontent = keyrbodycontent+key;
  sendForm2($(keyform).value, keydisplayTagFrame);
  dblank(keyrbodycontent);
 }

 function initDisplayTagSimple(displayid, key)
 {
     var formobj = document.ajxForm;
     if(key)  formobj = document.ajxForm02;

     var table = document.getElementById(displayid);
     if(table){
     var rows = table.getElementsByTagName("tr");
     for (i=1; i < rows.length; i++) {
         rows[i].onmouseover = function() { this.className=this.className+'over'};
         rows[i].onmouseout = function() {
           oldclass = this.className.substring(0, this.className.indexOf("over"));
           this.className=oldclass;

         };

     }
         }
 }

 function initDisplayTag(displayid, key)
 {
     var formobj = document.ajxForm;
     if(key)  formobj = document.ajxForm02;

     var table = document.getElementById(displayid);
     if(table){
     var rows = table.getElementsByTagName("tr");
     for (i=1; i < rows.length; i++) {
         rows[i].onmouseover = function() { this.className=this.className+'over'};
         rows[i].onmouseout = function() {
           oldclass = this.className.substring(0, this.className.indexOf("over"));
           this.className=oldclass;

         };
         rows[i].onclick = function(){
           var table = this.parentNode;
           var rowCount = table.rows.length;
           for (var currentRow = 0; currentRow < rowCount; currentRow++) {
            if(rowCount>1 && formobj._keyvalue[currentRow].checked == true){
               formobj._keyvalue[currentRow].checked=false;
               table.rows[currentRow].className=table.rows[currentRow].className.substring(8, table.rows[currentRow].className.length);
            }
            if(rowCount==1 && formobj._keyvalue.checked == true){
               formobj._keyvalue.checked=false;
               table.rows[currentRow].className=table.rows[currentRow].className.substring(8, table.rows[currentRow].className.length);
            }
           }
           this.className='selected'+this.className;
           if(rowCount>1)
           formobj._keyvalue[this.rowIndex-1].checked=true;
           if(rowCount==1)
           formobj._keyvalue.checked=true;

         };

     }
         }
 }

 lastleft="0";
 lastwidth="100%";
 lastclassname="";
 function smovePane(tagid){
    $(tagid).style.left='0px';
    $(tagid).style.height='100%';
    $(tagid).style.width='100%';
    $(tagid).className='xdojoFloatingPane';

 }

  function movePane(obj, tagid){
  if($(tagid).style.left != '0px'){
    lastleft=$(tagid).style.left;
    lastwidth=$(tagid).style.width;
    lastclassname=$(tagid).className;
    $(tagid).style.left='0px';
    $(tagid).style.height='100%';
    $(tagid).style.width='100%';
    $(tagid).className='xdojoFloatingPane';
    $(obj).src=modifiedurl+"/tools/icons/floatingPaneRestore.gif";
  }else{
    $(tagid).style.left=lastleft;
    $(tagid).style.height="100%";
    $(tagid).style.width=lastwidth;
    $(tagid).className=lastclassname;
    $(obj).src=modifiedurl+"/tools/icons/floatingPaneMaximize.gif";
  }
 }

  function disableMovePane(tagid){
  if($(tagid).style.left == '0px' && $("_resultto").value == 'list'){
    $(tagid).style.left=lastleft;
    $(tagid).style.height="100%";
    $(tagid).style.width=lastwidth;
    $(tagid).className=lastclassname;
  }else{
   //get content action search
   if (window.XMLHttpRequest) { // Non-IE browsers
   if($('_searchkey') != 'undefined')
    setTimeout("eval($('_searchkey').getAttribute('onclick'))", 1000);
  }else if (window.ActiveXObject) { // IE
   if($('_searchkey') != 'undefined')
    setTimeout("eval($('_searchkey').getAttribute('onclick')+'anonymous()')", 1000);
  }
  }
 }

   function disableMovePane2(tagid){
  if($(tagid).style.left == '0px'){
    $(tagid).style.left=lastleft;
    $(tagid).style.height="100%";
    $(tagid).style.width=lastwidth;
    $(tagid).className=lastclassname;
  }
 }

  function shwSDiv(tagid){
   var _01 = $(tagid).style.display;
   if(_01 == 'block'){
    $(tagid).style.display = "none";
   }else{
    //view
    $(tagid).style.display = "block";
   }
   //alert(document.forms['thirdthirdinfoSearch'][0].)
 }
 

 function TJS_EditBGColor(form, field, iddiv) {

  obj = document.forms[form][field];
  for(var index = 0; index < obj.options.length; index++)
     {
       if( obj.options[index].selected == true)
       {
        var color = obj.options[index].value;
       }
     }
   document.getElementById(iddiv).style.backgroundColor = color;
}

 function keyUp(action, element, attribute){
 //46=Del
 var key = -1;
 if(event!=null) {
  key = (event) ? event.keyCode : event.which;
 }
 if(key == 46){
  executeScript(element, attribute);
 }
}

 function keyMove(action, toRow){
 //40=Bas, 38=Haut, 39=Droite, 37=Gauche
 var key = -1;
 if(event!=null) {
  key = (event) ? event.keyCode : event.which;
 }
 if(key == 40){
   
 }
}

 function keyPress(action, element, attribute){
 //13=enter
 //27=Echap
 //46=Del
 //40=Bas, 38=Haut, 39=Droite, 37=Gauche
 var key = -1;
 if(event!=null) {
  key = (event) ? event.keyCode : event.which;
 }
 if(key == 13){
   switch(action){
    case 'P' : executeScript(element, attribute);break;
    case 'N'  : if(document.forms[attribute][element])document.forms[attribute][element].focus(); break;
   }
 }
}


 function executeScript(element, attribute) {
  _script = $(element).getAttribute(attribute);

  if(_script.indexOf('javascript:') != -1)
   _script = _script.substring(11, _script.length);
  eval($(element).getAttribute(attribute));
}
