var dominio = "http://www.enoclub2000.it"

function firstSWF(){
	var shtml = "<object classid=\"clsid:d27CDB6E-AE6D-11cf-96B8-444553540000\"";
	shtml += " codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0\"";
	shtml += "  width=\"100%\" height=\"98%\" id=\"simple_movie\" align=\"\">";
	shtml += " <param name=\"movie\" value=\""+dominio+"/images/enoclub-intro.swf\">";
	shtml += " <param name=\"quality\" value=\"high\">";
	shtml += " <param name=\"bgcolor\" value=\"#000000\">";
	shtml += " <param name=\"wmode\" value=\"window\">";
	shtml += " <param name=\"scale\" value=\"noborder\">";
	shtml += " <embed src=\""+dominio+"/images/enoclub-intro.swf\" ";
	shtml += " quality=\"high\" bgcolor=\"#000000\" scale=\"noborder\" width=\"100%\" height=\"100%\" ";
	shtml += " name=\"simple_movie\" align=\"\" wmode=\"window\" ";
	shtml += "  type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>";
	shtml += "     </object>"

	var md = document;
	var swf1 = md.getElementById("first");
	swf1.innerHTML = shtml;
}

function testaSWF(){
	var shtml = "<object classid=\"clsid:d27CDB6E-AE6D-11cf-96B8-444553540000\"";
	shtml += " codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0\"";
	shtml += "  width=\"726\" height=\"142\" id=\"simple_movie\" align=\"\">";
	shtml += " <param name=\"movie\" value=\""+dominio+"/images/enoclub-head08.swf\">";
	shtml += " <param name=\"quality\" value=\"high\">";
	shtml += " <param name=\"bgcolor\" value=\"#000000\">";
	shtml += " <param name=\"wmode\" value=\"transparent\">";
	shtml += " <embed src=\""+dominio+"/images/enoclub-head08.swf\" ";
	shtml += " quality=\"high\" bgcolor=\"#000000\" width=\"726\" height=\"142\" ";
	shtml += " name=\"simple_movie\" align=\"\" wmode=\"transparent\" ";
	shtml += "  type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>";
	shtml += "     </object>"

	var md = document;
	var swf5 = md.getElementById("flashtesta");
	swf5.innerHTML = shtml;
}

function captchaSWF(capcode)
{
	var shtml = "<object classid=\"clsid:d27CDB6E-AE6D-11cf-96B8-444553540000\"";
	shtml += " codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0\"";
	shtml += "  width=\"120\" height=\"32\" id=\"simple_movie\" align=\"\">";
	shtml += " <param name=\"movie\" value=\""+dominio+"/images/captcha.swf?code="+capcode+"\">";
	shtml += " <param name=\"quality\" value=\"high\">";
	shtml += " <param name=\"bgcolor\" value=\"#000000\">";
	shtml += " <param name=\"wmode\" value=\"window\">";
	shtml += " <embed src=\""+dominio+"/images/captcha.swf?code="+capcode+"\" ";
	shtml += " quality=\"high\" bgcolor=\"#000000\" width=\"120\" height=\"32\" ";
	shtml += " name=\"simple_movie\" align=\"\" wmode=\"window\" ";
	shtml += "  type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>";
	shtml += "     </object>"

	var md = document;
	var swf6 = md.getElementById("captcha");
	swf6.innerHTML = shtml;
}
	
	var url_match = /https?:\/\/([-\w\.]+)+(:\d+)?(\/([\w/_\.]*(\?\S+)?)?)?/;
	var email_match = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*\.(\w{2}|(com|net|org|edu|int|it|eu|co.uk|biz|aero|name|coop|info|pro|museum))$/;
	var txt_match = /^[a-zA-Z0-9-._ ]+$/;


/*RIDIMENSIONA LE IMMAGINI*/

     function FitPic(id_img,maxw)
	 {

       Dimesioni_massime = maxw;
	   Dimesioni_reali = document.getElementById(id_img).width
	   
	   
	   if(Dimesioni_reali > Dimesioni_massime)
	   {
		   document.getElementById(id_img).width = Dimesioni_massime
	   }
     }


//verifica richiesta informazioni
function verifica_info()
{
  var emailID=document.frm_informazioni.email
  if(document.frm_informazioni.nome.value == "" )
	alert ("Il campo nome è obbligatorio");
  else if(document.frm_informazioni.cognome.value == "" )
	alert ("Il campo cognome è obbligatorio");
  else if(emailID.value == "")
	alert ("Inserite il vostro indirizzo e-mail");
  else if (!email_match.test(emailID.value))
	alert ("Inserite un indirizzo email valido");
  else if(document.frm_informazioni.info_richieste.value == "" )
	alert ("Il campo informazioni richieste è obbligatorio");
  else if(document.frm_informazioni.captcha_ver.value != document.frm_informazioni.captcha_code.value )
	alert ("Il codice di verifica non coincide");
	
	
  else
  document.frm_informazioni.submit();
}


//verifica la ricerca dei locali

function verifica_ricerca_locali()
{
  if ((document.cerca_locali.regione_it.value == "") && (document.cerca_locali.provincia_it.value == "") && (document.cerca_locali.paese_it.value == ""))
	alert ("E' necessario inserire almeno un termine di ricerca");
  else
  document.cerca_locali.submit();
}

function verifica_commenti()
{
	var autore_it=document.frm_commenti.autore_it  
	if(autore_it.value == "" )
		alert ("Il campo autore è obbligatorio");
	else if (!txt_match.test(autore_it.value))
		alert ("Il campo autore è obbligatorio e può contenere solo lettere e numeri");
	else if(document.frm_commenti.commento_it.value == "" )
		alert ("Non è stato espresso alcun commento");
	else if(document.frm_commenti.accettazione_trattamento_dati[1].checked)
		alert ("Per proseguire è necessario accettare il trattamento dei dati");
	else if(document.frm_commenti.captcha_ver.value != document.frm_commenti.captcha_code.value )
		alert ("Il codice di verifica non coincide");
		
	else
	document.frm_commenti.submit();
}
