// JavaScript Document

$(document).ready(function(){
	
//get actual site id
var actual = $('#actual').html();

//get and set previus and next site id in the buttons
var prevno = $('#' + actual).prev().html();
var nextno = $('#' + actual).next().html();
$('#right').attr('href', "?cat=/single.php&id=" + nextno);					   	
$('#left').attr('href', "?cat=/single.php&id=" + prevno);
	

//einblenden wenn da
if ($('#left').attr('href') != '?cat=/single.php&id=null') {
	$('#left').fadeIn(0);
}
if ($('#right').attr('href') != '?cat=/single.php&id=null') {
	$('#right').fadeIn(0);
}

//tastenshizzle
$(document).keydown(function(e){
	//left
    if (e.keyCode == 37) { 
	if($('#left').attr('href') != '?cat=/single.php&id=null')window.location = $('#left').attr('href');	return false;    }

	//right
    if (e.keyCode == 39) { 
	if($('#right').attr('href') != '?cat=/single.php&id=null'){window.location = $('#right').attr('href');	return false;    }}
	});

//show info-arrows
//$('#left').hover(
//  function () {$("#left .arrow").fadeIn(50).animate({   top: '0'}, 50, function() {});  },
//  function () {$("#left .arrow").delay(50).fadeOut(50);});

$('#right').hover(
  function () {$("#right .arrow").fadeIn(50).animate({   top: '0'}, 50, function() {});	},
  function () {$("#right .arrow").delay(50).fadeOut(50);});
//end document ready
});



