
function DF_InitShowHideNews(id,openit) {
	if (document.getElementById) {
		if (openit) {
			for (var i = 0; i < newsElems.length; i++) {
				DF_ShowHideNews(newsElems[i],0);
			}
		}
		DF_ShowHideNews(id,openit);
	}
}

function DF_ShowHideNews(id,openit) {
	var obj = document.getElementById(id)
	if (openit) {
		obj.getElementsByTagName('table')[0].style.display='block';
		obj.getElementsByTagName('h4')[0].style.display='none';
	} else {
		obj.getElementsByTagName('table')[0].style.display='none';
		obj.getElementsByTagName('h4')[0].style.display='block';
	}
}

function DF_CloseNLSentWin() {
	document.getElementById('NLSentWin').style.display = 'none';
}

function DF_OpenWindow(url,name,width,height,center) { 
	/******************** COPYRIGHT ********************
	Copyright 2005 dotfly.multimedia | Tobias Mueller.
	www.dotfly.de | info@dotfly.de
	All rights reserved.
	******************* END COPYRIGHT ******************/
	if (url && name) {
		var posX, posY, prop = '', DFWin, a = arguments;
		if (width && height) {
			prop += 'width=' + width + ',height=' + height;
			if (center) {
				posX = (screen.width / 2) - (width / 2);
				posY = (screen.height / 2) - (height / 2);
				prop += ',left=' + posX + ',top=' + posY;
			}
		}
		if (a.length == 11) {
			prop += ',toolbar=' + a[5] + ',location=' + a[6] + ',status=' + a[7] + ',menubar=' + a[8] + ',scrollbars=' + a[9] + ',resizable=' + a[10];
		}
		DFWin = window.open(url,name,prop);
		DFWin.focus();
	}
	document.MM_returnValue = false;
}

var DF_SlideNL = {
	
	init : function() {
		this.formHeadElem = document.getElementById('NewsletterAreaBox').getElementsByTagName('h2')[0].childNodes[0];
		this.formFatherElem = document.getElementById('NewsletterFormBox');
		this.formFatherElemHeight = 0;
		this.formBaseElem = this.formFatherElem.getElementsByTagName('div')[0];
		this.formBaseElemHeight = this.formBaseElem.offsetHeight;
		this.slideStepDivider = 2;
		this.slideStepMin = 2;
		this.slidedOut = false;
		this.sliding = false;
	},
	
	slide : function() {
		if (!this.sliding) {
			if (this.slidedOut) {
				this.slideIn();
			} else {
				this.slideOut();
			}
		}
	},
	
	slideOut : function() {
		if (!this.sliding) {
			if (document.all && !window.opera) {
				preloadImages();
			}
			this.formFatherElemHeight = 0; 
			this.formBaseElemHeight = this.formBaseElem.offsetHeight;
			this.slideSteps = Math.round(this.formBaseElemHeight / this.slideStepDivider);
			//this.formHeadElemClassNameOld = this.formHeadElem.className;
			this.formHeadElem.className = 'active';
			this.sliding = true;
		}
		this.formFatherElemHeight += this.slideSteps;
		this.slideSteps -= (this.slideSteps > this.slideStepMin) ? Math.round(this.slideSteps / this.slideStepDivider) : 0;
		this.formFatherElem.style.height = this.formFatherElemHeight + 'px';
		if (this.formFatherElemHeight < this.formBaseElemHeight - this.slideSteps) {
			window.setTimeout('DF_SlideNL.slideOut()',35);
		} else {
			this.formFatherElem.style.height = 'auto';
			this.slidedOut = true;
			this.sliding = false;
		}
	},
	
	slideIn : function() {
		if (!this.sliding) {
			this.formFatherElemHeight = this.formBaseElem.offsetHeight;
			this.formBaseElemHeight = this.formFatherElemHeight;
			this.slideSteps = Math.round(this.formBaseElemHeight / this.slideStepDivider);
			this.sliding = true;
		}
		this.formFatherElemHeight -= this.slideSteps;
		this.slideSteps -= (this.slideSteps > this.slideStepMin) ? Math.round(this.slideSteps / this.slideStepDivider) : 0;
		this.formFatherElem.style.height = this.formFatherElemHeight + 'px';
		if (this.formFatherElemHeight >= this.slideSteps) {
			window.setTimeout('DF_SlideNL.slideIn()',35);
		} else {
			this.formFatherElem.style.height = '1px';
			this.slidedOut = false;
			this.sliding = false;
			this.formHeadElem.className = '';
		}
	}
	
}

var DF_ChangeNLForm = {
	
	hideRows : ['NLMailRow','NLFaxRow','NLStreetRow','NLPlzRow','NLCityRow','NLCountryRow'],
	
	change : function(e) {
		if (arguments[0] == 'Mail') {
			this.showRows = ['NLMailRow'];
		} else if (arguments[0] == 'Fax') {
			this.showRows = ['NLFaxRow'];
		} else {
			this.showRows = ['NLStreetRow','NLPlzRow','NLCityRow','NLCountryRow'];
		}
		this.hide();
		this.show();
	},
	
	hide : function() {
		for (var i = 0; i < this.hideRows.length; i++) {
			document.getElementById(this.hideRows[i]).style.display = 'none';
		}
	},
	
	show : function() {
		for (var i = 0; i < this.showRows.length; i++) {
			document.getElementById(this.showRows[i]).style.display = (document.all && !window.opera) ? 'inline' : 'table-row';
		}
	}
}

var DF_CSSHover = {
	
	init : function() {
		if (document.all && !window.opera) {
			this.allElems = document.getElementsByTagName('*');
			for (var i = 0; i < this.allElems.length; i++) {
				if (this.allElems[i].className.indexOf('csshover') != -1) {
					this.eventSetting = function() {
						var elem = arguments[0];
						elem.onmouseover = function() {
							DF_CSSHover.hover(elem);
						}
						elem.onmouseout = function() {
							DF_CSSHover.out();
						}
					}
					this.eventSetting(this.allElems[i]);
				}
			}
		}
	},
	
	hover : function() {
		this.elem = arguments[0];
		if (this.elem.className.indexOf('active') == -1 ) {
			this.classNameOld = this.elem.className;
			this.elem.className = this.elem.className + ' hover';
		}
	},
	
	out : function() {
		if (this.elem.className.indexOf('active') == -1 ) {
			this.elem.className = this.elem.classNameOld;
		}
	}
	
}

function TMVerweisBlur() {
	if (document.getElementsByTagName) {
		var verweise, verweis;
		verweise = document.getElementsByTagName('a');
		for (var i = 0; i < verweise.length; i++) {
			verweis		= verweise[i];
			verweisblur	= function(verweis) {
				verweis.onmouseup = function() {
					if (verweis.blur) {
						verweis.blur();
					}
				};
			};
			verweisblur(verweis);
		}
	}
}

var imagesToPreload = [
	'/de/images/subnav/subnav1_01.gif',
	'/de/images/subnav/subnav2_01.gif',
	'/de/images/subnav/subnav3_01.gif',
	'/de/images/subnav/subnav4_01.gif',
	'/de/images/nav/nav1_01.gif',
	'/de/images/nav/nav2_01.gif',
	'/de/images/nav/nav3_01.gif',
	'/de/images/nav/nav4_01.gif',
	'/de/images/nav/nav5_01.gif',
	'/de/images/nav/nav6_01.gif',
	'/de/images/nav/nav7_01.gif',
	'/de/images/nav/nav8_01.gif',
	'/de/images/nav/nav9_01.gif',
	'/de/images/buttons/bt_reservierung_01.gif',
	'/de/images/icons/card_arrow_01.gif',
	'/de/images/icons/link_arrow_02.gif',
	'/de/images/newsletter/t_email.gif',
	'/de/images/newsletter/t_fax.gif',
	'/de/images/newsletter/t_land.gif',
	'/de/images/newsletter/t_anrede.gif',
	'/de/images/newsletter/t_name.gif',
	'/de/images/newsletter/t_ort.gif',
	'/de/images/newsletter/t_plz.gif',
	'/de/images/newsletter/t_post.gif',
	'/de/images/newsletter/t_str_nr.gif',
	'/de/images/newsletter/t_vorname.gif'
];

var imagesToPreloadOnUnload = [
	'/de/images/subnav/subnav1_00.gif',
	'/de/images/subnav/subnav2_00.gif',
	'/de/images/subnav/subnav3_00.gif',
	'/de/images/subnav/subnav4_00.gif',
	'/de/images/subnav/subnav1_01.gif',
	'/de/images/subnav/subnav2_01.gif',
	'/de/images/subnav/subnav3_01.gif',
	'/de/images/subnav/subnav4_01.gif',
	'/de/images/nav/nav1_00.gif',
	'/de/images/nav/nav2_00.gif',
	'/de/images/nav/nav3_00.gif',
	'/de/images/nav/nav4_00.gif',
	'/de/images/nav/nav5_00.gif',
	'/de/images/nav/nav6_00.gif',
	'/de/images/nav/nav7_00.gif',
	'/de/images/nav/nav8_00.gif',
	'/de/images/nav/nav9_00.gif',
	'/de/images/nav/nav1_01.gif',
	'/de/images/nav/nav2_01.gif',
	'/de/images/nav/nav3_01.gif',
	'/de/images/nav/nav4_01.gif',
	'/de/images/nav/nav5_01.gif',
	'/de/images/nav/nav6_01.gif',
	'/de/images/nav/nav7_01.gif',
	'/de/images/nav/nav8_01.gif',
	'/de/images/nav/nav9_01.gif',
	'/de/images/buttons/bt_reservierung_00.gif',
	'/de/images/buttons/bt_reservierung_01.gif',
	'/de/images/icons/card_arrow_00.gif',
	'/de/images/icons/card_arrow_01.gif',
	'/de/images/icons/link_arrow_01.gif',
	'/de/images/icons/link_arrow_02.gif',
	'/de/images/newsletter/t_email.gif',
	'/de/images/newsletter/t_fax.gif',
	'/de/images/newsletter/t_land.gif',
	'/de/images/newsletter/t_anrede.gif',
	'/de/images/newsletter/t_name.gif',
	'/de/images/newsletter/t_ort.gif',
	'/de/images/newsletter/t_plz.gif',
	'/de/images/newsletter/t_post.gif',
	'/de/images/newsletter/t_str_nr.gif',
	'/de/images/newsletter/t_vorname.gif'
];

preloadImages = function() {
	var args = arguments[0] ? arguments[0] : imagesToPreload;
	var imgs = new Array()
	for (var i = 0; i < args.length; i++) {
		imgs[i] = new Image();
		imgs[i].src = args[i];
	}
	return imgs;
}

preloadImagesOnUnload = function() {
	if (document.all && !window.opera && arguments.length > 0) {
		preloadImages(arguments[0]);
	}
}

window.onload = function() {
	DF_CSSHover.init();
	DF_SlideNL.init();
	//TMVerweisBlur();
	preloadImages();
}
