// fonction simple, seul le fichier à afficher est passé en variable
function popup(url) {
	window.open(url, 'nom_de_la_fenetre',  'location=yes, toolbar=yes, directories=yes, menubar=yes, resizable=yes, scrollbars=yes, status=yes, width=800, height=600, screenY=0, screenX=0');
}

//Ajoute une consultation
//id correspond à l'id du reportage ou de l'émission
//type prend 1 ou 2 (1 pour émission, 2 pour reportage)
function updateConsultation(id, type){
	var option = {  url: "/ajax/addConsultation.php?id="+id+"&type="+type,
		method : 'get'
	};
	new Request(option).send();
}

function updatePub(id){
	var option = {  url: "/ajax/addPub.php?id="+id,
		method : 'get'
	};
	new Request(option).send();
}

function updateTag(nom){
	new Request({method: 'post', url: '/ajax/addTag.php'}).send('tag='+nom);
}

function updateRechAlternative(id){
	var option = {  url: "/ajax/addRechercheAlternative.php?id="+id,
		method : 'get'
	};
	new Request(option).send();
}

function addTagSession(nom){
	new Request({method: 'post', url: '/ajax/addTagSession.php'}).send('tag='+nom);
}

function print_r(obj) {
	win_print_r = window.open('about:blank', 'win_print_r');
	win_print_r.document.write('<html><body>');
	r_print_r(obj, win_print_r);
	win_print_r.document.write('</body></html>');
}

function r_print_r(theObj, win_print_r) {
	if(theObj.constructor == Array || theObj.constructor == Object){
		if (win_print_r == null)
			win_print_r = window.open('about:blank', 'win_print_r');
		}
		for(var p in theObj){
			if(theObj[p].constructor == Array|| theObj[p].constructor == Object){
				win_print_r.document.write("<li>["+p+"] =>"+typeof(theObj)+"</li>");
				win_print_r.document.write("<ul>")
				r_print_r(theObj[p], win_print_r);
				win_print_r.document.write("</ul>")
			} else {
				win_print_r.document.write("<li>["+p+"] =>"+theObj[p]+"</li>");
			}
		}
	win_print_r.document.write("</ul>")
}

function afficheDiv(div){
	document.getElementById(div).style.display='block';
	document.getElementById(div).style.visibility='visible';
}

function cacheDiv(div){
	document.getElementById(div).style.display='none';
	document.getElementById(div).style.visibility='hidden';
}
