$(document).ready(function(){

$(".chefthumb").hover (

  function () {
  var position = $(this).position();
  var nleft=position.left + 60;
var ntop=position.top - 50;
  var pat=this.id;
    $(this).append($("<div class='chefheadshot'><img src='http://www.starchefs.com/product_education/jade_range/images/thumbs/"+ pat+".jpg'></class>"));
 $(".chefheadshot").css({'left' : nleft, 'top' : ntop});
  }, 
  function () {
    $(this).find(".chefheadshot:last").remove();
  }
)

$(".chefnamethumb").hover (

  function () {
  var position = $(this).position();
  var nleft=position.left + 80;
var ntop=position.top - 50;
  var pat=this.id.replace("_name","");;
    $(this).append($("<div class='chefheadshot'><img src='http://www.starchefs.com/product_education/jade_range/images/thumbs/"+ pat+".jpg'></class>"));
 $(".chefheadshot").css({'left' : nleft, 'top' : ntop});
  }, 
  function () {
    $(this).find(".chefheadshot:last").remove();
  }
)

var titantitle= new Array("","Full Range","Fryer","Heavy Duty Broilers","Salamanders","Suites","Fire and Ice");
var titanurl=new Array("",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=6",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=27",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=23",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=24",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=5",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=21")


$(".rightarrow").click (
function() {

var currentidstr=$(".titanimg").attr("id");
var currentid=parseInt(currentidstr.replace("pic-",''));
var nextcurrentid=currentid+1;
if (nextcurrentid>6)
nextcurrentid=6;
else {
nextcurrentid=nextcurrentid;
}
//var test=document.images.titanimg.src;
//alert(test);
//document.images.titanimg.src="/images/jadepic/titan"+nextcurrentid+".jpg";
//$(".titanimg").id="pic-"+nextcurrentid;
var newimage="/images/jadepic/titan"+nextcurrentid+".jpg";
var newid="pic-"+nextcurrentid;
$(".titanimg").attr("src", newimage);
$(".titanurl").attr("href",titanurl[nextcurrentid]);
$(".titantitle").text(titantitle[nextcurrentid]);
$(".titanimg").attr("id", newid);
})


$(".leftarrow").click (
function() {
var Lcurrentidstr=$(".titanimg").attr("id");
var Lcurrentid=parseInt(Lcurrentidstr.replace("pic-",''));
var Lnextcurrentid=Lcurrentid-1;

if (Lnextcurrentid<1)
var Lnextcurrentid=1;
else {
var Lnextcurrentid=Lnextcurrentid;
}
var Lnewimage="/images/jadepic/titan"+Lnextcurrentid+".jpg";
var Lnewid="pic-"+Lnextcurrentid;
$(".titanimg").attr("src", Lnewimage);
$(".titanurl").attr("href",titanurl[Lnextcurrentid]);
$(".titantitle").text(titantitle[Lnextcurrentid]);
$(".titanimg").attr("id", Lnewid);
})


var specialtitle=new Array("","Smoker","Chinese B.B.Q","Teppan Yaki","Tortilla Griddle","Woks")
var specialurl=new Array("",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=20",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=28",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=30",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=29",
"http://www.jaderange.com/Jade_PriceList_2010.pdf#page=28")


$(".specialrightarrow").click (
function() {
var scurrentidstr=$(".specialimg").attr("id");
var scurrentid=parseInt(scurrentidstr.replace("spe-",''));
var snextcurrentid=scurrentid+1;
if (snextcurrentid>5)
snextcurrentid=5;
else {
snextcurrentid=snextcurrentid;
}
var snewimage="/images/jadepic/special"+snextcurrentid+".jpg";
var snewid="spe-"+snextcurrentid;
$(".specialimg").attr("src", snewimage);
$(".specialurl").attr("href", specialurl[snextcurrentid]);
$(".specialtitle").text(specialtitle[snextcurrentid]);
$(".specialimg").attr("id", snewid);
})


$(".specialleftarrow").click (
function() {
var Lscurrentidstr=$(".specialimg").attr("id");
var Lscurrentid=parseInt(Lscurrentidstr.replace("spe-",''));
var Lsnextcurrentid=Lscurrentid-1;
if (Lsnextcurrentid<1)
Lsnextcurrentid=1;
else {
Lsnextcurrentid=Lsnextcurrentid;
}
var Lsnewimage="/images/jadepic/special"+Lsnextcurrentid+".jpg";
var Lsnewid="spe-"+Lsnextcurrentid;
$(".specialimg").attr("src", Lsnewimage);
$(".specialurl").attr("href", specialurl[Lsnextcurrentid]);
$(".specialtitle").text(specialtitle[Lsnextcurrentid]);
$(".specialimg").attr("id", Lsnewid);
})



$(".bistrorightarrow").click (
function() {
var bcurrentidstr=$(".bistroimg").attr("id");
var bcurrentid=parseInt(bcurrentidstr.replace("bistro-",''));
var bnextcurrentid=bcurrentid+1;
if (bnextcurrentid>11)
bnextcurrentid=11;
else {
bnextcurrentid=bnextcurrentid;
}
var bnewimage="/images/jadepic/bistro"+bnextcurrentid+".jpg";
var bnewid="bistro-"+bnextcurrentid;

$(".bistroimg").attr("src", bnewimage);
$(".bistroimg").attr("id", bnewid);
})


$(".bistroleftarrow").click (
function() {
var Lbcurrentidstr=$(".bistroimg").attr("id");
var Lbcurrentid=parseInt(Lbcurrentidstr.replace("bistro-",''));
var Lbnextcurrentid=Lbcurrentid-1;
if (Lbnextcurrentid<1)
Lbnextcurrentid=1;
else {
Lbnextcurrentid=Lbnextcurrentid;
}
var Lbnewimage="/images/jadepic/bistro"+Lbnextcurrentid+".jpg";
var Lbnewid="bistro-"+Lbnextcurrentid;
$(".bistroimg").attr("src", Lbnewimage);
$(".bistroimg").attr("id", Lbnewid);
})


})