window.onload = init;
function init()
{
	clock();
}
function clock()
{
	if (document.getElementById('jsClock') != null) 
	{
		var today = new Date();
		var hours = today.getHours();
		var minutes = today.getMinutes();
		var seconds = today.getSeconds();
		var time_holder; // holds the time
		// add a leading zero if less than 10
		hours = ((hours < 10) ? "0" + hours : hours);
		minutes = ((minutes < 10) ? "0" + minutes : minutes);
		seconds = ((seconds < 10) ? "0" + seconds : seconds);
		
		time_holder = hours + ":" + minutes;// + ":" + seconds;
		document.getElementById('jsClock').innerHTML = time_holder;
		
		// keep the clock ticking
		setTimeout("clock()", 1000);
	}
}

$(document).ready(function(){	
	$('a[rel=external]').click(function(){
		window.open(this.href);
	
		return false;
	});
	$('.left .menu li').click(function(){
		//alert($(this+' a').attr('href'))
		var lp = $(this).children().attr('href');
		window.location.href=lp;
	});
	$('.slideshow').cycle({
		speed: 1000,
		timeout: 6000
	});
	
	$('.combined .checkbox input').click(function(){
		var ar = $(this).attr('name').split('][');
		var s = ar[1].substr(0,ar[1].length-1);
		//alert($('#' + s).css('display'));
		if ($('#' + s).is(':visible') && !$(this).is(':checked')) {
			$('#' + s).fadeOut();
		}
		else if ($('#' + s).is(':hidden') && $(this).is(':checked'))
		{
			$('#' + s).fadeIn();
		}
	});
	
	$('.combined .checkbox input').each(function(){
		if($(this).is(':checked'))
		{
			var ar = $(this).attr('name').split('][');
			var s = ar[1].substr(0,ar[1].length-1);
			$('#' + s).css('display', 'block');
		}
	})
});

function showInfo(text)
{
	Shadowbox.open({
        player:     'iframe',
	    content:    base+'pages/info/'+text,
        height:     130,
	    width:      510
   });
}

