// JavaScript Document

	
	function init()
{
	if (document.getElementById("box4")) {
			var nS4 = new noobSlide({
				box: $('box4'),
				items: $$('#box4 div'),
				size: 965,
				handles: $$('#handles4 span'),
				onWalk: function(currentItem,currentHandle){
					//$('info4').set('html',currentItem.getFirst().innerHTML);
					this.handles.removeClass('active');
					currentHandle.addClass('active');
				}
			});
		}
		if(document.getElementById("show")) 
		{
			window.demo=new demo()
		
		}
	if (document.getElementById("msgdiv"))
	  {
		toggleBox('msgdiv',1);
		document.getElementById("all").onclick = function(){toggleBox('msgdiv',0);};
	  }	
	
}

function toggleBox(szDivID, iState){
   var obj = document.layers ? document.layers[szDivID] : document.getElementById ?  document.getElementById(szDivID).style : document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") : (iState ? "visible" : "hidden"); 
   if (iState)
	{	
		xy = getScrollXY();
   		obj.top = (screen.height/2+xy[1]-120)+"px";
	}
}	 

function getScrollXY() {
  var scrOfX = 0, scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  return [ scrOfX, scrOfY ];
}	  

if (window.addEventListener)
window.addEventListener("load", init, false)
else if (window.attachEvent)
window.attachEvent("onload", init)
else if (document.getElementById)
window.onload=init


	  var demo = new Class({
	    initialize: function(){
	      this.el = $('show');
	      // We attach our event listener to each of the demos.
  		  $$('#demos li').each(function(li, i){
  		    li.set('events', {'click': this.start.pass(i + 1, this)});
  		  }, this)
  		  // Start our default demo.
	      this.start();
	    },
	    
	    start: function(p){
        var data = {};
        if (this.show)
        this.show.destroy('empty');
		    this.show = new Slideshow.KenBurns(this.el, null, { captions: false, controller: true, delay: 4000, duration: 1000, height: 350, hu: 'images/', thumbnails: true, width: 600, zoom: 0 });
      	this.show.slideshow.retrieve('images').getElements('a').set('rel', 'lightbox');
			  var box = new Lightbox({ 
      			  'onClose': function(){ this.pause(false); }.bind(this.show), 
      			  'onOpen': function(){ this.pause(true); }.bind(this.show) 
      			});
      			box.image.addEvent('click', function(){ this.close(); }.bind(box));	   
  	    
		
		
  	    // This last little bit just inserts our thumbnails "fuzzy edge" overlays.
  	    if (this.show.options.thumbnails){
   	      ['a', 'b'].each(function(p){ 
    			  new Element('div', { 'class': 'overlay ' + p }).inject(this.show.slideshow.retrieve('thumbnails'));
          }, this);
  	    }
	    }
	  })	


