// $Id$

// Global killswitch 
$(document).ready(function(){
	$('.link-prev').click(function() {
    	var nextPub = function(data) {
    		var result=eval('('+ data +')');
			$('.pone a.titlelink').html(result[0]['title']);
			$('.pone a.titlelink').attr('href',result[0]['link']);
			$('.pone div.pubbody').html(result[0]['body']);
			$('.pone li.pages').html(result[0]['pages']);
			$('.pone li.size').html(result[0]['size']);
			$('.pone li.ftype').html(result[0]['filetype']);
			$('.pone div.author').html(result[0]['author']);
			$('.pone .link2 a').attr('href',result[0]['download']);
			$('.pone img.pubimage').attr('src',result[0]['image']);
			
			$('.ptwo a.titlelink').html(result[1]['title']);
			$('.ptwo a.titlelink').attr('href',result[1]['link']);
			$('.ptwo div.pubbody').html(result[1]['body']);
			$('.ptwo li.pages').html(result[1]['pages']);
			$('.ptwo li.size').html(result[1]['size']);
			$('.ptwo li.ftype').html(result[1]['filetype']);
			$('.ptwo div.author').html(result[1]['author']);
			$('.ptwo .link2 a').attr('href',result[1]['download']);
			$('.ptwo img.pubimage').attr('src',result[1]['image']);
			
			$('a.link-prev').attr('href',result[0]['prenode']);
			$('a.link-next').attr('href',result[1]['nextnode']);
		}
		$.get(this.href, null, nextPub);
		return false;
    });
    $('.link-next').click(function() {
    	var nextPub = function(data) {
    		var result=eval('('+ data +')');
    		$('.pone a.titlelink').html(result[0]['title']);
			$('.pone a.titlelink').attr('href',result[0]['link']);
			$('.pone div.pubbody').html(result[0]['body']);
			$('.pone li.pages').html(result[0]['pages']);
			$('.pone li.size').html(result[0]['size']);
			$('.pone li.ftype').html(result[0]['filetype']);
			$('.pone div.author').html(result[0]['author']);
			$('.pone .link2 a').attr('href',result[0]['download']);
			$('.pone img.pubimage').attr('src',result[0]['image']);
			
			$('.ptwo a.titlelink').html(result[1]['title']);
			$('.ptwo a.titlelink').attr('href',result[1]['link']);
			$('.ptwo div.pubbody').html(result[1]['body']);
			$('.ptwo li.pages').html(result[1]['pages']);
			$('.ptwo li.size').html(result[1]['size']);
			$('.ptwo li.ftype').html(result[1]['filetype']);
			$('.ptwo div.author').html(result[1]['author']);
			$('.ptwo .link2 a').attr('href',result[1]['download']);
			$('.ptwo img.pubimage').attr('src',result[1]['image']);
			
			$('a.link-prev').attr('href',result[0]['prenode']);
			$('a.link-next').attr('href',result[1]['nextnode']);
		}
		$.get(this.href, null, nextPub);
		return false;
    });
    
  });


