// JavaScript Document

function PopWin(imgpath, doctitle, width, height) {
    imagepath = imgpath;
	documenttitle = doctitle;
	w_width = width;
	w_height = height;
	picwin = window.open("about:blank","bonsejours","width=" + w_width + ",height=" + w_height + "")
    setTimeout('update()',100)
}

function update() {
    doc = picwin.document;
    doc.open('text/html');
    doc.write('<HTML><HEAD><TITLE>' + documenttitle + '<\/TITLE><\/HEAD><BODY bgcolor="#FFFFFF" background="' + imagepath + '" onblur="javascript:self.close()">');
    doc.write('<\/BODY><\/HTML>');
    doc.close();
}


function PopUp(file, name, width, height) {
	window.open(''+ file + '',''+ name + '','width=' + width + ',height=' + height + '');

}

function Mailto() { 
  var who = "info";
  var serveur = "kamapigment.com";
  window.location = "mailto:" + who + "@" + serveur +"?subject=";
}

function MailtoLis() { 
  var who = "info";
  var serveur = "activlis.com";
  window.location = "mailto:" + who + "@" + serveur +"?subject=";
}

function v(){
	
	var g=0;
	if (document.forms.mailCat.nom.value == "")  { if (parseInt(document.forms.mailCat.llang.value)==1) alert('Please enter Family Name'); else alert('Nom de famille manquant'); g=1;return;}
	if (document.forms.mailCat.prenom.value == "")   { if (parseInt(document.forms.mailCat.llang.value)==1) alert('Please enter First Name'); else alert('Pr&eacute;nom manquant'); g=1;return;}
	if (document.forms.mailCat.adresse.value == "") { if (parseInt(document.forms.mailCat.llang.value)==1) alert('Please enter Street Address');else alert('Adresse incomplète'); g=1;return;}
	if (document.forms.mailCat.ville.value == "" )  { if (parseInt(document.forms.mailCat.llang.value)==1) alert('Please enter City'); else alert('Veuillez indiquer la ville'); g=1;return;}
	if (document.forms.mailCat.prov.value == "" )  {if (parseInt(document.forms.mailCat.llang.value)==1) alert('Please enter Province / State'); else alert('Veuillez indiquer la province/l\'&eacute;tat/le d&eacute;partement'); g=1;return;}
	if (document.forms.mailCat.pays.value == ""){ if (parseInt(document.forms.mailCat.llang.value)==1) alert('Please enter Country'); else alert('Veuillez indiquer le pays'); g=1;return;}
	if (document.forms.mailCat.postal.value == "" )    { if (parseInt(document.forms.mailCat.llang.value)==1) alert('Please enter Postal code / Zip'); else alert ('Veuillez indiquer le code postal'); g=1;return;}
	if (document.forms.mailCat.email.value == "")  { if (parseInt(document.forms.mailCat.llang.value)==1) alert('Please enter valid email address'); else alert('Veuillez indiquer une adresse de courriel valide'); g=1;return;}
	if (IsOk()==0) if (g==0) document.forms.mailCat.submit(); 
	}
	function IsOk(){
	var ecod = 0;var i =0;
	var done='false';
	for (i=0; i<document.forms.mailCat.elements.length;i++){
			if (document.forms.mailCat.elements[i].value){
				j = document.forms.mailCat.elements[i].value.indexOf('<');
				if (j>=0){alert('Unacceptable character detected'); return 10;}
			}
	}
	j = document.forms.mailCat.email.value.indexOf('@');
	if  (j<1) { if (parseInt(document.forms.mailCat.llang.value)==1) alert('Email not valid'); else alert ('Courriel non valide'); return 20;}
	return ecod;
}

