function showSubNav(obj)
{

	//alert(navigator.appName);
	if(navigator.appCodeName != "Netscape") {
		//alert(obj.offsetLeft);
		obj.lastChild.style.left = obj.offsetLeft + "px";
	}
	//obj.lastChild.style.display = "block";

}

function hideSubNav(obj)
{

	//alert("hide");
	//obj.lastChild.style.display = "none";

}


function submitFORM()
{	
	OC = document.frmQuickFind.OC.value;
	FC = document.frmQuickFind.FC.value;
	
	
	if (document.frmQuickFind.FC[0].checked)
	{
		FC = "HO";
	} else {
		FC = "AP";
	}
	
	ID = document.frmQuickFind.ID.value;
	if (ID == "1000194") {
		RG = "OG";
	} else {
		RG = "DN";
	}
	RG = document.frmQuickFind.RG.value;
	FN = document.frmQuickFind.FN.value;
	CF = "SOMMER";
	LG = document.frmQuickFind.LG.value;
	
	d1 = document.frmQuickFind.datum.value;
	d2 = document.frmQuickFind.datum2.value;
	
	
	
	dat1 = d1.split("/");
	dat2 = d2.split("/");
	
	d1 = dat1[1] + "/" + dat1[0] + "/" + dat1[2];
	d2 = dat2[1] + "/" + dat2[0] + "/" + dat2[2];
	sd = (Date.parse(d2) - Date.parse(d1))/1000;
	sd = sd / 86400;
	//alert(sd);

	sfd = dat1[0];
	sfm = dat1[1];
	sfy = dat1[2];
	//sd = 7;
	sr = 1;
	sp = 2;
	
	//sbo = document.frmQuickFind.SrchBookOnly.checked;
	sbo 	= document.frmQuickFind.SrchBookOnly.value;
	switch(sbo) {
			case "true":
				 sbo = "on";
				break;
			default:
				sbo = "off";
				break;
	}
	//alert('SrchBookOnly ok');
	url = "http://feratel-sc-kufstei.concentrator.net/tosc.asp?TOSCNEW=TRUE&PLANNER=TRUE&OC=" + OC + "&ID=" + ID + "&RG=" + RG + "&FN=" + FN;
	url = url + "&CF=" + CF + "&LG=" + LG + "&FC=" + FC + "&SrchFromDay=" + sfd + "&SrchFromMonth=" + sfm;
	url = url + "&SrchFromYear=" + sfy + "&SrchDays=" + sd + "&SrchRooms=" + sr + "&SrchPax=" + sp;
	url = url + "&SrchBookOnly=" + sbo;
	//alert(url);
	myLightWindow.activateWindow({
            href: url,
            title: 'Suchen & Buchen',
            author: 'Spherecast',
            opacity:70,
            caption: '',
            width:650,
            height:500
        });
}

function submitFORM2()
{
       	OC = document.frmQuickFind2.OC.value;
       	ID = document.frmQuickFind2.ID.value;
        if (ID == "1000194") {
		RG = "OG";
	} else {
		RG = "DN";
	}
        FN = document.frmQuickFind2.FN.value;
        CF = "SOMMER";
        LG = document.frmQuickFind2.LG.value;
        if (document.frmQuickFind2.FC[0].checked)
	    {
		    FC = "HO";
	    } else {
		    FC = "AP";
	    }
        
	if (LG == 1)
		buttontext = "Unterkunft suchen";
	if (LG == 2)
		buttontext = "Search accommodation";
	if (LG == 3)
		buttontext = "Rechercher";
	if (LG == 4)
		buttontext = "Cercara dei alloggi";
        sfd = document.frmQuickFind2.SrchFromDay.value;
        sfm = document.frmQuickFind2.SrchFromMonth.value;
        sfy = document.frmQuickFind2.SrchFromYear.value;
        sd = document.frmQuickFind2.SrchDays.value;
       	sr = document.frmQuickFind2.SrchRooms.options[document.frmQuickFind2.SrchRooms.selectedIndex].text;
        sp = document.frmQuickFind2.SrchPax.options[document.frmQuickFind2.SrchPax.selectedIndex].text;
        sbo 	= document.frmQuickFind2.SrchBookOnly.checked;
		if (sbo == true) {
			sbo = "on";
		} else {
			sbo = "off";
		}

        url = "http://feratel-sc-kufstei.concentrator.net/tosc.asp?TOSCNEW=TRUE&PLANNER=TRUE&OC=" + OC + "&ID=" + ID + "&RG=" + RG + "&FN=" + FN;
        url = url + "&CF=" + CF + "&LG=" + LG + "&FC=" + FC + "&SrchFromDay=" + sfd + "&SrchFromMonth=" + sfm;
        url = url + "&SrchFromYear=" + sfy + "&SrchDays=" + sd + "&SrchRooms=" + sr + "&SrchPax=" + sp;
        url = url + "&SrchBookOnly=" + sbo;
		//alert(url);
        myLightWindow.activateWindow({
		href: url, 
		title: '', 
		author: '', 
		caption: '',
		width:650,
		height:500
	});
}

function submitFORM3(params)
{
       	
       	
	
	//alert(params);
	ID = document.urlaubsplaner.UPOrte.options[document.urlaubsplaner.UPOrte.selectedIndex].value;
	if (ID==1000194) {
		part = "&RG=OG";
	} else {
		part = "&RG=DN";
	}
	url = "http://feratel-sc-kufstei.concentrator.net/tosc.asp?TOSCNEW=TRUE&OC=SC-KUFSTEI&CF=SOMMER&PLANNER=TRUE&";
		
        url = url + params + "&ID=" + ID + part;
	//alert(url);
        myLightWindow.activateWindow({
		href: url, 
		title: '', 
		author: '', 
		caption: '',
		width:650,
		height:500
	});
}


function setCurrentDay() {
	//
	// Set Quickfinder date to current day
	//
	//alert('set date');
	var today = new Date();
	var today_day   = today.getDate();
	var today_month = today.getMonth();
	var today_year  = today.getFullYear();

	window.document.frmQuickFind2.SrchFromDay.options[today_day-1].selected = true;
	window.document.frmQuickFind2.SrchFromMonth.options[today_month].selected = true;
	window.document.frmQuickFind2.SrchFromYear.options[0].value = today_year;
	window.document.frmQuickFind2.SrchFromYear.options[0].text = today_year;
	setFormDate();
}
function setFormDate() {
    var jetzt = new Date();
    var anreisedatum = jetzt.getDate() + "/" + (jetzt.getMonth() + 1) + "/" + jetzt.getFullYear();
    var heute = jetzt.getTime();
    var dann = heute + (7 * 24 * 60 * 60 * 1000);
    jetzt.setTime(dann);
    var Jahr = jetzt.getFullYear();
    var Monat = jetzt.getMonth() + 1;
    var Tag = jetzt.getDate();
    //alert("in 7 Tagen ist der " + Tag + "." + Monat + "." + Jahr);
    var abreisedatum = jetzt.getDate() + "/" + (jetzt.getMonth() + 1) + "/" + jetzt.getFullYear();
    document.frmQuickFind.datum.value = anreisedatum;
    document.frmQuickFind.datum2.value = abreisedatum;
}

function unverbAnfrage(LG) {
						
	url = "http://feratel-kufstein.concentrator.net/tosc.asp?TOSCNEW=TRUE&OC=KUFSTEIN&RG=OG&ID=1000194&FN=POOL&FC=HO&CF=SOMMER&PLANNER=TRUE&LG=" + LG;
	switch(LG) {
 		case "1":
 			btext = "Unverbindliche Anfrage";
 			break;
 		case "2":
 			btext = "Non binding request";
 			break;
 		case "4":
 			btext = "Richiesta";
 			break;
 		case "3":
 			btext = "Demande";
 			break;
 		default:
 			btext = "Non binding request";
 			break;
	}
	myLightWindow.activateWindow({
		href: url, 
		title: '', 
		author: '', 
		caption: '',
		width:650,
		height:500
	});
	

	
	var el   = document.getElementById("QSLB_Submit");
	myLytebox.start(el,false, true);
	html = "<input class='QFButton' onclick='unverbAnfrage(" + LG + ");' type='button' size='14' value='"+ btext +"' name='Submit1'>";
	obj = document.getElementById("lbdiv3");
	obj.innerHTML = html;
}

function setLinkBox() {

	showID = document.urlaubsplaner.UPOrte.options[document.urlaubsplaner.UPOrte.selectedIndex].value;
	var link_url =  document.getElementById("up_li_ho").href;
	document.getElementById("up_li_ho").href = getUPUrl(link_url, showID);
	
	var link_url =  document.getElementById("up_sr_ho").href;
	document.getElementById("up_sr_ho").href = getUPUrl(link_url, showID);

	var link_url =  document.getElementById("up_po_ho").href;
	document.getElementById("up_po_ho").href = getUPUrl(link_url, showID);

	var link_url =  document.getElementById("up_li_ap").href;
	document.getElementById("up_li_ap").href = getUPUrl(link_url, showID);

	var link_url =  document.getElementById("up_sr_ap").href;
	document.getElementById("up_sr_ap").href = getUPUrl(link_url, showID);

	var link_url =  document.getElementById("up_po_ap").href;
	document.getElementById("up_po_ap").href = getUPUrl(link_url, showID);

	var link_url =  document.getElementById("up_li_br").href;
	document.getElementById("up_li_br").href = getUPUrl(link_url, showID);


}

function getUPUrl(linkurl, showID) 
{
	var params = linkurl.split("&");
	pre = params[0] + "&" + params[1];
	r_g = params[2];
	i_d = params[3];
	rest= params[4] + "&" +  params[5] + "&" +  params[6] + "&" +  params[7] + "&" +  params[8] 
	if (showID != "1000194") {
		r_g = "RG=DN";
	} else {
		r_g = "RG=OG";
	}
	
	var newlink = pre + "&" + r_g + "&" + "ID=" + showID + "&" + rest;
	//alert(newlink);
	return newlink;
}

function showPan2(item)
{
	url = "http://www.panoramafactory.at/tp/austria/tirol/" + item + ".html";
	//alert(url);
	lupe = window.open(url,"kostenlos","toolbar=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=550,height=476");

}

function chkFormular_gewinn(Language)
{
	//alert('check form');
	chkError = false;
	if (document.forms[1].elements[0].checked == false && document.forms[1].elements[1].checked == false) {
		if (Language == "de") {
			alert("Bitte wählen Sie eine Gewinnoption");
		} else {
			alert("Please select");
		}
		document.forms[1].elements[0].focus();
		return false;
	}
	if (document.forms[1].elements[2].checked == false && document.forms[1].elements[3].checked == false && document.forms[1].elements[4].checked == false) {
		if (Language == "de") {
			alert("Bitte geben Sie Ihre Antwort ein!");
		} else {
			alert("Please select the right answer!");
		}
		document.forms[1].elements[2].focus();
		return false;
	}


	for (i = 0; i <= document.forms[1].length; i++)
	{
		if (document.forms[1].elements[i].getAttribute("Mandatory"))
		{
			//alert('found mandatory field');
			if (document.forms[1].elements[i].getAttribute("Mandatory") == 1)
			{
				
				FieldName = document.forms[1].elements[i].name;
				switch (document.forms[1].elements[i].tagName)
				{
					
					case "SELECT":
								if (document.forms[1].elements[i].selectedIndex == 0)
									chkError = true;
								break;
					case "INPUT":
								if (document.forms[1].elements[i].value == "")
									chkError = true;
								break;
					case "TEXTAREA":
								if (document.forms[1].elements[i].innerText == "")
									chkError = true;
								break;
				}
				if (chkError)
				{
					
					if (Language == "en") {
						switch (FieldName)
						{
							case "Anrede":
								FieldName = "Form of address";
								break;
							case "titel":
								FieldName = "Title";
								break;
							case "vorname":
								FieldName = "Name";
								break;
							case "nachname":
								FieldName = "Surname";
								break;
							case "firma":
								FieldName = "Company";
								break;
							case "strasse":
								FieldName = "Address";
								break;
							case "plz":
								FieldName = "ZIP";
								break;
							case "ort":
								FieldName = "City";
								break;
							case "Land":
								FieldName = "Country";
								break;
							case "email":
								FieldName = "email";
								break;
						}
					}
					switch (Language)
					{
						case "de":	
								msg = "Geben Sie bitte einen Wert für das Feld <" + FieldName + "> an!";
								break;
						case "en":	
								msg = "Please enter a value for the field <" + FieldName + ">!";
								break;
					}
					alert(msg);
					document.forms[1].elements[i].focus();
					return false;
				}
			}
		}
	}
}