function onDocumentLoad () {	
	
	if ( typeof(hotelCategory) == 'undefined') {
		hotelCategory = "";
	}
	try {
		if ($('mylightbox')) {
			myLightbox = new Lightbox();
		}
	}
	catch (e) {}
	
	if($('languages') != null)
	{
		var languages = new dropDown($('languages'));
	}
	
	if($('requesttyp') != null)
	{
		var requesttyp = new dropDown($('requesttyp'));
	}
	
	if($('requestdestination') != null)
	{
		var requestdestination = new dropDown($('requestdestination'));
	}
	
	switch (hotelCategory)
	{
		case 'wellness': 
			var sujetColor = "05b1a3";
		break;
		
		case 'city': 
			var sujetColor = "b6030e";
		break;
		
		case 'family': 
			var sujetColor = "f48f00";
		break;
		
		default: 
			var sujetColor = "00468e";
		break;
		
	}
	try {
		text2image($$('h1'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '600',
			height: '23',
			color: sujetColor,
			size: '12',
			positionx: 0,
			positiony: 15,
			replaceElement: {
				tagName: "span",
				className: "h1"
			},
			addImage: {
				tagName: "img",
				className: "stars",
				top: 0
			}
		});
		
		
		
		text2image($$('.sidebar_right h3'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '140',
			height: '',
			color: sujetColor,
			size: '12',
			positionx: 0,
			positiony: 14,
			replaceElement: {
				tagName: "span",
				className: "h3"
			}
		});
		
		
		text2image($$('#countries .hotelname'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '220',
			height: '',
			color: '00468e',
			size: '12',
			positionx: 0,
			positiony: 15,
			replaceElement: {
				tagName: "div",
				className: "hotelname"
			}
		});
		
		
		
		text2image($$('#countries .hotelnamewide'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '280',
			height: '',
			color: '00468e',
			size: '12',
			positionx: 0,
			positiony: 15,
			replaceElement: {
				tagName: "span",
				className: "h1"
			}
		});
		
		text2image($$('.headline h2.img','#countries .locaname'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '600',
			height: '23',
			color: '909499', 
			color: '333333',
			size: '8',
			positionx: 0,
			positiony: 12,
			replaceElement: {
				tagName: "div",
				className: "locaname"
			},
			modifyValue : function (vari)
			{
				return vari.toUpperCase();
			}
		});
		
		
		
		text2image($$('.sidebar_right h4'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '600',
			height: '23',
			color: '909499',
			size: '8',
			positionx: 0,
			positiony: 15,
			replaceElement: {
				tagName: "span",
				className: "h4"
			},
			modifyValue : function (vari)
			{
				return vari.toUpperCase();
			}
		});
		
		text2image($$('.boxes .callback h3.blue'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '140',
			height: '23',
			color: '00498d',
			size: '10',
			positionx: 0,
			positiony: 15,
			replaceElement: {
				tagName: "span",
				className: "h3"
			}
		});
		
		text2image($$('.boxes .requestbox h3.white'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '140',
			height: '23',
			color: 'ffffff',
			size: '10',
			positionx: 0,
			positiony: 15,
			replaceElement: {
				tagName: "span",
				className: "h3"
			}
		});
		
		
		text2image($$('#content .textarea h3.img'),{
			font: 'StoneSerITCStd-Medium.ttf',
			width: '',
			height: '',
			color: '00498d',
			size: '10',
			positionx: 0,
			positiony: 15,
			replaceElement: {
				tagName: "span",
				className: "h3"
			},
			modifyValue : function (vari)
			{
				return vari.toUpperCase();
			}
		});
	}
	catch (e) {
	}
	
	var hotelTypes = new Array({key: 'wellness', color: '05b1a3'},{key: 'city', color: 'b6030e'},{key: 'family', color: 'f48f00'});
	
	/*for(var i=0; i<hotelTypes.length; i++)
	{
		text2image($$('#content .textarea .packages h3.' + hotelTypes[i].key),{
			font: 'StoneSansITCStd-Medium.ttf',
			width: '',
			height: '22',
			color: hotelTypes[i].color,
			size: '9.5',
			positionx: 0,
			positiony: 15,
			replaceElement: {
				tagName: "span",
				className: "h3"
			},
			modifyValue : function (vari)
			{
				return vari.toUpperCase();
			}
		});
	}*/
	
	
	
	var elementhover = new classSwitcher( [ $$('#topnav li'), $$('#topnav li ul li'), $$('#topnav li ul li ul li') ] );
	var picHover = new classPicSwitcher( [ $$('#topnav li.main') ] );
	
	//Sprachauswahl Initialisierung
	/*new langSelect();*/
	
	//Initialisierung fuer Sliderteaser
	/*
	var slideboxes = document.getElementsByClassName('slidebox');
	if(slideboxes.length > 0)
	{
		for( k=0; k<slideboxes.length; k++ )
		{
			//Slideteaser Initialisieren
			new slideBox(slideboxes[k]);
		}
	}
	*/
	
	//Initialisierung fuer Hotelkategorien wenn vorhanden
	var categories = document.getElementsByClassName('categories');
	if(categories.length > 0)
	{
		for( j=0; j<categories.length; j++ )
		{
			cats = categories[j].getElementsByClassName('category');
			new catSlider(cats);
		}
	}
	
	//Initialisierung fuer Angebote wenn vorhanden
	if ($('packagescroll')) {
		var offerBlock = document.getElementsByClassName('packages');
		if(offerBlock.length > 0) {
			for( j=0; j<offerBlock.length; j++ ) {
				offers = offerBlock[j].getElementsByClassName('entry');
				new offerSlider(offers);
			}
		}
	}
	// Initalisiere Autocomplete Search
	/**
	 * deprecated by Nutch
	 * if ($('searchbox')) {
	 *	initializeSuggestFramework();
	 * }
	 */
	// Fade Headerimages
	if ($('slideheaderimages')) {
		// headerimages
		animBackgroundHelper = null;
		var animBackground = Class.create();
		animBackground.prototype = {
			initialize : function (element) {
				this.images = $('slideheaderimages').getElementsByTagName('img');
				for (i=0;i<this.images.length;i++) {
					if(i != 0) {
						$(this.images[i]).setOpacity(0);
						this.images[i].style.zIndex = 2;
					}
					else {
						$(this.images[i]).setOpacity(100);
						this.images[i].style.zIndex = 3;
						this.images[i].style.display = "block";
					}
				}
				this.actual = 0;
				if(this.images.length != 1) {
					new PeriodicalExecuter(this.changeImage,4);
				}
				animBackgroundHelper = this;
			},
			changeImage : function () {
				images = animBackgroundHelper.images;
				if(animBackgroundHelper.actual == images.length -1) {
					animBackgroundHelper.images[0].style.display = "block";
					animBackgroundHelper.images[animBackgroundHelper.actual].style.zIndex = 2;
					animBackgroundHelper.images[0].style.zIndex = 3;
					ex9 = new Animator({transition: Animator.makeEaseOut(3),duration: 4000});
					ex9.addSubject(new NumericalStyleSubject(animBackgroundHelper.images[animBackgroundHelper.actual], 'opacity', 1, 0));
					ex9.addSubject(new NumericalStyleSubject(animBackgroundHelper.images[0], 'opacity', 0, 1));
					ex9.play();
					animBackgroundHelper.actual = 0;
				}
				else {
					animBackgroundHelper.images[animBackgroundHelper.actual +1].style.display = "block";
					animBackgroundHelper.images[animBackgroundHelper.actual].style.zIndex = 2;
					animBackgroundHelper.images[animBackgroundHelper.actual + 1].style.zIndex = 3;
					ex9 = new Animator({transition: Animator.makeEaseOut(3),duration: 4000});
					ex9.addSubject(new NumericalStyleSubject(animBackgroundHelper.images[animBackgroundHelper.actual], 'opacity', 1, 0));
					ex9.addSubject(new NumericalStyleSubject(animBackgroundHelper.images[animBackgroundHelper.actual + 1], 'opacity', 0, 1));
					ex9.play();
					animBackgroundHelper.actual ++;
				}
			}
		}
		new animBackground();
	}
	// Fade Portalimages
	if ($('slideportalimages')) {
		// headerimages
		animBackgroundHelper = null;
		var animBackground = Class.create();
		animBackground.prototype = {
			initialize : function (element) {
				this.images = $('slideportalimages').getElementsByTagName('img');
				for (i=0;i<this.images.length;i++) {
					if(i != 0) {
						$(this.images[i]).setOpacity(0);
						this.images[i].style.zIndex = 2;
					}
					else {
						$(this.images[i]).setOpacity(100);
						this.images[i].style.zIndex = 3;
						this.images[i].style.display = "block";
					}
				}
				this.actual = 0;
				if(this.images.length != 1) {
					new PeriodicalExecuter(this.changeImage,4);
				}
				animBackgroundHelper = this;
			},
			changeImage : function () {
				images = animBackgroundHelper.images;
				if(animBackgroundHelper.actual == images.length -1) {
					animBackgroundHelper.images[0].style.display = "block";
					animBackgroundHelper.images[animBackgroundHelper.actual].style.zIndex = 2;
					animBackgroundHelper.images[0].style.zIndex = 3;
					ex9 = new Animator({transition: Animator.makeEaseOut(3),duration: 4000});
					ex9.addSubject(new NumericalStyleSubject(animBackgroundHelper.images[animBackgroundHelper.actual], 'opacity', 1, 0));
					ex9.addSubject(new NumericalStyleSubject(animBackgroundHelper.images[0], 'opacity', 0, 1));
					ex9.play();
					//$('teaser').getElementsBySelector("h2").getElementsBySelector("a");
					links = $('teaser').getElementsBySelector("a")
					for (i=0; i < links.length; i++ ) {
						switch (i) {
							case 0:
							links[i].update (animBackgroundHelper.images[0].name);
							break;
							case 1:
							links[i].update (animBackgroundHelper.images[0].alt);
							break;
						}
						links[i].href = getUrl(animBackgroundHelper.images[0].longDesc.replace("http://www.falkensteiner.com",""));
					}
					animBackgroundHelper.actual = 0;
				}
				else {
					animBackgroundHelper.images[animBackgroundHelper.actual +1].style.display = "block";
					animBackgroundHelper.images[animBackgroundHelper.actual].style.zIndex = 2;
					animBackgroundHelper.images[animBackgroundHelper.actual + 1].style.zIndex = 3;
					ex9 = new Animator({transition: Animator.makeEaseOut(3),duration: 4000});
					ex9.addSubject(new NumericalStyleSubject(animBackgroundHelper.images[animBackgroundHelper.actual], 'opacity', 1, 0));
					ex9.addSubject(new NumericalStyleSubject(animBackgroundHelper.images[animBackgroundHelper.actual + 1], 'opacity', 0, 1));
					ex9.play();
					links = $('teaser').getElementsBySelector("a")
					for (i=0; i < links.length; i++ ) {
						switch (i) {
							case 0:
							links[i].update (animBackgroundHelper.images[animBackgroundHelper.actual + 1].name);
							break;
							case 1:
							links[i].update (animBackgroundHelper.images[animBackgroundHelper.actual + 1].alt);
							break;
						}
						links[i].href = getUrl(animBackgroundHelper.images[animBackgroundHelper.actual + 1].longDesc.replace("http://www.falkensteiner.com",""));
					}
					animBackgroundHelper.actual ++;
				}
			}
		}
		new animBackground();
	}
	/**
	 * I-Frame Variante
	 */
	if($('iframe') != null) {
		links = document.getElementsByTagName("a");
		for (i = 0; i < links.length; i++) {
			links[i].target = "_blank";
		}
		
	}
}

function onDocumentFmtgLoad () {	
	try {
		if ($('mylightbox')) {
			myLightbox = new Lightbox();
		}
	}
	catch (e) {}
	
	if($('language') != null)
	{
		var languages = new dropDown($('language'));
	}
}


function getLink(link) {	
	if(link.substr(1,13) == "falkensteiner") {
		link = link.replace(/\/falkensteiner/i, "");	
	}
	if (window.document.location.host != "www.falkensteiner.com") {
		link = "http://www.falkensteiner.com" + link; 
	}
	
	if($('iframe') != null) {
		window._blank.location.href = link;
		return;
	}

	location.href=link;
}
function getUrl(link) {	
	if(link.substr(1,13) == "falkensteiner")
	{
		link = link.replace(/\/falkensteiner/i, "");	
	}
	return link;
}
function getLanguage() {	
	return language;
}

function changeFontSize (id, isIncrease) {
	// 1 = increase
	// 0 = decrease
	var $obj;
	var $size;
	var $line;
	
	$obj = $(id);
	
	if ($obj) {
		$size = $obj.getStyle('font-size');
		$line = $obj.getStyle('line-height');
		if (isIncrease) { 
			$size = $size = parseFloat($size) + 1; // increase
			$line = $line = parseFloat($line) + 2; // increase
		}
		else {
			$size = $size = parseFloat($size) - 1; // decrease
			$line = $line = parseFloat($line) - 2; // increase
		}
		if (($size < 10) || ($size > 16)) {
			return false;
		}
		$size = $size + "px";
		$line = $line + "px";
		$obj.setStyle ("font-size: " + $size );
		$obj.setStyle ("line-height: " + $line );
		return true;
	}
	else {
		return false;
	}
}
function JumpBottom () {
	window.scrollTo(0,100000);
}

