function TrackIT(openpag) {
	document.location.href = openpag;
}


// INC ----------------------------------------------------------------------------------------------------------------
function IncludeJavaScript(jsFile)
{
  document.write('<script type="text/javascript" src="'
    + jsFile + '"></script>'); 
}

IncludeJavaScript('../scr/prototype.js');
IncludeJavaScript('../scr/effects.js');
IncludeJavaScript('../scr/lightwindow.js');
IncludeJavaScript('../scr/lb/lb.js');


// --------------------------------------------------------------------------------------------------------------------
function showhide(pageelement) {
	if (document.getElementById('visibile').value == 'si')
	{
		document.getElementById(pageelement).style.display = 'none';
		document.getElementById('visibile').value = 'no';
	} else {
		document.getElementById(pageelement).style.display = '';
		document.getElementById('visibile').value = 'si';
	}
}


today=new Date()
var dateto=new Date(today.getFullYear(), 5, 26)//0,xx=gennaio
if (today.getMonth()==7 && today.getDate()>26)
dateto.setFullYear(dateto.getFullYear()+1)
var one_day=1000*60*60*24


function OpenLink(LinkToOpen) {
	document.location.href = LinkToOpen;
}


function ApriFile(UrlFile){
	var wh = 500
	var hh = 500
	var winl = (screen.width - wh) / 2;
	var wint = (screen.height - hh) / 2;
	window.open(UrlFile,"FilPre","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+wh+",height="+hh+",top="+wint+",left="+winl+"");
}

function offer(){
	myLightWindow.activateWindow({ href: '../offer.htm', 
		title: 'Offerta - Angebot - offers', caption: '', type: 'external', width: 550, height: 250 });
}

function Comforts_de(){
	myLightWindow.activateWindow({ href: 'comforts.htm', 
		title: 'Comforts', caption: '', type: 'external', width: 550, height: 700 });
}

function Comforts_it(){
	myLightWindow.activateWindow({ href: 'comforts.htm', 
		title: 'Comforts', caption: '', type: 'external', width: 550, height: 700 });
}

function Comforts_en(){
	myLightWindow.activateWindow({ href: 'comforts.htm', 
		title: 'Comforts', caption: '', type: 'external', width: 550, height: 700 });
}



// --------------------------------------------------------------------------------------------------------------------


function firstClear(obj)
{
  if(obj.clearThis == undefined)
  {
    obj.value = '';
    obj.clearThis = true;
  } 
}

function firstClearP(obj)
{
  if(obj.clearThis == undefined)
  {
	obj.setAttribute('value','');
	obj.setAttribute('type','password');
	obj.setAttribute('name',obj.getAttribute('name'));
	obj.parentNode.replaceChild(newO,obj);
	obj.focus();
    obj.clearThis = true;
  } 
}

var fadebgcolor="#ffffff"
var fadearray=new Array()
var fadeclear=new Array()
var dom=(document.getElementById)
var iebrowser=document.all
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //iop(10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();})
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array()
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative; z-index:1;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute; z-index:1;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute; z-index:1;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}
function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}

function SendGutscheinDE()
{	
	errfound = false;
	
	if (!ValidLength(document.FrmReq.TxtVorname.value,3))
		error(document.FrmReq.TxtVorname,"Bitte geben Sie Ihren Vornamen ein.");
	if (!ValidLength(document.FrmReq.TxtNachname.value,3))
		error(document.FrmReq.TxtNachname,"Bitte geben Sie Ihren Nachnamen ein.");
	if (!ValidLength(document.FrmReq.TxtTel.value,6))
		error(document.FrmReq.TxtTel,"Bitte geben Sie Ihre Telefonnummer ein.");
	if (!ValidEmail(document.FrmReq.TxtMail.value))
		error(document.FrmReq.TxtMail, "Bitte geben Sie Ihre E-Mail Adresse ein.");
	if (document.FrmReq.TxtPrivacy.checked == 0)
		error(document.FrmReq.TxtPrivacy,"Sie müssen die Bedingungen des Gesetzes 675/96\nüber die Behandlung der persönlichen Daten\nzustimmen.");
	if (errfound == false)
		{
			document.FrmReq.TxtCheck03.value = 'validato';
			document.FrmReq.BtnSend.disabled = true;
			document.FrmReq.BtnSend.value = 'Ihre Anfrage wird gesendet...';
			document.FrmReq.submit();
		}
}

function SendGutscheinEN()
{	
	errfound = false;
	
	if (!ValidLength(document.FrmReq.TxtVorname.value,3))
		error(document.FrmReq.TxtVorname,"Please enter your name.");
	if (!ValidLength(document.FrmReq.TxtNachname.value,3))
		error(document.FrmReq.TxtNachname,"Please enter your surname.");
	if (!ValidLength(document.FrmReq.TxtTel.value,6))
		error(document.FrmReq.TxtTel,"Please enter your phone number.");
	if (!ValidEmail(document.FrmReq.TxtMail.value))
		error(document.FrmReq.TxtMail, "Please enter your e-mail address.");
	if (document.FrmReq.TxtPrivacy.checked == 0)
		error(document.FrmReq.TxtPrivacy,"To continue you must agree the privacy statement.");
	if (errfound == false)
		{
			document.FrmReq.TxtCheck03.value = 'validato';
			document.FrmReq.BtnSend.disabled = true;
			document.FrmReq.BtnSend.value = 'Sending your request...';
			document.FrmReq.submit();
		}
}

function SendGutscheinIT()
{	
	errfound = false;
	
	if (!ValidLength(document.FrmReq.TxtVorname.value,3))
		error(document.FrmReq.TxtVorname,"Inserire il proprio nome.");
	if (!ValidLength(document.FrmReq.TxtNachname.value,3))
		error(document.FrmReq.TxtNachname,"Inserire il proprio cognome.");
	if (!ValidLength(document.FrmReq.TxtTel.value,6))
		error(document.FrmReq.TxtTel,"Inserire il proprio numero telefonico.");
	if (!ValidEmail(document.FrmReq.TxtMail.value))
		error(document.FrmReq.TxtMail, "Inserire il proprio indirizzo e-mail.");
	if (document.FrmReq.TxtPrivacy.checked == 0)
		error(document.FrmReq.TxtPrivacy,"Per proseguire è necessario acconsentire il trattamento dei dati personali.");
	if (errfound == false)
		{
			document.FrmReq.TxtCheck03.value = 'validato';
			document.FrmReq.BtnSend.disabled = true;
			document.FrmReq.BtnSend.value = 'Invio della richiesta in corso...';
			document.FrmReq.submit();
		}
}

function ValidLength(item, len) 
{	
	return(item.length >=len);
}
function ValidEmail(item)
{	
	if(!ValidLength(item,5)) return false;
	if(item.indexOf('@',0) == -1) return false;
	if(item.indexOf('.',0) == -1) return false;
	if(item.indexOf(',',0) > 0) return false;
	return true;	
}
function error(elem, text)
{	
	if (errfound) return;
	window.alert(text)
	elem.select();
	elem.focus;
	errfound = true;
}
function NewsletterDE(){
	window.open('../newsletter/popnews.asp?Lang=de','NewsPop','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width=400,height=450');
}
function NewsletterIT(){
	window.open('../newsletter/popnews.asp?Lang=it','NewsPop','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width=400,height=450');
}
function NewsletterEN(){
	window.open('../newsletter/popnews.asp?Lang=en','NewsPop','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width=400,height=450');
}

// ------------------------------------------------------------------------------------------------------------------------
// EXPRESS ANFRAGE SMALL (GENERATE DATE)
// ------------------------------------------------------------------------------------------------------------------------

function SetRequestDate(){
	var calcoloarrivo = new Date()
		calcoloarrivo.setDate(calcoloarrivo.getDate()+ 1)
	var calcolopartenza = new Date()
		calcolopartenza.setDate(calcolopartenza.getDate()+ 7)

	var mesearrivo=new Array(11)
	mesearrivo[0]="01"
	mesearrivo[1]="02"
	mesearrivo[2]="03"
	mesearrivo[3]="04"
	mesearrivo[4]="05"
	mesearrivo[5]="06"
	mesearrivo[6]="07"
	mesearrivo[7]="08"
	mesearrivo[8]="09"
	mesearrivo[9]="10"
	mesearrivo[10]="11"
	mesearrivo[11]="12"

	var giornoarrivo=new Array(11)
	giornoarrivo[0]="00"
	giornoarrivo[1]="01"
	giornoarrivo[2]="02"
	giornoarrivo[3]="03"
	giornoarrivo[4]="04"
	giornoarrivo[5]="05"
	giornoarrivo[6]="06"
	giornoarrivo[7]="07"
	giornoarrivo[8]="08"
	giornoarrivo[9]="09"
	giornoarrivo[10]="10"
	giornoarrivo[11]="11"
	giornoarrivo[12]="12"
	giornoarrivo[13]="13"
	giornoarrivo[14]="14"
	giornoarrivo[15]="15"
	giornoarrivo[16]="16"
	giornoarrivo[17]="17"
	giornoarrivo[18]="18"
	giornoarrivo[19]="19"
	giornoarrivo[20]="20"
	giornoarrivo[21]="21"
	giornoarrivo[22]="22"
	giornoarrivo[23]="23"
	giornoarrivo[24]="24"
	giornoarrivo[25]="25"
	giornoarrivo[26]="26"
	giornoarrivo[27]="27"
	giornoarrivo[28]="28"
	giornoarrivo[29]="29"
	giornoarrivo[30]="30"
	giornoarrivo[31]="31"

	var mesepartenza=new Array(11)
	mesepartenza[0]="01"
	mesepartenza[1]="02"
	mesepartenza[2]="03"
	mesepartenza[3]="04"
	mesepartenza[4]="05"
	mesepartenza[5]="06"
	mesepartenza[6]="07"
	mesepartenza[7]="08"
	mesepartenza[8]="09"
	mesepartenza[9]="10"
	mesepartenza[10]="11"
	mesepartenza[11]="12"

	var giornopartenza=new Array(11)
	giornopartenza[0]="00"
	giornopartenza[1]="01"
	giornopartenza[2]="02"
	giornopartenza[3]="03"
	giornopartenza[4]="04"
	giornopartenza[5]="05"
	giornopartenza[6]="06"
	giornopartenza[7]="07"
	giornopartenza[8]="08"
	giornopartenza[9]="09"
	giornopartenza[10]="10"
	giornopartenza[11]="11"
	giornopartenza[12]="12"
	giornopartenza[13]="13"
	giornopartenza[14]="14"
	giornopartenza[15]="15"
	giornopartenza[16]="16"
	giornopartenza[17]="17"
	giornopartenza[18]="18"
	giornopartenza[19]="19"
	giornopartenza[20]="20"
	giornopartenza[21]="21"
	giornopartenza[22]="22"
	giornopartenza[23]="23"
	giornopartenza[24]="24"
	giornopartenza[25]="25"
	giornopartenza[26]="26"
	giornopartenza[27]="27"
	giornopartenza[28]="28"
	giornopartenza[29]="29"
	giornopartenza[30]="30"
	giornopartenza[31]="31"

	var dataarrivo = giornoarrivo[calcoloarrivo.getDate()] + "/" + mesearrivo[calcoloarrivo.getMonth()] + "/" + calcoloarrivo.getFullYear()
	var datapartenza = giornopartenza[calcolopartenza.getDate()] + "/" + mesepartenza[calcolopartenza.getMonth()] + "/" + calcolopartenza.getFullYear()
	document.FrmBook.BookDal.value = dataarrivo
	document.FrmBook.BookAl.value = datapartenza
}


function PayIT(){
	var wh = 670
	var hh = 410
	var winl = (screen.width - wh) / 2;
	var wint = (screen.height - hh) / 2;
	window.open("../_vpos/ita/pay.asp","FilPre","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+wh+",height="+hh+",top="+wint+",left="+winl+"");
}

function PayDE(){
	var wh = 670
	var hh = 410
	var winl = (screen.width - wh) / 2;
	var wint = (screen.height - hh) / 2;
	window.open("../_vpos/deu/pay.asp","FilPre","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+wh+",height="+hh+",top="+wint+",left="+winl+"");
}

function PayEN(){
	var wh = 670
	var hh = 410
	var winl = (screen.width - wh) / 2;
	var wint = (screen.height - hh) / 2;
	window.open("../_vpos/eng/pay.asp","FilPre","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width="+wh+",height="+hh+",top="+wint+",left="+winl+"");
}
