var winAdr;
var winPrint;       
		 
function gotoPage(adr){
	if(adr){
		if((adr == "partenaire") || (adr == "coordonnee") || (adr == "lexique")){
			openWin("anx",adr)
		} else if (adr == "mention"){
			openWin("men",adr)
		} else {
			
			window.opener.location.href = "../pages/"+adr+".asp"
		}
	}
}		 
function verifEmail(mail) {
	var aro = mail.indexOf("@")
	var dot = mail.lastIndexOf(".")
	if((aro < 3)||(point + 2 > mail.length)||(dot < aro+3)) return false
	return true
}
function verifForm(n,s,m) {
	if(n.value=="") {
		alert("Un nom est requis !")
		n.focus(); 
		return false }
	if(s.value=="") {
		alert("Un nom de société est requis !")
		s.focus();
		return false }
	if(!verifEmail(m.value)) {
		alert("Email invalide !"); m.value=""
		m.focus(); 
		return false }
	return true
}
			

function openWin(){

	if(openWin.arguments.length){
		winType = openWin.arguments[0];
		fileName = openWin.arguments[1];
		typeExt = openWin.arguments[2];
		var features = "toolbar=yes,location=no,status=yes,menubar=no,scrollbars=no,resizable=yes,width=620,height=";						
		if (winType == "Cv"){
		//fenetre cv
			var theURL = "../cv/"+fileName+".asp";
			if(fileName == "thieux"){
				var features = features + "610"
			} 
			else if(fileName == "amet"){
				var features = features + "550"
			}
			else if(fileName == "rey"){
				var features = features + "550"
			}else {
				var features = features + "520"
			}					
		} else if (winType == "anx"){
			// fenetre annexes
			var features = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=620,height=630";						
			if(fileName=="plan"){winType = "plan"}
			var theURL = "../annexes/"+fileName+".asp";					
		} else if (winType == "men"){
			// fenetre annexes
			var features = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=620,height=600";						
			var theURL = "../annexes/"+fileName+".asp";					
		} 
		else if (winType == "form"){
			// fenetre forms	
			var features = "toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=620,height=585";			
			var theURL = "../forms/form_"+fileName+".asp";
			if (fileName == "ml"){
				var theURL = theURL+"?se="+openWin.arguments[2];
			}
								
		} 
		/*** Ouverure Lettre info Ingenierie Patrimoniale/Arkeon Finance en tant que pop-up ***/
		else if(winType =="pdf"){
		    var theURL = fileName;
			var features = "toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=620,height=585";			
		}
		/*********************************/
		else if(winType =="info"){
		
		    var theURL = fileName;
			/*if(parseInt(typeExt)<= 0){
		      theURL = theURL + typeExt + ".htm";
			}
			else{
			  theURL = theURL + typeExt + ".pdf";
			}*/
			theURL = theURL + typeExt + ".pdf";
			var features = "toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=620,height=585";			
		}
		else if(winType =="hebdo"){
		    var theURL = fileName;
			var features = "toolbar=yes,location=yes,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=620,height=585";			
		}
		/*********************************/
			var re = new RegExp("default");
			if(re.test(theURL)){
			  alert("Vous devez choisir un document !");
			  return false
			}
		winAdr = window.open(theURL,winType,features);
		if(winAdr.focus){winAdr.focus();}
		
	}	
}

function printWin(winType){
	if (winType=="bdd"){
		window.print();
	} else if (winType=="lex"){
		//alert("sss="+window.parent.name);
		parent.mainFrame.focus();
		window.print();


	}
	else {
		var doc2print = document.URL;
		winPrint = window.open('../../scripts/print.asp?fileName='+doc2print ,'windowPrint', 'toolbar=no,menubar=no,scrollbars=no,resizable=no,width=200,height=150') ;
		window.focus();
	}
}
function winPrint() {
	setTimeout("self.close()",2000);
		}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.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];}
}



