     $(document).ready(function(){
        // ----------------------     CONFIG    --------------------------------       
        var currentBackground = 'btn1';
        var backgroundTimerInterval = 7000;

        ArrayImagesPath = new Array();
        ArrayImagesPath['btn1'] = '../../../files/uploadsb/image1.jpg';
        ArrayImagesPath['btn2'] = '../../../files/uploadsb/image2.jpg';
        ArrayImagesPath['btn3'] = '../../../files/uploadsb/image3.jpg';
        ArrayImagesPath['btn4'] = '../../../files/uploadsb/image4.jpg';      
 
        
        ArrayImageText = new Array();
        ArrayImageText['btn1'] = 'SLaM Inc is a forum for the exploration and expression of ideas about spirit in business and organisational life. SLaM is committed to enabling people and organisations to function with integrity, creativity and care, so that our emerging world is a desirable place to be. It does not subscribe to, or promote any particular belief system.';
        ArrayImageText['btn2'] = 'We provide opportunities for people and organisations to re-evaluate their experience of business and organisational life, discover a sense of community with others, expand their vision, and reshape their management and leadership practices. We believe that all of our words and actions carry significance, and we can develop a greater capacity to act with care and creativity for the earth, ourselves and society.<br><br>Our activities include periodic conferences, regular seminars/cafes, and publications.';
        ArrayImageText['btn3'] = 'SLaM events attract a mix of professionals, managers, academics, consultants and thinkers from the corporate, government and community sectors. What they have in common is a desire to see their work become more ethical, life-enhancing and socially responsible.';
        ArrayImageText['btn4'] = '<a href="http://www.slamconference.org.au" TARGET="_blank"><img src="../../../files/uploadsb/slam-conference-2011-logo.gif"/><br/>For more information about SLaM Conference 2011, Click Here</a>';        

        // ----------------------     CONFIG END -------------------------------
        
        $("#"+currentBackground).css('background-image','url(../../../files/uploadsb/blue_circle.png)');        
        var timer = window.setInterval(changeBackgroundTimer, backgroundTimerInterval);
		var hover = false;
         
        function changeBackgroundTimer() {
          if(currentBackground=='btn1')currentBackground='btn2';
          else if(currentBackground=='btn2')currentBackground='btn3';
          else if(currentBackground=='btn3')currentBackground='btn4';
          else if(currentBackground=='btn4')currentBackground='btn1';
          changeBackground(currentBackground);
        }

        function deactiveAllButtons() {
          for(var x=1;x<=4;x++)  $("#btn"+x).css('background-image','url(../../../files/uploadsb/black_circle.png)');
        }

        $("#content").html(ArrayImageText[currentBackground]);  
        $("#backgroundimage").css('background-image','url(../../../files/uploadsb/'+ArrayImagesPath[currentBackground]+')');  


        function changeBackground(backID) {
              for(var x=1;x<=4;x++) $("#btn"+x).fadeOut('slow');
              $("#backgroundimage").fadeOut('slow', function() {$("#backgroundimage").css('background-image','url(../../../files/uploadsb/'+ArrayImagesPath[backID]+')')}).fadeIn('slow');   
              deactiveAllButtons();   
              if($("#backcontent").width() == 0) {
                  $("#content").html(ArrayImageText[backID]);
              } else {
                  $("#content").fadeOut('slow', function() { $("#content").html(ArrayImageText[backID]) } ).fadeIn('slow');         
              }  
              
              $('#'+backID).css('background-image','url(../../../files/uploadsb/blue_circle.png)');
              for(var x=1;x<=4;x++) $("#btn"+x).fadeIn('slow'); 
              timer =  clearInterval(timer);
			  if (timer) {
				  timer =  clearInterval(timer);
			  }
			  if (!hover) {
				timer =  setInterval(changeBackgroundTimer, backgroundTimerInterval);
			  }
        }


        for(var y=1;y<=4;y++) {
           $("#btn"+y).click(function () {
               var idname = $(this).attr('id');
               changeBackground(idname);
               currentBackground = idname;
               return false;
           });
        }

        $("#close").click(function () {
		
			runtab();
             
        });
        
        $("#backgroundimage").click(function () {
			runtab();
        }).hover (function () {
				timer =  clearInterval(timer);
				hover = true;
			}, 	function () {
				if (timer) {
				  timer =  clearInterval(timer);
				}
				hover = false;
				timer =  setInterval(changeBackgroundTimer, backgroundTimerInterval);
			});        
		});
	 
	 function runtab() {
		if($("#backcontent").width() == 0) {
			 $("#backcontent").animate({width:"280"},"slow");
			 $("#close").animate({left:"280"},"slow");     
			 $("#close").css('background-image','url(../../../files/uploadsb/close_txt.png)');     
			 $("#content").fadeIn(500);                
		  } else {
			 $("#backcontent").animate({width:"0"},"slow");
			 $("#close").animate({left:"0"},"slow");    
			 $("#close").css('background-image','url(../../../files/uploadsb/open_txt.png)');   
			 $("#content").fadeOut(500);
		  }
          return false;	 
	 }
