jQuery(function($){
	
	var $expertise = $('.our_expertise li');
	$expertise.hover(function(){
		$(this).find('span').stop().animate({queue: false, backgroundPosition: '0 -81px', top: '-6px'},{duration:800, easing:'easeOutExpo'});	
		$(this).find('em').stop().animate({queue: false, top: '-6px'},{duration:800, easing:'easeOutSine'});	
	}, function(){
		$(this).find('span').stop().animate({queue: false, backgroundPosition: '0 0px', top: '0px'},{duration:1000, easing:'easeOutExpo'});	
		$(this).find('em').stop().animate({queue: false, top: '0px'},{duration:800, easing:'easeOutCirc'});	
	});
	
	
	
	var $navPoint = $('#page_nav li a');
	$navPoint.hover(function(){
		if($(this).parent().hasClass('active')){
		}else{
			$(this).stop().animate({queue: false, top: '-6px', paddingBottom: '6px'},{duration:500, easing:'easeOutCirc'});	
		}
	}, function(){
		$(this).stop().animate({queue: false, top: '0px', paddingBottom: '0px'},{duration:500, easing:'easeOutBounce'});	
	});
	
	
	var $dropNavPoint = $('#page_nav li');
	$dropNavPoint.hover(function(){										 
		$(this).find('ul').stop(true, true).slideDown(500,'easeOutCirc');	
	}, function(){
		$(this).find('ul').stop(true, true).slideUp(500,'easeOutCirc');	
	});
	
	$('.tab_title').click(function(){
		$('.tab_title').removeClass('active');	
		$('.tab_title').removeClass('activeScroll');
		$(this).addClass('activeScroll');
		$(this).addClass('active').next('.tab_content').slideDown(1000).siblings('.tab_content').slideUp(700, function(){
			var ScrolT =  $('.activeScroll').offset().top;
			$(window).scrollTop(ScrolT);																									   
		});	
		
		
	});
	
	
	var $FooterNan = $('#footer_content li a');
	$FooterNan.hover(function(){
		$(this).stop().animate({queue: false, paddingLeft: '6px'},{duration:500, easing:'easeOutCirc'});	
	}, function(){
		$(this).stop().animate({queue: false, paddingLeft: '0px'},{duration:500, easing:'easeOutBounce'});	
	});
	
	$('.link_twitter').hover(function(){
		$(this).stop().animate({queue: false,bottom:'10px'},500);						
	},function(){
		$(this).stop().animate({queue: false,bottom:'0px'},500);			
	});
	
	
	var posDesinger =0;				   	
	var DesingerTotWidth=0;
	var slideDur = 1000;
	var slideStyle = 'easeOutExpo';
	var positionsDesinger = new Array();
	$('#banner_slide .slide_content').each(function(i){
		positionsDesinger[i]= DesingerTotWidth;
		DesingerTotWidth += $(this).width();
	});
	
	$('#banner_slide').width(DesingerTotWidth);
	$("#SlideNext").click(function(){
		var itemcount = $("#banner_slide > .slide_content").size();
		if(posDesinger < itemcount - 1 ){
			posDesinger = posDesinger +1;	
		}
		$('#banner_slide').stop().animate({marginLeft:-positionsDesinger[posDesinger]+'px'},{duration: slideDur, easing: slideStyle});
	});
	$("#SlidePrev").click(function(){
		if(posDesinger !=0 ){
			posDesinger = posDesinger - 1;	
		}
		$('#banner_slide').stop().animate({marginLeft:-positionsDesinger[posDesinger]+'px'},{duration: slideDur, easing: slideStyle});
	});
	
	
	
	$.fn.FadeBugImage = function(options) {
        return this.each(function() {   
            $.FadeBugImage(this, options);
        });
    };

    $.FadeBugImage = function(container, options) {
        var settings = {
        	'animationtype':    'fade',
            'speed':            'normal',
            'type':             'sequence',
            'timeout':          2000,
            'containerheight':  'auto',
            'runningclass':     'FadeBugImage',
            'children':         null
        };
        if (options)
            $.extend(settings, options);
        if (settings.children === null)
            var elements = $(container).children();
        else
            var elements = $(container).children(settings.children);
        if (elements.length > 1) {
            $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass);
            for (var i = 0; i < elements.length; i++) {
                $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide();
            };
            if (settings.type == "sequence") {
                setTimeout(function() {
                    $.FadeBugImage.next(elements, settings, 1, 0);
                }, settings.timeout);
                $(elements[0]).show();
            } else if (settings.type == "random") {
            		var last = Math.floor ( Math.random () * ( elements.length ) );
                setTimeout(function() {
                    do { 
												current = Math.floor ( Math.random ( ) * ( elements.length ) );
										} while (last == current );             
										$.FadeBugImage.next(elements, settings, current, last);
                }, settings.timeout);
                $(elements[last]).show();
						} else if ( settings.type == 'random_start' ) {
								settings.type = 'sequence';
								var current = Math.floor ( Math.random () * ( elements.length ) );
								setTimeout(function(){
									$.FadeBugImage.next(elements, settings, (current + 1) %  elements.length, current);
								}, settings.timeout);
								$(elements[current]).show();
						}	else {
							alert('FadeBugImage-Type must either be \'sequence\', \'random\' or \'random_start\'');
						}
				}
		};
	
		$.FadeBugImage.next = function(elements, settings, current, last) {
			if (settings.animationtype == 'slide') {
				$(elements[last]).slideUp(settings.speed);
				$(elements[current]).slideDown(settings.speed);
			} else if (settings.animationtype == 'fade') {
				$(elements[last]).fadeOut(settings.speed);
				$(elements[current]).fadeIn(settings.speed, function() {
								removeFilter($(this)[0]);
							});
			} else
				alert('FadeBugImage-animationtype must either be \'slide\' or \'fade\'');
			if (settings.type == "sequence") {
				if ((current + 1) < elements.length) {
					current = current + 1;
					last = current - 1;
				} else {
					current = 0;
					last = elements.length - 1;
				}
			} else if (settings.type == "random") {
				last = current;
				while (current == last)
					current = Math.floor(Math.random() * elements.length);
			} else
				alert('FadeBugImage-Type must either be \'sequence\', \'random\' or \'random_start\'');
			setTimeout((function() {
				$.FadeBugImage.next(elements, settings, current, last);
			}), settings.timeout);
		};
	
	
	// **** remove Opacity-Filter in ie ****
	function removeFilter(element) {
		if(element.style.removeAttribute){
			element.style.removeAttribute('filter');
		}
	}
	
});
