
function dn(){}
/* Script d'inscription */

	var nbParticipant = 1;
	var debug = false;
	var siteUrl = "http://" + window.location.hostname + "/ajax/ajax.php";
	var patternEmail = new RegExp('^[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$', 'i');
			
	function validationGlobale(event, ui)
	{							
		var selected = ui.index;	//Index de l'élément que l'usager tente d'afficher		
		
		if(debug)
			return true;
		
		switch(selected)
		{
			//Désire se rendre sur l'onglet 1
			case 0:
			{			
				return true;
				break;
			}
			
			//Désire se rendre sur l'onglet 2
			case 1:
			{	
				return validerSection1();
				break;
			}
			
			//Désire se rendre sur l'onglet 3
			case 2:
			{		
				return validerSection1() && validerSection2();
				break;
			}
			
			//Désire se rendre sur l'onglet 4
			case 3:
			{							
				return validerSection1() && validerSection2() && validerSection3();
				break;
			}
		}	
	}
	
	//Vider les champs de la section 1
	function viderSection1()
	{
		document.getElementById("optSexeF").checked = false;
		document.getElementById("optSexeM").checked = false;
		document.getElementById("txtPrenom").value = "";
		document.getElementById("txtNom").value = "";
		document.getElementById("txtFonction").value = "";
		document.getElementById("txtEntreprise").value = "";
		document.getElementById("txtAdresse1").value = "";
		document.getElementById("txtAdresse2").value = "";
		document.getElementById("txtVille").value = "";
		document.getElementById("txtProvince").value = "";
		document.getElementById("txtPays").value = "";
		document.getElementById("txtCodePostal").value = "";
		document.getElementById("txtTelephone").value = "";
		document.getElementById("txtPosteTelephonique").value = "";
		document.getElementById("txtCourriel").value = "";
	}

	//Vider les champs de la section 2
	function viderSection2()
	{
		for(var i = 1; i <= 10 ; i++)
		{
			document.getElementById("txtParticipant" + i + "Prenom").value = "";
			document.getElementById("txtParticipant" + i + "Nom").value = "";
			document.getElementById("txtParticipant" + i + "Courriel").value = "";			
		}
		
		cmbNombreParticipants = document.getElementById("cmbNombreParticipants");

		for(var j = 1 ; j < cmbNombreParticipants.length ; j++)
		{
			if(cmbNombreParticipants[j].value == 1)
			{
				cmbNombreParticipants.selectedIndex = j;
				break;
			}				
		}
		
		majNombreParticipant(cmbNombreParticipants);		
	}
	
	//Vider les champs de la section 3
	function viderSection3()
	{
	
	}
	
	//Valider les données de la section courrante et afficher la prochaine section
	function afficherSection2()
	{	
		$(".onglet-section2").click();
	}
	
	//Valider les données de la section courrante et afficher la prochaine section
	function afficherSection3()
	{
		$(".onglet-section3").click();
	}
	
	//Valider les données de la section courrante et afficher la prochaine section
	function afficherSection4()
	{
		$(".onglet-section4").click();
	}
	
	//Valider le contenu de la section 1 afin de savoir si l'on peut afficher la section 2
	function validerSection1()
	{
		var retour = true;
		
		//Valider que le sexe a été spécifié
		if(!document.getElementById("optSexeF").checked && !document.getElementById("optSexeM").checked)
		{
			document.getElementById("optSexeMSpan").className = "champsErreur";
			document.getElementById("optSexeFSpan").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("optSexeMSpan").className = "";
			document.getElementById("optSexeFSpan").className = "";
		}
		
		//Valider que le prénom a été inscrit
		if(document.getElementById("txtPrenom").value == "")
		{
			document.getElementById("txtPrenom").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtPrenom").className = "";
		}
		
		//Vérifier que le nom a été inscrit
		if(document.getElementById("txtNom").value == "")
		{
			document.getElementById("txtNom").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtNom").className = "";
		}
		
		//Vérifier que la fonction a été inscrite
		if(document.getElementById("txtFonction").value == "")
		{
			document.getElementById("txtFonction").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtFonction").className = "";
		}
		
		//Vérifier que l'entreprise a été inscrite
		if(document.getElementById("txtEntreprise").value == "")
		{
			document.getElementById("txtEntreprise").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtEntreprise").className = "";
		}
		
		//Vérifier que l'adresse1 a été inscrite
		if(document.getElementById("txtAdresse1").value == "")
		{
			document.getElementById("txtAdresse1").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtAdresse1").className = "";
		}
		
		//Vérifier que la ville a été inscrite
		if(document.getElementById("txtVille").value == "")
		{
			document.getElementById("txtVille").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtVille").className = "";
		}
		
		//Vérifier que la province a été inscrite
		if(document.getElementById("txtProvince").value == "")
		{
			document.getElementById("txtProvince").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtProvince").className = "";
		}
		
		//Vérifier que le pays a été inscrit
		if(document.getElementById("txtPays").value == "")
		{
			document.getElementById("txtPays").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtPays").className = "";
		}
		
		//Vérifier que le code postal a été inscrite
		if(document.getElementById("txtCodePostal").value == "")
		{
			document.getElementById("txtCodePostal").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtCodePostal").className = "";
		}
		
		//Vérifier que le téléphone a été inscrit
		if(document.getElementById("txtTelephone").value == "")
		{
			document.getElementById("txtTelephone").className = "champsErreur";
			retour = false;
		}
		else
		{
			document.getElementById("txtTelephone").className = "";
		}

		//Vérifier que le courriel a été inscrit
		if(document.getElementById("txtCourriel").value == "")
		{
			document.getElementById("txtCourriel").className = "champsErreur";
			retour = false;
		}
		else
		{
			//Valider le formatage du courriel
			var chaineCourriel = "";
			chaineCourriel = document.getElementById("txtCourriel").value;
			
			if(!patternEmail.test(chaineCourriel))
			{
				document.getElementById("txtCourriel").className = "champsErreur";
				retour = false;
			}
			else
				document.getElementById("txtCourriel").className = "";
		}
		
		return retour;												
		//return true;												
	}
	
	//Valider le contenu de la section 2 afin de savoir si l'on peut afficher la section 3
	function validerSection2()
	{
		var retour = true;
		
		for(var i = 1; i <= nbParticipant ; i++)
		{
			//Vérifier si le prénom
			if(document.getElementById("txtParticipant" + i + "Prenom").value == "")
			{
				document.getElementById("txtParticipant" + i + "Prenom").className = "champsErreur";
				retour = false;
			}
			else
			{
				document.getElementById("txtParticipant" + i + "Prenom").className = "";
			}
			
			//Vérifier si le nom
			if(document.getElementById("txtParticipant" + i + "Nom").value == "")
			{
				document.getElementById("txtParticipant" + i + "Nom").className = "champsErreur";
				retour = false;
			}
			else
			{
				document.getElementById("txtParticipant" + i + "Nom").className = "";
			}
			
			//Vérifier si le courriel
			if(document.getElementById("txtParticipant" + i + "Courriel").value == "")
			{
				document.getElementById("txtParticipant" + i + "Courriel").className = "champsErreur";
				retour = false;
			}
			else
			{
				//Valider le formatage du courriel
				var chaineCourriel = "";
				chaineCourriel = document.getElementById("txtParticipant" + i + "Courriel").value;
				
				if(!patternEmail.test(chaineCourriel))
				{
					document.getElementById("txtParticipant" + i + "Courriel").className = "champsErreur";
					retour = false;
				}
				else
					document.getElementById("txtParticipant" + i + "Courriel").className = "";				
			}			
		}
		
		return retour;												
		//return true;																								
	}
	
	//Valider le contenu de la section 3 afin de savoir si l'on peut afficher la section 4
	function validerSection3()
	{
		var retour = true;		
		var params = "action=demandeConfirmation";	
		
		//Valider si tous les champs ont été remplis dans la section 3
		var objEndroit = document.getElementById("cmbChoixEndroit");
		var dropdownIndexEndroit = objEndroit.selectedIndex;
		var endroitId = objEndroit[dropdownIndexEndroit].value;
		
		var minUneFormation = false;
		
		//Récupérer tous les champs du formulaire et les passer en POST à la requête AJAX				
		var elem = document.getElementById('frmInscription').elements;
		for(var i = 0; i < elem.length; i++)
		{
			if(elem[i].type == "checkbox")
			{
				if((elem[i].name.substring(0,12) == "cacFormation") && (elem[i].checked))
				{
					document.getElementById("divListeFormation").className = "";
					minUneFormation = true;
				}
			}
			
			if((elem[i].type != "textarea") && (elem[i].type != "button"))
			{
				if(((elem[i].type == "checkbox") && (elem[i].checked)) || (elem[i].type != "checkbox"))
					params += "&" + elem[i].name + "=" + elem[i].value;
			}
		} 

		//Vérifier qu'un endroit ait été spécifié
		if(!isNaN(endroitId))
		{	
			var objFormation = document.getElementById("cmbListeTheme");
			
			document.getElementById("cmbChoixEndroit").className = "";
			
			if(objFormation != null)
			{
				var dropdownIndexFormation = objFormation.selectedIndex;
				var formationId = objFormation[dropdownIndexFormation].value;
				
				//Vérifier qu'un endroit ait été spécifié
				if(!isNaN(formationId))
				{
					document.getElementById("cmbListeTheme").className = "";
					
					if(minUneFormation)
					{
						//Afficher une image de chargement dans la section 4
						var zoneConfirmation = document.getElementById("zoneConfirmation");
						
						//Supprimer tout les nodes du DIV
						while(zoneConfirmation.hasChildNodes()) 
						{
							zoneConfirmation.removeChild(zoneConfirmation.lastChild);
						}
						
						var imageChargement = document.createElement("img");
							imageChargement.src = "images/chargement.gif";			
							imageChargement.width = "105";
							imageChargement.height = "16";
							imageChargement.id = "imageChargement";
							
						zoneConfirmation.appendChild(imageChargement);	
						
						//Envoyer une requête AJAX avec la liste complète des champs du formulaire afin de créer le résumé de la transaction au format HTML													
						//La fonction callback affiche le résumé de la transaction HTML dans la section 4
						ajax.execute(siteUrl, afficherConfirmation, ajax.text, ajax.post, params);				
					}
					else
					{
						document.getElementById('divListeFormation').className = "champsErreur";
						retour = false;
					}
				}
				else
				{
					document.getElementById("cmbListeTheme").className = "champsErreur";
					retour = false;
				}				
			}
			else
			{
				document.getElementById("cmbChoixEndroit").className = "champsErreur";
				retour = false;
			}
		}
		else
		{
			document.getElementById("cmbChoixEndroit").className = "champsErreur";
			retour = false;
		}
		
		return retour;																										
	}
	
	//Valider le contenu de la section 4 afin de savoir si l'on peut procéder à la réservation
	function validerSection4()
	{
		var caseCocher = document.getElementById("cacTermes").checked;
		
		if(!caseCocher)
			alert("Veuillez indiquer que vous acceptez les termes et conditions en section 4.");
		
		return caseCocher;		
	}
	
	//Changer le nombre de participants dans la section 2
	function majNombreParticipant(obj)
	{
		var dropdownIndex = obj.selectedIndex;
		var nouveauChiffre = obj[dropdownIndex].value;
		
		nbParticipant = nouveauChiffre;
		
		for(var i = 1; i <= 10 ; i++)
		{
			document.getElementById("participant" + i).className = (i <= nouveauChiffre ? "" : "invisible");
		}
	}	
	
	function changerEndroitInscription(obj)
	{		
		var zoneFormation = document.getElementById("zoneFormation");
		
		//Supprimer tout les nodes du DIV
		while (zoneFormation.hasChildNodes()) 
		{
			zoneFormation.removeChild(zoneFormation.lastChild);
		}
		
		var dropdownIndex = obj.selectedIndex;
		var endroitSelection = obj[dropdownIndex].value;
		
		if(endroitSelection != "none")
		{
			//Si un endroit a été spécifié afficher une image de chargement le temps de créer les contrôles de sélection de la formation
			var imageChargement = document.createElement("img");
			imageChargement.src = "images/chargement.gif";			
			imageChargement.width = "105";
			imageChargement.height = "16";
			imageChargement.id = "imageChargement";
			
			zoneFormation.appendChild(imageChargement);	
			
			//Lancer une requête AJAX pour obtenir la liste des formation disponibles pour cette région
			
				//Afficher la liste des thèmes disponibles				
				var params = "action=listeTheme&endroitId=" + endroitSelection;						
				
				ajax.execute(siteUrl, afficherListeTheme, ajax.text, ajax.post, params);					
		}
	}	
	
	function afficherListeTheme(resultatAjax)
	{	
		var msie = false;
	
		if(resultatAjax != "")
		{
			if(window.DOMParser)
			{
				parser=new DOMParser();
				xmlDoc = parser.parseFromString(resultatAjax, "text/xml");
			}
			else //Internet Explorer
			{
				msie = true;
				xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
				xmlDoc.async = "false";
				xmlDoc.loadXML(resultatAjax); 
			}
			
			var noeudParent = xmlDoc.firstChild;
							
			//Le domparser traite la première balise (xml) comme étant un noeud, donc nous "sautons" au prochain
			if(debug)
			{
				/*if(msie)	
				{
					noeudParent = noeudParent.firstChild;			
				}	*/
			}
			
			var zoneFormation = document.getElementById("zoneFormation");		
			
			//Supprimer tout les nodes du DIV
			while(zoneFormation.hasChildNodes()) 
			{
				zoneFormation.removeChild(zoneFormation.lastChild);
			}
			
			//Vérifier si un noeud erreur a été retourné
			if(noeudParent.nodeName == "erreurs")
			{
				alert(noeudParent.firstChild.firstChild.textContent);
			}
			else
			{
				//Créer un contrôle combobox
				var cmbListeTheme = document.createElement("select");
				cmbListeTheme.id = "cmbListeTheme";			
				cmbListeTheme.name = "cmbListeTheme";			

					//Affecter un événement onChange afin de charger les formation de ce thème
					cmbListeTheme.onchange = function(){changerThemeInscription(this);};

					var optTheme = document.createElement("option");
					optTheme.value = "none";
					
					if(!msie)					
						optTheme.text = "Sélectionnez...";					
					else
					{
						var montexte = document.createTextNode("Sélectionnez...");
						optTheme.appendChild(montexte);
					}
					
					cmbListeTheme.appendChild(optTheme);
				
				
					//Créer la liste des options nécessaire
					for(var i = 0; i < noeudParent.childNodes.length; i++)
					{
						var optTheme = document.createElement("option");
												
						if(!msie)						
							optTheme.value = noeudParent.childNodes[i].childNodes[0].textContent;	//ID du thème																		
						else						
							optTheme.value = noeudParent.childNodes[i].childNodes[0].text;	//ID du thème												
									
						if(!msie)
							optTheme.text = noeudParent.childNodes[i].childNodes[1].textContent;	//Nom du thème																					
						else	
						//Tweak pour IE
						{
							var montexte2 = document.createTextNode(noeudParent.childNodes[i].childNodes[1].text);
							optTheme.appendChild(montexte2);
						
							//optTheme.text = noeudParent.childNodes[i].childNodes[1].text;	//Nom du thème								
						}
						
						cmbListeTheme.appendChild(optTheme);
					}
								
				//Ajouter le contrôle au DIV principal
				
				var labelTheme = document.createElement("span");
				
				if(msie)
				{
					var montexte = document.createTextNode("Quel programme vous intéresse : ");
					labelTheme.appendChild(montexte);		
				}
				else
					labelTheme.textContent = "Quel programme vous intéresse : ";
				
				labelTheme.setAttribute("style","float:left;");
				labelTheme.styleFloat = "left";
				
				zoneFormation.appendChild(labelTheme);	
				zoneFormation.appendChild(cmbListeTheme);	
				
				//Afficher le DIV qui comprendra la liste des formations disponibles pour le thème choisit
				var divListeFormation = document.createElement("div");
				divListeFormation.id = "divListeFormation";
				divListeFormation.name = "divListeFormation";
										
				zoneFormation.appendChild(divListeFormation);			
			}
		}
	}
	
	//Charger par AJAX la liste des formation disponibles et les afficher
	function changerThemeInscription(obj)
	{
		var zoneListeFormation = document.getElementById("divListeFormation");
				
		var imageChargement = document.createElement("img");
			imageChargement.src = "images/chargement.gif";			
			imageChargement.width = "105";
			imageChargement.height = "16";
			imageChargement.id = "imageChargement";
			
		zoneListeFormation.appendChild(imageChargement);	
		
		//Trouver le ID du thème sélectionné
		var dropdownIndex = obj.selectedIndex;
		var themeSelection = obj[dropdownIndex].value;
		
		var objEndroit = document.getElementById("cmbChoixEndroit");
		var dropdownIndex = objEndroit.selectedIndex;
		var endroitSelection = objEndroit[dropdownIndex].value;
				
		//Envoyer la requête ajax pour le chargement des formations et faire un callBack à la fonction qui affichera la liste de celles-ci
		var params = "action=listeFormation&themeId=" + themeSelection + "&endroitId=" + endroitSelection;						
		
		ajax.execute(siteUrl, afficherListeFormation, ajax.text, ajax.post, params);	
	}
	
	function afficherListeFormation(resultatAjax)	
	{
		var msie = false;		
	
		if(window.DOMParser)
		{
			parser=new DOMParser();
			xmlDoc = parser.parseFromString(resultatAjax, "text/xml");
		}
		else //Internet Explorer
		{
			msie = true;
		
			xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
			xmlDoc.async = "false";
			xmlDoc.loadXML(resultatAjax); 
		}
		
		var noeudParent = xmlDoc.firstChild;
				
		var zoneListeFormation = document.getElementById("divListeFormation");		
		//Supprimer tout les nodes du DIV
		while(zoneListeFormation.hasChildNodes()) 
		{
			zoneListeFormation.removeChild(zoneListeFormation.lastChild);
		}
		
		//Vérifier si un noeud erreur a été retourné
		if(noeudParent.nodeName == "erreurs")
		{
			alert(noeudParent.firstChild.firstChild.textContent);
		}
		else
		{
			//Créer la liste des formations disponibles
			for(var i = 0; i < noeudParent.childNodes.length; i++)
			{
				var pFormation = document.createElement("p");
				
				var cacFormation = document.createElement("input");
				cacFormation.id = "cacFormation" + (!msie ? noeudParent.childNodes[i].childNodes[0].textContent : noeudParent.childNodes[i].childNodes[0].text); //ID du calendrier de formation	OU de la formation SI privée			
				cacFormation.name = "cacFormation" + (!msie ? noeudParent.childNodes[i].childNodes[0].textContent : noeudParent.childNodes[i].childNodes[0].text) ; //ID du calendrier de formation	OU de la formation SI privée			
				cacFormation.value = 1;					
				cacFormation.type = "checkbox";					
				
				if(!msie)
				{				
					var spanFormation = document.createElement("span");
					spanFormation.textContent = noeudParent.childNodes[i].childNodes[1].textContent;	//Nom de la formation - date - Coût
					
					if(noeudParent.childNodes[i].childNodes.length > 2)
					{				
						if(noeudParent.childNodes[i].childNodes[2].textContent != "")
						{
							spanFormation.textContent += " - ";
							spanFormation.textContent += noeudParent.childNodes[i].childNodes[2].textContent;
						}
										
						if(noeudParent.childNodes[i].childNodes[2].textContent != noeudParent.childNodes[i].childNodes[3].textContent)
						{
							spanFormation.textContent += " au " + noeudParent.childNodes[i].childNodes[3].textContent;
						}
						
						if(noeudParent.childNodes[i].childNodes[4].textContent != "")
						{
							spanFormation.textContent += " - ";
							spanFormation.textContent += noeudParent.childNodes[i].childNodes[4].textContent;
						}
					}
				}
				else //Tweak MSIE
				{
					var spanFormation = document.createElement("span");
					
					var chaineContenu = "";
					
					chaineContenu = noeudParent.childNodes[i].childNodes[1].text;	//Nom de la formation - date - Coût
					
					if(noeudParent.childNodes[i].childNodes.length > 2)
					{				
						if(noeudParent.childNodes[i].childNodes[2].text != "")
						{
							chaineContenu += " - ";
							chaineContenu += noeudParent.childNodes[i].childNodes[2].text;
						}
										
						if(noeudParent.childNodes[i].childNodes[2].text != noeudParent.childNodes[i].childNodes[3].text)
						{
							chaineContenu += " au " + noeudParent.childNodes[i].childNodes[3].text;
						}
						
						if(noeudParent.childNodes[i].childNodes[4].text != "")
						{
							chaineContenu += " - ";
							chaineContenu += noeudParent.childNodes[i].childNodes[4].text;
						}
					}
					
					var montexte = document.createTextNode(chaineContenu);
					spanFormation.appendChild(montexte);					
				}
				
				pFormation.appendChild(cacFormation);
				pFormation.appendChild(spanFormation);
				pFormation.appendChild(document.createElement("br"));
				
				zoneListeFormation.appendChild(pFormation);				
			}			
		}
	}
	
	function afficherConfirmation(resultatAjax)
	{		
		var zoneConfirmation = document.getElementById("zoneConfirmation");
		zoneConfirmation.innerHTML = resultatAjax;
	}
	
	function enregistrerInscription()
	{
		if(confirm("Êtes-vous certain de vouloir enregistrer ces modifications, les modifications et suppressions seront irréversibles. Le client recevra automatiquement la facture de la formation."))
		{
			document.getElementById("frmInscription").submit();
		}
	}
	
/* Script d'inscription */



//Utiliser sur le onKeyUp (reste keydown, keypress a tester)
//Je dois passer "event" en paramètre à la fonction ex : onkeydown=test(obj, autre, event);
function getKeyCode(event)
{
	return (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
	
	/*switch(KeyID)
	{
		case 13://enter
			window.document.location.href="MouvementFiche.php?numero="+obj.value;
			break;
	}
	
	*/
}

function creerFacture(url)
{
	if(confirm("Êtes-vous certain de vouloir créer cette facture, une fois créée vous ne pourrez plus modifier l'inscription ni la supprimer."))
	{
		document.location.href = url;
	}
}

function supprimer(url)
{
	if(confirm("Êtes-vous certain de vouloir supprimer cette ligne?\r\nLes données supprimées seront irrécupérables."))
	{
		document.location.href = url;
	}
}

function changerPage(obj)
{
	var dropdownIndex = obj.selectedIndex;
	var newPageId = obj[dropdownIndex].value;

	document.location.href = "admin_contenu.php?id=" + newPageId;
}

function changerTheme(obj)
{
	var dropdownIndex = obj.selectedIndex;
	var newPageId = obj[dropdownIndex].value;

	document.location.href = "admin_themes.php?id=" + newPageId;
}

function changerEndroit(obj)
{
	var dropdownIndex = obj.selectedIndex;
	var newPageId = obj[dropdownIndex].value;

	document.location.href = "admin_endroits.php?id=" + newPageId;
}

function changerFormation(obj)
{
	var dropdownIndex = obj.selectedIndex;
	var newPageId = obj[dropdownIndex].value;

	document.location.href = "admin_formations.php?id=" + newPageId;
}

function changerCalendrier(obj)
{
	var dropdownIndex = obj.selectedIndex;
	var newPageId = obj[dropdownIndex].value;	

	document.location.href = "admin_calendrier.php?mois=" + newPageId;
}

function aTraiter(obj, prefixe)
{
 return obj.id != null &&
		obj.id.indexOf(prefixe) == 0;
}

function traiterCollection(collection, filtre, traiterElem)
{
 var n = collection.length;
 for(var i = 0; i < n ; i++)
  if(filtre == "" || aTraiter(collection[i], filtre))
	traiterElem(collection[i]);
}
		
function ChangerSource()
 {
	var temp = this.src;
	this.src = this.remp.src;
	this.remp.src = temp;
 }
 
 function Charger(img)
 {
  img.remp = new Image();
  img.remp.src = img.title;
  img.title = img.alt;
  img.onmouseover = img.onmouseout = ChangerSource;
 } 

 function precharger()
 { /*
   $(document).ready
    (
		function() 
		{	
			$("#id").mouseover(function(){$("#id").stop().animate({top:"-=91px",left:"+=19"}, "slow");});						
			$("#id").mouseout(function(){$("#id").stop().animate({top:"+=91px",left:"-=19"}, "slow");});						
		}
	); */
 }
 
