function get_cookie ( cookie_name )
	{
	  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
	
	  if ( results )
		return ( unescape ( results[2] ) );
	  else
		return null;
	} 

function pub(){
	tabpub=Array("http://a526.g.akamai.net/7/526/14067/v1/img.priceminister.com/visuels/2008-08-26-auto/swf/auto-spe/615x54-321Auto.swf","http://www.priceminister.com/visuels/2008-08-29-auto/auto/astique/612x54-321AutoCampAff","http://www.priceminister.com/visuels/2008-08-29-auto/auto/grande/612x54-321AutoCampAff","http://www.priceminister.com/visuels/2008-08-29-auto/auto/petite/612x54-321AutoCampAff")
	nombre= Math.floor(Math.random() * tabpub.length);
	
	document.write("<embed type=\"application/x-shockwave-flash\" src=\"" + tabpub[nombre] + "\" style=\"\" id=\"concours\" name=\"concours\" bgcolor=\"#ffffff\" quality=\"high\" wmode=\"opaque\" allowscriptaccess=\"always\" domain=\"" + tabpub[nombre] + "\" width=\"612\" height=\"54\">");
	}
function fn_region(vzip,idregion){
 	if (idregion>0){
	
		addfiltre('region',vzip)
		addfiltre('idregion',idregion)
		cartedefault="/images/accessoires/cartes/" + idregion + ".gif"
		delfiltre('&nomdepartement=' + nomdepartement);
		
		delfiltre('&region='+ nomregion);
		
	}
	else
	{
	document.form2.region.value=""
	document.form2.typelocalisation.value=zip
	document.form2.idregion.value=""
	if (document.form2.typelocalisation.value=='3'){
		document.getElementById("carte").src="/images/accessoires/cartes/Monde_Trans.gif"
		cartedefault="/images/accessoires/cartes/Monde_Trans.gif"
	}else
	{
	document.getElementById("carte").src="/images/accessoires/cartes/Vierge_70.gif"
	cartedefault="/images/accessoires/cartes/Vierge_70.gif"
	}
	}
	
	
}
function valideselect(){
	marque=document.f_select.marque.options[document.f_select.marque.options.selectedIndex].text
	modele=document.f_select.modele.value
	marque=marque.replace(' ','_');
	if (document.f_select.modele.options.selectedIndex>0){
		window.location=repbase + marque + "-" + modele + ".htm"
	}else{
		if (document.f_select.marque.options.selectedIndex>0){
		window.location=repbase + marque + ".htm"
		}else{window.location="/Achat-voiture/Achat-voiture.htm"}
	}
	}
function fn_Mouse_out(idregion){
 document.getElementById("carte").src=cartedefault
	
}
function changemarque(){
		document.f_select.modele.disabled=true;
		if(document.all)
		{			
			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;
		}
		else
		{
			var XhrObj = new XMLHttpRequest();
		}
		
		XhrObj.open("GET", "/tech/selectmarque.aspx?marque=" +document.f_select.marque.value,false);		
		XhrObj.send(null);		
		if (XhrObj.status == 200)
			     {
					document.getElementById("f_select_modele").innerHTML=XhrObj.responseText;	
					document.f_select.modele.disabled=false;			
		         }	
	
}
function addfiltre(champ,valeur){	
		document.cookie = "liste=" + get_cookie("liste") + "&" + champ +"=" + valeur + ";path=/";
		window.location=urlredir;
	}
	
	function delfiltre(nomfiltre){		
		if (nomfiltre.length==0){
		document.cookie = "liste=;path=/";document.cookie = "listelife=;path=/";document.cookie = "redirlife=;path=/";urlredir="/Achat-voiture/Achat-voiture.htm";
		
		}else{document.cookie = "liste=" + get_cookie("liste").replace(nomfiltre,"") + ";path=/";}
		window.location=urlredir;
	}
	function dellife(idlife){
	document.cookie = "listelife=" + get_cookie("listelife").replace("&idlife=" + idlife,"") + ";path=/";
	window.location=urlredir;
	}
	
	function fn_Mouse_over(idregion){
 cartedefault=document.getElementById("carte").src
 if (cartedefault.indexOf("Monde_Trans",0)<=0){
 document.getElementById("carte").src="/images/accessoires/cartes-v4/Maxi/" + idregion + ".gif"
 
 }
	
}
var allPageTags = new Array(); 
function doSomethingWithClasses(theClass,theClass2,lien1,lien2) { 
 //Populate the array with all the page tags 
 var allPageTags=document.getElementsByTagName("*"); 
 //Cycle through the tags using a for loop 
 for (i=0; i<allPageTags.length; i++) { 
 //Pick out the tags with our class name 

 if (allPageTags[i].id==theClass) { 
 //Manipulate this in whatever way you want 
 	if (allPageTags[i].style.display==''){
 		allPageTags[i].style.display='none'
	}else{
		allPageTags[i].style.display=''
	}
 } 
  if (allPageTags[i].id==theClass2) { 
 //Manipulate this in whatever way you want 
 if (allPageTags[i].style.display==''){
 		allPageTags[i].style.display='none'
	}else{
		allPageTags[i].style.display=''
	}
 } 
 } 
 document.getElementById(lien1).style.display='none';
 document.getElementById(lien2).style.display='';
} 
 function addfiltrefull(champ,valeur){
	 	valeur=valeur.replace(" ","_")
	 	if (valeur.length>0){
	 		window.location=urlsearch + "/" + valeur;
	 	}else{window.location=urlsearch}
	}
