// 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 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;
}

function DownCat() {
	if (document.forms.catcurr.currency[0].checked == true)  {
	CatCurrency = document.forms.catcurr.currency[0].value;
	}else {
	CatCurrency = document.forms.catcurr.currency[1].value;
	}
	window.open ( "../../catalogue/cateng_" + CatCurrency + ".pdf","_blank");
	}

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 MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


if (document.getElementById) {
document.writeln('<style type="text/css"><!--')
document.writeln('.texter {display:none} @media print {.texter {display:block;}}')
document.writeln('//--></style>') }

function openClose(theID) {
if (document.getElementById(theID).style.display == "block") { document.getElementById(theID).style.display = "none" }
else { document.getElementById(theID).style.display = "block" } 

}
