// Wird nach Aufruf der Startseite aufgerufen:
// Ueberprueft, ob Cookies erlaubt, setzt Parameter und leitet diese ans IndexServlet weiter
function startServlet( startUrl )
{
    checkCookies();
    setParams();
    
    if ( startUrl != undefined && startUrl != '' )
    {
    	document.forms[0].STARTURL.value = location.href;
    }
    
    document.forms[0].submit();
}
	
// Setze Parameter ins Formular
function setParams()
{
    // z.B. ?var1=wert1&var2=wert2
    values = location.search;
    und    = 0; 
	    
    // Parameter sind vorhanden
    if ( values.length > 1 )
    {
		var oneValue;
		var gleich;
	
		// Entferne ?
		values = values.substring(1,values.length);
	
		// Solange noch & in values
		while ( und != -1 )
		{
		    und = values.indexOf("&");
	
		    // Bestimme Wertepaar, z.B. var1=wert1
		    if ( und == -1 )
		    {
				oneValue = values;
		    }
		    else
		    {
				oneValue = values.substring(0,und);
		    }
			    
		    // Trenne Paramter und Wert
		    gleich   = oneValue.indexOf("=");
	
		    if ( gleich != -1 && gleich != oneValue.length-1 )
		    {
				// Setze Wert in Formular
				setParam( oneValue.substring(0,gleich), oneValue.substring(gleich+1,oneValue.length) );
		    }
	
		    // Schneide bearbeiteten Paramter aus values
		    if ( und != -1 )
		    {
				values = values.substring(und+1,values.length);
		    }
		}
    }
}

// Setze einen Parameter ins Formular
function setParam( param, value )
{
    if ( param.toUpperCase() == "HN" )
    {
		document.forms[0].HN.value = value;
    }
    else if ( param.toUpperCase() == "LINKS" )
    {
		document.forms[0].LINKS.value = value;
    }
    else if ( param.toUpperCase() == "SPRACHE" )
    {
		document.forms[0].SPRACHE.value = value;
    }
    else if ( param.toUpperCase() == "IP" )
    {
		document.forms[0].IP.value = value;
    }
    else if ( param.toUpperCase() == "ARR" )
    {
		document.forms[0].ARR.value = value;
    }
    else if ( param.toUpperCase() == "DEP" )
    {
		document.forms[0].DEP.value = value;
    }
    else if ( param.toUpperCase() == "LN" )
    {
		document.forms[0].LN.value = value;
    }
    else if ( param.toUpperCase() == "NOPAX" )
    {
		document.forms[0].NOPAX.value = value;
    }
    else if ( param.toUpperCase() == "STREET" )
    {
		document.forms[0].STREET.value = value;
    }
    else if ( param.toUpperCase() == "CITY" )
    {
		document.forms[0].CITY.value = value;
    }
    else if ( param.toUpperCase() == "ZIP" )
    {
		document.forms[0].ZIP.value = value;
    }
    else if ( param.toUpperCase() == "EMAIL" )
    {
		document.forms[0].EMAIL.value = value;
    }
    else if ( param.toUpperCase() == "PHONE" )
    {
		document.forms[0].PHONE.value = value;
    }
    else if ( param.toUpperCase() == "COUNTRY" )
    {
		document.forms[0].COUNTRY.value = value;
    }
    else if ( param.toUpperCase() == "NOROOMS" )
    {
		document.forms[0].NOROOMS.value = value;
    }
    else if ( param.toUpperCase() == "NOCHILDS" )
    {
		document.forms[0].NOCHILDS.value = value;
    }
    else if ( param.toUpperCase() == "DEST" )
    {
		document.forms[0].DEST.value = value;
    }
    else if ( param.toUpperCase() == "ID" )
    {
		document.forms[0].ID.value = value;
    }
    else if ( param.toUpperCase() == "PW" )
    {
		document.forms[0].PW.value = value;
    }
    else if ( param.toUpperCase() == "CATRANGE" )
    {
		document.forms[0].CATRANGE.value = value;
    }
    else if ( param.toUpperCase() == "FSLINK" )
    {
		document.forms[0].FSLINK.value = value;
    }
    else if ( param.toUpperCase() == "FSTITLE" )
    {
		document.forms[0].FSTITLE.value = value;
    }
    else if ( param.toUpperCase() == "RATES" )
    {
		document.forms[0].RATES.value = value;
    }
    else if ( param.toUpperCase() == "SHOWSERVICES" )
    {
		document.forms[0].SHOWSERVICES.value = value;
    }
    else if ( param.toUpperCase() == "STARTURL" )
    {
		document.forms[0].STARTURL.value = value;
    }
    else if ( param.toUpperCase() == "ANY" )
    {
		document.forms[0].ANY.value = value;
    }
    else if ( param.toUpperCase() == "MHN" )
    {
		document.forms[0].MHN.value = value;
    }
    else if ( param.toUpperCase() == "NOPAXPERGT" )
    {
		document.forms[0].NOPAXPERGT.value = value;
    }
    else if ( param.toUpperCase() == "RESETNAVI" )
    {
		document.forms[0].RESETNAVI.value = value;
    }
    else if ( param.toUpperCase() == "MC" )
    {
		document.forms[0].MC.value = value;
    }
    else if ( param.toUpperCase() == "PACKAGE" )
    {
		document.forms[0].PACKAGE.value = value;
    }
    else if ( param.toUpperCase() == "CAT" )
    {
		document.forms[0].CAT.value = value;
    }
    else if ( param.toUpperCase() == "LINKSINTITLE" )
    {
		document.forms[0].LINKSINTITLE.value = value;
    }
    else if ( param.toUpperCase() == "LOGOASBACK" )
    {
		document.forms[0].LOGOASBACK.value = value;
    }
    else if ( param.toUpperCase() == "FLAGS" )
    {
		document.forms[0].FLAGS.value = value;
    }
    else if ( param.toUpperCase() == "PFRAME" )
    {
		document.forms[0].PFRAME.value = value;
    }
    else if ( param.toUpperCase() == "SHOWAV" )
    {
		document.forms[0].SHOWAV.value = value;
    }
}
	
	// Ueberpruefe, ob Cookies erlaubt sind
	function checkCookies()
	{
	    document.cookie = "SIHOTWEBTestCookie";
	    
	    //if ( document.cookie.length == 0 )
	    //{
		//alert( "You have to accept session cookies in your browser" );
	    //}
	    //else
	    //{
		//document.cookie = "";
   	    //}
	}

