﻿
var offerLoopIntervalId = 0;


function offerLoop() {

var $visibleObj = $("#header .offer:visible");
$visibleObj.hide();
var $nextObj = $visibleObj.next(".offer");
if($nextObj.length) {
    $visibleObj.next(".offer").fadeIn();
}
else {
$("#header .offer:first").fadeIn();
}

}
 

 
 $(document).ready(function(){


    $("#servicemenu ul li:last").css("border-right" , "none");
    $("#eventslist ul li:last").css("border-bottom" , "none");
    $("#newslist ul li:last").css("border-bottom" , "none");

        $(".navigateOffers").click(function(){
            $("#header .offer").hide();
            var clickedNum = $(this).text();
            $("#header .num"+clickedNum).show();
            
            clearInterval(offerLoopIntervalId);
            
        });
        
         $("#header .offer:first").show();
         
        offerLoopIntervalId = setInterval("offerLoop()", 6000 );


/* //cycle
    $('#cycle').cycle({
		fx: 'fade' , // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	    timeout: 8000 ,
	    cleartype: true
	});

*/

   //newslettter
   $("#newsletterRadioOff").click(function(){
        $("#newsletterOn").hide();
        $("#newsletterOff").show();
   });

   $("#newsletterRadioOn").click(function(){
        $("#newsletterOff").hide();
        $("#newsletterOn").show();
   });
   
   
   //filter : AricleList category menu
   
   $(".tabs a").click(function(){
   
   var thisID = $(this).attr("id");
   $(".tabs a").removeClass("selected");
   $(this).addClass("selected");
   
   if(thisID.indexOf("_all") >= 0) {
    $(".pageBody .story").slideDown();
   } else {
    $(".pageBody .story").hide();
    $(".pageBody #category"+thisID).slideDown();
   }
   
   return false;
   
   
   });
   
   
  $('.lightBox a').lightBox({
	//overlayBgColor: '#FFF',
	overlayOpacity: 0.6,
	imageLoading: '/media/img/lightbox/lightbox-ico-loading.gif',
	imageBtnClose: '/media/img/lightbox/lightbox-btn-close.gif',
	imageBtnPrev: '/media/img/lightbox/lightbox-btn-prev.gif',
	imageBtnNext: '/media/img/lightbox/lightbox-btn-next.gif',
	containerResizeSpeed: 350,
	txtImage: 'Bilde',
	txtOf: 'av'
	//See: http://leandrovieira.com/projects/jquery/lightbox/
   });
   
    });


