var dettagli,virtualwindow;


function aprifinestra(indirizzo,largo,alto,nomewin,siono){
	lar=screen.width/2-largo/2;
	al=(screen.height/2-alto/2)-20;
	(siono)?siono='yes':siono='no'; 
		if (!(eval(nomewin)==null||eval(nomewin+".closed"))){
			eval(nomewin+".close()"); 
		}
		eval(nomewin+"=window.open('"+indirizzo+"','"+nomewin+"','width='+largo+',height='+alto+',left='+lar+',top='+al+',resize=no,scrollbars='+siono)");
}



function finestravirtuale(img){
aprifinestra('',250,150,"virtualwindow");
sorgente='<html><head><title>CapoVaticano.com</title></head>';
sorgente+='<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">';
sorgente+='<img src="'+img+'" name="pic" border="0" onLoad="allargami();">';
sorgente+='<BR><BR>';
sorgente+='<div align="center"><img src="/images/caricamento.gif" id="caricamento" name="caricamento"></div>';
sorgente+='<script src="/funzioni.js"></script>';
sorgente+='<script>';
if (!document.all) sorgente+='var caricamento=MM_findObj("caricamento");';
sorgente+='setTimeout("caricamento.width=0;caricamento.height=1" , 5000);';
sorgente+='function allargami(yes){';
if (!document.all) sorgente+='		pic=MM_findObj("pic");';
sorgente+='		var largo=pic.width+10;';
sorgente+='		var alto=pic.height+80;';
sorgente+='		var i=1;';
sorgente+='		lar=screen.width/2-largo/2;';
sorgente+='		al=(screen.height/2)-(alto/2)-20;';
sorgente+='		self.resizeTo(largo,alto);';
sorgente+='		self.moveTo(lar,al);';
sorgente+='		if (yes!=1) allargami(1);}';
sorgente+='</script>';
sorgente+='</body></html>';

if (virtualwindow.document.pic==null) {
	virtualwindow.document.write(sorgente);
} else {
	virtualwindow.document.pic.src=img;
	virtualwindow.allargami();
	}
}


function cambiastile(stile,cont,img,isroot){
	var isroot=(isroot)?'images/':'../images/';
	if (cont=='over') {document.getElementById(stile).className='titolo verde';document.getElementById(img).src=isroot+'punto.gif';}
	else {document.getElementById(stile).className='titolo marrone';document.getElementById(img).src=isroot+'pixel.gif';}
}


function over(liv){
	objliv=MM_findObj(liv);
	objliv.style.visibility='visible';
}

function out(liv){
	objliv=MM_findObj(liv);
	objliv.style.visibility='hidden';
}

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();
}
MM_reloadPage(true);

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&&id.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function unblur() {
	this.blur();
} 

function blurLinks() {
	if (!document.getElementById) return;
	theLinks = document.getElementsByTagName("A");
	theAreas = document.getElementsByTagName("AREA");
	for(i=0; i<theLinks.length; i++) {theLinks[i].onfocus = unblur;}
	for(i=0; i<theAreas.length; i++) {theAreas[i].onfocus = unblur;}
	window.defaultStatus='Design by Medialeader';
  } 
  
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 our_check_form(nome_form) {
	nome_form=MM_findObj(nome_form);
	var email_reg_exp = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
	var errors='';
	if (nome_form.email){
		if ((nome_form.email.value == "") || (nome_form.email.value == "undefined")) {
		   errors+="\n Email: Obbligatoria";
		}
        else if (!email_reg_exp.test(nome_form.email.value)) {
           errors+="\n Email: Formato non Valido";
        }		
	}
	if (nome_form.nome){
		if ((nome_form.nome.value=='') || (nome_form.nome.value == "undefined")) {
			errors+="\n Nome: Obbligatorio";
		}
	}
	if (nome_form.richiamare){
		if ((nome_form.richiamare.value!='') && (isNaN(nome_form.richiamare.value))) {
			errors+="\n\n Telefono: Devono essere inseriti solo numeri \n\nesempio: \n029563254 corretto \n02/9563254 non corretto";
		}
	}
	/*
	if (nome_form.text){
		if ((nome_form.text.value == "") || (nome_form.text.value == "undefined")) errors+="\n Captcha: Obbligatorio - Il Captcha e' una sequenza di quattro lettere \n sotto riportate per evitare invii automatici";
		else if (nome_form.text.value.toUpperCase()!=capt)  {errors+="\n Captcha: Errato - - Il Captcha e' una sequenza di quattro lettere \n sotto riportate per evitare invii automatici";
		}
	}*/	if (errors) alert('Si sono verificati i seguenti errori:\n'+errors);	//nome_form.submit=false;
	document.mycheck = (errors == '');
}

