﻿// JScript-Datei
var fader = "";
var opacity = 0;
var act = 0;
var act2 = 0;

function fadeIn(objId) {
	if (active2=="" ) {
    opacity = opacity + 0.4;
	document.getElementById(objId).style.filter="alpha(opacity=" + Math.sin(opacity)*100 + ")";
    document.getElementById(objId).style.MozOpacity = Math.sin(opacity);
	document.getElementById('langUl').style.display="block";
	
    if(opacity >= Math.PI/2) {
        window.clearInterval(fader);
        fader = "";
		opacity = 0;
		document.getElementById('navmenu-h').style.zindex="0";
		document.getElementById('langUl').style.zindex="999";

    }
    }
}

function fadeOut(objId) {
	window.clearInterval();
    
    if (active2=="" || open != 0) {
    opacity = opacity - 0.4;
	document.getElementById(objId).style.filter="alpha(opacity=" + Math.sin(opacity)*100 + ")";
    document.getElementById(objId).style.MozOpacity = Math.sin(opacity);
	document.getElementById(objId).style.zindex=0;
	
	//document.getElementById(objId).style.filter="alpha(opacity=" + opacity + ")";
    //document.getElementById(objId).style.MozOpacity = opacity/100;
    if(opacity <= 0) {
		opacity = 0;
        window.clearInterval(fader);
        fader = "";
        //active2 = "";
		//alert("close fader");
		document.getElementById(objId).style.display = "none";
		document.getElementById(objId).style.filter="alpha(opacity=0)";
		document.getElementById(objId).style.MozOpacity = 0;
		open = 1;
    }
    }
}



function selectField(obj) 
{
    if (obj.style.backgroundImage=="url(http://www.montafon.at/Design/images/online_0.gif)" || obj.style.backgroundImage=="") 
    {
        obj.style.backgroundImage="url(http://www.montafon.at/Design/images/online_1.gif)";
        document.getElementById("SrchBookOnly").value = "true";
    } else {
        obj.style.backgroundImage="url(http://www.montafon.at/Design/images/online_0.gif)";
        document.getElementById("SrchBookOnly").value = "false";
    }
}

function showDropDown(obj) 
{
	
    if (active != "") {
	return(false);
    }
    objName = obj.id;
    part = objName.split("-");
    act = part[0] + "ValueBox";
    //alert("style=" + document.getElementById(act).style.display);
    if (document.getElementById(act).style.display == "block") {
		opacity = Math.PI/2;
		if ( fader == "") {
		    fader = window.setInterval("fadeOut(act)",1);
		}
    } else {
        initForm();
		opacity = 0;
        document.getElementById(act).style.display = "block";
        if ( fader == "") {
		    fader = window.setInterval("fadeIn(act)",1);
		}
    }
}
function showDropDown2(objName, active, active2) 
{
    if (active2=="" || open != 0) {
    part = objName.split("-");
    act2 = part[0] + "ValueBox";
    if (document.getElementById(act2).style.display == "block") {
		opacity = Math.PI/2;
	    // clear interval!!
	    // window.clearInterval();
		fader = window.setInterval("fadeOut(act2)",3);
    } else {
        initForm();
		opacity = 0;
        document.getElementById(act2).style.display = "block";
		fader = window.setInterval("fadeIn(act2)",1);
    }
    }
}
function select(obj) 
{
    hfield = obj.title;
    ddwin = obj.title + "ValueBox";
    ddvalue = obj.title + "Value";
    oid = obj.id;
    var lbl = ""
    if (oid.search(/HO/) != -1) {
        lbl = document.getElementById("Lbl_HO").value;
        
    } 
    if (oid.search(/AP/) != -1) {
        lbl = document.getElementById("Lbl_AP").value;
    }
    if (lbl != "") {
        document.getElementById("SrchRooms-label1").innerHTML = lbl;
    }
	opacity = Math.PI/2;
	fader = window.setInterval("fadeOut(ddwin)",3);
    document.getElementById(ddvalue).innerHTML = obj.innerHTML;
    document.getElementById(hfield).value = obj.innerHTML;
    if (hfield == "SrchStars") {
        parts = obj.id.split("|");
        document.getElementById("SrchStars").value = parts[0];
        document.getElementById("FC1").value = parts[1];
    }
    if (hfield == "SrchOrt") {
        parts = obj.id.split("|");
        document.getElementById("SrchOrt").value = parts[0];
        document.getElementById("RG").value = parts[1];
    }
}
function select2(item) 
{
   
    ddwin = item + "ValueBox";
	opacity = Math.PI/2;
	fader = window.setInterval("fadeOut(ddwin)",3); 
}
function initForm() 
{
    document.getElementById("SrchOrtValueBox").style.display = "none";
    document.getElementById("SrchStarsValueBox").style.display = "none";
    document.getElementById("SrchFromDayValueBox").style.display = "none";
    document.getElementById("SrchFromMonthValueBox").style.display = "none";
    document.getElementById("SrchFromYearValueBox").style.display = "none";
    document.getElementById("SrchDaysValueBox").style.display = "none";
}

function setCurrentDay() 
{
	//
	// Set Quickfinder date to current day
	//
	var today = new Date();
	var today_day   = today.getDate();
	var today_month = today.getMonth() +1;
	var today_year  = today.getFullYear();

    document.getElementById("SrchFromDayValue").innerHTML = today_day;
	document.getElementById("SrchFromMonthValue").innerHTML = today_month;
	document.getElementById("SrchFromYearValue").innerHTML = today_year;
}

function submitFORM()
{
		//alert("tosc");
       	OC = document.frmQuickFind.OC.value;
       	ID = document.frmQuickFind.SrchOrt.value;
        RG = document.frmQuickFind.RG.value;
        FN = document.frmQuickFind.FN.value;
        CF = "SPHERECAST";
        LG = document.frmQuickFind.LG.value;
        FC = document.frmQuickFind.FC1.value;
		stars = document.frmQuickFind.SrchStars.value;
        sfd = document.frmQuickFind.SrchFromDay.value;
        sfm = document.frmQuickFind.SrchFromMonth.value;
        sfy = document.frmQuickFind.SrchFromYear.value;
        sd = document.frmQuickFind.SrchDays.value;
       	sr = document.frmQuickFind.SrchRooms.value;
        sp = document.frmQuickFind.SrchPax.value;
        sbo = document.frmQuickFind.SrchBookOnly.value;
        ID="1000224";
		if (stars == "") {
			Effect.Pulsate('SrchStars-dropdown', { pulses: 5, duration: 1.5, from: 0.3 });
			new Effect.Highlight('SrchStars-label', { startcolor: '#ff0000', endcolor: '#000000' });
			return(false);
		}
		
		
	baseurl = "http://feratel-gaschurn.concentrator.net/";
	OC = "GASCHURN";
 
        
        
        //alert(sr);
        var today = new Date();
	    var today_day   = today.getDate();
	    var today_month = today.getMonth() + 1;
	    var today_year  = today.getFullYear();
	    if (sfd=="") {
	        sfd = today_day;
        }
        if (sfm=="") {
	        sfm = today_month;
        }
        if (sfy=="") {
	        sfy = today_year;
        }
        
		switch(sbo) {
			case "true":
				 sbo = "on";
				break;
			default:
				sbo = "off";
				break;
		}
        
        
        url = baseurl + "tosc.asp?TOSCNEW=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 + "&SrchStars=" + stars;
		
		myLightWindow.activateWindow({
            href: url,
            title: 'Suchen & Buchen',
            author: 'Spherecast',
            opacity:70,
            caption: '',
            width:650,
            height:500,
            top:300
        });
}

function PrintContent() {
    window.print();

}