// ------------------------------------------------------------------------------------------------------------------------
// POPUPS
// ------------------------------------------------------------------------------------------------------------------------

function Newsletter() {
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=320")
}

function IsMap() {
window.open("http://www.val-gardena.net/location.asp","POPMap","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width=700,height=450")
}

function pop_ski() {
window.open("http://www.val-gardena.net/skimap/skimap_it.htm","POPUP","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width=800,height=550")
}

function popAnfrage() {
window.open("http://www.val-gardena.net/taxi/eng/anfrage.asp","POPUP","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizeable=0,width=450,height=400")
}

function pop02() {
window.open("./pop_smap.htm","POPUP","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width=600,height=425")
}

function VirtualTour() {
window.open("http://www.val-gardena.net/360/val_gardena/italiano/low/popup.html","POPUP","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizeable=0,width=760,height=450")
}


// ------------------------------------------------------------------------------------------------------------------------
// EXPRESS ANFRAGE SMALL (GENERATE DATE)
// ------------------------------------------------------------------------------------------------------------------------

function SetRequestDate(){
	var calcoloarrivo = new Date()
		calcoloarrivo.setDate(calcoloarrivo.getDate()+ 0)
	var calcolopartenza = new Date()
		calcolopartenza.setDate(calcolopartenza.getDate()+ 0)

	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.FrmRightRequest.TxtArrivo.value = dataarrivo
	document.FrmRightRequest.TxtPartenza.value = datapartenza
}


// ------------------------------------------------------------------------------------------------------------------------
// EXPRESS ANFRAGE (FORM VALIDATION)
// ------------------------------------------------------------------------------------------------------------------------

function Children(){
	var selection = document.Form1.Bambini.value

	if (selection == "0")
	{
		document.getElementById('OptChildren').firstChild.nodeValue = "optional"
	}
	else
	{
		document.getElementById('OptChildren').firstChild.nodeValue = "Please enter here the age of the children"
	}
}

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 sendit()
{
	if ((document.Form1.NrCamereHotel.value == "0") &&
		(document.Form1.NrCamereGarni.value  == "0") &&
		(document.Form1.NrAppartamenti.value  == "0"))
	{
		alert("Please choose an accommodation type.");
		return false;
	}
	else if ((document.Form1["5Stelle"].checked == 0) &&
		(document.Form1["4Stelle"].checked  == 0) &&
		(document.Form1["3Stelle"].checked  == 0) &&
		(document.Form1["2Stelle"].checked  == 0) &&
		(document.Form1["1Stelle"].checked  == 0))
	{
		alert("Please choose at least one category.");
		return false;
	}
	else if ((document.Form1.Ortisei.checked == 0) &&
		(document.Form1.SantaCristina.checked  == 0) &&
		(document.Form1.Selva.checked  == 0))  
	{
		alert("Please choose at least one location.");
		return false;
	}
	else 
		Control2()
}

function Control2()
	{	errfound = false;

		var CheckBambini = document.Form1.Bambini.value

		if (CheckBambini == "1") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")}
			else if (CheckBambini == "2") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino2.value,1)) error(document.Form1.Bambino2,"Please enter the age of the children.")}
			else if (CheckBambini == "3") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino2.value,1)) error(document.Form1.Bambino2,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino3.value,1)) error(document.Form1.Bambino3,"Please enter the age of the children.")}
			else if (CheckBambini == "4") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino2.value,1)) error(document.Form1.Bambino2,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino3.value,1)) error(document.Form1.Bambino3,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino4.value,1)) error(document.Form1.Bambino4,"Please enter the age of the children.")}
			else if (CheckBambini == "5") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino2.value,1)) error(document.Form1.Bambino2,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino3.value,1)) error(document.Form1.Bambino3,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino4.value,1)) error(document.Form1.Bambino4,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino5.value,1)) error(document.Form1.Bambino5,"Please enter the age of the children.")}
			else if (CheckBambini == "6") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino2.value,1)) error(document.Form1.Bambino2,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino3.value,1)) error(document.Form1.Bambino3,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino4.value,1)) error(document.Form1.Bambino4,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino5.value,1)) error(document.Form1.Bambino5,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino6.value,1)) error(document.Form1.Bambino6,"Please enter the age of the children.")}
			else if (CheckBambini == "7") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino2.value,1)) error(document.Form1.Bambino2,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino3.value,1)) error(document.Form1.Bambino3,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino4.value,1)) error(document.Form1.Bambino4,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino5.value,1)) error(document.Form1.Bambino5,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino6.value,1)) error(document.Form1.Bambino6,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino7.value,1)) error(document.Form1.Bambino7,"Please enter the age of the children.")}
			else if (CheckBambini == "8") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino2.value,1)) error(document.Form1.Bambino2,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino3.value,1)) error(document.Form1.Bambino3,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino4.value,1)) error(document.Form1.Bambino4,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino5.value,1)) error(document.Form1.Bambino5,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino6.value,1)) error(document.Form1.Bambino6,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino7.value,1)) error(document.Form1.Bambino7,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino8.value,1)) error(document.Form1.Bambino8,"Please enter the age of the children.")}
			else if (CheckBambini == "9") {
				if (!ValidLength(document.Form1.Bambino1.value,1)) error(document.Form1.Bambino1,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino2.value,1)) error(document.Form1.Bambino2,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino3.value,1)) error(document.Form1.Bambino3,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino4.value,1)) error(document.Form1.Bambino4,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino5.value,1)) error(document.Form1.Bambino5,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino6.value,1)) error(document.Form1.Bambino6,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino7.value,1)) error(document.Form1.Bambino7,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino8.value,1)) error(document.Form1.Bambino8,"Please enter the age of the children.")
				if (!ValidLength(document.Form1.Bambino9.value,1)) error(document.Form1.Bambino9,"Please enter the age of the children.")}

		if (!ValidLength(document.Form1.Nome.value,3))
			error(document.Form1.Nome,"Please enter your first name.");
		if (!ValidLength(document.Form1.Cognome.value,3))
			error(document.Form1.Cognome,"Please enter your last name.");
		if (!ValidLength(document.Form1.Indirizzo.value,3))
			error(document.Form1.Indirizzo,"Please enter your address.");
		if (!ValidLength(document.Form1.CAP.value,3))
			error(document.Form1.CAP,"Please enter your ZIP code.");
		if (!ValidLength(document.Form1.Citta.value,3))
			error(document.Form1.Citta,"Please enter the name of your city.");
		if (!ValidEmail(document.Form1.Email.value))
			error(document.Form1.Email, "Please enter your e-mail address.");
		if (errfound == false)
			{
			document.Form1.BtnSend.disabled = true;
			document.Form1.BtnSend.value = 'Please wait...\nSending your request...';
			document.Form1.submit();
			}
			
	}

function error(elem, text)
	{	if (errfound) return;
		window.alert(text)
		elem.select();
		elem.focus;
		errfound = true;
	}


// ------------------------------------------------------------------------------------------------------------------------
// HOTEL SUCHE (FORM VALIDATION)
// ------------------------------------------------------------------------------------------------------------------------

function ValidLength2(item, len) 
	{	return(item.length >=len);
	}

function validateForm1()
{
	formObj = document.FrmSearch;
	if ((formObj.TxtHotel.checked == 0) &&
		(formObj.TxtPension.checked  == 0) &&
		(formObj.TxtGarni.checked  == 0) &&
		(formObj.TxtResidence.checked  == 0) &&
		(formObj.TxtApartments.checked  == 0) &&
		(formObj.TxtRifugi.checked  == 0))
	{
		alert("1) Please choose at least one accommodation type.");
		return false;
	}
	else if ((formObj.Txt1s.checked == 0) &&
		(formObj.Txt2s.checked  == 0) &&
		(formObj.Txt3s.checked  == 0) &&
		(formObj.Txt4s.checked  == 0) &&
		(formObj.Txt5s.checked  == 0))
	{
		alert("2) Please choose at least one category.");
		return false;
	}
	else if ((formObj.TxtOrt1.checked == 0) &&
		(formObj.TxtOrt2.checked  == 0) &&
		(formObj.TxtOrt3.checked  == 0))  
	{
		alert("3) Please choose at least one location.");
		return false;
	}
	else 
		document.FrmSearch.submit();
}

function Control3()
{	errfound = false;
	if (!ValidLength2(document.FrmSKey.TxtKey.value,3))
		error(document.FrmSKey.TxtKey,"Please enter more than 3 characters.");
	if (errfound == false)
		document.FrmSKey.submit();
}

function error(elem, text)
{	if (errfound) return;
	window.alert(text)
	elem.select();
	elem.focus;
	errfound = true;
}


// SLIDES ---------------------------------------------------------

var slideShowSpeed = 6000
var crossFadeDuration = 5
var Pic = new Array()
Pic[0] = '../imgorg/headers/willkommen01.jpg'
Pic[1] = '../imgorg/headers/willkommen02.jpg'
Pic[2] = '../imgorg/headers/willkommen03.jpg'
Pic[3] = '../imgorg/headers/willkommen04.jpg'
var t
var j = 0
var p = Pic.length
var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}
function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', slideShowSpeed)
}




function ResetBambini()
{
		document.getElementById('TabBambino1').style.display = 'none'
		document.getElementById('TabBambino2').style.display = 'none'
		document.getElementById('TabBambino3').style.display = 'none'
		document.getElementById('TabBambino4').style.display = 'none'
		document.getElementById('TabBambino5').style.display = 'none'
		document.getElementById('TabBambino6').style.display = 'none'
		document.getElementById('TabBambino7').style.display = 'none'
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
}

function FBambini()
{
	var BambiniSelection = document.Form1.Bambini.value
	
	if (BambiniSelection == "1")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = 'none'
		document.getElementById('TabBambino3').style.display = 'none'
		document.getElementById('TabBambino4').style.display = 'none'
		document.getElementById('TabBambino5').style.display = 'none'
		document.getElementById('TabBambino6').style.display = 'none'
		document.getElementById('TabBambino7').style.display = 'none'
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
		
	}
	else if (BambiniSelection == "2")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = ''
		document.getElementById('TabBambino3').style.display = 'none'
		document.getElementById('TabBambino4').style.display = 'none'
		document.getElementById('TabBambino5').style.display = 'none'
		document.getElementById('TabBambino6').style.display = 'none'
		document.getElementById('TabBambino7').style.display = 'none'
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
	}
	else if (BambiniSelection == "3")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = ''
		document.getElementById('TabBambino3').style.display = ''
		document.getElementById('TabBambino4').style.display = 'none'
		document.getElementById('TabBambino5').style.display = 'none'
		document.getElementById('TabBambino6').style.display = 'none'
		document.getElementById('TabBambino7').style.display = 'none'
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
	}
	else if (BambiniSelection == "4")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = ''
		document.getElementById('TabBambino3').style.display = ''
		document.getElementById('TabBambino4').style.display = ''
		document.getElementById('TabBambino5').style.display = 'none'
		document.getElementById('TabBambino6').style.display = 'none'
		document.getElementById('TabBambino7').style.display = 'none'
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
	}
	else if (BambiniSelection == "5")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = ''
		document.getElementById('TabBambino3').style.display = ''
		document.getElementById('TabBambino4').style.display = ''
		document.getElementById('TabBambino5').style.display = ''
		document.getElementById('TabBambino6').style.display = 'none'
		document.getElementById('TabBambino7').style.display = 'none'
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
	}
	else if (BambiniSelection == "6")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = ''
		document.getElementById('TabBambino3').style.display = ''
		document.getElementById('TabBambino4').style.display = ''
		document.getElementById('TabBambino5').style.display = ''
		document.getElementById('TabBambino6').style.display = ''
		document.getElementById('TabBambino7').style.display = 'none'
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
	}
	else if (BambiniSelection == "7")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = ''
		document.getElementById('TabBambino3').style.display = ''
		document.getElementById('TabBambino4').style.display = ''
		document.getElementById('TabBambino5').style.display = ''
		document.getElementById('TabBambino6').style.display = ''
		document.getElementById('TabBambino7').style.display = ''
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
	}
	else if (BambiniSelection == "8")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = ''
		document.getElementById('TabBambino3').style.display = ''
		document.getElementById('TabBambino4').style.display = ''
		document.getElementById('TabBambino5').style.display = ''
		document.getElementById('TabBambino6').style.display = ''
		document.getElementById('TabBambino7').style.display = ''
		document.getElementById('TabBambino8').style.display = ''
		document.getElementById('TabBambino9').style.display = 'none'
	}
	else if (BambiniSelection == "9")
	{
		document.getElementById('TabBambino1').style.display = ''
		document.getElementById('TabBambino2').style.display = ''
		document.getElementById('TabBambino3').style.display = ''
		document.getElementById('TabBambino4').style.display = ''
		document.getElementById('TabBambino5').style.display = ''
		document.getElementById('TabBambino6').style.display = ''
		document.getElementById('TabBambino7').style.display = ''
		document.getElementById('TabBambino8').style.display = ''
		document.getElementById('TabBambino9').style.display = ''
	}
	else
	{
		document.getElementById('TabBambino1').style.display = 'none'
		document.getElementById('TabBambino2').style.display = 'none'
		document.getElementById('TabBambino3').style.display = 'none'
		document.getElementById('TabBambino4').style.display = 'none'
		document.getElementById('TabBambino5').style.display = 'none'
		document.getElementById('TabBambino6').style.display = 'none'
		document.getElementById('TabBambino7').style.display = 'none'
		document.getElementById('TabBambino8').style.display = 'none'
		document.getElementById('TabBambino9').style.display = 'none'
	}
}
