
$(document).ready(function () {
    $('#menu li').hover(
    function () {
        $(this).find('ul').show().css('z-index','200');
    },
    function () {
        $(this).find('ul').hide();
    }
    )
});


function changeImages() {
	for (var i=0; i<changeImages.arguments.length; i+=2) {
		document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
	}
}

 function getAbsoluteLeft(objectId) {
	// Get an object left position from the upper left viewport corner
	// Tested with relative and nested objects
	o = document.getElementById(objectId)
	oLeft = o.offsetLeft            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oLeft += oParent.offsetLeft // Add parent left position
		o = oParent
	}
	// Return left postion
	return oLeft
}

 function getAbsoluteTop(objectId) {
	// Get an object left position from the upper left viewport corner
	// Tested with relative and nested objects
	o = document.getElementById(objectId)
	oTop = o.offsetTop            // Get left position from the parent object
	while(o.offsetParent!=null) {   // Parse the parent hierarchy up to the document element
		oParent = o.offsetParent    // Get parent object reference
		oTop += oParent.offsetTop // Add parent left position
		o = oParent
	}
	// Return left postion
	return oTop
}

function showTR(obj)
{
  var currentRow = obj;
  var tbl =  currentRow.parentNode;
  var rIndex = currentRow.sectionRowIndex + 2;
  var nextRow = tbl.rows[rIndex];
  if(tbl.rows[rIndex].style.display == "")
       tbl.rows[rIndex].style.display = "none";
  else
       tbl.rows[rIndex].style.display = "";
}

function showThisTR(obj)
{
  var currentRow = obj;
  var tbl =  currentRow.parentNode;
  var rIndex = currentRow.sectionRowIndex;
  var nextRow = tbl.rows[rIndex];
  if(tbl.rows[rIndex].style.display == "")
       tbl.rows[rIndex].style.display = "none";
  else
       tbl.rows[rIndex].style.display = "";
}

function showTRAdmin(obj)
{
  var currentRow = obj;
  var tbl =  currentRow.parentNode;
  var rIndex = currentRow.sectionRowIndex + 1;
  var nextRow = tbl.rows[rIndex];
  if(tbl.rows[rIndex].style.display == "")
       tbl.rows[rIndex].style.display = "none";
  else
       tbl.rows[rIndex].style.display = "";
}

function showTRAdmin2(obj, increment)  // Referme les autres onglets

{
  var currentRow = obj;
  var tbl =  currentRow.parentNode;

	for(i=1;i<tbl.rows.length;i+=increment)
	{
	  var rIndex = i;
		if(i==obj.sectionRowIndex+1)
		{
		  if(tbl.rows[rIndex].style.display == "")
		       tbl.rows[rIndex].style.display = "none";
		  else
		       tbl.rows[rIndex].style.display = "";
		}
		else
		{
		tbl.rows[rIndex].style.display = "none";
		}
	}
}


function showTRHide(obj)  // Referme les autres onglets

{
  var currentRow = obj;
  var tbl =  currentRow.parentNode;

	for(i=1;i<tbl.rows.length;i++)
	{
	  var rIndex = i;
	  if (tbl.rows[rIndex].id=='hide')
	  {
		if (i==obj.sectionRowIndex+2)
		{
		  if(tbl.rows[rIndex].style.display == "")
		       tbl.rows[rIndex].style.display = "none";
		  else
		       tbl.rows[rIndex].style.display = "";
		}
		else
		{
		tbl.rows[rIndex].style.display = "none";
		}
	   }
	 }
}

function resize(DeltaWidth, DeltaHeight){
	w = document.pic.width;
	h = document.pic.height;
	window.resizeTo(w+DeltaWidth,h+DeltaHeight);
	focus();
}
