
// cambio tipo form di contatto da privato ad azienda
function TipoChange(){
  var tipo=document.getElementById('tipo').value;
  if(tipo=='A'){var ntipo='P'; var stst='none'; var plab=document.getElementById('ttipo'+ntipo).value;}
  else{var ntipo='A'; var stst='block'; var plab=document.getElementById('ttipo'+ntipo).value;}
  document.getElementById('tipo').value=ntipo; document.getElementById('tipoB').innerHTML="<img src='images/empty.png' width=1 height=2 border=0><br>"+plab;
  document.getElementById('ragsoc_DVM').style.display=stst;
}
// cambio motivo di contattodel form
function FormMotiv(id){
  if(id==1){var stst='block';}else{var stst='none';}
  document.getElementById('period_dal_DVM').style.display=stst; document.getElementById('period_al_DVM').style.display=stst; document.getElementById('ospiti_DVM').style.display=stst;
}

// Mostra / nasconde un DIV con la modalità "display"
function AltroShow(val,id){
  var divx=document.getElementById(id);
  if(id=='cercodiv' && val==4 || id=='dovediv' && val==8){divx.style.display="block";}else{divx.style.display="none";}
}

function ResidOn(id,stato){
  document.getElementById('resid_'+id).className='resid'+stato;
}

function PrSch(url){myWindow = window.open(url,'scheda','toolbar=no,scrollbars=yes,resizable=no,directories=no,menubar=yes,status=no,width=625,height=550');}
function PrZoo(p){var n=document.getElementById('zomnum').value; axLoaderScript('scripts/scheda_img_zoom.php?id='+p+'&n='+n,'PrZooExe');}
function PrZooExe(imgurl){document.getElementById('ImgZommy').style.background="url("+imgurl+") no-repeat center top";  document.getElementById('ImgZommy').style.display="block";}
function PrZooH(){document.getElementById('ImgZommy').style.background="url(images/sch_noimg_280.gif) no-repeat center top"; document.getElementById('ImgZommy').style.display="none";}
function PrTZoo(idt,n){axLoaderScript('scripts/scheda_imgtip_zoom.php?idt='+idt+'&n='+n,'PrTZooExe');}
function PrTZooExe(esito){var a=esito.split('|'); var imgurl=a[0]; var idt=a[1]; document.getElementById('ImgZommy'+idt).style.background="url("+imgurl+") no-repeat center top";  document.getElementById('ImgZommy'+idt).style.display="block";}
function PrTZooH(idt){document.getElementById('ImgZommy'+idt).style.background="url(images/sch_noimg_280.gif) no-repeat center top"; document.getElementById('ImgZommy'+idt).style.display="none";}

function CatOn(id){ document.getElementById("DIVcat"+id).className='CategBoxON'; document.getElementById("TDcat"+id).className='CategTxtON'; }
function CatOff(id){ document.getElementById("DIVcat"+id).className='CategBox'; document.getElementById("TDcat"+id).className='CategTxt'; }

function CrImgOff(id){ document.getElementById("CrI"+id).src='images/carr-off.png'; document.getElementById("CrTD"+id).className='TDoff';}
function CrImgOn(id){ document.getElementById("CrI"+id).src='images/carr-on.png';  document.getElementById("CrTD"+id).className='TDon';}

function ScImgOff(id,s){ document.getElementById("ScI"+id).src='images/scheda_'+s+'.gif'; document.getElementById("ScTD"+id).className='TDoff';}
function ScImgOn(id){ document.getElementById("ScI"+id).src='images/scheda_on.gif'; document.getElementById("ScTD"+id).className='TDon';}

function CrrImgOff(id){ document.getElementById("CrrI"+id).src='images/cestino-off.gif'; document.getElementById("CrrTD"+id).className='TDoff';}
function CrrImgOn(id){ document.getElementById("CrrI"+id).src='images/cestino-on.gif';  document.getElementById("CrrTD"+id).className='TDon';}

function SchedaImgChange(bodys){ 
  var imgs=bodys.split("||");
  document.getElementById("Foto").style.background='url('+imgs[0]+') no-repeat center top';
  document.getElementById("Fotine").innerHTML=imgs[1];
}
function ShowFormDesty(id,id2) {
  var vall=document.getElementById(id2).value;
  var divv=document.getElementById(id);
  if(vall=='C2'){divv.style.display="block"}else{divv.style.display="none"}
}
function ShowHideRegme() {
  var rdo=document.getElementById('B2B2');
  var regm=document.getElementById('reg_mediv');
  if(rdo.checked==true){regm.style.display="block"}else{regm.style.display="none"}
}
function ShowHide(id) {
  var divv=document.getElementById(id);
  divv.style.display=(divv.style.display=="block") ? "none" : "block";
}
function PagBanca(url){window.location.href=url;}

function PaySubm(){
  var ko=0; var kon='';
  amount=document.d1.amount;  first_name=document.d1.first_name;  last_name=document.d1.last_name;  address1=document.d1.address1;  note=document.d1.note;
  zip=document.d1.zip;  city=document.d1.city;  state=document.d1.state;  email=document.d1.email;  night_phone_b=document.d1.night_phone_b;
  if(amount.value==''){ko++; amount.style.background='#FF1D05';} else{ amount.style.background='#FFFFFF';}
  if(first_name.value==''){ko++; first_name.style.background='#FF1D05';} else{first_name.style.background='#FFFFFF';}
  if(last_name.value==''){ko++; last_name.style.background='#FF1D05';} else{last_name.style.background='#FFFFFF';}
  if(address1.value==''){ko++; address1.style.background='#FF1D05';} else{address1.style.background='#FFFFFF';}
//  if(zip.value==''){ko++; zip.style.background='#FF1D05';} else{zip.style.background='#FFFFFF';}
  if(city.value==''){ko++; city.style.background='#FF1D05';} else{city.style.background='#FFFFFF';}
//  if(state.value==''){ko++; state.style.background='#FF1D05';} else{state.style.background='#FFFFFF';}
  if(email.value==''){ko++; email.style.background='#FF1D05';} else{email.style.background='#FFFFFF';}
  if(night_phone_b.value==''){ko++; night_phone_b.style.background='#FF1D05';} else{night_phone_b.style.background='#FFFFFF';}
//  if(note.value==''){ko++; note.style.background='#FF1D05';} else{note.style.background='#FFFFFF';}
  if(ko==1){lett='Il campo indicato non è stato compilato in modo corretto.';}
  if(ko>1){lett='I campi indicati non sono stati compilati in modo corretto.';}
  if(ko>0){alert(lett);} else{document.d1.submit();}
}
