jQuery.noConflict();
/* Funktion für das Menü im IE6 */
sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	
	if (sfEls.length>0) {
    for (var i=0; i<sfEls.length; i++) {
  		sfEls[i].onmouseover=function() {
  		  
  			this.className+=" sfhover";
  			// alert (this.className);
  		}
  		sfEls[i].onmouseout=function() {
  			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
  		}
  	}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

/*
 * Tooltip script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */
this.tooltip = function(){	
	/* CONFIG */		
		xOffset = 40;
		yOffset = 30;		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result		
	/* END CONFIG */		
	jQuery("a.tooltip").hover(function(e){											  
		this.t = this.title;
		this.title = "";									  
		jQuery("body").append("<p id='tooltip'>"+ this.t +"</p>");
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");		
    },
	function(){
		this.title = this.t;		
		jQuery("#tooltip").remove();
    });	
	jQuery("a.tooltip").mousemove(function(e){
		jQuery("#tooltip")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};

/**
* hoverIntent r5 // 2007.03.27 // jQuery 1.1.2+
* <http://cherne.net/brian/resources/jquery.hoverIntent.html>
* 
* @param  f  onMouseOver function || An object with configuration options
* @param  g  onMouseOut function  || Nothing (use configuration options object)
* @author    Brian Cherne <brian@cherne.net>
*/
(function(jQuery){jQuery.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=jQuery.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY;};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){jQuery(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev]);}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev]);};var handleHover=function(e){var p=(e.type=="mouseover"?e.fromElement:e.toElement)||e.relatedTarget;while(p&&p!=this){try{p=p.parentNode;}catch(e){p=this;}}if(p==this){return false;}var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);}if(e.type=="mouseover"){pX=ev.pageX;pY=ev.pageY;jQuery(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob);},cfg.interval);}}else{jQuery(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob);},cfg.timeout);}}};return this.mouseover(handleHover).mouseout(handleHover);};})(jQuery);

jQuery(document).ready(function () {
	tooltip();
	jQuery('.bannerRight').css('display','block');
	jQuery('.bannerRight').cycle({
		fx:      'custom', 
    cssBefore: {  
        left: 230,  
        top:  129,  
        width: 0,  
        height: 0,  
        opacity: 1, 
        zIndex: 1 
    }, 
    animOut: {  
        opacity: 0  
    }, 
    animIn: {  
        left: 0,  
        top: 0,  
        width: 460,  
        height: 258  
    }, 
    cssAfter: {  
        zIndex: 0 
    }, 
    delay: -3000 
	});
	
	/*$('.bannerRight').css({'left: 2px;'});*/

	jQuery('.subnav').each(function () {
		jQuery(this).parent().eq(0).hoverIntent({
			timeout: 100,
			over: function () {
				var current = jQuery('.subnav:eq(0)', this);
				current.slideDown(500);
			},
			out: function () {
				var current = jQuery('.subnav:eq(0)', this);
				current.slideUp(500);
			}
		});
	});
	
	jQuery('.subnav a').hover(function () {
		jQuery(this).stop(true).animate({paddingLeft: '35px'}, {speed: 100});
		jQuery(this).stop(true).animate({height: '100px'}, {speed: 100});
	}, function () {
		jQuery(this).stop(true).animate({paddingLeft: '10px'}, {speed: 100});
		jQuery(this).stop(true).animate({height: '30px'}, {speed: 100});
	});
	
	jQuery('.toggleContact').toggle(
    function(){ // you can add as much here as you'd lik
      jQuery('.contact').height('160px');
         jQuery('.contact').slideDown('slow');
         jQuery('#imgArrows').attr('src','fileadmin/templates/images/kontakt-up.gif');
    }, function() { // same here
         jQuery('.contact').slideUp('slow');
         jQuery('#imgArrows').attr('src','fileadmin/templates/images/kontakt-down.gif');
    }
  );
});