$(window).load(function() {
  //  $('#slider').nivoSlider({ captionOpacity: 1.0, pauseTime: 5000, directionNav: false, effect:'fade', directionNavHide:false });
//	$('#slider').data('nivoslider').stop();
	
   // $('#slider-port').nivoSlider({ pauseTime: 3000,effect: 'fade', directionNav:true, directionNavHide:false, prevText: '', nextText: '' });
});

var colors = new Array('#00BAED','#BE94C1','#8883BB','#055A81','#F03868','#00BAED', '#87D7F4','#F6CC88','#231F20','#FFFFFF','#00ACB2','#BE94C1', '#055A81','#00ACB2');
				
function loadBar() {
	var prev = '#00BAED';
	var temp = '#00BAED';
	time = 0;
	
	var viewportwidth;
	 if (typeof window.innerWidth != 'undefined')
	 {
	      viewportwidth = window.innerWidth;
	 }
	 else if (typeof document.documentElement != 'undefined'
	     && typeof document.documentElement.clientWidth !=
	     'undefined' && document.documentElement.clientWidth != 0)
	 {
	       viewportwidth = document.documentElement.clientWidth;
	 }
	 else
	 {
	       viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
	 }
	
	for(var x = 0;x < (viewportwidth / 80); x++) {
		while(temp == prev) {
			temp = colors[parseInt(Math.random() * colors.length)];	
		}
		
		$('.border table').append('<td width="80px" class="'+ time +'a" style="background:'+ temp +';border: 1px solid '+ temp +';"></td>');
		$('.' + time + 'a').hide();
		setTimeout("$('."+ time +"a').fadeIn(200);",time)
		time += 200;
		prev = temp;
	}
}

function applyHover() {
	var temp = '';
	$('.border table td').hover(function() {
		temp = $(this).css('background-color');
		var color = colors[parseInt(Math.random() * colors.length)];
		$(this).css('background',color);
		$(this).css('border-color',color);
	},function() {
		$(this).css('background-color',temp);
		$(this).css('border-color',temp);
		temp = '';
	});
}

$(document).ready(function() {
	$('.lazy').lazyload();
	setTimeout("loadBar();",500);
	setTimeout("applyHover();",3000);
});
