function RequestParams (querystring) {
  if (querystring == '') return;
  var wertestring = querystring.slice(1);
  var paare = wertestring.split("&");
  var paar, name, wert;
  for (var i = 0; i < paare.length; i++) {
    paar = paare[i].split("=");
    name = paar[0];
    wert = paar[1];
    name = unescape(name).replace("+", " ");
    wert = unescape(wert).replace("+", " ");
    this[name] = wert;
  }
}

function initIframe(framename, querystring)
{

	if (querystring == '') return;
	if (framename == '') return;
	
	if (document.getElementById(framename))
	{
		document.getElementById(framename).src = document.getElementById(framename).src + querystring;
	
	}
	else if (parent[framename])
	{
		parent[framename].location.href = parent[framename].location.href + querystring;
	
	} 	
}


function setIframeContent(URI)
{
  if (URI == null || URI == '')	return;
  document.location.href = URI;  
}

function buildOptions(array, selActDayName)
{
	var returnArray = new Array();
	var oneday = 24 * 60 * 60 * 1000;


	var nowInMS = new Date().getTime();
	var now3days = nowInMS +  + (3 * oneday);
	nowInMS = nowInMS - (5 * 60 * 1000);
	
	var now0 = new Date();
	now0.setHours(0);
	now0.setMinutes(0);
	now0.setSeconds(0);
	now0.setMilliseconds(0);
	var now0InMS = now0.getTime();
	


	for (var day in array)
	{
		var split = day.split(".");

		var targetYear=split[2], targetMonth=split[1], targetDay=split[0], targetHour=0, targetMinute=0, targetSecond=0;
		var target = new Date(targetYear,targetMonth-1,targetDay,targetHour,targetMinute,targetSecond);
		var targetInMS  = target.getTime();
		
		var fromInMS = now0InMS - oneday;
		var toInMS = now0InMS + 4 * oneday;

		if  (fromInMS < targetInMS && targetInMS < toInMS)
		{

			var valid = false;
			for (i = 0; i < array[day].length; i++)
			{
				var optvalue = array[day][i].text;
				var hours = optvalue.substring(0,2);
				var min = optvalue.substring(3,4) * 10;
				var extargetInMS = targetInMS + (((hours * 60) + min) * 60 *1000);


				if (nowInMS < extargetInMS && extargetInMS <= now3days)
				{
					valid = true;
					var index = 0;
					if (returnArray[day] == null)
					{
						returnArray[day] = new Array();
					}
					else
					{
						index = returnArray[day].length;
					}

					returnArray[day][index] = array[day][i];
				}


			}
			
			<!-- add day option -->
			if (valid == true)
			{
				var myOption = new Option(array[day]['name'], day, false, false);
				document.getElementById(selActDayName).options[document.getElementById(selActDayName).length] = myOption;
			}

		}

	}

	return returnArray;
}


function removeTimes(container)	
{
	for (i = document.getElementById(container).length-1; i >= 0; i--)
		document.getElementById(container).remove(i);
}	 


function addAvailTimes(options, index, container)
{
	for (i = 0; i < options[index].length; i++)
	{
		document.getElementById(container).options[document.getElementById(container).length] = options[index][i];
	}
}


function onDaySelect(day, container, options)
{
   removeTimes(container);
   addAvailTimes(options, day, container);
   return false;
}	


function scrollToNull()
{
	//not possible anymore: parent.scrollTo(0, 0);
}

function Set_Cookie( name, value, expires, path, domain, secure )
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
		expires = expires;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}



function Get_Cookie( check_name ) {
	// first we'll split this cookie up into name/value pairs
	// note: document.cookie only returns name=value, not the other components
	var a_all_cookies = document.cookie.split( ';' );
	var a_temp_cookie = '';
	var cookie_name = '';
	var cookie_value = '';
	var b_cookie_found = false; // set boolean t/f default f

	for ( i = 0; i < a_all_cookies.length; i++ )
	{
		// now we'll split apart each name=value pair
		a_temp_cookie = a_all_cookies[i].split( '=' );


		// and trim left/right whitespace while we're at it
		cookie_name = a_temp_cookie[0].replace(/^\s+|\s+$/g, '');

		// if the extracted name matches passed check_name
		if ( cookie_name == check_name )
		{
			b_cookie_found = true;
			// we need to handle case where cookie has no value but exists (no = sign, that is):
			if ( a_temp_cookie.length > 1 )
			{
				cookie_value = unescape( a_temp_cookie[1].replace(/^\s+|\s+$/g, '') );
			}
			// note that in cases where cookie is initialized but no value, null is returned
			return cookie_value;
			break;
		}
		a_temp_cookie = null;
		cookie_name = '';
	}
	if ( !b_cookie_found )
	{
		return null;
	}
}


function Delete_Cookie( name, path, domain ) {
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
	( ( path ) ? ";path=" + path : "") +
	( ( domain ) ? ";domain=" + domain : "" ) +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}


// liefert den Wochentag zu einem Datum
// input format 'dd.mm.yyyy'
function getWeekday(date) 
{

	var split = date.split('.');
		
	var timeObj=new Date();
	if (split.length > 0)
		timeObj.setDate(split[0]);
	if (split.length > 1)
		timeObj.setMonth(split[1]-1);
	if (split.length > 2)
		timeObj.setFullYear(split[2]);
	
	var day_index=timeObj.getDay();

	var Wochentag = new Array("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");

	return Wochentag[day_index];
}
