function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}

function invertVisibilityLayers()
{
  var i, visStr,disStr, obj, args = invertVisibilityLayers.arguments;
  for (i=0; i<(args.length); i++)
  {
    if ((obj = findObj(args[i])) != null)
    {
      visStr = "hide";
	  if (obj.style)
      {
        obj = obj.style;
        if(obj.visibility == 'visible') 
		{
			visStr = 'hidden';
			disStr = 'none';
		}
        else 
		{
			if(obj.visibility == 'hidden')
			{
				visStr = 'visible';
				disStr = 'block';
			}
	  	}
      }
      obj.visibility = visStr;
      obj.display = disStr;
    }
  }
  return visStr == 'visible';
}

function closeVisibilityLayers(){
	
  var i, visStr,disStr, obj;
  var idCat = closeVisibilityLayers.arguments[0];
  var listCat = closeVisibilityLayers.arguments[1];
 var tabCat = listCat.split(",");
 for (i=0; i<(tabCat.length); i++){
   if ((obj = findObj(tabCat[i])) != null){
   	 if(tabCat[i] != idCat){
	    if (obj.style) {
	        obj = obj.style;
	        obj.visibility = 'hidden';
	        obj.display = 'none';
	        
	      }
   	}
    	
     }
  }
}

function toggle(id,listIds)
{
	invertVisibilityLayers(id);
	closeVisibilityLayers(id,listIds);
}
function validateSearch(nameVar)
{
	var err = 1;
	if(nameVar == ""){
		alert("Veuillez renseinez une expression de recherche");	
		err = 0;
	}
	return err;
}