//--------------------------------------Void-------------------------------------------------------------

function Ajax()

{

pary='ajax';

}

var charArray = new Array(
	' ', '!', '"', '#', '$', '%', '&', "'", '(', ')', '*', '+', ',', '-',
	'.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
	'<', '=', '>', '?', '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
	'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
	'X', 'Y', 'Z', '[', '\\', ']', '^', '_', '`', 'a', 'b', 'c', 'd', 'e',
	'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
	't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '', 'Ç', 'ü',
	'é', 'â', 'ä', 'à', 'å', 'ç', 'ê', 'ë', 'è', 'ï', 'î', 'ì', 'Ä', 'Å',
	'É', 'æ', 'Æ', 'ô', 'ö', 'ò', 'û', 'ù', 'ÿ', 'Ö', 'Ü', 'ø', '£', 'Ø',
	'×', 'ƒ', 'á', 'í', 'ó', 'ú', 'ñ', 'Ñ', 'ª', 'º', '¿', '®', '¬', '½',
	'¼', '¡', '«', '»', '_', '_', '_', '¦', '¦', 'Á', 'Â', 'À', '©', '¦',
	'¦', '+', '+', '¢', '¥', '+', '+', '-', '-', '+', '-', '+', 'ã', 'Ã',
	'+', '+', '-', '-', '¦', '-', '+', '¤', 'ð', 'Ð', 'Ê', 'Ë', 'È', 'i',
	'Í', 'Î', 'Ï', '+', '+', '_', '_', '¦', 'Ì', '_', 'Ó', 'ß', 'Ô', 'Ò',
	'õ', 'Õ', 'µ', 'þ', 'Þ', 'Ú', 'Û', 'Ù', 'ý', 'Ý', '¯', '´', '­', '±',
	'_', '¾', '¶', '§', '÷', '¸', '°', '¨', '·', '¹', '³', '²', '_', ' ');

var hex_digits = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
		'A', 'B', 'C', 'D', 'E', 'F');

// clean_numstr
function clean_numstr(raw_str, base)
{
	var ret_str = "";
	var c = "";
	var i;
	for(i=0; i < raw_str.length; i++) {
		c = raw_str.charAt(i);
		if(c == "0" || parseInt(c, base) > 0) {
			ret_str += c;
		}
	}
	return ret_str;
}

/// cette fonction converti un code hexdécimal en une chaine 
function hex_from_chars(char)
{
	var char_str = char;
	var delimiter = "";
	var hex_str = "";
	var i, n;
	for(i=0; i < char_str.length; i++) {
		n = charToByte(char_str.charAt(i));
		if(n != 0) {
			if(i > 0) hex_str += delimiter;
			hex_str += byteToHex(n);
		}
	}
	return hex_str ;
}

///une fonction qui va convertir un byte en caractaire
function byteToChar(n)
{
	if(n < 32 || n > 255) return " ";
	return charArray[n-32];
}

/// une fonction qui va convertir un caractaire en byte

function charToByte(c)
{
	var i;
	for(i=0; i < charArray.length; i++) {
		if(c == charArray[i]) return i+32;
	}
	return 0;
}

/// une fonction qui va convertire un byte en hexa
function byteToHex(n)
{
	return hex_digits[(n >> 4) & 0xf] + hex_digits[n & 0xf];
}

/// cette fonction converti un chaine en une hexdécimal 
function chars_from_hex(char)
{
	var hex_str = clean_numstr(char, 16);
	var char_str = "";
	var num_str = "";
	var i;
	for(i=0; i < hex_str.length; i+=2)
		char_str += byteToChar(parseInt(hex_str.substring(i, i+2), 16));
	return char_str;
}



function sendMultiData1()

{

			var param = '';

			var n_argument=sendMultiData1.arguments.length;

			for (var i=0; i <n_argument; i=i+3)

			{

			para = sendMultiData1.arguments[i];

			placy = sendMultiData1.arguments[i+1];

	//		document.getElementById(placy).innerHTML = 'salut' ;

			fction = sendMultiData1.arguments[i+2];

			j=i+3;

			param = param + para + '&place'+j + '='+placy + '&myfunction'+j+'='+fction;

			}

			var n_ajax_fct=n_argument+3;

			param = 'id_langue='+val_id('id_langue')+'&nmd5_user='+val_id('nmd5_user')+'&type_autentif='+val_id('type_autentif')+'&place0=authentif&myfunction0=test_user&'+param+'&n_ajax_fct='+n_ajax_fct;

			//var places = 'place2';

			//var contents=document.getElementById('corp');

			//contents.innerHTML = param;

			sendData1(param);

}



	function sendData1(param)

	{

		page = 'function.php';

		if(document.all)

		{

			//Internet Explorer

			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;

		}//fin if

		else

		{

		    //Mozilla

			var XhrObj = new XMLHttpRequest();

		}//fin else



		//définition de l'endroit d'affichage:

		//var place = 'place5';

		//var content = document.getElementById(place);

		

		XhrObj.open("POST", page);



		//Ok pour la page cible

		XhrObj.onreadystatechange = function()

		{

			if (XhrObj.readyState == 4 && XhrObj.status == 200)

			{

			//récupération de la chaine : place1##resultat_fct1##place2##resultat_fct2

			var chaine = XhrObj.responseText;

			

			//découper la chaine selon la méthode Split

			var MyTable = chaine.split('##');

				//var place = 'place5';

				//var content = document.getElementById(place);

				//content.innerHTML = chaine;

			//Afficher résultat_fct1 dans la place1, resultat_fct2 sur la place2...

				for (j=0; j<MyTable.length; j=j+2)

				{

				var place = MyTable[j];

				var contenu = MyTable[j+1];

				var content = document.getElementById(place);

				content.innerHTML = contenu;

				}

			//document.getElementById("load1").style.visibility='hidden';
			//$("#Layer2").fadeOut(1000);
			//active_menu();
				$("#slider").easySlider({
				auto: true, 
				continuous: true
			});
				
				$(document).ready(function(){	
		$("#slider1").easySlider();
	});
			

			}

		}



		XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

		XhrObj.send(param);

		param=null;

		

	}//fin fonction SendData



function active_menu()

{

var Accordion1 = new Spry.Widget.Accordion("Accordion1");	

}

//------------------------------------ Text de l'existance d'une valeur  

		function exist(mychamp,zone_hiden,message)

		{

		var val = document.getElementById(zone_hiden).innerHTML;

		pary= val.indexOf("coucou");

			if (pary!=-1)

			{

			rouge_control(mychamp,'rouge');

			alert(message);		

			return 'walou';

			}else{

			return 'yes';

			}

		}

//------------------------------------ Text de l'existance d'une valeur  

		function yes_or_no(mychamp,message)

		{

		var val = document.getElementById(mychamp).value;

			if (val!='yes')

			{

			alert(message);		

			return 'walou';

			}else{

			return 'yes';

			}

		}



function coche_case (place,myvalue) {

if (myvalue=='on')

{

next_value='off';

send_value='yes';

}else{

next_value='on';

send_value='no';

}

message="<a href=# OnClick=\"coche_case('promo_case','"+next_value+"')\"><img src=\"img/star_"+myvalue+".gif\" border=0></a>&nbsp;&nbsp;Promotions<input type=hidden id=\"promo\" value=\""+send_value+"\">";

document.getElementById(place).innerHTML = message;

}

function ikona(type)

{

if(type=='voiture')

{

selected1="<img src=\"img/s1.gif\" width=62 height=30 border=0>"; 

}else{

selected1="<img src=\"img/d1.gif\" width=62 height=30 name=b1 border=0>";

}

//-------------------------------------------------------------------------

if(type=='moto')

{

selected2="<img src=\"img/s2.gif\" width=68 height=30 border=0>"; 

}else{

selected2="<img src=\"img/d2.gif\" width=68 height=30 name=b2 border=0></a>";

}

//--------------------------------------------------------------------------

if(type=='camion'){

selected3="<img src=\"img/s3.gif\" width=68 height=30 border=0>"; 

}else{

selected3="<img src=\"img/d3.gif\" width=68 height=30 name=b3 border=0>";

}

//---------------------------------------------------------------------------

if(type=='bateau')

{

selected4="<img src=\"img/s4.gif\" width=68 height=30 border=0>"; 

}else{

selected4="<img src=\"img/d4.gif\" width=68 height=30 name=b4 border=0>";

}



if(type=='autre')

{

selected5="<img src=\"img/s5.gif\" width=62 height=30 border=0>"; 

}else{

selected5="<img src=\"img/d5.gif\" width=62 height=30 name=b5 border=0>";

}



mon_tableau="<table width=328 border=0 cellspacing=0 cellpadding=0><tr><td width=62>"+selected1+"</td><td width=68>"+selected2+"</td><td width=68>"+selected3+"</td><td width=68>"+selected4+"</td><td width=62>"+selected5+"</td></tr></table>";

document.getElementById('viw1').innerHTML = "";

document.getElementById('viw2').innerHTML = "";

document.getElementById('viw3').innerHTML = "";

document.getElementById('viw4').innerHTML = "";

document.getElementById('viw5').innerHTML = "";

document.getElementById('nb_annonces').innerHTML = "";

document.getElementById('place_marque').innerHTML = "";

document.getElementById('ikona').innerHTML = mon_tableau;

}

function chk(name)

{

	if(document.getElementById(name).checked == true)

	{

		document.getElementById(name+'_h').value = 1;

	}

	else

	{

		document.getElementById(name+'_h').value = 0;

	}

}

function val_check(name)

{

	if(document.getElementById(name).checked == true)

	{

	return'yes';

	}else{

	return'no';

	}

}

	

function val_check_num(name)

{

	if(document.getElementById(name).checked == true)

	{

	return parseInt('1');

	}else{

	return parseInt('0');

	}

}



function chk_case(name)

{

	if(document.getElementById(name).checked == true)

	{

		document.getElementById('h'+name).value = 1;

	}

	else

	{

		document.getElementById('h'+name).value = 0;

	}

}





function st_last_tab(objet,type_rub,bg_tab0,text_tab0,bg_tab1,text_tab1) {

if (type_rub==0)

{

document.getElementById(objet).style.background=bg_tab0;

document.getElementById(objet).style.color=text_tab0;

}



if (type_rub==1)

{

document.getElementById(objet).style.background=bg_tab1;

document.getElementById(objet).style.color=text_tab1;

}



}



function st_tab(objet,bg_tab,text_tab) {

if (objet!=0)

{

document.getElementById(objet).style.background=bg_tab;

document.getElementById(objet).style.color=text_tab;

}

}



function st_tab_control(objet,bg_tab,text_tab) {

	if (val_id('if_select')!=objet)

	{

	document.getElementById(objet).style.background=bg_tab;

	document.getElementById(objet).style.color=text_tab;

	}

}



function st_tab_affect(objet,bg_tab,text_tab) {

	if (val_id('niveau_affect')!=objet)

	{

	document.getElementById(objet).style.background=bg_tab;

	document.getElementById(objet).style.color=text_tab;

	}

}

function change_val_id(id_champ,myvalue){

document.getElementById(id_champ).value=myvalue;

}







	function sendData(param)

	{

	

		page = 'function.php';

		if(document.all)

		{

			//Internet Explorer

			var XhrObj = new ActiveXObject("Microsoft.XMLHTTP") ;

		}//fin if

		else

		{

		    //Mozilla

			var XhrObj = new XMLHttpRequest();

		}//fin else



		//définition de l'endroit d'affichage:

		//var place = 'place5';

		//var content = document.getElementById(place);

		

		XhrObj.open("POST", page);



		//Ok pour la page cible

		XhrObj.onreadystatechange = function()

		{

			if (XhrObj.readyState == 4 && XhrObj.status == 200)

			{

			//récupération de la chaine : place1##resultat_fct1##place2##resultat_fct2

			var chaine = XhrObj.responseText;

			

			//découper la chaine selon la méthode Split

			var MyTable = chaine.split('##');

				//var place = 'place5';

				//var content = document.getElementById(place);

				//content.innerHTML = chaine;

			//Afficher résultat_fct1 dans la place1, resultat_fct2 sur la place2...

				for (j=0; j<MyTable.length; j=j+2)

				{

				var place = MyTable[j];

				var contenu = MyTable[j+1];

				var content = document.getElementById(place);

				content.innerHTML = contenu;

				if(content=="photo"){

				$("#photo").slideDown();}

				}
				


			//document.getElementById("load1").style.visibility='hidden';
			$("#Layer2").fadeOut(1000);
			}

		}



		XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded');

		XhrObj.send(param);

		param=null;

	}//fin fonction SendData

	

		/*function sendMultiData()

		{

			var param = '';

			for (var i=0;i<sendMultiData.arguments.length; i=i+3)

			{

			para = sendMultiData.arguments[i];

			placy = sendMultiData.arguments[i+1];

		//	document.getElementById(placy).innerHTML = 'salut' ;

			fction = sendMultiData.arguments[i+2];

			param = param + para + '&place'+i + '='+placy + '&myfunction'+i+'='+fction;

			}

			var n_ajax_fct = sendMultiData.arguments.length ;

			param = 'id_langue=1&'+param+'&n_ajax_fct='+n_ajax_fct;

			//var places = 'place2';

			//var contents = document.getElementById(places);

			//contents.innerHTML = param ;

			sendData(param);

		}



		*/

		function openpop(id,w,h,nmd5) {

		 mafenetre =

		 window.open("form_articles.php?id="+id+"&nmd5_user="+nmd5, "null", "width="+w+",height="+h+",screenX=200,screenY=200,top=300,left=300,scrollbars=1");

		 mafenetre.focus();

		}

		function openpop_n(w,h,nmd5,langue) {

		 mafenetre =

		 window.open("form_articles.php?nmd5_user="+nmd5+"&langue="+langue, "null", "width="+w+",height="+h+",screenX=200,screenY=200,top=300,left=300,scrollbars=1");

		 mafenetre.focus();

		}

		function controlMultiData()

		{

			var param = '';

			var initial = 0;

			var n_argument=controlMultiData.arguments.length;

			for (var i=0; i < n_argument; i=i+3)

			{

			var para = controlMultiData.arguments[i];

			var pary= para.indexOf("walou");

				if(pary!=-1)

				{

				initial = initial+1;

				}

	

			placy = controlMultiData.arguments[i+1];

			fction = controlMultiData.arguments[i+2];

			j=i+3;

			param = param + para + '&place'+j + '='+placy + '&myfunction'+j+'='+fction;

			}

			var n_ajax_fct=n_argument;

			/*param = 'id_langue='+val_id('id_langue')+'&nmd5_user='+val_id('nmd5_user')+'&type_autentif='+val_id('type_autentif')+'&place0=authentif&myfunction0=test_user&'+param+'&n_ajax_fct='+n_ajax_fct;*/

			param = 'id_langue=1&'+param+'&n_ajax_fct='+n_ajax_fct;

			

				if(initial==0)

				{

				//alert('Mail invalide');

				sendData(param);

				end_zone(5000);

				}else{

				//document.getElementById('layer_load').style.visibility ='hidden';

				}

		}



//--------------------------------------SONDAGE----------------------------------------------

function control_sondage()

{

	if (val_check('choix1')=='no' && val_check('choix2')=='no' && val_check('choix3')=='no')

	{

	alert('Vous devez choisir une option !');		

	return 'walou';

	}else{

	return 'yes';

	}

}

//------------------------------------ Authentifaction demandé-------------------------------

function connect ()

{

	if (val_id('nmd5_user')==0)

	{

			rouge_control('login','rouge');

			rouge_control('passe','rouge');

			alert('Veuillez vous inscrire/authentifier pour accéder !');		

			return 'walou';

	}else{

			return 'yes';

	}

}

//------------------------------------text minimal

		function caract(mychamp,number_caract,message)

		{

		var val = document.getElementById(mychamp).value;

			if (val.length<number_caract)

			{

			rouge_control(mychamp,'rouge');

			alert(message);		

			return 'walou';

			}else{

			return val;

			}

		}

function must_different(mychamp,different_value,message)

{

	var val = document.getElementById(mychamp).value;

	if (val==different_value)

	{

	alert(message);		

	return 'walou';

	}else{

	return val;

	}

}

		

		function navigation()

		{

			if(document.all)

			{

			return 'ie';

			}else{

			return 'ff';

			}

		

		}

	function val_id(id_champ){

	var valeur = document.getElementById(id_champ).value;

	return valeur ;

	}

	

	function val_extern_id(win_name,id_champ){

	var valeur = window.frames[win_name].document.getElementById(id_champ).value;

	return valeur ;

	}



	function val_edit(id_champ,my_value){

	document.getElementById(id_champ).value=my_value;

	}

	

	function edit_zone(id_zone,my_value){

	document.getElementById(id_zone).innerHTML=my_value;

	}



	

	function control_nb_photo(frame,id_champ,nb_max)

	{

	nb_photo=parseInt(val_extern_id(frame,id_champ));

	

		if(nb_max<nb_photo)

		{

		alert('Nombre de photos ne doit pas dépasser '+nb_max+' !'); 

		return 'walou';

		}else{

			if(nb_photo==0)

			{

			alert('Aucune photo n\'a été chargée pour cette annonce, Veillez rectifier (Parcourir puis charger) !');

			return 'walou';

			}else{

			return 'yes';

			}

		}

	

	}



	function edit_extern_zone(win_name,id_zone,my_value){

    window.frames[win_name].document.getElementById(id_zone).innerHTML=my_value;

	}



function Test_Checked(id_champ)

{

     if(document.getElementById(id_champ).checked==false)

     {  //pas coché!

        return false;

     }

	 else

	 {

	 return id_champ;

	 }

}

function roll_list(id_zone,style_zone)

{

	if (style_zone=='normal')

	{

	//document.getElementById(id_zone).class='item_list';url(img/barre_annonce.jpg)

	document.getElementById(id_zone).style.border='1px solid #F0F0F0';

	document.getElementById(id_zone).style.background='#DEDCCE';

	document.getElementById(id_zone).style.padding='1px';

	}

	if (style_zone=='normal2')

	{

	//document.getElementById(id_zone).class='item_list';url(img/barre_annonce.jpg)

	document.getElementById(id_zone).style.border='1px solid #F0F0F0';

	document.getElementById(id_zone).style.background='#EDEEF8';

	document.getElementById(id_zone).style.padding='1px';

	}

	if (style_zone=='light')

	{

	//document.getElementById(id_zone).class='item_list';url(img/barre_annonce.jpg)

	document.getElementById(id_zone).style.border='2px solid #FFEE8B';

	document.getElementById(id_zone).style.background='url(img/barre_annonce.jpg)';

	document.getElementById(id_zone).style.padding='0px';

	}

	

	if (style_zone=='edit_light')

	{

	//document.getElementById(id_zone).class='item_list';url(img/barre_annonce.jpg)

	document.getElementById(id_zone).style.border='2px solid #FFEE8B';

	document.getElementById(id_zone).style.background='#FFFDDE';

	document.getElementById(id_zone).style.padding='0px';

	}



	if (style_zone=='selecty')

	{

	document.getElementById(id_zone).style.border='2px solid #F0F0F0';

	document.getElementById(id_zone).style.background='#EEEDE5';

	document.getElementById(id_zone).style.padding='0px';

	}

}



function select_comparer(id_select)

{

value_select=val_check('compar'+id_select);

scomparer1=document.getElementById('comparer1').value;

scomparer2=document.getElementById('comparer2').value;

if(value_select=='yes')

{

	if(scomparer1=='0')

	{

	document.getElementById('comparer1').value=id_select;

	}else{

		if(scomparer2=='0')

		{

		document.getElementById('comparer2').value=id_select;

		}else{

		document.getElementById('compar'+scomparer1).checked=false;

		document.getElementById('comparer1').value=scomparer2;

		document.getElementById('comparer2').value=id_select;

		}

	}

}else{

	if (id_select==scomparer1)

	{

	document.getElementById('comparer1').value=scomparer2;

	document.getElementById('comparer2').value='0';

	}

	if (id_select==scomparer2)

	{

	document.getElementById('comparer2').value='0';

	}

}



}



function open_zone(largeur,hauteur,titre) {



var flash='<table width=90% height=80% border=0 cellspacing=0 cellpadding=0><tr><td align=center valign=middle>Chargement</td></tr></table>';



var content1=document.getElementById('zone_message');

content1.innerHTML=flash;

/*

nb_select=document.getElementsByTagName("select").length;

for (var i=0; i < nb_select; i=i+1)

{

document.getElementsByTagName("select")[i].style.visibility='hidden';

}

*/

motie=parseInt(largeur/2);

motie_h=parseInt(hauteur/2);

htop=300-motie_h;

left=512-motie;

pas_top=parseInt(motie_h/10);

pas_left=parseInt(motie/10);

pas_width=largeur/10;

pas_height=hauteur/10;

	document.getElementById('box_message').style.visibility='visible';

	document.getElementById('zone_message').style.visibility='hidden';

	document.getElementById('box_message').style.width=pas_width;

	document.getElementById('titre_zone').style.width=pas_width;

	document.getElementById('box_message').style.height=pas_height;

	document.getElementById('box_message').style.left=512;

	document.getElementById('box_message').style.top=300;

zone_plus(pas_top,pas_left,pas_width,pas_height,htop,left,largeur,hauteur,titre);

}



function zone_plus(pas_top,pas_left,pas_width,pas_height,fi_top,fi_left,fi_width,fi_height,titre)

{

	if(parseInt(document.getElementById('box_message').style.width)<fi_width)

	{

	var sal="plus_zone('"+pas_top +"','"+ pas_left +"','"+ pas_width +"','"+ pas_height +"','"+ fi_top +"','"+ fi_left +"','"+ fi_width +"','"+ fi_height +"','"+ titre+"')";

	//var content1 = document.getElementById('zone_message');

	//content1.innerHTML = sal;

	setTimeout ("plus_zone("+pas_top +","+ pas_left +","+ pas_width +","+ pas_height +","+ fi_top +","+ fi_left +","+ fi_width +","+ fi_height +",'"+ titre+"')",1);

	}else{

	document.getElementById('titre_zone').style.width=fi_width;	

	document.getElementById('box_message').style.width=fi_width;

	document.getElementById('box_message').style.height=fi_height;

	document.getElementById('box_message').style.left=fi_left;

	document.getElementById('box_message').style.top=fi_top;

	document.getElementById('zone_message').style.visibility='visible';

	} 

}



function plus_zone(pas_top,pas_left,pas_width,pas_height,fi_top,fi_left,fi_width,fi_height,titre)

{

	var content1 = document.getElementById('zone_titre');

	content1.innerHTML = titre;

document.getElementById('titre_zone').style.width=parseInt(document.getElementById('titre_zone').style.width)+pas_width;

document.getElementById('box_message').style.width=parseInt(document.getElementById('box_message').style.width)+pas_width;

document.getElementById('box_message').style.height=parseInt(document.getElementById('box_message').style.height)+pas_height;

document.getElementById('box_message').style.left=parseInt(document.getElementById('box_message').style.left)-pas_left;

document.getElementById('box_message').style.top=parseInt(document.getElementById('box_message').style.top)-pas_top;



zone_plus(pas_top,pas_left,pas_width,pas_height,fi_top,fi_left,fi_width,fi_height,titre);

}



function loadat(zone) {

var flash='<table width=100% height=165 border=0 cellspacing=0 cellpadding=0><tr><td align=center valign=middle><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"30\" height=\"30\"><param name=\"movie\" value=\"load2.swf\"><param name=\"wmode\" value=\"transparent\"></param><param name=\"quality\" value=\"high\"><embed src=\"load2.swf\" wmode=\"transparent\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"30\" height=\"30\"></embed></object></td></tr></table>';

var content3 = document.getElementById(zone);

content3.innerHTML = flash;

}



function edit_zone(largeur,hauteur,titre) {

var flash='<table width=90% height=80% border=0 cellspacing=0 cellpadding=0><tr><td align=center valign=middle><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"30\" height=\"30\"><param name=\"movie\" value=\"load2.swf\"><param name=\"wmode\" value=\"transparent\"></param><param name=\"quality\" value=\"high\"><embed src=\"load2.swf\" wmode=\"transparent\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"30\" height=\"30\"></embed></object></td></tr></table>';



var content3 = document.getElementById('zone_message');

content3.innerHTML = flash;

motie=largeur/2;

left=512-motie;

motie_hauteur=hauteur/2;

htop=330-motie_hauteur;

document.getElementById('box_message').style.width=largeur;

document.getElementById('titre_zone').style.width=largeur;

document.getElementById('box_message').style.height=hauteur;

document.getElementById('box_message').style.left=left;

document.getElementById('box_message').style.top=htop;

var content1 = document.getElementById('zone_titre');

content1.innerHTML = titre;

}



function end_div(after,id_zone)

{

setTimeout ("visiblite('',id_zone,'hidden')",after); 

}



function end_zone(after)

{

setTimeout ("colse_zone()",after); 

}



function colse_zone()

{

var content = document.getElementById('zone_titre');

content.innerHTML = '';

var content2 = document.getElementById('zone_message');

content2.innerHTML = '';

document.getElementById('box_message').style.visibility='hidden';



nb_select=document.getElementsByTagName("select").length;

for (var i=0; i < nb_select; i=i+1)

{

document.getElementsByTagName("select")[i].style.visibility='visible';

}

}



function visiblite(control,objet,valeur) {

	if (control=='')

	{

	document.getElementById(objet).style.visibility='hidden'

	}else{

		if (valeur=='visible')

		{

		document.getElementById(objet).style.visibility='visible'

		}

		else 

		{

		document.getElementById(objet).style.visibility ='hidden'

		}

	}

}



function visiblite1(control,objet,valeur) {

	if (control=='')

	{

	document.getElementById(objet).style.width=5;

    document.getElementById(objet).style.height=5;



	}else{

		if (valeur=='visible')

		{

		document.getElementById(objet).style.width=815;

    	document.getElementById(objet).style.height=500;

		}

		else 

		{

		document.getElementById(objet).style.width=5;

    	document.getElementById(objet).style.height=5;

		}

	}

}



//-----------------------------------------

function control_login(id_champ)

{

var val = document.getElementById(id_champ).value;

var mycontrol=/^[A-Za-z\ ]+$/;

if ((!mycontrol.test(val)) && (val.length<2))

{

rouge_control(id_champ,'rouge');

alert('Login invalide!');		

return 'walou';

}else{

return val;

}

}

function control_passe(id_champ)

{

var valeur= document.getElementById(id_champ).value;

if(valeur=='') 

{

rouge_control(id_champ,'rouge');

alert("Passe invalide.!");

return 'walou';

}else{

return valeur;

}

}

//------------------------------------Password

		function passe(passe,passe1)

		{

		var val = document.getElementById(passe).value;

		var val1 = document.getElementById(passe1).value;

			if (val.length<5)

			{

			rouge_control(passe,'rouge');

			rouge_control(passe1,'rouge');

			alert("le nombre de carractère du mot de passe doit être supperieur à 5!");		

			return 'walou';

			}else{

				if (val!=val1)

				{

				rouge_control(passe,'rouge');

				rouge_control(passe1,'rouge');

				alert("le mot de passe et la confirmation du mot de passe ne sont pas identiques!");		

				return 'walou';

				}else{

				return val;

				}

			}

		}

//------------------------------------Confirmation d'email

		function mail_conforirm(mail,mail1)

		{

		var val = document.getElementById(mail).value;

		var val1 = document.getElementById(mail1).value;

				if (val!=val1)

				{

				rouge_control(mail,'rouge');

				rouge_control(mail1,'rouge');

				alert("l'email  et sa confirmation ne sont pas identiques!");		

				return 'walou';

				}else{

				return val;

				}

		

		}

//----------------------------------------

function control_nom(id_champ)

{

var val = document.getElementById(id_champ).value;

		   var mycontrol=/^[A-Za-z\ ]+$/;

			if ((!mycontrol.test(val)) && (val.length<2))

			{

			rouge_control(id_champ,'rouge');

			alert('Nom invalide!');		

			return 'walou';

			}else{

			return val;

			}

}

//----------------------------------------

function ville(id_champ)

{

var val = document.getElementById(id_champ).value;

		   var mycontrol=/^[A-Za-z\ ]+$/;

			if ((!mycontrol.test(val)) && (val.length<2))

			{

			rouge_control(id_champ,'rouge');

			alert('Ville invalid!');		

			return 'walou';

			}else{

			return val;

			}

}

//-------------------------------------------------------------

function control_prenom(id_champ)

		{

		var val = document.getElementById(id_champ).value;

		   var mycontrol=/^[A-Za-z\ ]+$/;

			if ((!mycontrol.test(val)) && (val.length<2))

			{

			rouge_control(id_champ,'rouge');

			alert('Prénom invalide');		

			return 'walou';

			}else{

			return val;

			}

		}

//-------------------------------------------------------------



//-----------------------------------Check box



function control_check(id_check,message) {	

	if(document.getElementById(id_check).checked){

	return 'yes' ;

	}else{

	rouge_control(id_check,'rouge');

	alert(message);

	return 'walou' ;

	

	}

}

//------------------------------------Id ANNONCE

		function id_annonce(id_champ)

		{

		var val = document.getElementById(id_champ).value;

		   var mycontrol=/^[amvcbAMVCB]+-+[0-9]+$/;

			if (!mycontrol.test(val))

			{

			rouge_control(id_champ,'rouge');

			alert('Id Annonce invalid !');		

			return 'walou';

			}else{

			return val;

			}

		}

//------------------------------------Mail

		function mail(id_champ)

		{

		var val = document.getElementById(id_champ).value;

		   var mycontrol=/^[a-zA-Z0-9]+[a-zA-Z0-9\.\-\_]+@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9])+$/;

			if (!mycontrol.test(val))

			{

			rouge_control(id_champ,'rouge');

			alert('Email invalide');		

			return 'walou';

			}else{

			return val;

			}

		}

		//---------------------------------Tel

		function control_tel(id_champ)

		{

		var val_tel = document.getElementById(id_champ).value;

		   var tela=/^[0-9\ +]+$/;

			if (!tela.test(val_tel))

			{

			rouge_control(id_champ,'rouge');

			alert('Numéro de téléphone invalide');		

			return 'walou';

			}else{

			montel=val_tel.replace(' ','');

			return montel;

			}

		}

//------------------------------------text minimal

		function caract_num(mychamp,number_caract,message)

		{

		var val = document.getElementById(mychamp).value;

		   var cara=/^[0-9\ +]+$/;

			if (!cara.test(val) || val.length<number_caract)

			{

			rouge_control(mychamp,'rouge');

			alert(message);		

			return 'walou';

			}else{

			monval=val.replace(' ','');

			return monval;

			}

		}



		//---------------------------------Annee

		function annee(id_champ)

		{

		var val_annee = document.getElementById(id_champ).value;

		   var anneea=/^[0-9\ +]+$/;

			if (!anneea.test(val_annee) || val_annee.length!=4)

			{

			rouge_control(id_champ,'rouge');

			alert('Année invalid');		

			return 'walou';

			}else{

			monannee=val_annee.replace(' ','');

			return monannee;

			}

		}

		//---------------------------------Prix

		function prix(id_champ)

		{

		var val_prix = document.getElementById(id_champ).value;

		   var prixa=/^[0-9\ ]+$/;

			if (!prixa.test(val_prix))

			{

			rouge_control(id_champ,'rouge');

			alert('Prix invalid');		

			return 'walou';

			}else{

			monprix=val_prix.replace(' ','');

			return monprix;

			}

		}

//----------------------------------------------------------



//------------------------------------------------------------------

function rouge_control(id_control,color)

{

if(color=='rouge')

{

document.getElementById(id_control).style.border='1px solid #DE753D';

	}else{

	document.getElementById(id_control).style.border='1px solid #000000';

	}

}


