$(document.body).addClass('js');

var checkExternalClick = function(event) {
    if ($(event.target).parents('.simple_overlay').length === 0) 
    {
        alert('no');
    }
};
$(document).ready(function(){
    if($.browser.safari)
    {
        $('.visualComp .navImgHolder map area').mouseover(function(){
            $(this).parents('.RolloutMenu').attr('style','display: block; position: absolute;');
            $(this).parents('.RolloutMenu').parent('li').find('a:first').attr('style','background: #66b4db; color: #fff;');
        });
        $('.visualComp .navImgHolder map area').mouseout(function(){
            $(this).parents('.RolloutMenu').removeAttr('style');
            $(this).parents('.RolloutMenu').parent('li').find('a:first').removeAttr('style');
        });
    }
    
	/* - Themenformular abschicken */
	$('#select_navi select').change(function(){this.form.submit();});
	
	/* Sidebar */
	/* - E-Mail */
	sb_email = $('#sb-e-mail');
	sb_email.def = sb_email.val();
	sb_email.focus(function(){ if(sb_email.val() == sb_email.def ){ sb_email.val('');} }).blur(function(){ if(!sb_email.val() ){ sb_email.val(sb_email.def);} });
	
	/* Homepage */
	if($(document.body).is('.home')){
		/* - weitere Themen */
		$('#b-entdecken-all').slideUp();
		$('#b-entdecken .anzeigen').live('click',function(){ $('#b-entdecken').addClass('show'); return false; });
		$('#b-entdecken .ausblenden').live('click',function(){ $('#b-entdecken').removeClass('show'); return false; });

		/* TEASER */
		if($('#b-teaser').size()>0){
			var slide_timeout = 0;
			var click_timeout = 30000;
			var auto_timeout = 10000;
			var slide_time = 1000;
			slide_to = function(tab,next_timeout){
			    if((tab == undefined) || !( typeof tab == 'object')){
					var tab = ($('#homeTabs li.active').eq(0).next().size() > 0) ? $('#homeTabs li.active').eq(0).next().children('a') : $('#homeTabs li:first a');
					next_timeout = auto_timeout;
				} else {
					next_timeout = (next_timeout) ? next_timeout : click_timeout;
				}
				clearTimeout(slide_timeout);
				$('#t-slides li').not(tab.attr('hash')).fadeOut(slide_time);
				$(tab).parent().siblings().not(tab.attr('hash')).removeClass('active');
				$(tab).parent().addClass('active');
				$(tab.attr('hash')).fadeIn(slide_time,function(){slide_timeout = setTimeout(slide_to,next_timeout);});
				return false;
			}
			$('#t-tabs a').live('click',function(event){if (event.button == 0){return slide_to($(this));};});
			var first = $('#homeTabs li:first a');
			slide_to();
		}
	};
	
});

