browser = '';
if (navigator.appVersion.split('MSIE 6').length != 1)
	browser = 'ie6';


var CALENDAR_STEP = 35;
var CALENDAR_LIST = 'calendar_overview';
var VISIBLE_HEIGHT = 109;

function pxToInt(attr) {
	return parseInt(eval(attr.substring(0,attr.length-2)));
}

function calendar_top() {
	oldTop = getEl(CALENDAR_LIST).style.top;
	newTop = pxToInt(oldTop) + CALENDAR_STEP;
	hoehe = getEl(CALENDAR_LIST).offsetHeight.substring
	if (newTop>0) return false;
	if (newTop+hoehe<VISIBLE_HEIGHT) return false;
	getEl(CALENDAR_LIST).style.top = newTop + 'px';
	
		correctIE7RenderingBug();
	
	return false;
}

function calendar_bottom() {
	oldTop = getEl(CALENDAR_LIST).style.top;
	newTop = pxToInt(oldTop) - CALENDAR_STEP;
	if (newTop>0) return false;
	if (newTop+parseInt(getEl(CALENDAR_LIST).offsetHeight)<VISIBLE_HEIGHT-CALENDAR_STEP) return false;
	getEl(CALENDAR_LIST).style.top = newTop + 'px';
	return false;
}

function getXPos(obj) {
	leftGes = obj.offsetLeft;
	while (obj.offsetParent) {
		obj = obj.offsetParent;
		leftGes = leftGes + obj.offsetLeft;
	}
	if (browser=='ie6')
		if (getStyle(document.getElementById("calendar"), "position")!='absolute')
			leftGes = leftGes - parseInt(getStyle(document.getElementById("calendar_container"), "margin-left"));
	return leftGes;
}

function getYPos(obj) {
	topGes = obj.offsetTop;
	while (obj.offsetParent) {
		obj = obj.offsetParent;
		topGes = topGes + obj.offsetTop;
	}
	return topGes;
}

var aktTooltip = null;
function showCalendarToolTip(obj, nr) {
	getEl('termin_tooltip_'+nr).style.display = 'block';
	hoehe = getEl('termin_tooltip_'+nr).offsetHeight;
	getEl('termin_tooltip_'+nr).style.left = getXPos(obj)+7+'px';
	getEl('termin_tooltip_'+nr).style.top = (getYPos(obj)-hoehe-15)+'px';
		
	correctIE7RenderingBug();
	
	if (browser == 'ie6') {
		getEl('termin_tooltip_'+nr+'_bottom').style.display = 'block';
		getEl('termin_tooltip_'+nr+'_bottom').style.top = (getEl('termin_tooltip_'+nr).style.top.split("px")[0]-0+hoehe)+'px';
		getEl('termin_tooltip_'+nr+'_bottom').style.left = getEl('termin_tooltip_'+nr).style.left;
	}
	
	aktTooltip = nr;
}

function correctIE7RenderingBug() {
	if (navigator.appVersion.split('MSIE 7').length != 1) {
		document.getElementsByTagName('body')[0].style.paddingTop = '1px';
		document.getElementsByTagName('body')[0].style.paddingTop = '0px';
	}
}

function hideCalendarToolTip() {
	getEl('termin_tooltip_'+aktTooltip).style.display = 'none';
	if (browser == 'ie6')
		getEl('termin_tooltip_'+aktTooltip+'_bottom').style.display = 'none';
}

var aktCalendarEntry = null;
function viewCalendarEntry(nr) {
	getEl('calendar_overview').style.display = 'none';
	getEl('calender_button_top').style.display = 'none';
	getEl('calender_button_bottom').style.display = 'none';
	getEl('calendar_top_active').style.display = 'inline';
	getEl('calendar_bottom_active').style.display = 'block';
	getEl('calendar_visible').style.height = '115px';
	getEl('calendar_entry_'+nr).style.display = 'block';
	aktCalendarEntry = nr;
	return false;
}

function hideCalendarEntry(nr) {
	getEl('calendar_overview').style.display = 'block';
	getEl('calender_button_top').style.display = 'block';
	getEl('calender_button_bottom').style.display = 'block';
	getEl('calendar_top_active').style.display = 'none';
	getEl('calendar_bottom_active').style.display = 'none';
	getEl('calendar_visible').style.height = '109px';
	getEl('calendar_entry_'+aktCalendarEntry).style.display = 'none';
	return false;
}