
function notImplemented()
{
	//alert('notImplemented');
}


function highlightTableRows(tableId) {
    var previousClass = null;
    var table = document.getElementById(tableId); 
    var tbody = table.getElementsByTagName("tbody")[0];
    var rows = tbody.getElementsByTagName("tr");
    // add event handlers so rows light up and are clickable
    for (i=0; i < rows.length; i++) {
        rows[i].onmouseover = function() { previousClass=this.className;this.className+=' over' };
        rows[i].onmouseout = function() { this.className=previousClass };
        rows[i].onclick = function() {
            var cell = this.getElementsByTagName("td")[0];
            if (cell.getElementsByTagName("a").length > 0) {
                var link = cell.getElementsByTagName("a")[0];
                if (link.onclick) {
                    call = link.getAttributeValue("onclick");
                    // this will not work for links with onclick handlers that return false
                    eval(call);
                } else {
                  location.href = link.getAttribute("href");
                }
                this.style.cursor="wait";
            }
        }
    }
}

// basic event loader
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

// text field as disabled and clear the value
function initUpload(filepath,uploadfile) {
	if(filepath != 'undefined' && filepath != null &&  uploadfile != 'undefined' && uploadfile != null){
	    var y = document.getElementById(filepath);
		    y.disabled = true;
		    y.value = "";
	    var x = document.getElementById(uploadfile);
	    
	    x.onchange = function () { changeFile(filepath,uploadfile); }
 	}
}


// when you select a file then set the path to the text field
function changeFile(filepath,uploadfile)
{
	if(filepath != 'undefined' && filepath != null &&  uploadfile!= 'undefined' && uploadfile != null){
	    var x = document.getElementById(uploadfile);
	    var y = document.getElementById(filepath);
	    y.value = x.value;
    }
}


// Show the document's title on the status bar
window.defaultStatus=document.title;


// send Event to server by URL
function sendServerEvent(serverURL, parameters, returnFunction)
{
	var myAjax = new Ajax.Request(serverURL, {
		method: 'get', parameters: parameters, onComplete: returnFunction
			}
		);
}

function confirmCustom(message, buttonLeft, buttonRight)
{
	return confirmClassicJS(message);
	//return confirmDHTML(message, buttonLeft, buttonRight);
}

function confirmClassicJS(message)
{
	return confirm(message);
}

function confirmDHTML(message, buttonLeft, buttonRight)
{
	var alertBox = new Lert(message,[buttonLeft,buttonRight],
		{
			defaultButton:buttonLeft
		});

	alertBox.display();

	return "dhtml";
}


/*
* Le code suivant va apprendre la balise blink à IE
*/
if ( document.all )
{
	function blink_show()
	{
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ )
		{
			blink_tags[i].style.visibility = 'visible';
		}
		
		window.setTimeout( 'blink_hide()', 1200 );
	}
	
	function blink_hide()
	{
		blink_tags  = document.all.tags('blink');
		blink_count = blink_tags.length;
		for ( i = 0; i < blink_count; i++ )
		{
			blink_tags[i].style.visibility = 'hidden';
		}
		
		window.setTimeout( 'blink_show()', 250 );
	}
	
	// window.onload = blink_show;
}