if (document.all) {
	docObj = "document.all.";
	styleObj = ".style";
}
else {
	docObj = "document.";
	styleObj = "";
}

//////////////////////////////////////
//popup of a mouseOver info in the map
//////////////////////////////////////
function popUp(evt,currElem) {
	if(mouseOverPopup == true){
		var dom = (document.getElementById) ? true : false;
		var ff1 = ((navigator.userAgent.indexOf("Firefox")>-1) && dom) ? true: false;
		var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
		var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
		var ns4 = (document.layers && !dom) ? true : false;
		var ie4 = (document.all && !dom) ? true : false;
		var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false; 
	
		if (ie4 || ie5 || ff1) {
	        docObj = "document.all.";
	        styleObj = ".style";   
		} else {
	        docObj = "document.";
	        styleObj = "";
	    }
	
	    popUpWin = eval(docObj + currElem + styleObj);
	    if (ie4 || ie5) {
	        sc=document.body.scrollTop;
	        popUpWin.top = parseInt(evt.y)+2+sc;
	        popUpWin.left = Math.max(2,parseInt(evt.x)+8);
	    } else {
	        popUpWin.top = parseInt(evt.pageY)+2;
	        popUpWin.left = Math.max(2,parseInt(evt.pageX)+8);
	    }
	    popUpWin.visibility = "visible";
	    window.status = "";
	}
}
//////////////////////////////////////
//popup of a mouseOver info in the map
//////////////////////////////////////
function popUpWeather(evt,currElem) {
	if(mouseOverPopup == true){
		var dom = (document.getElementById) ? true : false;
		var ff1 = ((navigator.userAgent.indexOf("Firefox")>-1) && dom) ? true: false;
		var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
		var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
		var ns4 = (document.layers && !dom) ? true : false;
		var ie4 = (document.all && !dom) ? true : false;
		var nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false; 
	
		if (ie4 || ie5 || ff1) {
	        docObj = "document.all.";
	        styleObj = ".style";
		} else {
	        docObj = "document.";
	        styleObj = "";
	    }
	
	    popUpWin = eval(docObj + currElem + styleObj);
	    if (ie4 || ie5) {
	        sc=document.body.scrollTop;
	        popUpWin.top = parseInt(evt.y)+ 2 + sc;
	        popUpWin.left = Math.max(2,parseInt(evt.x)+8);
	    } else {
	        popUpWin.top = parseInt(evt.pageY) + 2;
	        popUpWin.left = Math.max(2,parseInt(evt.pageX)+8);	        
	    }
	    popUpWin.visibility = "visible";
	    window.status = "";
	}
}

////////////////////////////////////////
//popdown of a mouseOver info in the map
////////////////////////////////////////
function popDown(currElem) {
	popUpWin = eval(docObj + currElem + styleObj);
	popUpWin.visibility = "hidden";
}

////////////////////////////
//popup of POI highlighting
////////////////////////////

function popUpHighlight(evt,x,y,id){
	var lastPoiId;
	if (parent.listOldId) {
		lastPoiId = parent.listOldId;
	} else {
		lastPoiId = listOldId;
	}

	if(parent.mouseOverPopup == true){
		//display highlighting gifs in the map (left and right of POI)
		x = x + 414;
		y = y + 114;
		parent.document.getElementById("popupHighlightLeft").style.left = x-18;	 
		parent.document.getElementById("popupHighlightLeft").style.top = y-15;
		parent.document.getElementById("popupHighlightRight").style.left = x+8;	 
		parent.document.getElementById("popupHighlightRight").style.top = y-15;
		var ff1 = ((navigator.userAgent.indexOf("Gecko")>-1)) ? true: false;
		if (ff1){
			parent.document.getElementById("popupHighlightLeft").style.display ='table-row';
			parent.document.getElementById("popupHighlightRight").style.display ='table-row';
		} else {
			parent.document.getElementById("popupHighlightLeft").style.display ='block';
			parent.document.getElementById("popupHighlightRight").style.display ='block';
		}

		//highlight the POI or VI in the list, display special bg color and scroll content to see the highlighted part
		if(document.getElementById("poiId_"+id)){
		
		
	    	if(document.getElementById("poiId_"+lastPoiId)){
				document.getElementById("poiId_"+lastPoiId).style.backgroundColor = "ffffff";
	    	}
			document.getElementById("poiId_"+id).style.backgroundColor = "ededec";
			
		}else if(parent.iframePoiList){
			if(parent.iframePoiList.document.getElementById("poiId_"+id)){
				parent.iframePoiList.document.getElementById("poiId_"+id).scrollIntoView(false);
			    checkCounter = true;
			    if(parent.iframePoiList.document.getElementById("poiId_"+lastPoiId)){
						parent.iframePoiList.document.getElementById("poiId_"+lastPoiId).style.backgroundColor = "ffffff";
				}
				parent.iframePoiList.document.getElementById("poiId_"+id).style.backgroundColor = "#ededec";
			}
		}else if(parent.iframeTrafficList){
			if(parent.iframeTrafficList.document.getElementById("poiId_"+id)){
				parent.iframeTrafficList.document.getElementById("poiId_"+id).scrollIntoView(false);
			    if(parent.iframeTrafficList.document.getElementById("poiId_"+lastPoiId)){
					parent.iframeTrafficList.document.getElementById("poiId_"+lastPoiId).style.backgroundColor = "ffffff";
			    }
				parent.iframeTrafficList.document.getElementById("poiId_"+id).style.backgroundColor = "#ededec";
			}
		}		
	}
	
	if (parent.listOldId) {
		parent.listOldId = id;
	} else {
		listOldId = id;
	}	
}

/////////////////////////////
//popDown of POI highlighting
/////////////////////////////
function popDownHighlight(id){
	//don't display highlighting gifs (left and right of POI) anymore
	parent.document.getElementById("popupHighlightLeft").style.display ='none';	 	 
	parent.document.getElementById("popupHighlightRight").style.display ='none';	 	 
}

/////////////////////////////
// replace images onmouseover 
/////////////////////////////
function mapOver(name, status, sessionId) {

    var newClassName = (status == 0 ? "navOff" : "navOn");
    var newImgName = (status == 0 ? "_off.gif" : "_on.gif");
    var newBgColor = (status == 0 ? "#EEF0F0" : "#999999");
    if (name.length > 1) {
        document.getElementById("td_" + name + "_l").style.backgroundColor = newBgColor;
        document.getElementById("td_" + name + "_r").style.backgroundColor = newBgColor;
    }
    document.getElementById("td_" + name).style.backgroundColor = newBgColor;
    document.getElementById("img_" + name).src = "img/move/move_" + name + newImgName + ";jsessionid=" + sessionId;
}

////////////////////////////////////////////////////////////////////////////
//display 'inactive' gif over map (transparent gif) to prevent double clicks
////////////////////////////////////////////////////////////////////////////
function inactiveMap() {
	var ff1 = ((navigator.userAgent.indexOf("Gecko")>-1)) ? true: false;

	if (ff1){
		document.getElementById("inactivemap").style.display='table-row';
	} else {
		document.getElementById("inactivemap").style.display='block';
	}
	rectzoom = false;
}	

/////////////////////////////////////////////////////////////////////////////
// Title: Tigra Calendar
// URL: http://www.softcomplex.com/products/tigra_calendar/
// Version: 3.2 (European date format)
// Date: 10/14/2002 (mm/dd/yyyy)
// Feedback: feedback@softcomplex.com (specify product title in the subject)
// Note: Permission given to use this script in ANY kind of applications if
//    header lines are left unchanged.
// Note: Script consists of two files: calendar?.js and calendar.html
// About us: Our company provides offshore IT consulting services.
//    Contact us at sales@softcomplex.com if you have any programming task you
//    want to be handled by professionals. Our typical hourly rate is $20.

//Calendar
// if two digit year input dates after this year considered 20 century.
var NUM_CENTYEAR = 30;
// is time input control required by default
var BUL_TIMECOMPONENT = false;
// are year scrolling buttons required by default
var BUL_YEARSCROLL = true;

var calendars = [];
var RE_NUM = /^\-?\d+$/;

var invalidDate="Ungueltiges Datumsformat";
var acceptFormat="Erlaubtes Format ist tt.mm.jjjj.";
var noDayofmonth="Tag konnte nicht gefunden werden.";
var invalidDayofmonth="Ungueltiger Tag";
var acceptIntegers="Erlaubte Werte: nicht signierte Integer.";
var noMonth="Monat konnte nicht gefunden werden.";
var invalidMonth="Ungueltiger Monat";
var noYear="Jahr konnte nicht gefunden werden";
var invalidYear="Ungueltiges Jahr";
var allowed="Erlaubter Bereich ist";
var invalidHours="Ungueltiger Stunden-Wert";
var invalidMinutes="Ungueltiger Minuten-Wert";


function calendar1(obj_target) {

	// assing methods
	this.gen_date = cal_gen_date1;
	this.gen_time = cal_gen_time1;
	this.gen_tsmp = cal_gen_tsmp1;
	this.prs_date = cal_prs_date1;
	this.prs_time = cal_prs_time1;
	this.prs_tsmp = cal_prs_tsmp1;
	this.popup    = cal_popup1;
	this.validateDateTime = cal_validateDateTime;
	
	// validate input parameters
	if (!obj_target)
		return cal_error("Error calling the calendar: no target control specified");
	if (obj_target.value == null)
		return cal_error("Error calling the calendar: parameter specified is not valid target control");
	this.target = obj_target;
	this.time_comp = BUL_TIMECOMPONENT;
	this.year_scroll = BUL_YEARSCROLL;
	
	// register in global collections
	this.id = calendars.length;
	calendars[this.id] = this;
}


// timestamp generating function
function cal_gen_tsmp1 (dt_datetime) {
	return(this.gen_date(dt_datetime) + ' ' + this.gen_time(dt_datetime));
}

// date generating function
function cal_gen_date1 (dt_datetime) {
	return (
		(dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate() + "."
		+ (dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "."
		+ dt_datetime.getFullYear()
	);
}
// time generating function
function cal_gen_time1 (dt_datetime) {
	return (
		(dt_datetime.getHours() < 10 ? '0' : '') + dt_datetime.getHours() + ":"
		+ (dt_datetime.getMinutes() < 10 ? '0' : '') + (dt_datetime.getMinutes())
	);
}

// timestamp parsing function
function cal_prs_tsmp1 (str_datetime) {
	// if no parameter specified return current timestamp
	if (!str_datetime)
		return (new Date());

	// if positive integer treat as milliseconds from epoch
	if (RE_NUM.exec(str_datetime))
		return new Date(str_datetime);
		
	// else treat as date in string format
	var arr_datetime = str_datetime.split(' ');
	return this.prs_time(arr_datetime[1], this.prs_date(arr_datetime[0]));
}

// date parsing function
function cal_prs_date1 (str_date) {

	var arr_date = str_date.split('.');

//	if (arr_date.length != 3) return cal_error (invalidDate+": '" + str_date + "'.\n"+acceptFormat);
//	if (!arr_date[0]) return cal_error (invalidDate+": '" + str_date + "'.\n"+noDayofmonth);
//	if (!RE_NUM.exec(arr_date[0])) return cal_error (invalidDayofmonth+": '" + arr_date[0] + "'.\n"+acceptIntegers);
//	if (!arr_date[1]) return cal_error (invalidDate+": '" + str_date + "'.\n"+noMonth);
//	if (!RE_NUM.exec(arr_date[1])) return cal_error (invalidMonth+": '" + arr_date[1] + "'.\n"+acceptIntegers);
//	if (!arr_date[2]) return cal_error (invalidDate+": '" + str_date + "'.\n"+noYear);
//	if (!RE_NUM.exec(arr_date[2])) return cal_error (invalidYear+": '" + arr_date[2] + "'.\n"+acceptIntegers);

	var dt_date = new Date();
	dt_date.setDate(1);

//	if (arr_date[1] < 1 || arr_date[1] > 12) return cal_error (invalidMonth+": '" + arr_date[1] + "'.\n"+allowed+" 01-12.");
	dt_date.setMonth(arr_date[1]-1);
	 
	if (arr_date[2] < 100) arr_date[2] = Number(arr_date[2]) + (arr_date[2] < NUM_CENTYEAR ? 2000 : 1900);
	dt_date.setFullYear(arr_date[2]);

	var dt_numdays = new Date(arr_date[2], arr_date[1], 0);
	dt_date.setDate(arr_date[0]);
//	if (dt_date.getMonth() != (arr_date[1]-1)) return cal_error (invalidDayofmonth+": '" + arr_date[0] + "'.\n"+allowed+" 01-"+dt_numdays.getDate()+".");

	return (dt_date);
}

// time parsing function
function cal_prs_time1 (str_time, dt_date) {

	if (!dt_date) return null;
	var arr_time = String(str_time ? str_time : '').split(':');

	if (!arr_time[0]) dt_date.setHours(0);
	else if (RE_NUM.exec(arr_time[0])) 
		if (arr_time[0] < 24) dt_date.setHours(arr_time[0]);
//		else return cal_error (invalidHours+": '" + arr_time[0] + "'.\n"+allowed+" 00-23.");
//	else return cal_error (invalidHours+": '" + arr_time[0] + "'.\n"+acceptIntegers);
	
	if (!arr_time[1]) dt_date.setMinutes(0);
	else if (RE_NUM.exec(arr_time[1]))
		if (arr_time[1] < 60) dt_date.setMinutes(arr_time[1]);
//		else return cal_error (invalidMinutes+": '" + arr_time[1] + "'.\n"+allowed+" 00-59.");
//	else return cal_error (invalidMinutes+": '" + arr_time[1] + "'.\n"+acceptIntegers);

	dt_date.setMilliseconds(0);
	return dt_date;
}

function cal_error (str_message) {
	alert (str_message);
	return null;
}


//////////////////////////////////////////////
// scroll an iframe to a given window position
//////////////////////////////////////////////
function scrollToPosition(scrollVert){
	window.scrollTo(0,scrollVert);
}

////////////////////////////////////////////////
// display selected test of ruhrpilot info pages
////////////////////////////////////////////////
function showRuhrpilotText(text){
	
	var ff1 = ((navigator.userAgent.indexOf("Gecko")>-1)) ? true: false;	
	if (ff1){
	  document.getElementById('ruhr').style.display='none';
	  document.getElementById('situation').style.display='none';
	  document.getElementById('technic').style.display='none';
	  document.getElementById('date').style.display='none';
	  document.getElementById('service').style.display='none';
	  document.getElementById(text).style.display='table-row';
	} else {
	  document.getElementById('ruhr').style.display='none';
	  document.getElementById('situation').style.display='none';
	  document.getElementById('technic').style.display='none';
	  document.getElementById('date').style.display='none';
	  document.getElementById('service').style.display='none';
	  document.getElementById(text).style.display='block';
	}
}


/////////////////////////////////////////////
// display selected text of press info pages
/////////////////////////////////////////////
function showPressText(text){

	var hide = 'archive';
	if(text == 'archive'){
		hide = 'news';
	}
	
	var ff1 = ((navigator.userAgent.indexOf("Gecko")>-1)) ? true: false;	
	if (ff1){
	  document.getElementById(hide).style.display='none';
	  document.getElementById(text).style.display='table-row';
	} else {
	  document.getElementById(hide).style.display='none';
	  document.getElementById(text).style.display='block';
	}
}

///////////////////////////////////////////
// display selected text of agb info pages
///////////////////////////////////////////
function showAgbText(text){

	var hide = 'data';
	if(text == 'data'){
		hide = 'abg';
	}
	
	var ff1 = ((navigator.userAgent.indexOf("Gecko")>-1)) ? true: false;	
	if (ff1){
	  document.getElementById(hide).style.display='none';
	  document.getElementById(text).style.display='table-row';
	} else {
	  document.getElementById(hide).style.display='none';
	  document.getElementById(text).style.display='block';
	}
}

//////////////////////////
// iFrame height handling
/////////////////////////
// has to be placed in internationalized js-files because of different height of navi parts
function resize_iframe(iframe,height){
	if(iframe != ''){
		var iFrameName = iframe;
		var height = height; //special height for every iframe from title to iFrame
		var tablemin = 200; // minimum height of frame
		var tabletop = 400; //write in here the distance from the top
		var tablebottom = 40; //write in here the distance from the bottom
	
		var newHeight = document.body.clientHeight-tabletop-tablebottom;
		parent.document.getElementById(iFrameName).height = newHeight-height;
	}
}
