// création des options de modèles
function createSelectModeles(val,ident,lang){
	var xhr=null;
	if (window.XMLHttpRequest){ 
		xhr = new XMLHttpRequest();
	}else if (window.ActiveXObject){
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if(xhr != null){
		xhr.onreadystatechange = function() { resultSelectModeles(xhr,ident,lang);};
		xhr.open("GET", chemin + "modeles-select.php?id="+val, true);
		xhr.send(null);
	}
}

function resultSelectModeles(xhr,ident,lang){
	if (xhr.readyState == 4  && xhr.status == 200){
		var menu = document.getElementById(ident);
		menu.innerHTML = ""; // on vide le menu de sélection
		if(xhr.responseXML && xhr.responseXML.documentElement){ // cas où la marque existe
			var reponse = xhr.responseXML.documentElement;
			var tab_modeles = reponse.getElementsByTagName("modele");
			if(tab_modeles.length != 0){ // cas où il existe des modèles
				var oOption = document.createElement("OPTION");
				menu.options.add(oOption);
				oOption.value = "0";
				switch(lang){
					case "en" : oOption.innerHTML = "Indifferent";
					break;
					case "de" : oOption.innerHTML = "Egal";
					break;
					case "es" : oOption.innerHTML = "Indiferente";
					break;
					case "it" : oOption.innerHTML = "Indifferente";
					break;
					case "pl" : oOption.innerHTML = "Obojętny";
					break;
					default : oOption.innerHTML = "Indifférent";
					break;
				}
				for(i=0; i<tab_modeles.length; i++){ // création des options pour chaque modèle
					var oOption = document.createElement("OPTION");
					menu.options.add(oOption);
					oOption.value = tab_modeles[i].getElementsByTagName("id")[0].firstChild.nodeValue;
					var le_modele = tab_modeles[i].getElementsByTagName("nom")[0].firstChild.nodeValue;
					var regexp = /<|>/; // traîtement des caractères < et >
					while(regexp.test(tab_modeles[i].getElementsByTagName("nom")[0].firstChild.nodeValue)){
						le_modele = le_modele.replace(/</,"&lt;");
						le_modele = le_modele.replace(/>/,"&gt;");
					}
					oOption.innerHTML = le_modele;
				}
			}else{ // cas où il n'y a pas de modèle rattaché
				var oOption = document.createElement("OPTION");
				menu.options.add(oOption);
				oOption.value = "0";
				switch(lang){
					case "en" : oOption.innerHTML = "Indifferent";
					break;
					case "de" : oOption.innerHTML = "Egal";
					break;
					case "es" : oOption.innerHTML = "Indiferente";
					break;
					case "it" : oOption.innerHTML = "Indifferente";
					break;
					case "pl" : oOption.innerHTML = "Obojętny";
					break;
					default : oOption.innerHTML = "Indifférent";
					break;
				}
			}
		}else{ // cas où la marque n'existe pas
			var oOption = document.createElement("OPTION");
			menu.options.add(oOption);
			oOption.value = "0";
			switch(lang){
				case "en" : oOption.innerHTML = "Select a brand";
				break;
				case "de" : oOption.innerHTML = "Wählen Sie eine Markel";
				break;
				case "es" : oOption.innerHTML = "Seleccione una marca";
				break;
				case "it" : oOption.innerHTML = "Seleziona una marca";
				break;
				case "pl" : oOption.innerHTML = "Wybierz markę";
				break;
				default : oOption.innerHTML = "Sélectionnez une marque";
				break;
			}
		}
	}
}

function infoTopAnnonces(lang){
	if(!document.getElementById('infoTop')){
		var info = document.createElement('div');
		info.setAttribute("id","infoTop");
		info.style.backgroundColor = "#FFFFFF";
		info.style.color = "#444444";
		info.style.border = "2px solid #ecb800";
		info.style.width = "400px";
		info.style.position = "absolute";
		info.style.zIndex = "2000";
		info.style.padding = "7px";
		info.style.fontSize = "12px";
		info.style.fontWeight = "normal";
		var t = 0;
		var l = 0;
		var obj = document.getElementById('lienTopAnnonces');
		while(obj.tagName != "BODY" && obj.tagName != "HTML"){
			t = t + eval(obj.offsetTop);
			l = l + eval(obj.offsetLeft);
			obj = obj.offsetParent;
		}
		var titre = document.createElement("h3");
		titre.style.color = "#ecb800";
		titre.style.fontSize = "18px";
		titre.style.fontWeight = "bold";
		titre.style.margin = "0px 0px 0.5em 0px";
		switch(lang){
			case "en" : var texteTitre = document.createTextNode("Your ad to homepage");
			break;
			case "de" : var texteTitre = document.createTextNode("Ihre Anzeige auf der Homepage");
			break;
			case "es" : var texteTitre = document.createTextNode("Su anuncio a la página principal");
			break;
			case "it" : var texteTitre = document.createTextNode("Il tuo annuncio alla homepage");
			break;
			case "pl" : var texteTitre = document.createTextNode("Reklamy na stronie głównej");
			break;
			default : var texteTitre = document.createTextNode("Votre annonce en page d'accueil");
			break;
		}
		titre.appendChild(texteTitre);
		info.appendChild(titre);
		var icone = document.createElement("img");
		icone.setAttribute("src",chemin+"images/tarifs/top.jpg");
		//icone.style.float = "left";
		icone.setAttribute("align","left");
		icone.style.marginRight = "4px";
		icone.style.marginBottom = "3px";
		info.appendChild(icone);
		var para = document.createElement("div");
		switch(lang){
			case "en" : para.innerHTML = "<p style='margin-bottom:0.5em;'>The user has the possibility of reserving a site in the visible &quot; <b>TOP ANNOUNCEMENT</b> &quot; on the homepage of the site with the help of the payment of the sum of 100 euros.</p><p style='margin-bottom:0.5em;'>The <b>TOP ANNOUNCEMENT</b>  comprises 15 sites.</p><p style='margin-bottom:0.5em;'>The site is reserved for one 7 days duration during which no modification of the posted advertisement could be carried out.</p><p style='margin-bottom:0.5em;'>The posting of the 15 advertisements of the <b>TOP ANNOUNCEMENT</b> is random and begins at the date indicated to the moment from the validation from the order subject to site available.</p><p style='margin-bottom:0.5em;'>The setting on line of the advertisement in the <b>TOP ANNOUNCEMENT</b>  however is subordinated to the reception of the payment and the conformity of the advertisement.</p><p style='margin-bottom:0.5em;'>The purpose of the SIGNAL ADVERTISEMENTS is to show an advertisement placed well directly and thus increases the capacity of sale.</p>";
			break;
			case "de" : para.innerHTML = "<p style='margin-bottom:0.5em;'>Der Benutzer hat die Möglichkeit, einen Ort in &quot; <b>TOP ANZEIGEN</b> &quot; zu reservieren Erkennbare auf der Homepage des Standortes mittels der Zahlung der Summe von 100 Euro.</p><p style='margin-bottom:0.5em;'><b>TOP ANZEIGEN</b> umfaßt 15 Orte.</p><p style='margin-bottom:0.5em;'>Der Ort wird für eine Dauer von 7 Tagen reserviert, während deren keine änderung der angeschlagenen Anzeige durchgeführt werden kann.</p><p style='margin-bottom:0.5em;'>Der Anschlag der 15 Anzeigen von <b>TOP ANZEIGEN</b> ist zufallsbedingt und beginnt am Datum, das zum Zeitpunkt der Bewertung des Auftrags vorbehaltlich verfügbaren Ortes genannt wurde.</p><p style='margin-bottom:0.5em;'>Das online Setzen der Anzeige in <b>TOP ANZEIGEN</b> wird allerdings dem Eingang der Verordnung und der übereinstimmung der Anzeige untergeordnet.</p><p style='margin-bottom:0.5em;'><b>TOP ANZEIGEN</b> hat zum Ziel, eine gut gesetzte Anzeige direkt zu zeigen und erhöht also die Verkaufskapazität.</p>";
			break;
			case "es" : para.innerHTML = "<p style='margin-bottom:0.5em;'>El usuario tiene la posibilidad de reservar un sitio en la &quot; <b>CUMBRE ANUNCIOS</b> &quot; visible sobre la página de inicio del lugar pero con el pago de la suma de 100 euros.</p><p style='margin-bottom:0.5em;'>La <b>CUMBRE ANUNCIOS</b> implica 15 sitios.</p><p style='margin-bottom:0.5em;'>El sitio se reserva por un período de tiempo de 7 días durante los cuales ninguna modificación del anuncio indicado podrá efectuarse.</p><p style='margin-bottom:0.5em;'>La visualización de los 15 anuncios de la <b>CUMBRE ANUNCIOS</b> es aleatoria y comienza en la fecha indicada en el momento de la validación del pedido a reserva de sitio disponible.</p><p style='margin-bottom:0.5em;'>La puesta en línea del anuncio en la <b>CUMBRE ANUNCIOS</b> no obstante se supedita a la recepción del Reglamento y a la conformidad del anuncio.</p><p style='margin-bottom:0.5em;'>La <b>CUMBRE ANUNCIOS</b> tiene por objeto mostrar directamente un anuncio bien colocado y aumenta pues la capacidad de venta.</p>";
			break;
			case "it" : para.innerHTML = "<p style='margin-bottom:0.5em;'>L'utente ha la possibilità di riservo del sito &quot; nell'<b>ANNUNCIO SUPERIORE</b> &quot; visibile sul homepage del sito con l'aiuto del pagamento della somma di 100 euro.</p><p style='margin-bottom:0.5em;'>L'<b>ANNUNCIO SUPERIORE</b> comprende 15 siti.</p><p style='margin-bottom:0.5em;'>Il sito è riservato per l'una durata dei 7 giorni durante cui nessuna modifica della pubblicità inviata potrebbe essere effettuata.</p><p style='margin-bottom:0.5em;'>L'invio delle 15 pubblicità del <b>ANNOUNCEMENTis SUPERIORE</b> casuale e comincia alla data indicata al momento dalla convalida dall'ordine conforme al sito disponibile.</p><p style='margin-bottom:0.5em;'>La regolazione sulla linea della pubblicità nell'<b>ANNUNCIO SUPERIORE</b> tuttavia è subordinata alla ricezione del pagamento ed alla conformità della pubblicità.</p><p style='margin-bottom:0.5em;'>Lo scopo delle PUBBLICITÀ del SEGNALE è di mostrare una pubblicità disposta bene direttamente e così aumenta la capacità della vendita.</p>";
			break;
			case "pl" : para.innerHTML = "<p style='margin-bottom:0.5em;'>Użytkownik możliwość rezerwować miejsce w widocznym &quot; <b>ODGÓRNYM zawiadomieniu</b> &quot; na homepage miejsce z pomocą zapłaty suma 100 euro.</p><p style='margin-bottom:0.5em;'>Odgórny zawiadomienie zawiera 15 miejsc.</p><p style='margin-bottom:0.5em;'>Miejsce rezerwuje dla jeden 7 dni trwania podczas którego niosąca out mógł żadny modyfikacja wysłana reklama.</p><p style='margin-bottom:0.5em;'>Przeniesienie 15 reklam <b>ODGÓRNY aNNOUNCEMENT</b> is przypadkowy i zaczyna przy datą wskazującą moment być usytuowanym dostępnego od uzasadnienia od rozkazu tematu.</p><p style='margin-bottom:0.5em;'>Położenie na linii reklama w ODGÓRNYM zawiadomieniu jakkolwiek! podporządkowywa przyjęcie zapłata i konformizm reklama.</p><p style='margin-bottom:0.5em;'>Purpose SYGNAŁOWE reklamy jest pokazywać reklamę umieszczającą dobrze bezpośrednio i tak wzrasta pojemność sprzedaż.</p>";
			break;
			default :  para.innerHTML = "<p style='margin-bottom:0.5em;'>L'utilisateur a la possibilité de réserver un emplacement dans le &quot; <b>TOP ANNONCES</b> &quot; visible sur la page d'accueil du site moyennant le paiement de la somme de 100 euros.</p><p style='margin-bottom:0.5em;'>Le <b>TOP ANNONCES</b> comporte 15 emplacements.</p><p style='margin-bottom:0.5em;'>L'emplacement est réservé pour une durée de 7 jours durant lesquels aucune modification de l'annonce affichée ne pourra être effectuée.</p><p style='margin-bottom:0.5em;'>L'affichage des 15 annonces du <b>TOP ANNONCES</b> est aléatoire et débute à la date indiquée au moment de la validation de la commande sous réserve d'emplacement disponible.</p><p style='margin-bottom:0.5em;'>La mise en ligne de l'annonce dans le <b>TOP ANNONCES</b> est toutefois subordonnée à la réception du règlement et à la conformité de l'annonce.</p><p style='margin-bottom:0.5em;'>Le <b>TOP ANNONCES</b> a pour but de montrer directement une annonce bien placée et augmente donc la capacité de vente.</p>";
			break;
		}
		info.appendChild(para);
		var fermer = document.createElement("p");
		fermer.style.textAlign = "right";
		fermer.style.fontWeight = "bold";
		var lienFermer = document.createElement("a");
		lienFermer.setAttribute("href","javascript:fermerInfoTopAnnonces();");
		switch(lang){
			case "en" : var texteFermer = document.createTextNode("Close");
			break;
			case "de" : var texteFermer = document.createTextNode("Schließen");
			break;
			case "es" : var texteFermer = document.createTextNode("Cerrar");
			break;
			case "it" : var texteFermer = document.createTextNode("Chiudere");
			break;
			case "pl" : var texteFermer = document.createTextNode("Blisko");
			break;
			default : var texteFermer = document.createTextNode("Fermer");
			break;
		}
		lienFermer.appendChild(texteFermer);
		fermer.appendChild(lienFermer);
		info.appendChild(fermer);
		info.style.left = (l + document.getElementById('lienTopAnnonces').offsetWidth - 400)  + "px";
		document.getElementById('container').appendChild(info);
		info.style.top = (t - info.offsetHeight) + "px";
	}
}

function fermerInfoTopAnnonces(lang){
	if(document.getElementById("infoTop")){
		var elmt = document.getElementById("infoTop");
		elmt.parentNode.removeChild(elmt);
	}
}