var mRacine   = '/NewCuisine/';
var TagBaseId =	'Tag';
var NbTag     =	5;

function trapOnMouseDown(e)
{
  return false;
}

function trapOnClick(e)
{
  return true;
}

document.onselectstart = new Function("return false");
if (window.sidebar)
	{
	document.onmousedown = trapOnMouseDown;
	document.onclick = trapOnClick;
	}
	
function openurl(surl, stitle, ilarg, ihaut) {
  var ileft, itop;
  if (stitle=='') stitle='_blank';
  ileft=(screen.width - ilarg)/2;
  itop=(screen.height - ihaut)/2;
  window.open(surl,stitle,'height='+ihaut+',width='+ilarg+',left='+ileft+',top='+itop+',location=no,menubar=no,resizable=no,scrollbars=yes,titlebar=no,toolbar=no');
}

function togglemenu(tableau, affimg, sSens) 	{
	var i, mobj, mkey, mvisible;
	
	if (tableau.substring(0, 1) == "+") {
	i = 0;
	while (i++ < tableau.substring(1, tableau.length))
		{
				mobj=document.getElementById("tabl" + i);
				mvisible=(mobj.style.display!="none");		    	
				mkey=document.getElementById("img" + i);
				mobj.style.display="block";
				if (affimg == "O") mkey.src= mRacine + "commun/images/minus.gif";
		}	 
	}
	else
	  if (tableau.substring(0, 1) == "-") {
	i = 0;
	while (i++ < tableau.substring(1, tableau.length))
		{
				mobj=document.getElementById("tabl" + i);
				mvisible=(mobj.style.display!="none");		    	
				mkey=document.getElementById("img" + i);
				mobj.style.display="none";
				if (affimg == "O") mkey.src=mRacine + "commun/images/plus"+sSens+".gif";
		}	 	 
	  }
	  else 
			if (tableau.substring(0, 3) == "mnu") {
				mobj=document.getElementById(tableau);
				mvisible=(mobj.style.display!="none");		    	
				mkey=document.getElementById("imgmnu" + tableau.substring(3, tableau.length));
				if (mvisible) {
					mobj.style.display="none";
					if (affimg == "O") mkey.src= mRacine + "commun/images/plus"+sSens+".gif";
				}
				else {
					mobj.style.display="block";
					if (affimg == "O") mkey.src= mRacine + "commun/images/minus.gif";
				}				 
			}
			else {
				mobj=document.getElementById("tabl" + tableau);
				mvisible=(mobj.style.display!="none");		    	
				mkey=document.getElementById("img" + tableau);
				if (mvisible) {
					mobj.style.display="none";
					if (affimg == "O") mkey.src= mRacine + "commun/images/plus"+sSens+".gif";
				} else {
					mobj.style.display="block";
					if (affimg == "O") mkey.src= mRacine + "commun/images/minus.gif";
				}				 			 
			}
}

function TagOn(Tag) {
	for (i=1;i<=Tag;i++) {
		document.getElementById(TagBaseId+i).src=mRacine + "commun/images/TagOn.gif";
	}
}

function TagOff() {
  var Note = document.getElementById('hidNoteRec').value;
	for (i=NbTag;i>Note;i--) {
		document.getElementById(TagBaseId+i).src = mRacine + "commun/images/TagOff.gif";
	}
}

function SelectAllCheckboxes(spanChk){
	var xState=spanChk.checked;
	var theBox=spanChk;

	elm=theBox.form.elements;
	for(i=0;i<elm.length;i++)	{
	if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)		{
		if(elm[i].checked!=xState)
		elm[i].click();
		}
	}
}

function HighlightRow(chkB){
  var xState=chkB.checked;
  var theBox=chkB;  
  var TO,TB
  
	if(xState)	{
		chkB.parentElement.parentElement.style.backgroundColor='#FFECCE';
		chkB.parentElement.parentElement.style.color='#6699CC';
	}
	else 	{
		chkB.parentElement.parentElement.style.backgroundColor='#e9edf6';
		chkB.parentElement.parentElement.style.color='#285e84';
	}
	
	TO=0
	TB=1    
}
