$(document).ready(function(){
	$("#nav ul").hide();
	$("#nav a[href='#']").click(function( e ){
		e.preventDefault();
		var ul = $( this ).next('ul');
		$( ul ).toggle('slow');
	});
	
	$("a.externo, a[rel='externo']").click(function( e ){
		e.preventDefault();
		window.open( $(this).attr('href'), '', $(this).attr('rel') );
	});
	$("a[rel='externo']").click(function( e ){
		e.preventDefault();
		window.open( $(this).attr('href') );
	});
	
	
	$('#next-month, #prev-month').live('click',function(){
		var next = $(this).attr('alt');
	
		//alert( next );
		$.post('inc/calendar.php',
			{mes: next},
			function( data ){
				$('#calendar').html(data); 
		});
	});
	
	
	$("a.externo").click(function( e ){
		e.preventDefault();
		window.open( $(this).attr('href') );
	});	
});

function hora(){
	var now = new Date();
	var hours = now.getHours();
	var minutes = now.getMinutes();
	var seconds = now.getSeconds();
	
	if (hours <=9) hours="0"+hours;
	if (minutes<=9) minutes="0"+minutes;
	if (seconds<=9) seconds="0"+seconds;
	var cdate = hours+":"+minutes+":"+seconds;
	
	document.getElementById('clock').innerHTML = cdate;
	setTimeout('hora()',1000);
}
function addFav()
{ 
	var url=window.location.href; 
	var title="Toloi"; 
	if (window.sidebar) window.sidebar.addPanel(title, url,""); 
	else if(window.opera && window.print){ 
	var mbm = document.createElement('a'); 
	mbm.setAttribute('rel','sidebar'); 
	mbm.setAttribute('href',url); 
	mbm.setAttribute('title',title); 
	mbm.click(); 
	} 
	else if(document.all){window.external.AddFavorite(url, title);} 
} 
