// true if IE
var IE = /*@cc_on!@*/false;
$$('html')[0].className += ' json';



var pingalaCMS = {
		
	load : function() {
		
		pingalaCMS.startSlideshow(1);
		pingalaCMS.openWindow();
		new Effect.Appear('contents', { duration: 1});
		
	},
	
	openWindow : function(){
		
		allNodes = $$('.openWindow');
		allNodes.each(function(node, i) {
		allNodes[i].onclick = function() {
			//pageTracker._trackEvent('Outbound Links', this.href) //google track out links
			window.open(this.href); return false;
		};
		});
	},
	
	
	showPage  : function(whatpage){
		
		if(whatpage=='day'){ setcol = 'background: #fff;' } else { setcol = 'background: #000;' }
	 
					
		new Effect.Fade('contents', { 
			duration: 0.8,
		
			afterFinish: function(){
					new Effect.Morph($$('html')[0], { 
						style:  setcol, 
						duration: 0.5,
						afterFinish: function(){
								document.location = '/'+whatpage+'/';
						 }
					 });
			 }
		 });
			
		
	},
	
	startSlideshow : function(delay) {
		setTimeout(pingalaCMS.fadeInOut(delay), delay);
		lis = $$('#imgholder>li');
		lis.each(function(node, i) {if (node.className==''){node.className='block'; node.hide()}; });
	},


	fadeInOut : function(delay) {
		return(function() {
			lis = $$('#imgholder>li');
			new Effect.Appear(lis[1], { duration: 1, afterFinish: function(obj) {
				lisFade = lis[0].remove();
				lisFade.hide();
				$('imgholder').appendChild(lisFade); 
				pingalaCMS.startSlideshow(3000);
			}});
		})
	
	}
	
}


Event.observe(window, 'load', pingalaCMS.load, false);
