(function($){
  $.fn.clonePosition = function(element, options){
    var options = $.extend({
        setLeft : true,
        setTop  : true,
        setWidth: true,
        setHeight: true,
        offsetLeft: 393,
        offsetTop: 0
    }, (options || {}));
 
    var el = $(this); //what to position
    var src = $(element); //where to position
    var offsets = el.offset();
    var p = [src.offset().left, src.offset().top];
    var delta = [0, 0];
    //difference in size between element and source (to align centers, not top-left corners)
    var delta_size =[0, 0];
    var parent = null;
 
    if(el.css('position') == 'absolute') {
        d = el.offset();//relative to the parent
        delta[0]=d.left;
        delta[1]=d.top;
    }
    //use outer width to account for borders and padding
    delta_size[0] = (el.outerWidth()-src.outerWidth())/2;
    delta_size[1] = (el.outerHeight()-src.outerHeight())/2;
 
    if(parent == document.body){
        delta[0] -= document.body.offsetLeft;
        delta[1] -= document.body.offsetTop;
    }
 
    if(options.setLeft)   el.css('left',(p[0] - delta[0] + options.offsetLeft - delta_size[0]) + 'px');
    if(options.setTop)    el.css('top', (p[1] - delta[1] + options.offsetTop - delta_size[1]) + 'px');
    if(options.setWidth)  el.width(src.width() + 'px');
    if(options.setHeight) el.height(src.height() + 'px');
 
    return el;
  }
})(jQuery);

jQuery.fn.extend( {

  outerHtml: function( replacement )
  {
    // We just want to replace the entire node and contents with
    // some new html value
    if (replacement)
    {
      return this.each(function (){ $(this).replaceWith(replacement); });
    }

    /*
     * Now, clone the node, we want a duplicate so we don't remove
     * the contents from the DOM. Then append the cloned node to
     * an anonymous div.
     * Once you have the anonymous div, you can get the innerHtml,
     * which includes the original tag.
     */
    var tmp_node = $("<div></div>").append( $(this).clone() );
    var markup = tmp_node.html();

    // Don't forget to clean up or we will leak memory.
    tmp_node.remove();
    return markup;
  }
});

function getPositionX(obj){
    var topValue= 0,leftValue= 0;
    while(obj){
    leftValue+= obj.offsetLeft;
    topValue+= obj.offsetTop;
    obj= obj.offsetParent;
    }
    finalvalue = leftValue;
    return finalvalue;
}

function getPositionY(obj){
    var topValue= 0,leftValue= 0;
    while(obj){
    leftValue+= obj.offsetLeft;
    topValue+= obj.offsetTop;
    obj= obj.offsetParent;
    }
    finalvalue = topValue;
    return finalvalue;
}

function openRecommend() {
    jQuery("#recommendPage").css('display','block');

    posyelem = document.getElementById("main_content");
    posy = getPositionY(posyelem)+5+"px";
    jQuery("#recommendPage").css({
	'display': 'block',
	'top': posy});
}

function openContact() {
    jQuery("#contactPage").css('display','block');

    posyelem = document.getElementById("main_content");
    posy = getPositionY(posyelem)+5+"px";
    jQuery("#contactPage").css({
	'display': 'block',
	'top': posy});
}

function closeRecommend() {
    jQuery("#recommendPage").css('display','none');
}

oContentSplitterObserver = {
	nActivePage : 1,
	init:function(){
		this.aeContentParts = $('.content_splitter');
		
		if(this.aeContentParts.length > 0){
			if($('#right_col')[0] !== undefined){
				this.leftArrow = $('<li id="site_navi_left">&nbsp;</li>');
				this.sideNavi = $('<ul id="sitenavi"></ul>');
				this.sideNavi.append(this.leftArrow);
				$('#sitenavi_frame').append(this.sideNavi);
			}
			else if($('#fullwidth')[0] !== undefined){
				this.leftArrow = $('<li id="site_navi_left">&nbsp;</li>');
				this.sideNavi = $('<ul id="sitenavi"></ul>');
				this.sideNavi.append(this.leftArrow);
				$('#sitenavi_frame').append(this.sideNavi);
			}
			var sTextNode = '';
			var nWidth = 0;
			var spacer;
			for(var i = 0; i < this.aeContentParts.length; i++){
				var eSiteListElement = document.createElement('li');
				var sId = 'change_site_'+(i+1);
				eSiteListElement.id = sId;

				$('#sitenavi').append( eSiteListElement);
				$(eSiteListElement).click( oContentSplitterObserver.siteClicked);
				if( i !== ( this.aeContentParts.length - 1 ) ){
					spacer = $('<li>|</li>');
					$('#sitenavi').append( spacer );
					nWidth = nWidth + $(spacer).width();
				}
				if( i === 0){
					sTextNode = (i+1);
					$(eSiteListElement).css({
						color:'#CC0000'
					});
				}
				else{					
					sTextNode =+(i+1);
				}		
				$(eSiteListElement).append( '&nbsp;'+sTextNode+'&nbsp;' );


			}
			this.rightArrow = $('<li id="site_navi_right">&nbsp;</li>');
			this.sideNavi.append(this.rightArrow);

			this.rightArrow.click(jQuery.proxy(this.nextSiteClicked, this));
			this.leftArrow.click(jQuery.proxy(this.prevSiteClicked, this));

		}
	},
	siteClicked:function(){
		var nImagePart = parseInt(this.id.split('_')[2], 10);
		oContentSplitterObserver.nActivePage = nImagePart;
		for(var i = 0; i < oContentSplitterObserver.aeContentParts.length; i++){
			if(i == ( nImagePart - 1 ) ){
				$(oContentSplitterObserver.aeContentParts[i]).show();
				$('#change_site_'+(i+1)).css({
					color:'#CC0000'
				});
			}
			else{
				$(oContentSplitterObserver.aeContentParts[i]).hide();
				$('#change_site_'+(i+1)).css({
					color:'#333333'
				});
			}
		}
	},
	nextSiteClicked:function(){
		if(this.nActivePage == oContentSplitterObserver.aeContentParts.length)return;
		this.nActivePage ++;
		for(var i = 0; i < oContentSplitterObserver.aeContentParts.length; i++){
			if(i == ( this.nActivePage - 1 ) ){
				$(oContentSplitterObserver.aeContentParts[i]).show();
				$('#change_site_'+(i+1)).css({
					color:'#CC0000'
				});
			}
			else{
				$(oContentSplitterObserver.aeContentParts[i]).hide();
				$('#change_site_'+(i+1)).css({
					color:'#333333'
				});
			}
		}
	},
	prevSiteClicked:function(){
		if(this.nActivePage == 1)return;
		this.nActivePage --;
		for(var i = 0; i < oContentSplitterObserver.aeContentParts.length; i++){
			if(i == ( this.nActivePage - 1 ) ){
				$(oContentSplitterObserver.aeContentParts[i]).show();
				$('#change_site_'+(i+1)).css({
					color:'#CC0000'
				});
			}
			else{
				$(oContentSplitterObserver.aeContentParts[i]).hide();
				$('#change_site_'+(i+1)).css({
					color:'#333333'
				});
			}
		}
	}
};

var oTrademarks = (function() {
	return{
		init:function(){
			this.eArrowLeft = $('#trademarks_arrow_left');
			this.eArrowRight = $('#trademarks_arrow_right');
			this.eArrowLeft.click(jQuery.proxy(this.left, this));
			this.eArrowRight.click(jQuery.proxy(this.right, this));
		},
		left:function(){
			var aTabs = $('#trademark_tabs li a');
			for( var i = aTabs.length-1; i>=0; i--){
				if($(aTabs[i]).attr('class') == 'active'){					
					if(i-1 < 0)break;
					$('table.trademarks').hide();
					$('#trademarks_'+(i-1)).show()
					
					$('#trademark_tabs li a').removeClass('active');
					$(aTabs[i-1]).addClass('active');
					//$(aTabs[i-1]).find('a').addClass('active');
					break;
				}
			}
		},
		right:function(){
			var aTabs = $('#trademark_tabs li a');
			for( var i = 0; i<aTabs.length-1; i++){
				if($(aTabs[i]).attr('class') == 'active'){					
					if(i+1 > aTabs.length-1)break;
					$('table.trademarks').hide();
					$('#trademarks_'+(i+1)).show()
					
					$('#trademark_tabs li a').removeClass('active');
					$(aTabs[i+1]).addClass('active');
					//$(aTabs[i-1]).find('a').addClass('active');
					break;
				}
			}
		}
	};
})();

var oMenu = (function() {
	return{
		eMenu:{},
		init:function(){


			this.eMenu = $('#main_navi > ul > li div.outer').each(function(index, element){
				$(element).css({marginLeft:'-'+(($(element).width()-60)/2)+'px'});
				$(element).find('div.inner').height($(element).height());
				$(element).find('div.inner').width($(element).width());
				//var offset = $(element).position();
				//alert(offset.left);
				//$(element.parentNode).find('div.inner').clonePosition(element);
				//$(element.parentNode).find('div.inner').height($(element.parentNode).find('div.inner').height()+20);
			});
		}
	};
})();

var oSearchfield = (function() {
	return{
		eSearchfield:{},
		nStandardTop:0,
		init:function(event){
			this.eSearchfield = $('#search_field');
			this.nStandardTop = parseInt(this.eSearchfield.css('top'));
		},
		top:function(event){
			if($(this).find('ul').height() !== null){
				oSearchfield.eSearchfield.css({top:( $(this).find('ul').height() + oSearchfield.nStandardTop + 10 ) + 'px'});
			}
		},
		reset:function(e){
			oSearchfield.eSearchfield.css({top:oSearchfield.nStandardTop+'px'});
		}
	};
})();

var oCalendar = (function() {
	return{
		eButtonNextMonth:{},
		eButtonPrevMonth:{},
		eButtonNextYear:{},
		eButtonPrevYear:{},
		init:function(){
			this.eMenu = $('#main_navi ul');
			this.eMenu = $('#main_navi > ul > li').hover(oSearchfield.top, oSearchfield.reset);
			
			this.eButtonPrevMonth = $('#month_prev');
			this.eButtonNextMonth = $('#month_next');
			this.eButtonPrevYear = $('#year_prev');
			this.eButtonNextYear = $('#year_next');
			
			this.eButtonPrevMonth.click(jQuery.proxy(this.getCalendarPrevMonth, this));
			this.eButtonNextMonth.click(jQuery.proxy(this.getCalendarNextMonth, this));
			this.eButtonPrevYear.click(jQuery.proxy(this.getCalendarPrevYear, this));
			this.eButtonNextYear.click(jQuery.proxy(this.getCalendarNextYear, this));
			$('#appointment_date').focus(function(){
				$('#calendar').show();					
			});
			$('#appointment_date').change(function(){
				$('#calendar').hide();					
			});
			$('#show_calendar').click(function(){
				$('#calendar').show();
			});
		},
		setDate:function(sDate){
			$('#appointment_date').val(sDate);
			$('#calendar').hide();
		},
		getCalendarPrevMonth:function(){
			this.getCalendar($('#year').val(), parseInt($('#month').val()) -1)
		},
		getCalendarNextMonth:function(){
			this.getCalendar($('#year').val(), parseInt($('#month').val()) +1)
		},
		getCalendarPrevYear:function(){
			this.getCalendar(parseInt($('#year').val())-1, $('#month').val())
		},
		getCalendarNextYear:function(){
			this.getCalendar(parseInt($('#year').val())+1, $('#month').val())			
		},
		getCalendar:function(nYear, nMonth){
			var data = {
				ajax:1,
				year:nYear,
				month:nMonth
			};
			$.ajax({
				data:data,
				url: sBasePath+'calendar.html',
				type: "GET",
				context: this,
				success: function(response){
					$('#calendar').html(response);
					oCalendar.init();
				}
			});
		}
	};
})();

var oAjaxSession = (function() {
	return{

		init:function(aGuiState){
			this.aGuiState = aGuiState;
		},
		setGUIState:function(sStateName, sStateValue){
			var data = {
				ajax:1,
				GUIStateName:sStateName,
				GUIStateValue:sStateValue
			};
			$.ajax({
				data:data,
				url: sBasePath+'ajax_session.html',
				type: "GET",
				context: this,
				success: function(response){

				}
			});
		},
		getGUIState:function(){
			return this.aGuiState;
		}
	};
})();

var oBigSlider = (function() {
	return{
		eSliderUL:{},
		nOffset:1,
		eArrowLeft:{},
		eArrowRight:{},
		nImageWidth:990,
		init:function(){
			if($('#image_slider_list').length == 0)return;
			this.eSliderUL = $('#image_slider_list');
			if($('#image_slider_list li').length > 0 ){
				$('#download_pdf_link')[0].href = $('#download_pdf_link')[0].href + '&themeworldImageId='+$('#image_slider_list li')[0].id.split('_')[3];
			}
			this.eSliderUL.prepend($($('#image_slider_list li')[$('#image_slider_list li').length-1]).clone());
			this.eSliderUL.css({marginLeft:'-990px'});
			this.nCountImages = $('#image_slider_list li').length;
			this.nImageWidth = $('#image_slider_list li').width();
			this.eSliderUL.width(this.nCountImages*this.nImageWidth);
			this.eArrowLeft = $('#slider_arrow_left');
			this.eArrowRight = $('#slider_arrow_right');

			this.eArrowLeft.click(jQuery.proxy(this.left, this));
			this.eArrowRight.click(jQuery.proxy(this.right, this));			
		},
		left:function(){
			if(this.nOffset==0){
				this.nOffset = this.nCountImages-1;
				this.eSliderUL.css({marginLeft:'-'+(this.nOffset)*this.nImageWidth+'px'});
			}
			this.nOffset--;
			
			this.eSliderUL.animate({
				marginLeft:('-'+(this.nOffset)*this.nImageWidth)+'px'
			}, 800, function() {
			});
			this.updatePDFDownloadLink($('#image_slider_list li')[this.nOffset].id.split('_')[3]);
		},
		right:function(){
			if( this.nOffset == ( this.nCountImages-1 ) ){
				this.nOffset = 0;
				this.eSliderUL.css({marginLeft:'-'+(this.nOffset)*this.nImageWidth+'px'});
			}
			this.nOffset++;	
			this.eSliderUL.animate({
				marginLeft:('-'+(this.nOffset)*this.nImageWidth)+'px'
			}, 800, function() {
			});
			this.updatePDFDownloadLink($('#image_slider_list li')[this.nOffset].id.split('_')[3]);
		},
		updatePDFDownloadLink:function(nId){
	        var sHref = $('#download_pdf_link')[0].href;
	        var nPos = sHref.search(/&themeworldImageId=/);
	        $('#download_pdf_link')[0].href = sHref.substr(0, nPos ) + '&themeworldImageId=' + nId ;
		}
	};
})();

var oContentSlider = (function() {
	return{
		eSliderUL:{},
		nOffset:0,
		eArrowLeft:{},
		eArrowRight:{},
		nImageWidth:485,
		init:function(){
			if($('.imageslider_images').length == 0)return;
			this.eSliderUL = $('#imageslider_image_list');
			//this.eSliderUL.prepend($($('#imageslider_image_list li')[$('#imageslider_image_list li').length-1]).clone());

			this.eSliderUL.html( this.eSliderUL.html() + $(this.eSliderUL.find('li')[0]).outerHtml() );// $($('#imageslider_image_list li')[$('#imageslider_image_list li').length-1]).html() + this.eSliderUL[0].innerHTML;

			this.nCountImages = $('#imageslider_image_list li').length;
			this.nImageWidth = $('#imageslider_image_list li').width();
			this.eSliderUL.width(this.nCountImages*this.nImageWidth);
			this.eArrowLeft = $('#content_slider_left');
			this.eArrowRight = $('#content_slider_right');

			this.eArrowLeft.click(jQuery.proxy(this.left, this));
			this.eArrowRight.click(jQuery.proxy(this.right, this));			
		},
		left:function(){
			if( this.nOffset == ( this.nCountImages-1 ) ){
				this.nOffset = 0;
				this.eSliderUL.css({marginLeft:'-'+(this.nOffset)*this.nImageWidth+'px'});
			}
			this.nOffset++;	
			this.eSliderUL.animate({
				marginLeft:('-'+(this.nOffset)*this.nImageWidth)+'px'
			}, 800, function() {
			});
		},
		right:function(){
			if(this.nOffset==0){
				this.nOffset = this.nCountImages-1;
				this.eSliderUL.css({marginLeft:'-'+(this.nOffset)*this.nImageWidth+'px'});
			}
			this.nOffset--;		
			this.eSliderUL.animate({
				marginLeft:('-'+(this.nOffset)*this.nImageWidth)+'px'
			}, 800, function() {
			});
		}
	};
})();

var oTeaser = (function() {
	oTeaserSlider = function(){
		return{
			eSliderUL:{},
			nOffset:0,
			bActive:false,
			nSliderType:0,
			init:function(UList,nSliderType){				
				this.nSliderType = nSliderType;
				this.eSliderUL = $(UList);
				this.eSliderUL.append( $(this.eSliderUL.find('li')[0]).clone() );
				this.eSliderUL.append( $(this.eSliderUL.find('li')[1]).clone() );
				this.eSliderUL.append( $(this.eSliderUL.find('li')[2]).clone() );
				
				var oGUIState = oAjaxSession.getGUIState();
				if(nSliderType == 0){
					this.nOffset = oGUIState.newsSliderOffset;
				}
				else{
					this.nOffset = oGUIState.themeworldsSliderOffset;			
				}
				
				this.nCountTeaser = $(this.eSliderUL).find('li').length;
				this.nImageWidth = parseInt($(this.eSliderUL).find('li')[0].offsetWidth);
				this.eSliderUL.width(this.nCountTeaser*this.nImageWidth);
				this.eSliderUL.css({marginLeft:'-'+(this.nOffset)*this.nImageWidth+'px'});
			},
			show:function(){
				this.eSliderUL.show();
				this.bActive = true;
			},
			hide:function(){
				this.eSliderUL.hide();
				this.bActive = false;
			},
			right:function(){
				if( this.nOffset == ( this.nCountTeaser-3 ) ){
					this.nOffset = 0;
					this.eSliderUL.css({marginLeft:'-'+(this.nOffset)*this.nImageWidth+'px'});
				}
				this.nOffset++;
				if(this.nSliderType == 0){
					oAjaxSession.setGUIState('newsSliderOffset',this.nOffset);
				}
				else{
					oAjaxSession.setGUIState('themeworldsSliderOffset',this.nOffset);						
				}
				this.eSliderUL.animate({
					marginLeft:('-'+(this.nOffset)*this.nImageWidth)+'px'
				}, 800, function() {
				});
			},
			left:function(){
				if(this.nOffset==0){
					this.nOffset = this.nCountTeaser-3;
					this.eSliderUL.css({marginLeft:'-'+(this.nOffset)*this.nImageWidth+'px'});
				}
				this.nOffset--;
				if(this.nSliderType == 0){
					oAjaxSession.setGUIState('newsSliderOffset',this.nOffset);
				}
				else{
					oAjaxSession.setGUIState('themeworldsSliderOffset',this.nOffset);						
				}
				this.eSliderUL.animate({
					marginLeft:('-'+(this.nOffset)*this.nImageWidth)+'px'
				}, 800, function() {
				});
			}
		};
	}
	return{
		eArrowLeft:{},
		eArrowRight:{},
		eTabNews:{},
		eTabThemes:{},
		nActiveSlider:0,
		aeSliders:[],
		init:function(){
			this.eTabNews = $('#tab_news');
			this.eTabThemes = $('#tab_themes');
			this.eTabNews.click(jQuery.proxy(this.showNews, this));
			this.eTabThemes.click(jQuery.proxy(this.showThemes, this));
			
			var aTeaserUL = $('#teaser ul');
			if(aTeaserUL.length == 0)return;
			for(var i = 0; i < aTeaserUL.length; i++){
				this.aeSliders[i] = new oTeaserSlider();
				this.aeSliders[i].init(aTeaserUL[i],i);
			}
			this.aeSliders[this.nActiveSlider].show();
			//this.aeSliders[this.nActiveSlider].bActive = true;			
			
			this.eArrowLeft = $('#teaser_arrow_left');
			this.eArrowRight = $('#teaser_arrow_right');
			
			this.eArrowLeft.click(jQuery.proxy(this.left, this));
			this.eArrowRight.click(jQuery.proxy(this.right, this));
			
			var oGUIState = oAjaxSession.getGUIState();
			
			if(oGUIState.tabActive == 1){
				this.showThemes();
			}
		},
		showNews:function(){
			if(this.nActiveSlider == 0)return;
			this.eTabNews.addClass('active');
			this.eTabThemes.removeClass('active');
			
			$('#teaser_tabs').addClass('firstActive');
			$('#teaser_tabs').removeClass('secondActive');
			oAjaxSession.setGUIState('tabActive',0);
			this.nActiveSlider = 0;
			if(this.aeSliders.length > 1){
				this.aeSliders[0].show();
				this.aeSliders[1].hide();
			}
		},
		showThemes:function(){
			if(this.nActiveSlider == 1)return;
			this.eTabThemes.addClass('active');
			this.eTabNews.removeClass('active');
			
			$('#teaser_tabs').addClass('secondActive');
			$('#teaser_tabs').removeClass('firstActive');
			oAjaxSession.setGUIState('tabActive',1);
			this.nActiveSlider = 1;
			if(this.aeSliders.length > 1){
				this.aeSliders[1].show();
				this.aeSliders[0].hide();
			}
		},
		left:function(){
			this.aeSliders[this.nActiveSlider].left();
		},
		right:function(){
			this.aeSliders[this.nActiveSlider].right();
		}
	};
})();

oSearchresultObserver = {
	eSearchInput : {},
	bMakesRequest:false,
	bReload:false,
	nActivePage:1,
	init:function(){
		this.eSearchInput = $('#search_field');
		if(this.eSearchInput){			
			this.eSearchInput.keyup(jQuery.proxy(oSearchresultObserver.searchInputContentChanged, this));
		}
	},
	searchInputContentChanged : function(){		
		if(this.bMakesRequest || this.eSearchInput[0].value.length < 4){
			if(this.eSearchInput[0].value.length >= 4){
				this.bReload = true;
			}
			return;
		}
		this.bMakesRequest = true;
		var url = sBasePath+'modules/fulltextsearch/index.php';
		var parameter = {};
		parameter.ajax = 1;
		parameter.searchword = this.eSearchInput.value;

		var data = {
			ajax:1,
			searchword:this.eSearchInput[0].value
		};
		$.ajax({
			data:data,
			url: sBasePath+'modules/fulltextsearch/index.php',
			type: "GET",
			context: this,
			success: function(response){
/*
				$('body').html(response);
				return;
*/
				$('#main_content').html('<div id="searchresult">'+response+'</div>');

				oSearchresultObserver.bMakesRequest = false;
				oSearchresultObserver.initPager();
			}
		});
	},
	initPager:function(){
		this.aePages = $('.searchresult');

		if(this.aePages.length > 1){
			this.leftArrow = $('<li id="site_navi_left"></li>');
			this.sideNavi = $('<ul id="sitenavi"></ul>');
			this.sideNavi.append(this.leftArrow);
			$('#sitenavi_frame').html(this.sideNavi);
			var sTextNode = '';
			var nWidth = 0;
			var spacer;
			for(var i = 0; i < this.aePages.length; i++){
				var eSiteListElement = document.createElement('li');
				var sId = 'change_site_'+(i+1);
				eSiteListElement.id = sId;
	
				$('#sitenavi').append( eSiteListElement);
				$(eSiteListElement).click( oSearchresultObserver.siteClicked);
				if( i !== ( this.aePages.length - 1 ) ){
					spacer = $('<li>|</li>');
					$('#sitenavi').append( spacer );
					nWidth = nWidth + $(spacer).width();
				}
				if( i === 0){
					sTextNode = (i+1);
					$(eSiteListElement).css({
						color:'#CC0000'
					});
				}
				else{					
					sTextNode =+(i+1);
				}		
				$(eSiteListElement).append( '&nbsp;'+sTextNode+'&nbsp;' );
	
				nWidth = nWidth + $(eSiteListElement).width();
			}
			this.rightArrow = $('<li id="site_navi_right"></li>');
			this.sideNavi.append(this.rightArrow);
			
			this.rightArrow.click(jQuery.proxy(this.nextSiteClicked, this));
			this.leftArrow.click(jQuery.proxy(this.prevSiteClicked, this));
			var marginLeft = parseInt($('#sitenavi').css('marginLeft')) - $('#sitenavi').width();
			$('#sitenavi').css({marginLeft: marginLeft+'px'});			
		}
	},
	siteClicked:function(){
		var nImagePart = parseInt(this.id.split('_')[2], 10);
		oSearchresultObserver.nActivePage = nImagePart;
		for(var i = 0; i < oSearchresultObserver.aePages.length; i++){
			if(i == ( nImagePart - 1 ) ){
				$(oSearchresultObserver.aePages[i]).show();
				$('#change_site_'+(i+1)).css({
					color:'#CC0000'
				});
			}
			else{
				$(oSearchresultObserver.aePages[i]).hide();
				$('#change_site_'+(i+1)).css({
					color:'#333333'
				});
			}
		}
	},
	nextSiteClicked:function(){
		if(this.nActivePage == oSearchresultObserver.aePages.length)return;
		this.nActivePage ++;
		for(var i = 0; i < oSearchresultObserver.aePages.length; i++){
			if(i == ( this.nActivePage - 1 ) ){
				$(oSearchresultObserver.aePages[i]).show();
				$('#change_site_'+(i+1)).css({
					color:'#CC0000'
				});
			}
			else{
				$(oSearchresultObserver.aePages[i]).hide();
				$('#change_site_'+(i+1)).css({
					color:'#333333'
				});
			}
		}
	},
	prevSiteClicked:function(){
		if(this.nActivePage == 1)return;
		this.nActivePage --;
		for(var i = 0; i < oSearchresultObserver.aePages.length; i++){
			if(i == ( this.nActivePage - 1 ) ){
				$(oSearchresultObserver.aePages[i]).show();
				$('#change_site_'+(i+1)).css({
					color:'#CC0000'
				});
			}
			else{
				$(oSearchresultObserver.aePages[i]).hide();
				$('#change_site_'+(i+1)).css({
					color:'#333333'
				});
			}
		}
	}
};

$(document).ready(function(){
	if($('#slider')[0]){
		$('#left_col').html($('#slider'));
	}

	oAjaxSession.init(aGuiState);
	oContentSlider.init();	
	oSearchresultObserver.init();	
	oBigSlider.init();
	oTrademarks.init();
	oTeaser.init();

	oCalendar.init();
	oMenu.init();

	$($('#meta_navi ul li')[0]).css({backgroundImage:'none'});

	var aeSublists = $('#main_navi > ul > li  ul');

	for(var i = 0; i < aeSublists.length; i++ ){		
		if(aeSublists[i].childNodes.length == 1){
			$(aeSublists[i]).remove();
		}
	}
	var aeLists = $('#main_navi > ul > li');
	for(var i = 0; i < aeLists.length; i++ ){		
		aeSublists = $(aeLists[i]).find('ul');
		
		if(aeSublists.length>0){
			$(aeSublists[aeSublists.length-1]).css({borderRight:'none'});
		}
	}

	lis = $('.imageslider_images > img');
	if(lis.length) {
	    if(lis.attr("comp_id") !== undefined){
	    	$('#download_pdf_link')[0].href = $('#download_pdf_link')[0].href + '&sliderImageId='+lis.attr("comp_id");
	    }
	}
});
