function animazione_flash() {
      document.write("<object type='application/x-shockwave-flash' data='slide.swf'width='215' height='300' id='filmato'> ");
      document.write("<param name='movie' value='cucciolate/08-2008/cuccioli.swf' /> ");
      document.write("<param name='quality' value='high' /><param name='wmode' value='transparent' /> ");
      document.write("</object> ");
}


//Controllo campi obbligatori
function formCheck(formobj){
	//1) Inserisci il nome che hai assegnato ai tuoi campi con name
	var fieldRequired = Array("user","nome","telefono","mail","messaggio","captcha");
	//2) Inserisci la descrizione del campo da riempire che appare nel messaggio a video
	var fieldDescription = Array("Nome","Cognome e Nome","Telefono","E-mail","Messaggio","Codice di verifica");
	//3) Inserisci il messagio che deve precedere l'elenco dei campi non inseriti.
	var alertMsg = "Per favore, riempi i seguenti campi:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++){
		var obj = formobj.elements[fieldRequired[i]];
		if (obj){
			switch(obj.type){
			case "select-one":
				if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "select-multiple":
				if (obj.selectedIndex == -1){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			case "text":
			case "textarea":
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
				break;
			default:
				if (obj.value == "" || obj.value == null){
					alertMsg += " - " + fieldDescription[i] + "\n";
				}
			}
		}
	}

	if (alertMsg.length == l_Msg){
		return true;
	}else{
		alert(alertMsg);
		return false;
	}
}

//Controllo email!
function ControllaMail(){
   EmailAddr = document.modulo.mail.value;
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(EmailAddr))
      return true;
   else
      {
		  if(EmailAddr != ""){
			  alert("Indirizzo e-mail non valido!");
			  document.modulo.mail.focus();
			  return false;
		}
      }
}

function ControllaMail2(){
   EmailAddr = document.modulo.email.value;
   Filtro = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,})+\.)+([a-zA-Z0-9]{2,})+$/;
   if (Filtro.test(EmailAddr))
      return true;
   else
      {
		  if(EmailAddr != ""){
			  alert("Indirizzo e-mail non valido!");
			  document.modulo.email.focus();
			  return false;
		}
      }
}
// Solo un checkbox non usato!!!
function checkBoxValidate(cb) {
for (j = 0; j < 2; j++) {
if (eval("document.modulo.ckbox[" + j + "].checked") == true) {
document.modulo.ckbox[j].checked = false;
if (j == cb) {
document.modulo.ckbox[j].checked = true;
         }
      }
   }
}

//Solo un cechbox per colore
lastObj=null
function checkDefault(n){
currentObj=document.getElementById("check"+n)
currentObj.checked=true
chkBox(currentObj)}

function chkBox(newObj){
count=0
result=[]
if(newObj!=lastObj){
while(document.getElementById("check"+count)){
currentObj=document.getElementById("check"+count)
if(newObj==currentObj){
result.push(currentObj.id)
result.push(currentObj.name)
result.push(currentObj.value)
}else{
currentObj.checked=false}
count++}
}
lastObj=newObj
document.getElementById("display").innerHTML="Checkbox ID = "+(result[0]?result[0]:"")+"<br>"
+"Checkbox name ="+(result[1]?result[1]:"")+"<br>"
+"Checkbox value = "+(result[2]?result[2]:"")
}

//Solo un ceckbox tra maschio e femmina!
function toggleIt(elm,name1,name2,name3){
	if (elm.name == name1){
		if (elm.checked) elm.form[name2].checked = false;
		else elm.form[name2].checked = true;
	}
	else if (elm.name == name2){
		if (elm.checked) elm.form[name1].checked = false;
		else elm.form[name2].checked = true;
	}
}

//JS inserimento Script per Guestbook
function emoticon(text) {
var txtarea = document.modulo.messaggio;
text = ' ' + text + ' ';
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;
txtarea.focus();
}
}
// Onderdeel van smiley toevoeging, cursor positie word opgeslagen
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

// Finestra di popup animata
function expandingWindow(website){
var windowprops='width=1,height=1,scrollbars=yes,status=no,resizable=yes,location=no'
var heightspeed = 2; 
var widthspeed = 2; 
var leftdist = 10;   
var topdist = 10; 
var lunghezza = 500;
var altezza = 300;
	if(lunghezza == 0){
		lunghezza = window.screen.availWidth;}
	if(altezza == 0){
		altezza = window.screen.availHeight;}
if (window.resizeTo&&navigator.userAgent.indexOf("Opera")==-1) {
var winwidth = lunghezza;
var winheight = altezza;
var sizer = window.open("","","left=" + leftdist + ",top=" + topdist +","+ windowprops);
for (sizeheight = 1; sizeheight < winheight; sizeheight += heightspeed)
sizer.resizeTo("1", sizeheight);
for (sizewidth = 1; sizewidth < winwidth; sizewidth += widthspeed)
sizer.resizeTo(sizewidth, sizeheight);
sizer.location = website;}
else
window.open(website,'mywindow');}

//Select dinamico
function changeLocation(menuObj) {
  var i = menuObj.selectedIndex;
  if(i > 0) {
    window.location.href = "index.php?page=14&select="+menuObj.options[i].value;
  }
}

//Popup a centro pagina
function centerPopUp( url, name, width, height, scrollbars ) {
if( scrollbars == null ) scrollbars = "0"
str = "";
str += "resizable=1,";
str += "scrollbars=" + scrollbars + ",";
str += "width=" + width + ",";
str += "height=" + height + ",";
if ( window.screen ) {
var ah = screen.availHeight - 30;
var aw = screen.availWidth - 10;
var xc = ( aw - width ) / 2;
var yc = ( ah - height ) / 2;
str += ",left=" + xc + ",screenX=" + xc;
str += ",top=" + yc + ",screenY=" + yc;
}
window.open( url, name, str );
}

//Testo Lampeggiante
var c1='f5fafe'
var c2='3c9ff1'
function colore1(){
codice='<font color=' + c1+ '><b>NUOVA CUCCIOLATA!</b></font>'
if(document.all)
{
document.all('testo').innerHTML=codice;
}
else if(document.getElementById){
document.getElementById("testo").innerHTML = codice
}
attesa = window.setTimeout("colore2()",500);
}
function colore2(){
codice='<font color=' + c2 + '><b>NUOVA CUCCIOLATA!</b></font>'
if(document.all)
{
document.all('testo').innerHTML=codice;
}
else if(document.getElementById){
document.getElementById("testo").innerHTML =codice
}
attesa = window.setTimeout("colore1()",500)
}
function avvia()
{
attesa = window.setTimeout("colore1()",500);
}

//Testo Lampeggiante
var c1='f5fafe'
var c2='3c9ff1'
function colore1(){
codice='<font color=' + c1+ '>Sono disponibili presso le sedi provinciali ENCI<br>i pedigree relativi alle cucciolate con lettere<br>"B", "C", "D".</font>'
if(document.all)
{
document.all('testo1').innerHTML=codice;
}
else if(document.getElementById){
document.getElementById("testo1").innerHTML = codice
}
attesa = window.setTimeout("colore2()",500);
}
function colore2(){
codice='<font color=' + c2 + '>Sono disponibili presso le sedi provinciali ENCI<br>i pedigree relativi alle cucciolate con lettere<br>"B", "C", "D".</font>'
if(document.all)
{
document.all('testo1').innerHTML=codice;
}
else if(document.getElementById){
document.getElementById("testo1").innerHTML =codice
}
attesa = window.setTimeout("colore1()",500)
}
function avvia()
{
attesa = window.setTimeout("colore1()",500);
}