
(function($){
 
 Drupal.behaviors.MyBehavior = { 
	 attach: function(context) { 
	 //code to run when elements are loaded (either page ready or via ajax) 
 //alert("yes");
 
 //Link referencer
	 $(".view-referencer .field-link a").html('');
 
	if ($(".showcase").length) {
	
	$('.showcase').cycle({cleartype:true,timeout:15000})
	
	$('.showcase').before('<div id="slide-nav">').cycle({ 
		fx:     'fade', 
		speed:  2500,	
		timeout: 12000, 
		pager:  '#slide-nav', 
		delay: -8000
		});
	}
	
	
	
	//Videotabs
	$("#tabs div.tab").hide();
	$("#tabs div#fragment-1").show();
	
	$("#tabs li").click(function(){
		pos = $("span", this).attr("id"); 
		//alert(pos);
	 
		$("#tabs div.tab").hide();
		$("#tabs div div#"+pos).fadeIn('fast');
		
		//Styre active tab	
		$("#tabs li").removeClass('active');
		$(this).addClass('active');
		return false; 
	});	
	
	
	
	 },    
	 detach: function(context) {     
	 //code to run when elements are removed    
	 }  
 }
 
 


     
	

})(jQuery)
;

