$(document).ready(function(){
     
    $("#content img").each(function (i) {
       var img_href = $(this).attr("src");
       
       if($(this).attr("alt")){
         var title = $(this).attr("alt");
       }else{
         var title = '';
       }

       if ((img_href.indexOf('content/images/')!=-1 || img_href.indexOf('aaddmm/uploads/')!=-1) && title.indexOf('trourimg')==-1){
         $(this).wrap('<a href="'+img_href+'" class="fancybox" title="'+title+'" rel="group"></a>');
       }
     });
     
     $('#content a[class=fancybox]').fancybox({'titlePosition' : 'inside', 'SpeedIn': 500, 'SpeedOut': 400, 'overlayShow': true, 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'easingIn' : 'easeOutBack', 'easingOut' : 'easeInBack' });// titlePosition:over
 
     $('a[class=new_page]').fancybox({'autoScale' : false, 'type' : 'iframe', 'width':500, 'height':500});
     $('a[class=edit]').fancybox({'autoScale' : false, 'type' : 'iframe', 'width':600,'height':550});

     //typography
     $(".attention, .notice, .alert, .download, .approved, .media, .note, .camera, .doc").each(function (i) {
        var txt = $(this).html();
        $(this).html('<div class="typo-icon">'+txt+'</div>');
     });
     
     $('#slider').nivoSlider({effect:'fade', animSpeed:400, pauseTime:4000, controlNav:false});

      /*
      $('#slider').nivoSlider({
      effect:'random', //    * sliceDown    * sliceDownLeft    * sliceUp    * sliceUpLeft    * sliceUpDown    * sliceUpDownLeft    * fold    * fade    * random    * slideInRight    * slideInLeft
      slices:15,
      animSpeed:500, //Slide transition speed
      pauseTime:3000,
      startSlide:0, //Set starting Slide (0 index)
      directionNav:true, //Next & Prev
      directionNavHide:true, //Only show on hover
      controlNav:true, //1,2,3...
      controlNavThumbs:false, //Use thumbnails for Control Nav
      controlNavThumbsFromRel:false, //Use image rel for thumbs
      controlNavThumbsSearch: '.jpg', //Replace this with...
      controlNavThumbsReplace: '_thumb.jpg', //...this in thumb Image src
      keyboardNav:true, //Use left & right arrows
      pauseOnHover:true, //Stop animation while hovering
      manualAdvance:false, //Force manual transitions
      captionOpacity:0.8, //Universal caption opacity
      beforeChange: function(){},
      afterChange: function(){},
      slideshowEnd: function(){}, //Triggers after all slides have been shown
      lastSlide: function(){}, //Triggers when last slide is shown
      afterLoad: function(){} //Triggers when slider has loaded
      });
      */

      //dwopdown ie fix
  		$('li.headlink').hover(
  			function() { $('ul', this).css('display', 'block'); },
  			function() { $('ul', this).css('display', 'none'); }
      );
      
    	//When page loads...
    	$(".tab_content").hide(); //Hide all content
    	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
    	$(".tab_content:first").show(); //Show first tab content
    
    	//On Click Event
    	$("ul.tabs li").click(function() {
    
    		$("ul.tabs li").removeClass("active"); //Remove any "active" class
    		$(this).addClass("active"); //Add "active" class to selected tab
    		$(".tab_content").hide(); //Hide all tab content
    
    		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
    		$(activeTab).fadeIn(); //Fade in the active ID content
    		return false;
    	});
});
function show_boeknu(){
  		$("ul.tabs li").removeClass("active"); //Remove any "active" class
  		$("#tab6").addClass("active"); //Add "active" class to selected tab
  		$(".tab_content").hide(); //Hide all tab content
  		$("#tab6").fadeIn(); //Fade in the active ID content
}

