function openPopup(url, width, height) {
	if (!width) {
		width = 750;
	}
	if (!height) {
		height = 500;
	}
	window.open(url, '_blank', 'width='+width+',height='+height);
}

function selectObject(url, id, name, reloadForm){
	return selectItem(name,id,reloadForm);
}

function openPopupScroll(url,width, height) {
	if (!width) {
		width = 750;
	}
	if (!height) {
		height = 500;
	}
	window.open(url, '_blank', 'width='+width+',height='+height+', scrollbars=1');
}

function orderBy(form,column) {
	var element = document.getElementById(form);
	
	var cond = element.orderBy.value;
	
	if (cond == column + ' ASC'){
		element.orderBy.value = column + ' DESC';
	}
	else{
		element.orderBy.value = column + ' ASC';
	}
	
	element.submit();
}

function goPage(form, sens){
	var element = document.getElementById(form);
	element.pageAction.value = sens;
	element.submit();
}

function displayElement(id, value){
	var element = document.getElementById(id);
	if (value){
		element.style.display = value;
	}
	else{
		if (element.style.display == 'none'){
			element.style.display = 'inline';
		}
		else{
			element.style.display = 'none';
		}
	}
}

// Equivalent print_r() en Javascript
function print_r(obj) {
   // Go through all the properties of the passed-in object
   var msg = obj + "\n";
   for (var i in obj) {
	    msg += "\t[" + i + "] => ";
		if (typeof obj[i] == "function") { 
			msg += "[function " + i + "]\n";
		}		
		else {
			msg += obj[i] + "\n";
		}
   }
   return msg;
}

// Equivalent show() en Javascript
function show(obj, name) {
	if (name) {
		document.writeln(name + ':')
	}
	document.writeln("<XMP>" + print_r(obj) + '</XMP>');
}

var display = true;

function raccourciClavier(evnt) {

	code = document.all?event.keyCode:evnt.which; 

	switch(code) {
		case 222: 
			var e=document.getElementsByName("adminTools");
			if (display) {
				for(var i=0;i<e.length;i++){e[i].style.visibility = 'hidden';}
				display = false;
			}
			else {
				for(var i=0;i<e.length;i++){e[i].style.visibility = 'visible';}
				display = true;
			}
			break;
		//default: alert(code);
	}
	return true;
}
