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.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];}
}
function toggleView(id)
{
  // show/hide the divisions
  if(document.getElementById)
    document.getElementById(id).style.display = (document.getElementById(id).style.display == 'block') ? 'none' : 'block';
  else if (document.all)
    document.getElementById(id).style.display = (document.all[id].style.display == 'block') ? 'none' : 'block';

}
function hideimg(id)
{
	if (document.getElementById(id).style.display == 'block')
		document.getElementById(id).style.display = 'none';
	else
		document.getElementById(id).style.display = 'block'
}
function afficher_video(file, id1, id2)
{
			hideimg(id1); 
			hideimg(id2);
			document.getElementById(id2).innerHTML = "<embed type=\"application/x-mplayer2\" showstatusbar=1  src=\"videos/" + file + "\"></EMBEB></a><br><br><a href=\"javascript: fermer_video('"+id1+"', '"+id2+"')\">Fermer</a><br><br><br>";
}
function fermer_video(id1, id2)
{
	hideimg(id1); 
	hideimg(id2);
	document.getElementById(id2).innerHTML='';
}
function afficheVignette(cheminVignette,cheminMaxi)	
{	
document.write('<A HREF="javascript:afficheMaxi(\''+cheminMaxi+'\')"><IMG SRC="'+cheminVignette+'" BORDER=0 ALT="cliquez ici pour voir en grand" style="filter:alpha(opacity=60);margin-right: 5px;" onMouseover="visible(this,0)" onMouseout="visible(this,1)" align="left"></A>');	
}

function afficheVignette2(cheminVignette,cheminMaxi, alternative)	
{	
	text = '<a href="javascript:afficheMaxi(\''+cheminMaxi+'\')">';
	text += '<img src="'+cheminVignette+'" border="0" alt="'+alternative+'" style="filter:alpha(opacity=60);" onMouseover="visible(this,0)" onMouseout="visible(this,1)">';
	text += '</A>';
	document.write(text);	
}

function afficheMaxi(chemin)	{	i1 = new Image;	i1.src = chemin;	html = '<html><HEAD><TITLE>Photo d\'Alexandre del Valle</TITLE><style>a {  color: #E01205; text-decoration: none;font-family: Verdana;font-size: 11px;}a:active {  color: #000000} a:hover {  color: #000000; text-decoration: underline}</style></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0 onBlur=window.close()><CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+10,document.imageTest.height+90)"><br><a href="javascript:window.close();"><p>Fermer la fen&ecirc;tre</a></CENTER></BODY></HTML>';	popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');	popupImage.document.open();	popupImage.document.write(html);	popupImage.document.close()	};
function visible(cur,which){
if (which==0)
cur.filters.alpha.opacity=100
else
cur.filters.alpha.opacity=60
}
function VerifForm()
	{
	adresse = document.demande_contact.email.value;
	nom = document.demande_contact.nom.value;
	prenom = document.demande_contact.prenom.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >7)&&(point > 1)&&(nom != '')&&(prenom != ''))
		{
		document.demande_contact.Envoyer.disabled=true; 
		document.demande_contact.submit();
		}
	else
		{
	    alert('entra per favore informazioni valide (nome / cognome / Email), grazie');		
		}
	}

function checkNEmail(form) {
	if (isBlank(form.email.value) || isBlank(form.name.value) || !isEmailValid(form.email.value) ) 
	{
		alert("entrate un nome valido e un indirizzo mail.\n L'indirizzo mail o il nome che hai scritto non è valido.");
		form.email.focus();
		return false;
	}
	}

function checkEmail(form) {
	if (isBlank(form.email.value) || !isEmailValid(form.email.value) ) {
		alert(" inserisci per favore un indirizzo mail valido.\n l'indirizzo email inserito non è valido.");
		form.email.focus();
		return false;
	}
return true;

}

function isBlank(fieldValue) {
	var blankSpaces = / /g;
	fieldValue = fieldValue.replace(blankSpaces, "");
	return (fieldValue == "") ? true : false;
}

function isEmailValid(fieldValue) {
	var emailFilter = /^.+@.+\..{2,4}$/;
	var atSignFound = 0;
	for (var i = 0; i <= fieldValue.length; i++)
		if ( fieldValue.charAt(i) == "@" )
			atSignFound++;
	if ( atSignFound > 1 )
		return false;
	else
		return ( emailFilter.test(fieldValue) && !doesEmailHaveInvalidChar(fieldValue) ) ? true : false;
}

function doesEmailHaveInvalidChar(fieldValue) {
	var illegalChars = /[\(\)\<\>\,\;\:\\\/\"\[\] ]/;
	return ( illegalChars.test(fieldValue) ) ? true : false;
}


ie4 = document.all;
dom = document.getElementById;