/* Initialisierungen */
var EVENT_HANDLING		= new Object();
var EVENTS_SUGGESTIONS 	= null;
var EVENTS_CALENDAR		= null;

/* Sammlung von allgemeinen Funktionen */
function trim(string_to_trim)
{
  return string_to_trim.replace (/^\s+/, '').replace(/\s+$/, '');
}

function GetWindowSize()
{
	var window_data = new Object();
	
	/* Höhe + Breite des Fensters */
	if (window.innerWidth || window.innerHeight) {
		/* Firefox, Opera, ... */
		window_data['width']  = window.innerWidth;
		window_data['height'] = window.innerHeight;
	} else if (document.documentElement) {
		/* Internet Explorer */
		window_data['width']  = document.documentElement.clientWidth;
		window_data['height'] = document.documentElement.clientHeight;
	} else {
		/* Internet Explorer */
		window_data['width']  = document.body.clientWidth;
		window_data['height'] = document.body.clientHeight;
	}
	
	window_data['x'] = (document.all ? window.screenLeft : window.screenX);
	window_data['y'] = (document.all ? (window.screenTop - 105) : window.screenY); // - 105 wg. Internetexplorer
	
	window_data['sx'] = (document.body.scrollLeft + document.documentElement.scrollLeft);
	window_data['sy'] = (document.body.scrollTop  + document.documentElement.scrollTop);
	// window_data['y'] = window.posy; // Maus!?
	
	return window_data;
}

function addslashes(str)
{
	str=str.replace(/\\/g,'\\\\');
	str=str.replace(/\'/g,'\\\'');
	str=str.replace(/\"/g,'\\"');
	str=str.replace(/\0/g,'\\0');
	return str;
}

function IsDefined(variable)
{
    return (typeof(window[variable]) == "undefined") ? false : true;
}

function AttachEvent(obj, evt, fnc, useCapture) {
	if (!useCapture) useCapture = false;
	
	if (obj.addEventListener) {
		obj.addEventListener(evt, fnc, useCapture);
		return true;
	} else
	if (obj.attachEvent) {
		return obj.attachEvent("on" + evt, fnc);
	}
}

function GetTarget(e)
{
	if (e.target)
	{
		target = e.target;
	} else
	if (e.srcElement)
	{
		target = e.srcElement;
	}
	
	if (target.nodeType == 3) // Safari bug !
		target = target.parentNode;
	
	return target;
}

function GetMousePosition(e)
{
	var m_pos = new Object();
	
	if (e.pageX || e.pageY)
	{
		mx = e.pageX;
		my = e.pageY;
	} else
	if (e.clientX || e.clientY)
	{
		mx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
		my = e.clientY + document.body.scrollTop  + document.documentElement.scrollTop;
	} else {
		mx = -1;
		my = -1;
	}
	
	m_pos.x= mx;
	m_pos.y= my;
	
	return m_pos;
}

function DynSSF(location)
{
	document.getElementById('srh_in_location').value = location;
	document.getElementById('srh_in_location').focus();
	
	document.location.href = '#';
}
