function CambiaImage(nome,num){
	var nome_div = document.getElementById(nome);
	nome_div.style.background = "url('http://www.hotel-cesenatico.eu/html/img/btn0"+num+"_b.jpg') no-repeat";
	return;
}

function RimettiImage(nome,num){
	var nome_div = document.getElementById(nome);
	nome_div.style.background = "url('http://www.hotel-cesenatico.eu/html/img/btn0"+num+"_a.jpg') no-repeat";
	return;
}

function CambiaStelle(idImg){
	var nome_img = document.getElementById(idImg);
	nome_img.src = "http://www.hotel-cesenatico.eu/html/img/menu_"+idImg+"_on.gif";
	return;
/*
	var nome_img = document.getElementById('stelle'+num);
	if (num==0) {nome_img.src = "http://www.hotel-cesenatico.eu/html/img/cat_hotel_r_sel.gif";}
	else {nome_img.src = "http://www.hotel-cesenatico.eu/html/img/cat_hotel_"+num+"_sel.gif";}
	return;
*/
}

function RimettiStelle(idImg){
	var nome_img = document.getElementById(idImg);
	nome_img.src = "http://www.hotel-cesenatico.eu/html/img/menu_"+idImg+"_off.gif";
	return;
/*
	var nome_img = document.getElementById('stelle'+num);
	if (num==0) {nome_img.src = "http://www.hotel-cesenatico.eu/html/img/cat_hotel_r.gif";}
	else {nome_img.src = "http://www.hotel-cesenatico.eu/html/img/cat_hotel_"+num+".gif";}
	return;

*/
}

function Cambia(num){
	var nome='open'+num
	var nome_div = document.getElementById(nome);
	nome_div.style.background = "url('http://www.hotel-cesenatico.eu/html/img/hotel_hover_left.jpg') no-repeat";
	var nome='close'+num
	var nome_div = document.getElementById(nome);
	nome_div.style.background = "url('http://www.hotel-cesenatico.eu/html/img/hotel_hover_right.jpg') no-repeat";
	return;
}

function Rimetti(num){
	var nome_div = document.getElementById('open'+num);
	nome_div.style.background = "";
	var nome_div = document.getElementById('close'+num);
	nome_div.style.background = "";
	return;
}

function CambiaLoc(d){
	var nome_li = document.getElementById('cesenatico'+d);
	nome_li.style.background = "url('http://www.hotel-cesenatico.eu/html/img/tratteggio_bkg_scuro.gif') repeat-x";
	return;
}

function RimettiLoc(d){
	var nome_li = document.getElementById('cesenatico'+d);
	nome_li.style.background = "url('http://www.hotel-cesenatico.eu/html/img/tratteggio_bkg_chiaro.gif') repeat-x";
	return;
}

function CambiaSin(d,s){
	var nome_img = document.getElementById(d+s);
	nome_img.src = "http://www.hotel-cesenatico.eu/html/img/tab_label_"+d+"_over.gif";
	return;
}

function TornaSin(d,s){
	var nome_img = document.getElementById(d+s);
	nome_img.src = "http://www.hotel-cesenatico.eu/html/img/tab_label_"+d+".gif";
	return;
}

function BloccaSin(d){
	var nome_div = document.getElementById("varie_eventi");
	nome_div.style.display = "none";
	var nome_div = document.getElementById("varie_meteo");
	nome_div.style.display = "none";
	var nome_div = document.getElementById("varie_info");
	nome_div.style.display = "none";
	var nome_div = document.getElementById(d);
	nome_div.style.display = "block";
	return;
}

function Verifica() {
  var p,errors='';
  if (document.prenotazione.nome.value=="") errors='- Nome è un campo obbligatorio.\n';
  if (document.prenotazione.privacy.checked==false) errors+='- Privacy è obbligatorio.\n';
  if (document.prenotazione.email.value=="") {
	errors+='- Email è un campo obbligatorio.\n';
  }
  else {
	p=document.prenotazione.email.value.indexOf('@');
	if (p<1 || p>(document.prenotazione.email.value.length-5)) errors+='- Email deve essere un indirizzo valido.\n';
	else {
		p=document.prenotazione.email.value.indexOf('.');
		if (p<1 || p>(document.prenotazione.email.value.length-3)) errors+='- Email deve essere un indirizzo valido.\n';
	}
  }
  if (errors) {
	alert('I seguenti campi non sono validi:\n'+errors);
	return false;
  }
return true;
}

function CambiaMezzo(val){
	var nome_img = document.getElementById(val);
	nome_img.src = "http://www.hotel-cesenatico.eu/html/img/icon_"+val+"_sel.gif";
	return;
}

function TornaMezzo(val){
	var nome_img = document.getElementById(val);
	nome_img.src = "http://www.hotel-cesenatico.eu/html/img/icon_"+val+".gif";
	return;
}

function Verifica_news() {
  var p,errors='';
  if (document.newsletter.nome.value=="") errors='- Nome è un campo obbligatorio.\n';
  if (document.newsletter.privacy.checked==false) errors+='- Privacy è obbligatorio.\n';
  if (document.newsletter.email_news.value=="") {
	errors+='- Email è un campo obbligatorio.\n';
  }
  else {
	p=document.newsletter.email_news.value.indexOf('@');
	if (p<1 || p>(document.newsletter.email_news.value.length-5)) errors+='- Email deve essere un indirizzo valido.\n';
	else {
		p=document.newsletter.email_news.value.indexOf('.');
		if (p<1 || p>(document.newsletter.email_news.value.length-3)) errors+='- Email deve essere un indirizzo valido.\n';
	}
  }
  if (errors) {
	alert('I seguenti campi non sono validi:\n'+errors);
	return false;
  }
return true;
}

//------------------------------------

function mostraDiv(div){
	var nome_div = document.getElementById(div);
	nome_div.style.display = 'block';
}

function nascondiDiv(div){
	var nome_div = document.getElementById(div);
	nome_div.style.display = 'none';
}

function Cambia_sfondo(div,img){
	var nome_div = document.getElementById(div);
	nome_div.style.background = "url('"+img+"') top no-repeat";
}

function popup(url, w, h) {
	newWindow = window.open(url,'popupWindow','width='+w+', height='+h+', left=300, top=300, menubar=no, toolbar=no, location=no, bookmarks=no, status=no, scrollbars=no, resizable=no');
	if (window.focus) {
		newWindow.focus();
	}
}

function MM_findObj(n, d) { //v3.0
  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); 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 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];}}
}
