
function getComments(num){
	$.ajax({
  		url: "guestbookhtml.aspx",
		data: "com="+ num,
 	 	cache: false,
  		success: function(html){
   			 $("#loginComments").html(html);
  		}
	});
}

function getNext(){
	num++;
	if (num > total) num = 1; 
	getComments(num);
}

function getPrev(){
	num--;
	if (num < 1) num = total; 
	getComments(num);
}

$(document).ready(function(){
	$('#imgRotate').cycle({
    		fx:     'fade',
    		speed:   1500,
    		timeout: 2000
   	});
	
	getComments(num);
	
	$("#nextCom").click(function () { 
      		getNext(); 
		return false;
    	});
	
	$("#prevCom").click(function () { 
      		getPrev(); 
		return false;
    	});
});