jQuery.noConflict();

jQuery(document).ready(function() {
	jQuery("#content .contenttable tr:even, #content .htmlarea-showtableborders tr:even").css("background-color", "#F3F3F3");
	
	jQuery('table.startseite').each(function() {
		var anz_spalten = jQuery( this ).find('td.startseite_td').length;
		var breite_spalten = 0;
		if( anz_spalten == 1 )
			breite_spalten = 100;
		else if( anz_spalten == 2 )
			breite_spalten = 49;
		else if( anz_spalten == 3 )
			breite_spalten = 32;
		else if( anz_spalten == 4 )
			breite_spalten = 24;
		
		if( anz_spalten == 1 )
			jQuery( this ).find('td:eq(1)').remove();
		
		jQuery( this ).find('td.startseite_td').css('width', breite_spalten+'%');
	});
	
	jQuery('#content .contenttable tr').each(function() {
		jQuery( this ).find('td:first').css('border-left-width', '0px');
	});
	
	jQuery('div.csc-menu-4 div.csc-frame-frame1:nth-child(4)').after('<br style="clear:both;" />');
	jQuery('div.csc-menu-4 div.csc-frame-frame1:nth-child(4)').css('margin-right', '0px');
	
	if( jQuery('#content .csc-frame-expand').length > 0 ) {
		jQuery('#content .csc-frame-expand').each(function() {
			if(	jQuery( this ).find('.csc-textpic').length < 1 ) {
				jQuery( this ).find('p.bodytext:not(p:first),ul,ol,table').hide();
			} else {
				jQuery( this ).find('.csc-textpic-text *:not(p:first,b,strong,i,em,a,span,strike,br,sup,sub)').hide();
			}
			
			jQuery( this ).find('p.bodytext:first').append('<img class="expandlink" src="/fileadmin/templates/expand.gif" border="0" alt="" />');
		});
		
		jQuery('.expandlink').live('click', function() {
			jQuery( this ).parent().parent().find('*:hidden').fadeIn();
			jQuery( this ).fadeOut().remove();
		});
	}
	
	if( jQuery('#content .csc-menu-4 .csc-frame-frame1').length > 0 ) {
		jQuery('#content .csc-menu-4 .csc-frame-frame1 > a').equalHeights();
		//jQuery('#content .csc-menu-4 .csc-frame-frame1 > a').css('font-size', '0.9em');
	}
	
	//jQuery('#sabeubody-1 #nav li:last').after('<li><a href="javascript:void(0);">English</a></li>');
	
	jQuery('.life_science a').click(function() {
		var link = jQuery( this ).attr('href');
		jQuery( '#headerarea .altenlohgruppe' ).fadeOut( 500 );
		jQuery( '#sabeubody-1 #sabeu_ring' ).animate({
			top: '-88px',
			left: '748px'
		}, 1000, 'easeOutQuint', function() {
			location.href = '/' + link;
		});
		return false;
	});
	
	jQuery('.fluxx a').click(function() {
		var link = jQuery( this ).attr('href');
		jQuery( '#sabeubody-1 #sabeu_logo img, #nav li a' ).fadeOut( 500 );
		jQuery( '#sabeubody-1 #fluxx_logo img' ).fadeIn( 500 );
		jQuery( '#sabeubody-1 #sabeu_ring' ).animate({
			top: '-88px',
			left: '64px'
		}, 1000, 'easeOutQuint', function() {
			location.href = '/' + link;
		});
		return false;
	});
	
	/*jQuery('#headerarea #nav > li:last').css('border-right-width', '0px');
	
	var div = jQuery('#sabeubody-1 #content .mainmenu_right'),
              ul = jQuery('#sabeubody-1 #content .mainmenu_right ul'),
              ulPadding = 0;

	var divWidth = div.width();
	div.css({overflow: 'hidden'});
	var lastLi = ul.find('li');

	div.live('mousemove', function(e) {
		var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding;
		
		var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth;
		div.scrollLeft(left);
	});*/
});
