function showRightTeaser () {
	var viewportwidth;
	var rightelement;
 
	if (typeof window.innerWidth != 'undefined')
	{
		viewportwidth = window.innerWidth;
		
		if (typeof(document.getElementById('right_teaser')) != 'undefined' && document.getElementById('right_teaser') !== null)
		{
            rightelement = document.getElementById('right_teaser');
		    if(viewportwidth < 1165)
		    {
		    	rightelement.style.display = 'none';
		    }
		    if(viewportwidth > 1165)
		    {
		    	rightelement.style.display = 'block';
		    }
		}
	}
}

function checkBodyHeight () {
	if (typeof document.getElementById('subnavigation').offsetHeight != 'undefined')
	{
		document.getElementById('content').style.minHeight = document.getElementById('subnavigation').offsetHeight + "px";
	}
}

function checkGlamContentAd () {
	if($$('div.pagetop > span.teaser_city_name') == '' && $$('div.pagetop') != '')
	{

		if (typeof document.getElementById('glam_content_ad').offsetHeight != 'undefined')
		{
			if(document.getElementById('glam_content_ad').offsetHeight > 249)
			{
				$$('div.pagetop').addClass('glam_content_ad_pagetop');
				
				$('glam_content_ad').setStyle('visibility', 'visible');
				/*
				$('glam_content_ad').setStyle('background-color', '#FFFFFF');
				$('glam_content_ad').setStyle('position', 'absolute');
				$('glam_content_ad').setStyle('top', '226px');
				$('glam_content_ad').setStyle('width', '400px');
				*/
			}
		}

	}
}

function checkGlamLeaderBoard() {
		if (typeof document.getElementById('glam_leader_board').offsetHeight != 'undefined')
		{
			if(document.getElementById('glam_leader_board').offsetHeight > 60)
			{
				$('glam_leader_board').setStyle('visibility', 'visible');
				$('body').setStyle('margin', '92px 0 0 3px');
				$('header').setStyle('top', '94px');
				$('topurl').setStyle('top', '75px');
				$('mainnavigation').setStyle('top', '254px');
				$('subnavigation').setStyle('top', '288px');
				$('glam_content_ad').setStyle('top', '288px');
				$('glamLogoDiv').setStyle('top', '-58px');
			}
		}
	}
	
function checkGlamLayerAd() {
		if (typeof document.getElementById('glam_layer_ad').offsetHeight != 'undefined')
		{
			if(document.getElementById('glam_layer_ad').offsetHeight > 8 && document.getElementById('glam_leader_board').offsetHeight > 60)
			{
				$('glam_layer_ad').setStyle('top', '250px');
				$('glam_layer_ad').setStyle('visibility', 'visible');
				$('body').setStyle('margin', '93px 0 0 3px');
				$('mainnavigation').setStyle('top', '271px');
				$('subnavigation').setStyle('top', '309px');
				$('glam_content_ad').setStyle('top', '309px');
			}
			else if(document.getElementById('glam_layer_ad').offsetHeight > 8)
			{
				$('glam_layer_ad').setStyle('visibility', 'visible');
				$('body').setStyle('margin', '30px 0 0 3px');
				$('mainnavigation').setStyle('top', '208px');
				$('subnavigation').setStyle('top', '243px');
				$('glam_content_ad').setStyle('top', '243px');
			}
			
		}
	}

/*
function onload () {
	showRightTeaser();
	checkBodyHeight();
}
if(typeof(document.body.onresize) != 'undefined' && document.body.onresize !== null)
{
    document.body.onresize = showRightTeaser();
}
*/
window.addEvent('domready',function(e){
	showRightTeaser();
	checkBodyHeight();
	
	checkGlamContentAd();
	checkGlamLeaderBoard();
	checkGlamLayerAd();
});
window.addEvent('resize',function(e){
	showRightTeaser();
});
var tmFunc = function(){ 
	$$('.subsitemap > ul').each(function(ul) {
		ul.setStyle('visibility', 'hidden');
        ul.setStyle('display', 'none');
	});
};
				
window.addEvent('domready', function() {
	$$('.subsitemap > ul').each(function(ul) {
    	
    	ul.addEvent('mouseenter', function(el) {
    		ul.setStyle('visibility', 'visible');
    		ul.setStyle('display', 'block');
   		});
       	ul.addEvent('mouseleave', function(el) {
        	var duration = 3000;
        	setTimeout(tmFunc, duration);
        });
   	});
});
