if(navigator.appName == "Netscape"){
	HTMLElement.prototype.click = function() {
		var evt = this.ownerDocument.createEvent('MouseEvents');
		evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
		this.dispatchEvent(evt);
	}

	HTMLElement.prototype.monOver = function() {
		//event.stopPropagation();
		var evt2 = this.ownerDocument.createEvent('MouseEvents');
		evt2.initMouseEvent('mouseover', true, true, this.ownerDocument.defaultView, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
		this.dispatchEvent(evt2);
	}
}

function attendre(duree){
  string="execute();";
  a = setTimeout(string,duree);
}

function execute(){
  document.getElementById('lien_cache').click();
}

function getElementsByClassName(className, tag, elm){
	var testClass = new RegExp("(^|s)" + className + "(s|$)");
	var tag = tag || "*";
	var elm = elm || document;
	var elements = (tag == "*" && elm.all)? elm.all : elm.getElementsByTagName(tag);
	var returnElements = [];
	var current;
	var length = elements.length;
	for(var i=0; i<length; i++){
		current = elements[i ];
		if(testClass.test(current.className)){
			returnElements.push(current);
		}
	}
	return returnElements;
}

function openDeplacerCategorie(form_famille_produit_id, form_categorie_produit_id){
	var largeur = 700;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/catalogue/categories/deplacer?form_famille_produit_id="+form_famille_produit_id+"&form_categorie_produit_id="+form_categorie_produit_id, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function openDeplacerProduit(form_categorie_produit_id, form_produit_id){
	var largeur = 700;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/catalogue/produits/deplacer?form_categorie_produit_id="+form_categorie_produit_id+"&form_produit_id="+form_produit_id, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function openDeplacerPiece(form_produit_id, form_piece_id){
	var largeur = 700;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/catalogue/pieces/deplacer?form_produit_id="+form_produit_id+"&form_piece_id="+form_piece_id, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function changeNouveaute(form, produit_numero, produit_id){
	var largeur = 700;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/catalogue/nouveautes/changer/"+form+"/"+produit_numero+"/"+produit_id, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewProduits(produit_id){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/catalogue/produits/view_produits/"+produit_id, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewCGV(){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/upload/pdf/cgv.pdf", "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewInfos_legales(){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/upload/pdf/infos_legales.pdf", "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewGuide_fichiers_leger(){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/upload/pdf/guide_fichiers_leger.pdf", "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewGuide_fichiers_complet(){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/upload/pdf/guide_fichiers_complet.pdf", "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewCommandes(url){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open(url, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewFactures(url){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open(url, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewClients(client_id){
	var largeur = 600;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/gestion_commerciale/view_clients/"+client_id, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewClientsPros(client_id){
	var largeur = 600;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/gestion_commerciale/view_clients_pro/"+client_id, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function modifierCommandes(commande_id, statut_commande){
	var largeur = 300;//(screen.width-500);
	var hauteur = 300;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/gestion_commerciale/modifier_commandes/"+commande_id+"/"+statut_commande, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function modifierCommandesPros(commande_id, statut_commande){
	var largeur = 300;//(screen.width-500);
	var hauteur = 300;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/administration/gestion_commerciale/modifier_commandes_pro/"+commande_id+"/"+statut_commande, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function viewFicheTechnique(url){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open(url, "Fiche_technique", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function openExplorateur(param_url){
	var largeur = 650;//(screen.width-500);
	var hauteur = 250;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/tools/explorateur?"+param_url, "Explorateur", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, resizable=no");
	return;
}

function popUpVide(largeur, hauteur){
	if(!largeur || largeur.length < 1 || isNaN(largeur)){
		var largeur = 750;//(screen.width-500);
	}

	if(!hauteur || hauteur.length < 1 || isNaN(hauteur)){
		var hauteur = 600;//(screen.height-500);
	}

	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("about:blank", "pop_up_vide", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");

	return;
}

function upload_image(page) {
	var largeur = 300;//(screen.width-500);
	var hauteur = 150;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open(page, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=no, resizable=no");
	return;
}

function openCalendrier(form, champ) {
	var largeur = 500;//(screen.width-500);
	var hauteur = 250;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open("/tools/calendrier?form="+form+"&champ="+champ, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=no, resizable=no");
	return;
}

function string_date(date){

	jour = Number(date.substring(8,10));
	mois = Number(date.substring(5,7));
	annee = date.substring(0,4);

	objDate = new Date(annee, (mois-1), jour);

	jourlettre = objDate.getDay();
	moislettre = objDate.getMonth();

	tabJours = ["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"];
	tabMois = ["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Aout", "Septembre", "Octobre", "Novembre", "Décembre"];
	
	DinaDate = tabJours[jourlettre] + " " + jour + " " + tabMois[moislettre] + " " + annee;
	
	return DinaDate;
}

function popup(url){
	var largeur = 750;//(screen.width-500);
	var hauteur = 600;//(screen.height-500);
	var haut=((screen.height-hauteur)/2);
	var gauche=((screen.width-largeur)/2); 

	OpenWindow = this.open(url, "CtrlWindow", "left="+gauche+", top="+haut+", width="+largeur+", height="+hauteur+", toolbar=no, menubar=no, location=no, status=yes, scrollbars=yes, resizable=yes");
	return;
}

function after_loaded(){
    <!-- Ajuste la hauteur du menu gauche et du maincontent //-->
    ajust_gauche_and_maincontent_height();
}

function ajust_gauche_and_maincontent_height(){

	var userAgent = navigator.userAgent.toLowerCase();
	
	// Figure out what browser is being used
	browser = {
		version: (userAgent.match( /.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/ ) || [0,'0'])[1],
		safari: /webkit/.test( userAgent ),
		opera: /opera/.test( userAgent ),
		msie: /msie/.test( userAgent ) && !/opera/.test( userAgent ),
		mozilla: /mozilla/.test( userAgent ) && !/(compatible|webkit)/.test( userAgent )
	};
	
	marge = (browser["safari"] || browser["opera"] || browser["mozilla"])?20:0

  if (document.getElementById('gauche').offsetHeight > document.getElementById('maincontent').offsetHeight){
    <!--document.getElementById('maincontent').style.height = (document.getElementById('gauche').offsetHeight - document.getElementById('maincontent').style.paddingBottom) + "px"; //-->
    document.getElementById('maincontent').style.height = (document.getElementById('gauche').offsetHeight - marge) + "px";
  }
  else{
    document.getElementById('gauche').style.height = document.getElementById('maincontent').offsetHeight + "px";
  }

}

// Pour afficher le contenu d'une page dans un div sans recharger la page avec ajax
function testRef(url,id){
	var xhr_object = null;
	var position = id;
	if(window.XMLHttpRequest) 
		xhr_object = new XMLHttpRequest();
	else
		if (window.ActiveXObject) 
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	
	// On ouvre la requete vers la page d?sir?e
	xhr_object.open("GET", url, true);
	xhr_object.onreadystatechange = function(){
		if ( xhr_object.readyState == 4 ){
			// j'affiche dans la DIV sp?cifi?es le contenu retourn? par le fichier
			document.getElementById(position).innerHTML = xhr_object.responseText;
		}
	}
		
	// dans le cas du get
	xhr_object.send(null);
} 

function display_zone_libre(url, id){
	var xhr_object = null;
	var position = id;
	if(window.XMLHttpRequest) 
		xhr_object = new XMLHttpRequest();
	else
		if (window.ActiveXObject) 
			xhr_object = new ActiveXObject("Microsoft.XMLHTTP");
	
	// On ouvre la requete vers la page d?sir?e
	xhr_object.open("GET", url, true);
	xhr_object.onreadystatechange = function(){
		if ( xhr_object.readyState == 4 ){
			// j'affiche dans la DIV sp?cifi?es le contenu retourn? par le fichier
			document.getElementById(position).innerHTML = xhr_object.responseText;
		}
	}
		
	// dans le cas du get
	xhr_object.send(null);
} 

function cacheOff(){
	var nava = (document.layers);
	var dom = (document.getElementById);
	var iex = (document.all);
	if (nava) {
		cach = document.cache
	}
	else if (dom) {
		cach = document.getElementById("cache").style 
	}
	else if (iex) {
		cach = cache.style 
	}
		
	cach.visibility = "visible";
}


