$(document).ready(function(){

	//$('#infobox').animate({'width':'215px', 'opacity': '0.9'});
	var tooltip_open = false;
	
	//$('#infobox').prepend('<div id="tooltip"><div id="tooltip_strip" style="float: left; width: 0px;">test</div><div style="float: left"><a href="#" id="tooltip_icon"><img src="/fileadmin/templates/img/arrows/tooltip.png" border="0" /></a></div></div>');
	
	function toggleTooltip() {
		if (tooltip_open == false) {
			//$('#infobox').animate({width:'200px'});
			$('#infobox').animate({'width':'219px'}, {queue:false, duration:500, easing: 'easeOutQuint'});
			$('#tooltip_icon').animate({'left':'200px'}, {queue:false, duration:400, easing: 'easeOutQuint'});

			$('#tooltip_icon').unbind("mouseover");
			
			tooltip_open = true;
		} else {
			$('#infobox').animate({'width':'0px'}, {queue:false, duration:450, easing: 'easeOutQuint'});
			$('#tooltip_icon').animate({'left':'0px'}, {queue:false, duration:500, easing: 'easeOutQuint'});
			
			$('#tooltip_icon').mouseover(function() {
				if (tooltip_open == false)
					toggleTooltip();
			});
			
			//$('#infobox').animate({width:'0px'});
			//$('#infobox').fadeOut();
			tooltip_open = false;
		}
	}
	
	$('#tooltip_icon').mouseover(function() {
		if (tooltip_open == false)
			toggleTooltip();
	});
	
	$('#infobox').mouseleave(function() {
		if (tooltip_open == true)
			toggleTooltip();
	});
	
	
	// activate contentboxes [BEGIN]
	var isIE = 0;
	jQuery.each(jQuery.browser, function(i, val) {
		if($.browser.msie){ isIE = 1; }
	});
	
	if ( $("#sr_accordion").length > 0 ) {
			if (isIE) {
				$("#sr_accordion").accordion({
					autoHeight: false,
					collapsible: false,
					alwaysOpen: true,
					active: 0
				});
			} else {
				$("#sr_accordion").accordion({
					autoHeight: false,
					collapsible: false,
					alwaysOpen: true,
					change: function() {$('.sr_accordion_content').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 10});},
					active: 0
				});
			}
			
	}
	
	// activate contentboxes [END]
	
	
	$("#pagemenu div").hover(
		function() {
			var img_elem = $(this).find('img:first');
			img_elem.attr('src','/fileadmin/templates/img/pagemenu/'+img_elem.attr('id')+'_hover.png');
			$(this).children('a').children('span:first').fadeIn(500);
		},
		function() {
			var img_elem = $(this).find('img:first');
			img_elem.attr('src','/fileadmin/templates/img/pagemenu/'+img_elem.attr('id')+'.png');
			$(this).children('a').children('span:first').fadeOut(200);
	});
	
	$('#pm_inc_text').click(function() {
			var currentFontSize = $('.sr_accordion_content').css('font-size');
			
			var currentFontSizeNum = parseFloat(currentFontSize, 10);
			var newFontSize = currentFontSizeNum*1.1;
			
			if ( newFontSize < 15) {
				$('.sr_accordion_content').css('font-size', newFontSize);
				$('.sr_accordion_content').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 10});
			}
			
	});
	
	$('#pm_dec_text').click(function() {
			var currentFontSize = $('.sr_accordion_content').css('font-size');
			
			var currentFontSizeNum = parseFloat(currentFontSize, 10);
			var newFontSize = currentFontSizeNum*0.9;
			
			if ( newFontSize > 9) {
				$('.sr_accordion_content').css('font-size', newFontSize);
				$('.sr_accordion_content').jScrollPane({showArrows:true, scrollbarWidth: 15, arrowSize: 10});
			}
			
	});
	
	/*$("#pagemenu_email").hover(
		function() {
			$('#pagemenu_email_img').attr('src','/fileadmin/templates/img/pagemenu/email_hover.png');
		},
		function() {
			$('#pagemenu_email_img').attr('src','/fileadmin/templates/img/pagemenu/email.png');
	});
	
	$("#pagemenu_print").hover(
		function() {
			$('#pagemenu_print_img').attr('src','/fileadmin/templates/img/pagemenu/print_hover.png');
		},
		function() {
			$('#pagemenu_print_img').attr('src','/fileadmin/templates/img/pagemenu/print.png');
	});
	
	*/
	
});