
$("img").lazyload({placeholder : "/loading.gif", threshold : 100});

$("#registro").fancybox();

function logout(){
	$.post('forms/log2.php');
	setTimeout("window.location.reload()", 500);
}

$("#conf").livequery('click', function() {
if($('#menu_usr').is(':visible'))
    $("#menu_usr").hide("slow");
else
    $("#menu_usr").show("slow");	
});

$("#login").livequery('click', function() {
    $("#logeo").show();$("#logreg").hide();  
});

$('#flogin').livequery('submit', function() {
    $.post('forms/log2.php',$(this).serialize(),function(data){
	    if(data==1)
				$("#msglogin").html('<font color="red">contraseña incorrecta.</font>');
			    else
				window.location.reload();

    })
    return false;
});


function clfilter(){
   $(".active").each( function() {
     $(this).removeClass('active');	
   });
   
}

function url_base($id){
   $($id+" li a").each( function() {
	if($(this).attr('class')=='active') $href=$(this).attr('href');
   });
   if($href.indexOf('-')<0) $href=$href+"-";
   return $href;
}
/*
alert(1);
function disableEnterKey(e){
var key = (window.event) event.keyCode : e.which;
return (key != 13);
}
alert(2);
*/
/*
	// PageLoad function
	// This function is called when:
	// 1. after calling $.historyInit();
	// 2. after calling $.historyLoad();
	// 3. after pushing "Go Back" button of a browser
	function pageload(hash) {
		// hash doesn't contain the first # character.
		if(hash) {
			// restore ajax loaded state
			if(hash.indexOf("&l=1")>0){
				$("#listado").load(hash);
			}else{
				$("#main").load(hash);
			}
			
		} else {
			// start page
			//$("#main").load("/&a=1");
		}
	}
	function his($href){
			alert(1);
			var hash = $href;
			hash = hash.replace(/^.*#/, '');
			// moves to a new page. 
			// pageload is called at once. 
			$.history.load(hash);
			return false;
			
	}
	$(document).ready(function(){
		// Initialize history plugin.
		// The callback is called at once by present location.hash. 
		$.history.init(pageload);
		
		// set onlick event for buttons
		$("#menu li a").click(function(){
			clfilter()
			$(this).addClass('active');
			$href=$(this).attr('href');
			if($href!="/"){
				return his($(this).attr('href')+"&a=1");
			}else{
				return true;
			}
			
		});
	});
*/








