	var vider_form_pour_saisie_onclick = new Function("formId",
		"var input = document.getElementById(formId);if (input.value == input.defaultValue) {input.value = '';input.className=retirer_str(input.className, ' input_textebase')}");

	var vider_form_pour_saisie_onblur = new Function("formId",
		"var input = document.getElementById(formId);if (input.value == '') {input.value = input.defaultValue;input.className=input.className + ' input_textebase';}");


	function vider_form_pour_saisie_init(formId)
	{
		var input = document.getElementById(formId);
		
		if (input)
		{
			input.onclick   = function () { vider_form_pour_saisie_onclick(formId); };
			input.onblur    = function () { vider_form_pour_saisie_onblur(formId); };
			input.className = input.className + " input_textebase";
		}
	}
	
	function form_rech_onsubmit()
	{
		vider_form_pour_saisie_onclick("r_keywords");
	}

	function retirer_str(txt, retirer)
	{
		if (pos = txt.indexOf(retirer))
		{
			txt2 = txt.substr(0, pos);
			txt2+= txt.substr(pos + retirer.length);
			
			return txt2;
		}
	}



	var bloc = null;
	var fond = null;
	function afficher_bloc_init()
	{
		if (!bloc) bloc = document.getElementById("bloc");
		if (!fond) fond = document.getElementById("fond");
	}
	function afficher_bloc(txt)
	{
		afficher_bloc_init();
		
		win_width = (window.document.body.offsetWidth ? window.document.body.offsetWidth
									: (window.innerWidth ? window.innerWidth : 640)
								)

		bloc.style.background    = "white";
		bloc.style.position      = "absolute";
		bloc.style.width         = "500px";
		bloc.style.left          = (win_width - 500) / 2 + "px";
		bloc.style.top           = "200px";
		bloc.style.border        = "2px black solid";
		bloc.style.overflow      = "auto";
		bloc.style.height        = "auto";		
		
		fond.style.position      = "fixed";
		fond.style.width         = "100%";
		fond.style.height        = "100%";
		fond.style.top           = "0";
		fond.style.left          = "0";
		fond.style.opacity       = "0.8";
		fond.style.filter        = "alpha(opacity=80)";

		
		bloc.innerHTML = "<div id='cmds' style='float:right;margin:0;padding:0;border:2px black solid;border-top:none;border-right:none;padding:2px;'>"
			+ "<a href='javascript:transformerDivEnFramePuisImprimer(\"bloc\");'>Imprimer</a> &nbsp; "
			+ "<a href='javascript:cacher_bloc();'>Fermer</a></div>"
			+ "<div style='padding:5px;'>" + txt + "</div>";
		
		bloc.style.display = "block";
		fond.style.display = "block";
		fond.onclick       = cacher_bloc;

//		if (bloc.clientHeight > document.body.offsetHeight - 200)
//		{
			bloc.style.top    = document.body.scrollTop + 40 + "px";
//			bloc.style.height = document.body.offsetHeight - 100 + "px"; 
//		}
 
	}
	function cacher_bloc()
	{
		bloc.style.display = "none";
		fond.style.display = "none";
	}
	
	function transformerDivEnFramePuisImprimer(divId)
	{
		var divcenter = document.getElementById('zone_centre');
	
	// SAVE		
		var SAVE = divcenter.innerHTML;
		document.getElementById("bloc").style.display = "none";
		document.getElementById("fond").style.display = "none";
		document.getElementById("cmds").style.display = "none";
		

		divcenter.innerHTML = document.getElementById(divId).innerHTML;
		window.print();
	
	// DELAI à la CON
		d=new Date(); while(1){n=new Date();diff=n-d;if (diff > 1000) break;}
		
	// RESTORE
		document.getElementById("fond").style.display = "block";
		document.getElementById("bloc").style.display = "block";
		divcenter.innerHTML = SAVE;
		document.getElementById("cmds").style.display = "block";
		
		
		
/*		if (document.getElementById('FRAME_A_DELETE')) document.getElementById('FRAME_A_DELETE').parentNode.removeChild(document.getElementById('FRAME_A_DELETE'));
		
		
		var iframe = document.createElement("iframe"); 
		iframe.src="blank.html";
		iframe.id="FRAME_A_DELETE";
		window.document.body.appendChild(iframe);
		
		var div = document.createElement("div");
		document.getElementById("cmds").style.display = "none";
		div.innerHTML = document.getElementById(divId).innerHTML;
		document.getElementById("cmds").style.display = "block";
		
		
		var html = "<html><head><title>Site GPIH // Impression d'une offre</title><link href='css/style.css' rel='stylesheet' type='text/css' /></head><body>"
			+ "<div id='bloc'>" + div.innerHTML + "</div>"
			+ "</body></html>";
		
		if (iframe.contentDocument) iframe.contentDocument.body.innerHTML = html; 
		else if (document.frames("FRAME_A_DELETE").document) document.frames("FRAME_A_DELETE").document.body.innerHTML = html; 
		
		iframe.style.display = "none";
		if (document.frames("FRAME_A_DELETE").document.all)
		{
			//document.frames("FRAME_A_DELETE").focus();
			document.frames("FRAME_A_DELETE").document.all.print();
		}
		else window.frames[0].print();
		
*/
	}

	function afficherCacherById(id, type)
	{
		if (!type) type = "block";
		
		var bloc=document.getElementById(id);
		if (bloc && bloc.style.display=="none") bloc.style.display = type;
		else if (bloc && bloc.style.display!="none") bloc.style.display = "none";
	}




function Is() {
	agent = navigator.userAgent.toLowerCase();
	this.major = parseInt(navigator.appVersion);
	this.minor = parseFloat(navigator.appVersion);
	this.ns = ((agent.indexOf('mozilla') != -1) &&
	(agent.indexOf('spoofer') == -1) &&
	(agent.indexOf('compatible') == -1) &&
	(agent.indexOf('opera') == -1) &&
	(agent.indexOf('webtv') == -1) &&
	(agent.indexOf('hotjava') == -1));
	this.ns2 = (this.ns && (this.major == 2));
	this.ns3 = (this.ns && (this.major == 3));
	this.ns4 = (this.ns && (this.major == 4));
	this.ns6 = (this.ns && (this.major >= 5));
	this.ie = ((agent.indexOf("msie") != -1) &&
	(agent.indexOf("opera") == -1));
	this.ie3 = (this.ie && (this.major < 4));
	this.ie4 = (this.ie && (this.major == 4) &&
	(agent.indexOf("msie 4") != -1));
	this.ie5 = (this.ie && (this.major == 4) &&
	(agent.indexOf("msie 5.") != -1) &&
	(agent.indexOf("msie 5.5") == -1) &&
	(agent.indexOf("mac") == -1));
	this.iem5 = (this.ie && (this.major == 4) &&
	(agent.indexOf("msie 5.") != -1) &&
	(agent.indexOf("mac") != -1));
	this.ie55 = (this.ie && (this.major == 4) &&
	(agent.indexOf("msie 5.5") != -1));
	this.ie6 = (this.ie && (this.major == 4) &&
	(agent.indexOf("msie 6.") != -1));
	this.ie7 = (this.ie && (this.major == 4) &&
	(agent.indexOf("msie 7.0b") != -1));
	this.nsdom = (this.ns4 || this.ns6);
	this.ie5dom = (this.ie5 || this.iem5 || this.ie55);
	this.iedom = (this.ie4 || this.ie5dom || this.ie6);
	this.w3dom = (this.ns6 || this.ie6 ||this.ie7);
}
var is = new Is();

