    $(function(){
      if (self.location.href == top.location.href){
        $("body").css({font:"normal 13px/22px 'trebuchet MS', verdana, sans-serif, color:white"});
        var logo=$("<a class='hide_content' href='#' style='position:absolute;top:20px;left:20px;z-index:1000; color:white'><img src='images/f-spin_logo.png' border='0' alt='Click F-SPIN logo to toggle content!' title='Click F-SPIN logo to toggle content' /></a>");
        $("body").prepend(logo);
        $("#logo").fadeIn();
      }

      //General Shuffle function for an array
			$.shuffle = function(arr) {
			for (
			var j, x, i = arr.length; i;
			j = parseInt(Math.random() * i),
			x = arr[--i],arr[i] = arr[j],arr[j] = x
			);
			return arr;
			};
      //Build array to be shuffled
      var myImages=[
			"images/bg/fluid_001.jpg",
			"images/bg/fluid_002.jpg",
			"images/bg/fluid_003.jpg",
			"images/bg/fluid_004.jpg",
      "images/bg/blockshot.jpg",
      "images/bg/blockshot_02.jpg",
      "images/bg/blockshot_03.jpg",
      "images/bg/blockshot_04.jpg",
      "images/bg/fuseand.jpg",			
      "images/bg/fuseand_02.jpg",
      "images/bg/fuseand_03.jpg",
      "images/bg/fuseand_04.jpg",																				
      ];
			//Shuffle Array 
			var shuffledImages= $.shuffle(myImages);

      $.mbBgndGallery.buildGallery({
//        containment:"#wrapper",
        containment:"body",
        timer:2000,
        effTimer:2000,
        controls:"#controls",
        grayScale:false,
        autostarts:true,
        // If your server allow directory listing
        //folderPath:"images/bg/",
  
        // else (This should be an array of images:

        images:shuffledImages,

        onStart:function(){$("#controls .play").hide();$("#controls .pause").show();},
        onPause:function(){$("#controls .play").show();$("#controls .pause").hide();},
        onPlay:function(opt){$("#controls .play").hide();$("#controls .pause").show();},
        onChange:function(idx){}, //idx=the zero based index of the displayed photo
        onNext:function(opt){},   //opt=the options relatives to this component instance
        onPrev:function(opt){}   //opt=the options relatives to this component instance
      });


      $(".bw").toggle(
          function(){
            var el=$("body").get(0);
            el.opt.grayScale=true;
            $(this).addClass("sel");
            el.opt.gallery.find("img:first").greyScale();
          },
          function(){
            var el=$("body").get(0);
            el.opt.grayScale=false;
            $(this).removeClass("sel");
            el.opt.gallery.find("img:first").attr("src",el.opt.images[el.opt.imageCounter]);
          }
          )
    });
