$(document).ready(function(){

// Position social zeug
myResize();
	
//logo
	$("#logo").hoverIntent(
	  function () {
		$("#logo").stop().animate({top : 0, avoidTransforms : true}, 300,'easeInBack' );
	  }, 
	  function () {
		$("#logo").stop().animate({top : -140, avoidTransforms : true}, 300,'easeOutBack' );
	  }
	);

});

function myslideron(myslider) {
	$("div.projekt").not(myslider).each(function(){myslideroff("#"+$(this).attr("id"));});
  	$(myslider+" .projekt_text_abstract").stop(true,true).fadeOut(100, function(){
	$(myslider+" .projekt_text_header").stop().animate({
			width: 570
		},
		{
		duration: 500,
		specialEasing: { width: 'easeInOutQuad'	},
 		complete: function() {
			$(myslider+" .projekt_text_abstract").css("display","none");
 			$(myslider+" .projekt_text_body").width(500);
	 		$(myslider+" .projekt_text_full").stop().css("display","inline").fadeIn(200,function(){$(myslider+" .projekt_text_full").show()});
			}
		});
	});
};

function myslideroff(myslider) {
  	$(myslider+" .projekt_text_full").stop(true,true).fadeOut(200, function(){
 		$(myslider+" .projekt_text_body").width(270);
		$(myslider+" .projekt_text_header").stop().animate({
		width: 270
		},
		{
		duration: 500,
		specialEasing: { width: 'easeInOutQuad'	},
 		complete: function() {
			$(myslider+" .projekt_text_full").css("display","none");
	 		$(myslider).find(".projekt_text_abstract").stop().css("display","inline").fadeIn(200,function(){$(myslider+" .projekt_text_abstract").show()});
			}
 		});
	});
};


var resizeTimer = null;

function myResize(){
   var width_window  = $(window).width();
   if (width_window  < 1200) {
   		$('body #social').remove().appendTo("#header_innen").addClass("social_wrapper_top").removeClass("social_wrapper_right");

   } else {             
   		$('#header_innen #social').remove().appendTo("body").addClass("social_wrapper_right").removeClass("social_wrapper_top");
   		hoverSide();
   };
           
};

function hoverSide(){
	$(".social_wrapper_right").hoverIntent(
	  function () {
	    $(".social_wrapper_right").stop().animate({right : 0, avoidTransforms : true}, 300,'easeOutQuad' );
	  }, 
	  function () {
	     $(".social_wrapper_right").stop().animate({right : -240, avoidTransforms : true}, 300,'easeOutBack' );
    }
 	 	);
}


$(window).resize(function() {
    if (resizeTimer) clearTimeout(resizeTimer);
    resizeTimer = setTimeout(myResize, 500);
 });


jQuery(document).ready(function($) {
    jQuery('a.popup').live('click', function(){
        newwindow=window.open($(this).attr('href'),'','height=400,width=500,location=no,menubar=no,personalbar=no');
        if (window.focus) {newwindow.focus()}
        return false;
    });
});
