jQuery(document).ready(function() {
	
	jQuery('#mapView').click(function(){
		
		showMap();
		
	});
	
	
	
	jQuery('#listView').click(function(){
		
		if(jQuery('#mapView').hasClass('active')) {
			
			
			jQuery('#mapWrap').css('display','none');
			
			jQuery('.content-right').css('display','block');
			jQuery('.table').css('display','block');
			jQuery('.content-right').animate({'opacity':'1'},200);
			jQuery('.table').animate({'opacity':'1'},200);
			jQuery('#listView').addClass('active');
			jQuery('#mapView').removeClass('active')
		}
		
	});
	
	$('#mainmenu a').mouseover(function(){
		$(this).children('span').addClass('active');
	});
	
	$('#mainmenu a').mouseout(function(){
		$(this).children('span').removeClass('active');
	});
	
	/**
	 * prepare clip height
	 */
	$('#clip').css('height',$('.startimg').height()+$('.keyvisual').height()+$('.contentarea').height()+'px');
	$('#clip .middle').css('height',$('#clip').height()-($('#clip .top').height()+$('#clip .bottom').height())+'px');
	
	/**
	 * Ende
	 */
	
	/**
	 * Footer-Sitemap - Configuration
	 */
	$('div#footer-sitemap > #mainmenu > a > span:contains("IMMOBILIEN")').html('IMMOBILIENANGEBOTE');


	if($('div#footer-sitemap > .col_6 > span > a:eq(0)').html())
		$('#footer-sitemap > div:eq(0)').append('<a href="'+$('div#footer-sitemap > .col_6 > span > a:eq(1)').html()+'.html"><span>'+$('div#footer-sitemap > .col_6 > span > a:eq(1)').html()+	" / "+$('div#footer-sitemap > .col_6 > span > a:eq(0)').html()+'</span></a>');	
	else
		$('#footer-sitemap > div:eq(0)').append('<a href="'+$('div#footer-sitemap > .col_8 > span > a:eq(1)').html()+'.html"><span>'+$('div#footer-sitemap > .col_8 > span > a:eq(1)').html()+	" / "+$('div#footer-sitemap > .col_8 > span > a:eq(0)').html()+'</span></a>');	
	
	$('div#footer-sitemap > #mainmenu > a > span').each(function(i){
    	$(this).addClass("col_"+(i+1));
	});	
//	$('div#footer-sitemap > #mainmenu').wrap('<div>');
//	$('div#footer-sitemap > #mainmenu > a').unwrap('div#mainmenu');
	
//	$('div#footer-sitemap > #mainmenu').addClass('.mainmenu');
//	$('div#footer-sitemap > #mainmenu').removeAttr('id');
		
	$('div#footer-sitemap > div.sub > #menuleiste > .leftmenu-headline').remove();
	$('div#footer-sitemap > div.sub > #menuleiste > .spacer').remove();
	$('div#footer-sitemap > div.sub > div').each( function() {
		$(this).removeAttr('id');
	});	

	$('div#footer-sitemap > div.sub > div > a').each(function () {
		$(this).text($(this).text().toLowerCase());
	});
	$('div#footer-sitemap > div.sub > div > a:contains(" · ")').each(function () {
		$(this).text($(this).text().replace(/ · /, ', '));
	});
	
	$('div#footer-sitemap > div.sub > div a').wrap('<span>');	

	/**
	 * Ende
	 */
	
	/**
	 * Menuleiste - Configuration
	 */
	$('#menuleiste > .reitzenstein-page').remove();
	/**
	 * Ende
	 */
	
	/**
	 * Startseite - Objekt of the week
	 */
	
	$('#hpbox-oow-office').addClass('inactive');
	$('#obj-oow-office').hide();
	
	$('#hpbox-oow-office').click(function () {
		$('#hpbox-oow-home').addClass('inactive');
		$('#obj-oow-home').hide();		
		$(this).removeClass('inactive');
		$('#obj-oow-office').show();
		return false;			
	});
	
	$('#hpbox-oow-home').click(function () {
		$('#hpbox-oow-office').addClass('inactive');
		$('#obj-oow-office').hide();		
		$(this).removeClass('inactive');		
		$('#obj-oow-home').show();	
		return false;	
	});
	
	$('#hpbox-doc').addClass('inactive');
	
	$('#hpbox-doc').click(function () {
		$('#hpbox-press').addClass('inactive');
		$(this).removeClass('inactive');		
	});	
	
	$('#hpbox-press').click(function () {
		$('#hpbox-doc').addClass('inactive');
		$(this).removeClass('inactive');		
	});	
	/**
	 * Ende
	 */
	
	
	
});

