$(document).ready(function() {
	var i;
	var r=new doc();
	r.current($("#cur").attr("value"));
	var n=document.getElementsByName("link");
	var n1=document.getElementsByName("next");
	for(i=0;i<n.length;i++){
	$(n1[i]).click(function(){
	r.next();
	return false;
	});
	$(n[i]).attr("d",i);
       $(n[i]).click(function(i){
	 var d=$(i.target).attr("d")-0;
	  r.rt(d);
	  return false;
	   });}
  
});

function doc(th){
var d=document.getElementsByTagName("div");
this.ar=new Array();
for(i=0;i<d.length;i++)
	if(d[i].getAttribute("name")=="doci")
		this.ar.push(d[i]);

this.curent=0;
}

doc.prototype.rt=function(i){
if(i!=this.curent){
if(this.curent<this.ar.length)
$(this.ar[this.curent]).slideUp("slow");
this.curent=i;
$(this.ar[i]).slideDown("slow");
}
}

doc.prototype.current=function(cur){
this.curent=cur;
}

doc.prototype.next=function(){
if(this.curent<=this.ar.length){
$(this.ar[this.curent]).slideUp("slow");
$(this.ar[++this.curent]).slideDown("slow");
}
}

