//envoyer formulaire page gestion selection commande
function envoyerSelection(form) {
	form.action="gestion_add.asp";
	form.method="post";
	form.submit();
	return true
}

//modifier un article du'un devis
function modifierSelection(form) {
	form.action="gestion_cmdsm.asp";
	form.method="post";
	form.submit();
	return true
}

//envoyer formulaire page accueil
function envoyerConfirme() {
if(document.confirme.email.value!=""){
	document.confirme.action="/mail/confirm.asp";
	document.confirme.target="_blank";
	document.confirme.method="post";
	document.confirme.submit();
	return true
	}else{
	alert("Vous devez saisir une adresse email.")
	return false
	}
}

//envoyer formulaire page accueil
function envoyerMain() {
if(document.lettre.valid.checked==true && document.lettre.mail.value!=""){
	document.lettre.action="/mail/lettre.asp";
	document.lettre.target="_blank";
	document.lettre.method="post";
	document.lettre.submit();
	return true
	}else{
	alert("Vous devez accepter votre demande en cochant la case.")
	return false
	}
}

//envoyer formulaire page top frame
function envoyerTop() {
if(document.choixTop.aimage_motsclesus2.value!=""){
	document.choixTop.action="liste.asp";
	document.choixTop.method="post";
	document.choixTop.submit();
	return true
	}else{
	alert("Saisissez un/des mot(s) clé(s), exemple : chien assis")
	return false
	}
}

//selection du bouton radio dans page animaux
function selectpopup(numero){
	document.choix.popup[numero].checked = true;
}

//envoyer formulaire dans page animaux
function envoyer(num) {
	if (num==1) {
		document.choix.action="liste.asp";
		document.choix.target="";
		document.choix.method="post";
		document.choix.submit();
	}
	if (num==2) {
		document.choix.action="nbfiche.asp";
		document.choix.target="nbfiche";
		document.choix.method="post";
		document.choix.submit();
	}
}

//envoyer formulaire dans page detail
function envoyerDetail() {
	document.choix.action="liste.asp";
	document.choix.method="post";
	document.choix.submit();
}

//ecrire un cookie (remplacer le contenu)
function EcrireCookie(nom, valeur){
	var argv=EcrireCookie.arguments;
	var argc=EcrireCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(valeur)+((expires==null) ? "" : ("; expires="+expires.toGMTString()))+((path==null) ? "" : ("; path="+path))+((domain==null) ? "" : ("; domain="+domain))+((secure==true) ? "; secure" : "");
}

//ecrire un cookie (ajouter au contenu)
function EcrireCookiePlus(nom, valeur){
	var lavaleur = LireCookie(nom);
	if(lavaleur!=null){
		lavaleur+=valeur;
	}else{
		lavaleur=valeur;
	}
	var argv=EcrireCookiePlus.arguments;
	var argc=EcrireCookiePlus.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=nom+"="+escape(lavaleur)+((expires==null) ? "" : ("; expires="+expires.toGMTString()))+((path==null) ? "" : ("; path="+path))+((domain==null) ? "" : ("; domain="+domain))+((secure==true) ? "; secure" : "");
}

//lire un cookie, null si il n'esite pas
function getCookieVal(offset){
	var endstr=document.cookie.indexOf (";", offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr)); 
}

function LireCookie(nom){
	var arg=nom+"=";
	var alen=arg.length;
	var clen=document.cookie.length;
	var i=0;
	while (i<clen){
		var j=i+alen;
		if (document.cookie.substring(i, j)==arg) return getCookieVal(j);
		i=document.cookie.indexOf(" ",i)+1;
		if (i==0) break;
	}
	return null; 
}

//recharge la frame haut
function reloadTop(){
	parent.haut.document.location.href="top.asp";
}
	
//ajoute un article au panier, compteur+1 et recharge le bandeau haut
function ajouterArticle(){
	var lenum = 0;
	if(LireCookie("ariokodyca_nbarticles")!=null){
		lenum=parseInt(LireCookie("ariokodyca_nbarticles"))+1;
		EcrireCookie("ariokodyca_nbarticles",lenum);
	}else{
		EcrireCookie("ariokodyca_nbarticles","1");
	}
}

//ajoute un article au devis, compteur+1 et recharge le bandeau haut
function ajouterDevis(){
	var lenum = 0;
	if(LireCookie("ariokodyca_nbdevis")!=null){
		lenum=parseInt(LireCookie("ariokodyca_nbdevis"))+1;
		EcrireCookie("ariokodyca_nbdevis",lenum);
	}else{
		EcrireCookie("ariokodyca_nbdevis","1");
	}
}
