$.ajaxSetup({
cache: false
});



$("a.remote").click(function(){
									var hash = $(this).attr('href');
									
									hash = hash.replace(/^.*#/, '');
									hash = hash.split(':')
									// moves to a new page. 
									// pageload is called at once. 
									// hash don't contain "#", "?"
									$.historyLoad(hash[1]);
									return false;
									});

$(document).ready( function () {

//FORMULAIRE DE RECHERCHE
//produits

	
	
	$("#concour").submit( function() {
		

		//alert($('#info-courriel').val());
		//alert($('#info-nom').val());
		//alert("submit");
		$.ajax({	
			async: true,
			type: "POST",
			url: "php/login/concour.php", 
			data: "mail="+$('#concour-courriel').val()+"&nom="+$('#concour-nom').val()+"&lang=fr",
  		    success: function(msg){
			
			//alert(msg);
			
			if(msg == "add" || msg == "\nadd" || msg == "\r\nadd" )
			{
				$('#messageconcour').html('<b>Inscription r&eacute;ussie</b><script type="text/javascript">document.getElementById("submit").type="hidden";</script>');
			}
			else if(msg == "already" || msg == "\nalready" || msg == "\r\nalready")
			{
				$('#messageconcour').html('<b>Vous &ecirc;tes d&eacute;j&agrave; inscrit</b><script type="text/javascript">document.getElementById("submit").type="hidden";</script>');
			}
			else if(msg == "error"  || msg == "\nerror" || msg == "\r\nerror")
			{
				$('#messageconcour').html('<b>Veuillez v&eacute;rifier les informations inscritent</b>');
			}
			else
			{
				$('#messageconcour').html('<b>Veuillez utiliser le script correctement</b>');
			}
			
			
					
					// on dÃ©sactive l'affichage du formulaire et on affiche un message de bienvenue Ã  la place
				

			}
			});
	
	return false;
	});
	
	
	
	$("#infolettre").submit( function() {
		
		
		//alert($('#info-courriel').val());
		//alert($('#info-nom').val());
		
		$.ajax({	
			async: true,
			type: "POST",
			url: "php/login/infolettre.php",
			data: "mail="+$('#info-courriel').val()+"&nom="+$('#info-nom').val()+"&lang=fr",
  		    success: function(msg){
	//	alert(msg); 
			
			if(msg == "add" || msg == "\nadd" || msg == "\r\nadd" )
			{
				$('#erreurinfolettre').html('<b>Inscription r&eacute;ussie</b>');
			}
			else if(msg == "already" || msg == "\nalready" || msg == "\r\nalready")
			{
				$('#erreurinfolettre').html('<b>Vous &ecirc;tes d&eacute;j&agrave; inscrit</b>');
			}
			else if(msg == "error"  || msg == "\nerror" || msg == "\r\nerror")
			{
				$('#erreurinfolettre').html('<b>Veuillez v&eacute;rifier les informations inscritent</b>');
			}
			else
			{
				$('#erreurinfolettre').html('<b>Veuillez utiliser le script correctement</b>');
			}
			
			
					
					// on dÃ©sactive l'affichage du formulaire et on affiche un message de bienvenue Ã  la place
				

			}
			});
	
	return false;
	});
	


	
});

    
//CHARGEMENT AU DEMARAGE || CHANGEMENT DE PAGE



///MENU


function stripslashes(str) {
str=str.replace(/\\'/g,'\'');
str=str.replace(/\\"/g,'"');
str=str.replace(/\\0/g,'\0');
str=str.replace(/\\\\/g,'\\');
return str;
}







//##################################################################
//RECHERCHE


 
 
 


	
//ROLL OVER ###################################################################
function SimpleSwap(el,which){
  el.src=el.getAttribute(which || "origsrc");
}

function SimpleSwapSetup(){
  var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++){
    var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue;
      
    // preload image
    // comment the next two lines to disable image pre-loading
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc;
    // set event handlers
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    // save original src
    x[i].setAttribute("origsrc",x[i].src);
  }
}

var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}

function get_function(fonction){
variable = fonction.split('+');
if(!variable[1]){variable[1]="";}
hash = variable[0]+"("+variable[1]+")";
while(hash.indexOf(".") != -1){hash = hash.replace(".","\'");}

hash = hash.replace(/^.*#/, '');

hash = unescape(hash); 

$.historyLoad(hash);}
