/* Copyright (C) 2008 - scrie.ro */

var aPanos = new Array();
function panoramic(sImg)
{
 return (aPanos[aPanos.length] = new panoObject(aPanos.length, "http://blog.scrie.ro/images/pan/" + sImg));
}

function panoObject(panoid, sImg)
{
 this.panoSwitch=panoSwitch; this.panoCmd=panoCmd; this.panoScroll=panoScroll; this.panoMax=panoMax;
 this.id = panoid; this.bScroll = false; this.bRight = true;
	
 document.write("<div align=\"center\"><table width=\"430px\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr height=\"222px\"><td>"
  + "<div id=\"pano_" + this.id + "\" style=\"width:430px;height:222px;clip:rect(0 0 auto auto);overflow:auto\">"
  + "<img src=\"" + sImg + "\" align=\"left\"></div></td></tr></table></div><div align=\"center\" style=\"margin-top:10px;\">"
  + "<input type=\"image\" src=\"http://blog.scrie.ro/images/btnFirst.gif\" onclick=\"aPanos[" + this.id + "].panoCmd(1)\" style=\"vertical-align:middle\" border=\"0\">"
  + "<input type=\"image\" src=\"http://blog.scrie.ro/images/btnBack.gif\" onclick=\"aPanos[" + this.id + "].panoCmd(2)\" style=\"vertical-align:middle\" border=\"0\">"
  + "<input type=\"button\" value=\"Start\" onclick=\"aPanos[" + this.id + "].panoSwitch()\" class=\"stySmallBtn\" id=\"btnAutoScroll_" + this.id + "\">"
  + "<input type=\"image\" src=\"http://blog.scrie.ro/images/btnNext.gif\" onclick=\"aPanos[" + this.id + "].panoCmd(3)\" style=\"vertical-align:middle\" border=\"0\">"
  + "<input type=\"image\" src=\"http://blog.scrie.ro/images/btnLast.gif\" onclick=\"aPanos[" + this.id + "].panoCmd(4)\" style=\"vertical-align:middle\" border=\"0\">"
  + "</div>");
 this.panoElem = document.getElementById("pano_" + this.id);
 this.panoSwitch();
}

function panoSwitch()
{
 this.bScroll = !this.bScroll;
 document.getElementById("btnAutoScroll_" + this.id).value = (this.bScroll ? "Stop" : "Start");
 if (this.bScroll) this.panoScroll();
}
function panoScroll()
{
 if (!this.bScroll) return;
 var i = (this.bRight ? 1 : -1); var j = this.panoElem.scrollLeft + i;
 if (i<0 && j<=0 || i>0 && j>=this.panoMax()) this.bRight = !this.bRight;
 this.panoElem.scrollLeft = j + i; setTimeout("gpanoScroll(" + this.id + ")", 20);
}
function gpanoScroll(idpano) { aPanos[idpano].panoScroll(); }

function panoCmd(typ)
{
 switch (typ)
 {
  case 2: this.bRight = false; break;
  case 3: this.bRight = true; break;
  case 1: this.bRight = true; this.panoElem.scrollLeft = 0; break;
  case 4: this.bRight = false; this.panoElem.scrollLeft = this.panoMax(); break;
 }
 if (!this.bScroll) this.panoSwitch();
}
function panoMax() { return (this.panoElem.scrollWidth - this.panoElem.offsetWidth); }

