// JavaScript Document

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

var risultato;
function switchImage(imgName, imgSrc) { if (document.images) 
            { if (imgSrc != "none") 
			{ document.images[imgName].src = imgSrc; 
			} 
		   } 
		}
					
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];}}
}

function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); 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 changeDescription(fotonumber,language){
  if (language=="it"){
    document.getElementById("40").innerHTML=fotodescription_it[fotonumber];
  }else if(language=="en"){
    document.getElementById("40").innerHTML=fotodescription_en[fotonumber];
  }else if(language=="de"){
    document.getElementById("40").innerHTML=fotodescription_de[fotonumber];
  }
}   

var newwin;
function launchwin(winurl,winname,winfeatures)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl,winname,winfeatures);
	
	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}
function ChangeDay(Selezione){
if (Selezione.form.name=="form1"){
 if (Selezione.name=="mese_anreise"){
   var giornoSel=document.form1.giorno_anreise;
   var meseSel=Selezione;
   var annoSel=document.form1.anno_anreise;
 } else if (Selezione.name=="mese_abreise"){
   var giornoSel=document.form1.giorno_abreise;
   var meseSel=Selezione;
   var annoSel=document.form1.anno_abreise;
 } else if (Selezione.name=="anno_anreise"){
   var giornoSel=document.form1.giorno_anreise;
   var meseSel=document.form1.mese_anreise;
   var annoSel=Selezione;
 } else if (Selezione.name=="anno_abreise"){
   var giornoSel=document.form1.giorno_abreise;
   var meseSel=document.form1.mese_abreise;
   var annoSel=Selezione;
 }
} else {
 if (Selezione.name=="mese_anreise"){
   var giornoSel=document.formhausaltemuehle.giorno_anreise;
   var meseSel=Selezione;
   var annoSel=document.formhausaltemuehle.anno_anreise;
 } else if (Selezione.name=="mese_abreise"){
   var giornoSel=document.formhausaltemuehle.giorno_abreise;
   var meseSel=Selezione;
   var annoSel=document.formhausaltemuehle.anno_abreise;
 } else if (Selezione.name=="anno_anreise"){
   var giornoSel=document.formhausaltemuehle.giorno_anreise;
   var meseSel=document.formhausaltemuehle.mese_anreise;
   var annoSel=Selezione;
 } else if (Selezione.name=="anno_abreise"){
   var giornoSel=document.formhausaltemuehle.giorno_abreise;
   var meseSel=document.formhausaltemuehle.mese_abreise;
   var annoSel=Selezione;
 }
}
  var giornoSelected=giornoSel.options[giornoSel.selectedIndex].value;
  var annoSelected=annoSel.options[annoSel.selectedIndex].value;
  var mese=meseSel.value;
  var anno=Number(annoSel.value);
  var now=new Date();
  if ((anno%4)==0){
    var dayarr=new Array(31,29,31,30,31,30,31,31,30,31,30,31);
  } else {
    var dayarr=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
 }
 if ((mese == now.getMonth())&&(anno == now.getYear())){
   var startday=now.getDate();
   var startYear=now.getFullYear();
 } else {
   var startday=1;
}
 if (mese >= now.getMonth()){
 var startYear=now.getFullYear();
 } else {
     var startYear=now.getFullYear()+1;
   }
 
 daylength=giornoSel.options.length;
 for (i=daylength-1;i>=0;i--){
   giornoSel.remove(i);
 }
 var z=0;
 for (i=startday;i<=dayarr[mese];i++){
   var oOption=document.createElement("OPTION");
   giornoSel.options.add(oOption);
   giornoSel.options[z].value=i;
   giornoSel.options[z].text=i;
   if (giornoSelected==i){
     giornoSel.options[z].selected=true;
   }
   z++;
 }

 var annolength=annoSel.options.length;
 for (i=annolength-1;i>=0;i--){
   annoSel.remove(i);
 }
 z=0;
 for (i=startYear;i<=(startYear+5);i++){
   oOption=document.createElement("OPTION");
   annoSel.options.add(oOption);
   annoSel.options[z].value=i;
   annoSel.options[z].text=i;
   if (annoSelected==i){
     annoSel.options[z].selected=true;
   }
   z++;
 }
}

function validate(){
  data_anreise=new Date(document.form1.anno_anreise.value,document.form1.mese_anreise.value,document.form1.giorno_anreise.value);
  data_abreise=new Date(document.form1.anno_abreise.value,document.form1.mese_abreise.value,document.form1.giorno_abreise.value);
  if(data_abreise<data_anreise){
    alert("Data Abreise < Anreise!");
	return(false);
  } else {
  return(true);
  }
}

// funzioni controllo presenza email

function contenuto(Mail){

			if(Mail.length<1){
			alert("Die E-mail Adresse muß angegeben werden !");
			return false;
			}
			else if(Mail.length==1){
			alert("Bitte E-mail Adresse prüfen !");
			return false;
			}
			else if(Mail.indexOf("@")==-1){
			alert("Bitte E-mail Adresse prüfen !");
			return false;
			}
			else if(Mail.indexOf(".")==-1){
			alert("Bitte E-mail Adresse prüfen !");
			return false;
			}
			else if (!document.form1.accettazione.checked) {
		 	alert("Bitte bestätigen Sie noch, dass Sie unsere Geschäftsbedingungen akzeptieren.");
			return false;
		 	}
			else{
			Mail = Mail.toLowerCase()
			return true;
			}			
}

// carica file giusto taxi bus alta badia sulla home page
function caricafile(){
if (navigator.userLanguage) {
theAgent = navigator.userLanguage;
}
else 
{
theAgent = navigator.language;
}
 if (theAgent.indexOf('en') != -1) {
 var targeturl="dolomites/alta_badia_taxi_en.html";
 newwin=window.open("","","height=695,width=640");
 newwin.location=targeturl;
 }
 else if (theAgent.indexOf('it') != -1) {
 var targeturl="dolomiti/alta_badia_taxi_it.html";
 newwin=window.open("","","height=720,width=640");
 newwin.location=targeturl;
 }
 else {
 var targeturl="alta_badia_taxi.html";
 newwin=window.open("","","height=690,width=640");
 newwin.location=targeturl;
 }
}

// carica lastminute file
function caricalm(){
if (navigator.userLanguage) {
theAgent = navigator.userLanguage;
}
else 
{
theAgent = navigator.language;
}
 if (theAgent.indexOf('en') != -1) {
 var targeturl="dolomites/zimmerpreise_corvara_en.asp#lastminute";
 newwin=window.open("","","");
 newwin.location=targeturl;
 }
 else if (theAgent.indexOf('it') != -1) {
 var targeturl="dolomiti/zimmerpreise_corvara_it.asp#lastminute";
 newwin=window.open("","","");
 newwin.location=targeturl;
 }
 else {
 var targeturl="zimmerpreise_corvara_de.asp#lastminute";
 newwin=window.open("","","");
 newwin.location=targeturl;
 }
}

// carica testo sotto il titolo
function caricatesto(){
if (navigator.userLanguage) {
theAgent = navigator.userLanguage;
}
else 
{
theAgent = navigator.language;
}
 if (theAgent.indexOf('de') != -1) {
 document.form2.sottotitolo.value ="Die Sprache der Liebe ist die einzige Sprache, die alle Menschen verstehen";
 }
 else if (theAgent.indexOf('it') != -1) {
 document.form2.sottotitolo.value = "La lingua dell'amore è l'unica che possono capire tutti gli uomini";
 }
 else {
 document.form2.sottotitolo.value = "The language of love is the only one that all people can understand";
 }
}

function simplePreload()
{ 
  var args = simplePreload.arguments;
  document.imageArray = new Array(args.length);
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

function sendpage()
{
mail_str = "mailto:?subject= Pichlerhof WebSeiten: " + document.title;
mail_str += "&body=Schau dir diesen Tipp von Albergo Pordoi!";
mail_str += "Er heisst: " + document.title;
mail_str += ". Hier ist die Adresse: " + location.href;
mail_str += ". Gruß ";
location.href = mail_str;
}
function sendpageit()
{
mail_str = "mailto:?subject= Albergo Pordoi Pagine Web: " + document.title;
mail_str += "&body=Ti mando il link per le pagine internet dell'Albergo Pordoi!";
mail_str += "Si chiama: " + document.title;
mail_str += ". Ecco l'indirizzo: " + location.href;
mail_str += ". Cari saluti ";
location.href = mail_str;
}
function sendpageen()
{
mail_str = "mailto:?subject= Albergo Pordoi Web Site: " + document.title;
mail_str += "&body=I send you the link of the Hotel Pordoi!";
mail_str += "It titles: " + document.title;
mail_str += ". Here is the URL: " + location.href;
mail_str += ". Regards ";
location.href = mail_str;
}


function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function changeplace() {
	if ((document.form1.Unterkunft.value == "Pension La Scalira") || (document.form1.Unterkunft.value == "Pensione La Scalira")) {
	document.form1.HotelOrtschaft.value = "Corvara";
	}
	else if ((document.form1.Unterkunft.value == "Appartements Pastüres") || (document.form1.Unterkunft.value == "Apartments Pastüres") || (document.form1.Unterkunft.value == "Appartamenti Pastüres"))  {
	document.form1.HotelOrtschaft.value = "Colfosco";
	}
	else {
	document.form1.HotelOrtschaft.value = "";
	}
}


/***********************************************
* DHTML Ticker script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
function domticker(content, divId, divClass, delay, fadeornot){
this.content=content
this.tickerid=divId //ID of master ticker div. Message is contained inside first child of ticker div
this.delay=delay //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over ticker (and pause it if it is)
this.pointer=1
this.opacitystring=(typeof fadeornot!="undefined")? "width: 100%; filter:progid:DXImageTransform.Microsoft.alpha(opacity=100); -moz-opacity: 1" : ""
if (this.opacitystring!="") this.delay+=500 //add 1/2 sec to account for fade effect, if enabled
this.opacitysetting=0.2 //Opacity value when reset. Internal use.
document.write('<div id="'+divId+'" class="'+divClass+'"><div style="'+this.opacitystring+'">'+content[0]+'</div></div>')
var instanceOfTicker=this
setTimeout(function(){instanceOfTicker.initialize()}, delay)
}

domticker.prototype.initialize=function(){
var instanceOfTicker=this
this.contentdiv=document.getElementById(this.tickerid).firstChild //div of inner content that holds the messages
document.getElementById(this.tickerid).onmouseover=function(){instanceOfTicker.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){instanceOfTicker.mouseoverBol=0}
this.rotatemsg()
}

domticker.prototype.rotatemsg=function(){
var instanceOfTicker=this
if (this.mouseoverBol==1) //if mouse is currently over ticker, do nothing (pause it)
setTimeout(function(){instanceOfTicker.rotatemsg()}, 100)
else{
this.fadetransition("reset") //FADE EFFECT- RESET OPACITY
this.contentdiv.innerHTML=this.content[this.pointer]
this.fadetimer1=setInterval(function(){instanceOfTicker.fadetransition('up', 'fadetimer1')}, 100) //FADE EFFECT- PLAY IT
this.pointer=(this.pointer<this.content.length-1)? this.pointer+1 : 0
setTimeout(function(){instanceOfTicker.rotatemsg()}, this.delay) //update container
}
}
// -------------------------------------------------------------------
// fadetransition()- cross browser fade method for IE5.5+ and Mozilla/Firefox
// -------------------------------------------------------------------
domticker.prototype.fadetransition=function(fadetype, timerid){
var contentdiv=this.contentdiv
if (fadetype=="reset")
this.opacitysetting=0.2
if (contentdiv.filters && contentdiv.filters[0]){
if (typeof contentdiv.filters[0].opacity=="number") //IE6+
contentdiv.filters[0].opacity=this.opacitysetting*100
else //IE 5.5
contentdiv.style.filter="alpha(opacity="+this.opacitysetting*100+")"
}
else if (typeof contentdiv.style.MozOpacity!="undefined" && this.opacitystring!=""){
contentdiv.style.MozOpacity=this.opacitysetting
}
else
this.opacitysetting=1
if (fadetype=="up")
this.opacitysetting+=0.2
if (fadetype=="up" && this.opacitysetting>=1)
clearInterval(this[timerid])
}
/*apre un img*/

function newwin(bildurl, b ,h)
{
var eigenschaft,sbreite,shoehe,fenster,b,h;

// stellt die Bildschirmabmessungen fest
// find window size
var ns6 = (!document.all && document.getElementById);
var ie4 = (document.all);
var ns4 = (document.layers);

if(ns6||ns4) {
sbreite = innerWidth;
shoehe = innerHeight;
}
else if(ie4) {
sbreite = document.body.clientWidth;
shoehe = document.body.clientHeight;
}

x = (sbreite-b)/2;
y = (shoehe-h)/2;

eigenschaften="left="+x+",top="+y+",screenX="+x+",screenY="+y+",width="+b+",height="+h+",menubar=no,toolbar=no,resizable=yes";

fenster=window.open("","",eigenschaften);
fenster.focus();
fenster.document.open();
with (fenster) {
  document.write('<html><head>');
  document.write('<title>Image</title></head>');
  // bei Focusverlust schliessen, close if window looses focus
  document.write('<body onblur="window.close()" ');
  document.write('marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">');
  document.write('<center>');
  document.write('<A HREF="#" onClick="window.close();return false">'); 	
  document.write('<img src="'+ bildurl +'"border="0" alt="close window">');
  document.write('</A>'); 	
  document.write('<center>');
  document.write('</body></html>');
  fenster.document.close();
}


}


function newhtml(datei,w2,h2)
{
 F1=window.open(datei,"Html","width=" + w2 + ", height=" + h2);

 F1.focus()

}



