$(document).ready(function(){
$(".next").click(function() {
var nextid=this.id;
var picname=nextid.replace("next","showid");
//alert (picname);
$(".showfirst").hide();
$(".show").hide();
$("#"+picname+"").show();
})

$(".prev").click(function() {
var previd=this.id;
var ppicname=previd.replace("prev","showid");
//alert (picname);
$(".showfirst").hide();
$(".show").hide();
$("#"+ppicname+"").show();
})


$(".thumb").click(function() {
var thumbid=this.id;
var thumbname=thumbid.replace("thumb","showid");
//alert (picname);
$(".showfirst").hide();
$(".show").hide();
$("#"+thumbname+"").show();
})

var currentid=0;
$(".slideforward").click(function() {
var thumbdid=this.id;

var test=document.getElementById("slideforward_9").className;
var total=Number(test.replace("total_",""));
if (thumbdid=='slideforward')
thumbdid=1;
currentid=thumbdid;
if (total==1)
currentid=0;
var thumbdname="thumbd_"+currentid;
//alert (picname);
$(".thumbd").hide();
$("#"+thumbdname+"").show();
var lasn=Number(currentid)+1;
if (lasn < total)
this.id=Number(currentid)+1;
})

$(".slideback").click(function() {
if (currentid>0)
var cid=currentid-1;
else
var cid=0;
currentid=cid;
var test=document.getElementById("slideforward_9").className;
var total=Number(test.replace("total_",""));
if (total==1)
cid=0;
var thumbdnamed="thumbd_"+cid;
//alert (picname);
$(".thumbd_first").hide();
$(".thumbd").hide();
$("#"+thumbdnamed+"").show();
var ln=Number(cid)-1;
if (ln>0)
this.id=Number(cid)-1;
});


})
