/* ******************************** */
/* Miscellaneous JS-Functions       */
/* Programming: Tomasz Misztal 2009 */ 
/* ONLY FOR WWW.IHRMIETWAGEN.DE     */ 
/* ******************************** */

var EVENT_HANDLING = new Object();

EVENT_HANDLING['TOOLTIPS'] 		= false;
EVENT_HANDLING['SEARCH'] 		= false;
EVENT_HANDLING['SUGGESTIONS'] 	= false;
EVENT_HANDLING['CALENDAR'] 		= false;
EVENT_HANDLING['TIMETABLE'] 	= false;

/* Browser finden */
BROWSER_CURRENT = new Object();

BROWSER_CURRENT['msie'] 		= false;
BROWSER_CURRENT['firefox'] 		= false;
BROWSER_CURRENT['opera'] 		= false;
BROWSER_CURRENT['chrome'] 		= false;

var imw_div_offset_x = 0;
var imw_div_offset_y = 0;
var imw_div_pg_type = '';

var agent = navigator.userAgent.toLowerCase();

if (agent.indexOf("firefox") >- 1)
{
     BROWSER_CURRENT['firefox'] = true;
} else
if (agent.indexOf("opera") > -1)
{
     BROWSER_CURRENT['opera'] = true;
} else
if (agent.indexOf("chrome") > -1)
{
     BROWSER_CURRENT['chrome'] = true;
} else {
     BROWSER_CURRENT['msie'] = true;
}

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 isset(variable)
{
	return (typeof(window[variable]) == "undefined") ? false : true;
}

function ShowOnlineHelp()
{
	w_data = GetWindowSize();
	
	w_lexikon = window.open('/lexikon.php', 'online_help', 'left=' + (parseInt(w_data['x']) + 15) + ',top=' + (parseInt(w_data['y']) + 15) + ',width=550,height=400');
	w_lexikon.focus();
}

function ShowConditions(car_id, session_id, from_results)
{
	w_data = GetWindowSize();
	
	window_cardetails = window.open("konditionen.php?car_id=" + car_id + "&session=" + session_id + "&rlist=" + from_results, "car_details_" + car_id.replace(/,/, "_"), "left=" + (parseInt(w_data['x']) + 15) + ",top=" + (parseInt(w_data['y']) + 15) + ",width=720,height=540,scrollbars=yes");
	window_cardetails.focus();
}

function DirectBooking(car_id, session_id)
{
	w_data = GetWindowSize();
	
	window_dbook = window.open("anbieter.php?car_id=" + car_id + "&session=" + session_id, "car_book_" + car_id.replace(/,/, "_"), "left=" + (parseInt(w_data['x']) + 15) + ",top=" + (parseInt(w_data['y']) + 15) + ",width=1020,height=720,scrollbars=yes,resizable=yes");
	window_dbook.focus();
}

function changeClass(cell, cursor, newClass)
{
	if (cursor.length)
		cell.style.cursor = pPointer;
	if (newClass.length)
		cell.className = newClass;
}
