function youch()
{
	//document.ougli.action = "mise_en_base.php?etape=3&ajout_article_url=1";
	document.ougli.submit() ;

}

function minimum(champ,nbre,form) 
{ 
if (champ.length < nbre) 
{ 
alert("Veuillez saisir "+nbre+" caractères au minimum, pour votre mot de passe") 
return false; 
} 
document.Formulaire.action = "fiche_modifiee.php";
document.Formulaire.submit() ; 
}

function charge_pag(obj, id)
{
	if (obj.name == "go_to_next") {
		document.form_panier.action="paiement_online.php?id="+id;
	}
	if (obj.name == "go_to_next_cb") {
		document.form_panier.action="paiement_online_cb.php?id="+id;
	}
	if (obj.name == "go_to_shop") {
		document.form_panier.action="recouvrements.php";
	}
}

function recalcqte(obj)
{
	document.form_panier.action="mise_en_base.php?qte="+obj.value+"&idart="+obj.name+"";
	document.form_panier.submit() ;
}


function initMenu()
{  
   // On cache les sous-menus 
    // sauf celui qui porte la classe "open_at_load" : 
    $(".navigation ul.subMenu:not('.open_at_load')").hide(); 
    // On sélectionne tous les items de liste portant la classe "toggleSubMenu" 
 
    // et on remplace l'élément span qu'ils contiennent par un lien : 
    $(".navigation li.toggleSubMenu span").each( function ()
    { 
        // On stocke le contenu du span : 
        var TexteSpan = $(this).text(); 
        $(this).replaceWith('<a href="" title="Afficher le sous-menu">' + TexteSpan + '<\/a>') ; 
    } ) ; 
 
    // On modifie l'évènement "click" sur les liens dans les items de liste 
    // qui portent la classe "toggleSubMenu" : 
    $(".navigation li.toggleSubMenu > a").click( function ()
    { 
        // Si le sous-menu était déjà ouvert, on le referme : 
        if ($(this).next("ul.subMenu:visible").length != 0)
        { 
            $(this).next("ul.subMenu").slideUp("normal", function ()
            {
				$.ajax
				({
					type: "POST",
					data: "menu=none",
					url: "./open_menu.php",
					cache:false,
					success:function(html)
					{
						$(this).parent().removeClass("open") ;
					},
					error:function(XMLHttpRequest,textStatus, errorThrown)
					{
						alert("(086) Erreur de chargement...");
					}
				});
			} );
            
        } 
        // Si le sous-menu est caché, on ferme les autres et on l'affiche : 
        else
        {
			var menu_id;
            $(".navigation ul.subMenu").slideUp("normal", function () { $(this).parent().removeClass("open") }); 
            $(this).next("ul.subMenu").slideDown("normal", function ()
            {
				$.ajax
				({
					type: "POST",
					data: "menu="+$(this).attr("id"),
					url: "./open_menu.php",
					cache:false,
					success:function(html)
					{
						$(this).parent().addClass("open") ;
					},
					error:function(XMLHttpRequest,textStatus, errorThrown)
					{
						alert("(086) Erreur de chargement...");
					}
				});
			});
		} 
        // On empêche le navigateur de suivre le lien : 
        return false; 
    }); 
}


function testcoche(langue,cgv)
{

if ( (langue[0].checked == false) && (langue[1].checked == false) )

{
	alert("Vous devez choisir une langue") ;
	return false ;
}
if (cgv.checked == false)
{
	alert("Vous devez accepter les conditions générales de vente de Vite Encaisser") ;
	return false ;
}
else
{
document.form1.submit() ;
	//return (1) ;
}
}

function testcoche_simple(cgv)
{

//alert("rate") ;

if (cgv.checked == false)
{
	alert("Vous devez accepter les conditions générales de vente de Vite Encaisser") ;
	return false ;
}
else
{
	document.form1.submit() ;
	//return (1) ;
}
}

function testcoche_switch(cgv)
{

//alert("rate") ;

	if (cgv.checked == false)
	{
		alert("Vous devez accepter les conditions générales de vente de Vite Encaisser") ;
		return false ;
	}
	else
	{
		//document.forms['form1'].action="traitement.php" ;
		//document.forms['form1'].submit();
		document.form1.action = "traitement.php";
		document.form1.submit() ;
		//return (1) ;
	}
}

function testcoche_prod(prod)
{

//alert("rate") ;

if ( (prod[0].checked == false) && (prod[1].checked == false) && (prod[2].checked == false) && (prod[3].checked == false) && (prod[4].checked == false) && (prod[5].checked == false) && (prod[6].checked == false))
//if (1)
{
	alert("Vous devez choisir un produit") ;
	return false ;
}
else
{
	if (prod[0].checked == true)
		document.form1.action = "avertis_choc_online.php?etape=1";
	if (prod[1].checked == true)
		document.form1.action = "avertis_incisif_online.php?etape=1";
	if (prod[2].checked == true)
		document.form1.action = "avertis_international_online.php?etape=1";
	if (prod[3].checked == true)
		document.form1.action = "sticker_online.php?etape=1";
	if (prod[4].checked == true)
		document.form1.action = "direct_dom_online.php?etape=1";
	if (prod[5].checked == true)
		document.form1.action = "recherche_adresse_solvabilite_online_choix.php?etape=1";
	if (prod[6].checked == true)
		document.form1.action = "question_juridique_online.php?etape=1";

	document.form1.submit() ;
	//return (1) ;
}
}

function testcoche_depot(depot,gift)
{

	if ((depot[0].checked == false) && (depot[1].checked == false) && (depot[2].checked == false) && (depot[3].checked == false) && (depot[4].checked == false) && (depot[5].checked == false))
	{
		alert("Vous devez choisir un montant") ;
		return false ;	
	}
	else
	{
		if ((gift[0].checked == false) && (gift[1].checked == false))		
		{		
			alert("Vous devez choisir un type de cadeau") ;
			return false ;
		}
		else
		{ 		
			document.form1.action = "mise_en_base.php";
			document.form1.submit() ;
		}
	}
}

function testcoche_advanced(depot,gift)
{

//alert("rate") ;

if ( (depot[0].checked == false) && (depot[1].checked == false) && (depot[2].checked == false) && (depot[3].checked == false) && (depot[4].checked == false) && (depot[5].checked == false))
//if (1)
{
	alert("Vous devez choisir un montant") ;
	return false ;
	
}
else
{
	if ((gift[0].checked == false) && (gift[1].checked == false))
	{
		alert("Vous devez choisir votre cadeau") ;
		return false ;
	}
	else
	{
		
		if ((depot[0].checked == true) && (gift[0].checked == true))
			document.form1.action = "mise_en_base.php?produit=6&cadeau=1";
		if ((depot[0].checked == true) && (gift[1].checked == true))
			document.form1.action = "mise_en_base.php?produit=6&cadeau=2";
		if ((depot[1].checked == true) && (gift[0].checked == true))
			document.form1.action = "mise_en_base.php?produit=7&cadeau=1";
		if ((depot[1].checked == true) && (gift[1].checked == true))
			document.form1.action = "mise_en_base.php?produit=7&cadeau=2";
		if ((depot[2].checked == true) && (gift[0].checked == true))
			document.form1.action = "mise_en_base.php?produit=8&cadeau=1";
		if ((depot[2].checked == true) && (gift[1].checked == true))
			document.form1.action = "mise_en_base.php?produit=8&cadeau=2";
		if ((depot[3].checked == true)&& (gift[0].checked == true))
			document.form1.action = "mise_en_base.php?produit=9&cadeau=1";
		if ((depot[3].checked == true) && (gift[1].checked == true))
			document.form1.action = "mise_en_base.php?produit=9&cadeau=2";
		if ((depot[4].checked == true) && (gift[0].checked == true))
			document.form1.action = "mise_en_base.php?produit=10&cadeau=1";
		if ((depot[4].checked == true) && (gift[1].checked == true))
			document.form1.action = "mise_en_base.php?produit=10&cadeau=2";
		if ((depot[5].checked == true) && (gift[0].checked == true))
			document.form1.action = "mise_en_base.php?produit=11&cadeau=1";
		if ((depot[5].checked == true) && (gift[1].checked == true))
			document.form1.action = "mise_en_base.php?produit=11&cadeau=2";	
	
		document.form1.submit() ;
		//return (1) ;
	
	}

}
}

function confirmation(societe)
{

	if (window.confirm(Utf8.decode("Je reconnais agir en qualité de représentant autorisé de la société " + societe + ". Je confirme que la créance est certaine, liquide et exigible.")))
	{
		document.confirme_saisie.action = "mise_en_base.php";
		document.confirme_saisie.submit() ;
	}
	else
	{
		return false;
	}

}

function retour()
{

	document.form1.action = "recherche_adresse_solvabilite_online_choix.php";
	document.form1.submit() ;
	//return (1) ;

}

var Utf8 = {
 
	// public method for url encoding
	encode : function (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	},
 
	// public method for url decoding
	decode : function (utftext) {
		var string = "";
		var i = 0;
		var c = c1 = c2 = 0;
 
		while ( i < utftext.length ) {
 
			c = utftext.charCodeAt(i);
 
			if (c < 128) {
				string += String.fromCharCode(c);
				i++;
			}
			else if((c > 191) && (c < 224)) {
				c2 = utftext.charCodeAt(i+1);
				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
				i += 2;
			}
			else {
				c2 = utftext.charCodeAt(i+1);
				c3 = utftext.charCodeAt(i+2);
				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
				i += 3;
			}
 
		}
 
		return string;
	}
 
}

 


