// css-enhancing js

// remove this for production

function debug (myText){
	return;
	if (!myText){
		return;
	}
	if (typeof console !== "undefined"){
		console.log(myText);
	}else {
		if ($("#debugWindow").length==0){
			$('body').append('<div id="debugWindow" style="background-color:white;overflow:scroll;font-size:80%;border:1px solid red;;right:10px;top:10px;position:absolute;width:200px;height:200px;"></div>');
		}
		myText = myText.toString();
		$("#debugWindow").text($("#debugWindow").text()+myText);
	}
}

jQuery.noConflict();
$--
// pShadow 1.o
// A jQuery extension to add gorgeous drop shadows to HTML elements
// By Matthew Dawkins
// www.matthewdawkins.co.uk

(function($) {
	$.fn.pShadow=function(options) {
		// Default settings
		var settings={
			'type':'corners',
			'depth':20,
			'strength':1
		};
		// Enable chaining
		return this.each(function() {
			// $this is now the current object
			var $this=$(this);
			// Override defaults
			if (options) $.extend(settings,options);
			// Set type of shadow
			var shadow;
			if (settings['type']=='corners') shadow='$CMS_REF(media:"pshadow1")$';
			else if (settings['type']=='middle') shadow='$CMS_REF(media:"pshadow2")$';
			// Repeat to overlay images to create strength
			$this.not('.pshadow').each(function() {
				var ownerelement = $(this);
				var ownerpos = $(this).offset();
				for (i=0;i<settings['strength'];i++) {
					// For self-closing elements
					if(/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i.test($(this)[0].tagName)) {
						// Add owner class and image element
						$(this).addClass('haspshadow').after('<img src="'+shadow+'" alt="" class="pshadow" />');
						// Add styling for image
						$(this).next('.pshadow').each(function() {
							$(this).css('position','absolute')
							.css('left',ownerpos.left+'px')
							.css('width',ownerelement.outerWidth()+'px')
							.css('height',settings['depth']+'px')
							.css('top',(ownerpos.top+ownerelement.outerHeight())+'px')
							if (ownerelement.css('position')=='static') ownerelement.css('position','relative');
						});
					}
					// For non-self-closing elements
					else {
						// Add owner class and image element
						$(this).addClass('haspshadow').append('<img src="'+shadow+'" alt="" class="pshadow" />');
						// Add styling for image
						$(this).find('.pshadow:last').each(function() {
							$(this).css('position','absolute')
							.css('left','0')
							.css('width',$(this).parent().outerWidth()+'px')
							.css('height',settings['depth']+'px')
							.css('bottom','-'+settings['depth']+'px')
							if ($(this).parent().css('position')=='static') $(this).parent().css('position','relative');
						});
					}
				}
			});
			// Reset shadow images to override any conflicting CSS
			$('.pshadow').css('border','0')
			.css('padding','0')
			.css('background','none');
		});
	}
})(jQuery);
//END pShadow
--$

jQuery(document).ready(function($){

	// ie < 7.0 kann kein li:hover
	if ($.browser.msie && $.browser.version < '7') {
	    var ie6navigation = function (e) {
			if (this.hovering) {
				this.hovering = false;
			} else {
				this.hovering = true;
			}
			$(this).toggleClass('hover');			
		};
		function buttonHover(e) {
			ie6navigation.call(this, e);
			$(this.parentNode).toggleClass(this.className);
		}
		function hideInputs(e) {
			ie6navigation.call(this, e);
			$(this).nextAll().find('input, select').toggle();
		}
		$('.menu ul#navigation li').hover(ie6navigation, ie6navigation);
		$('.tip').hover(ie6navigation, ie6navigation);
		$('.more').hover(ie6navigation, ie6navigation);

	}
		
	//runde Ecken
	$(".cornerMenu").corner("tl tr 6px").corner("bl br 10px");
	//$(".corner1").corner("7px");
	$(".corner1Top").corner("6px, top");
	$(".corner1Bottom").corner("6px, bottom");
	$(".cornerTL").corner("tl bl 6px");
	//$(".corner2").corner("7px, tr bl br");
	//$(".corner3").corner("4px");
	//$(".corner4").corner("2px");

	//Shadows $-- MBe --$
	//$(".corner1").not(".coloredArea").pShadow({depth:10});
	//$(".twitter_widget").pShadow({depth:10});
	//$(".singleStudy.gallery").pShadow({depth:10});


	// Ausklappen des slidingContent	
	$("div.slidingContent").hide();
	$("a.slideLink").click(function (){
		$(this).blur();
		$(this).toggleClass("open");
		$(this).next("div.slidingContent").slideToggle("fast");
		return false;
	});
	
	// Filter
	$('form.filter span.enabled').each(function(numSpan) {
		var startSpan = $(this);
		startSpan.children('select').one('change', function (e) {
			nextSpan.removeClass('disabled').children('select').attr('disabled', false);
		});
		var nextSpan = startSpan.nextAll('span.disabled');
		nextSpan.children('select').attr('disabled', true);     
    });


	$('.tip').hover(function (){
		var myLineHeight = $(this).height();
		var myHeight = $(this).find(".toolTip").height();
		$(this).find(".toolTip").css("top",-myHeight-myLineHeight);
	},function (){
	});
	
	
});



