

function scrollimageobject(image_id,left,top,default_width,default_height){
this.id=image_id;
this.center_x=Number(left)+(Number(default_width)/2);
this.center_y=Number(top)+(Number(default_height)/2);
this.default_width=default_width;
this.default_height=default_height;
this.scalefactor=1;
this.zindex=90;
}

/*
//these are to be used for enabling multiple scrollwindows and imagepanels on the same page
function scrollwindowobject(scrollwindowid,scrollwindowwidth,scrollwindowheight,scrollwindowbgcolor,imagescalezonediv,frequency,amplitude,center,defaultimagelistid){
this.scrollwindowid=scrollwindowid;
this.scrollwindowwidth=scrollwindowwidth;
this.scrollwindowheight=scrollwindowheight;
this.scrollwindowbgcolor=scrollwindowbgcolor;
this.imagescalezonediv=imagescalezonediv;
this.frequency=frequency;
this.amplitude=amplitude;
this.center=center;
this.defaultimagelistid;
this.scrollwindowcenter_x = Math.round(scrollwindowwidth/2);
this.imagescalezonewidth = 32*imagescalezonediv;
this.leftbound = scrollwindowcenter_x - Math.round(imagescalezonewidth/2);
this.rightbound = scrollwindowcenter_x + Math.round(imagescalezonewidth/2);
}
*/

/*
var scrollpanelwindowcenter=Math.round(560/2);
var scrollinc=2;
var scrollvector=-1;

var scrollimage_default_x=120;
var scrollimage_default_y=90;
*/

function putscrollimage(theimageobject,i){
if(scrollmode==0){
theimageobject.style.left=scrollimagesarray[i].center_x - Math.round((scrollimagesarray[i].default_width*scrollimagesarray[i].scalefactor)/2)+"px";
theimageobject.style.top=(scrollimagesarray[i].center_y - Math.round((scrollimagesarray[i].default_height*scrollimagesarray[i].scalefactor)/2))-((scalefactor==1) ? 0:Math.round(imageyoffset*scalefactor))+"px";
theimageobject.style.width= Math.round(scrollimagesarray[i].default_width*scrollimagesarray[i].scalefactor)+"px";
theimageobject.style.height= Math.round(scrollimagesarray[i].default_height*scrollimagesarray[i].scalefactor)+"px";
theimageobject.style.zIndex=scrollimagesarray[i].zindex;
}
else
{
theimageobject.style.left=scrollimagesarray[i].center_x - Math.round((scrollimagesarray[i].default_width*scrollimagesarray[i].scalefactor)/2)+"px";
}

}

function putscrollimageshadow(theimageshadowobject,i){
if(!showshadows){
return;
}
theimageshadowobject.style.left=Number(theimageobject.style.left.replace(/px/,""))+((scalefactor==1) ? 0:Math.round(shadowoffset*scalefactor))+"px";
theimageshadowobject.style.top=Number(theimageobject.style.top.replace(/px/,""))+((scalefactor==1) ? 0:Math.round(shadowoffset*scalefactor))+"px";
theimageshadowobject.style.width=theimageobject.style.width;
theimageshadowobject.style.height= theimageobject.style.height;
theimageshadowobject.style.display='';
theimageshadowobject.style.zIndex=scrollimagesarray[i].zindex-1;
}

function putscrollimagelabel(theimagelabelobject){

//this added in Racetech to display labels if specified
if(!showlabels){
return;
}
theimagelabelobject.style.left=Number(theimageobject.style.left.replace(/px/,""))+((scalefactor==1) ? 0:Math.round(10*scalefactor))+"px";
theimagelabelobject.style.top=Number(theimageobject.style.top.replace(/px/,""))+Number(theimageobject.style.height.replace(/px/,""))+Number(labelyoffset)+"px";
theimagelabelobject.style.width=theimageobject.style.width;
//theimagelabelobject.style.height= theimageobject.style.height;
}



/*
var scrollwindowsarray=new Array();


var scrollwindowcenter_x = Math.round(560/2);

var imagescalezonediv = 14;
var imagescalezonewidth = 32*imagescalezonediv;
var leftbound = scrollwindowcenter_x - Math.round(imagescalezonewidth/2);
var rightbound = scrollwindowcenter_x + Math.round(imagescalezonewidth/2);
var frequency=.1;
var amplitude=50;
var center=.1;
*/

function resetscrollimagesize(imagelistid){
for(i in scrollimagesarray){
scalefactor=1;
scrollimagesarray[i].scalefactor=scalefactor;
theimageobject=document.getElementById(imagelistid+"_si_"+scrollimagesarray[i].id);
putscrollimage(theimageobject,i);

//this condition added in Racetech
if(showshadows){
theimageshadowobject=document.getElementById(imagelistid+"_sis_"+scrollimagesarray[i].id);
putscrollimageshadow(theimageshadowobject,i);
}

//added condition below in RACETECH to only render labels if specified 
if(showlabels){
theimagelabelobject=document.getElementById(imagelistid+"_sil_"+scrollimagesarray[i].id);
putscrollimagelabel(theimagelabelobject);
}

}
}


function presetscrollimagesize(imagelistid){
for(i in scrollimagesarray){

if((scrollimagesarray[i].center_x > leftbound) && (scrollimagesarray[i].center_x < rightbound) && (usesinescale)){
sinedist = (scrollimagesarray[i].center_x) - leftbound;
sinedist = Math.round(sinedist/imagescalezonediv);
scalefactor=1+((Math.sin(frequency*sinedist)*amplitude+center)/100);
scrollimagesarray[i].scalefactor=scalefactor;
scrollimagesarray[i].zindex=Math.round(100*scalefactor);
}
else
{
scalefactor=1
scrollimagesarray[i].scalefactor=scalefactor;
}


scrollimagesarray[i].scalefactor=scalefactor;
theimageobject=document.getElementById(imagelistid+"_si_"+scrollimagesarray[i].id);
putscrollimage(theimageobject,i);

//this condition added in racetech
if(showshadows){
theimageshadowobject=document.getElementById(imagelistid+"_sis_"+scrollimagesarray[i].id);
putscrollimageshadow(theimageshadowobject,i);
}

//added condition below in RACETECH to only render labels if specified 
if(showlabels){
theimagelabelobject=document.getElementById(imagelistid+"_sil_"+scrollimagesarray[i].id);
putscrollimagelabel(theimagelabelobject);
}


}
}

function centerscrollimages(imagelistid){
//scrollimagesdelta_x=Number(scrollimagesarray[scrollimagesarray.length-1].center_x)-Number(scrollimagesarray[0].center_x);
//scrollimagesoffset_x=Math.round(scrollimagesdelta_x/2)-scrollwindowcenter_x;
middleimage=Math.round(scrollimagesarray.length/2);
scrollimagesoffset_x=Math.round(scrollwindowcenter_x - scrollimagesarray[middleimage].center_x);
for(i in scrollimagesarray){
scrollimagesarray[i].center_x=Number(scrollimagesoffset_x)+Number(scrollimagesarray[i].center_x);
scalefactor=1;
theimageobject=document.getElementById(imagelistid+"_si_"+scrollimagesarray[i].id);
putscrollimage(theimageobject,i);

//this condition added in racetech
if(showshadows){
theimageshadowobject=document.getElementById(imagelistid+"_sis_"+scrollimagesarray[i].id);
putscrollimageshadow(theimageshadowobject,i);
}

//added LINES  below in RACETECH to only render labels if specified 
if(showlabels){
theimagelabelobject=document.getElementById(imagelistid+"_sil_"+scrollimagesarray[i].id);
putscrollimagelabel(theimagelabelobject);
}


}
}


function scrollallimages(imagelistid){
if( (scrollvector>0) && (Number((scrollimagesarray[0].center_x)+Number(scrollvector) >= (scrollwindowcenter_x - reverseoffset)))){
//scrollvector=0;
scrollvector=-1;
}
else if( (scrollvector<0) && (Number((scrollimagesarray[scrollimagesarray.length-1].center_x)+Number(scrollvector) <= (scrollwindowcenter_x + reverseoffset)))){
//scrollvector=0;
scrollvector=1;
}
if(scrollvector!=0){
if(scrollimagesarray){
for(i in scrollimagesarray){

scrollimagesarray[i].center_x=Number(scrollimagesarray[i].center_x)+scrollvector;


if((scrollimagesarray[i].center_x > leftbound) && (scrollimagesarray[i].center_x < rightbound) && (usesinescale)){
sinedist = (scrollimagesarray[i].center_x) - leftbound;
sinedist = Math.round(sinedist/imagescalezonediv);
scalefactor=1+((Math.sin(frequency*sinedist)*amplitude+center)/100);
scrollimagesarray[i].scalefactor=scalefactor;
scrollimagesarray[i].zindex=Math.round(100*scalefactor);
}
else
{
scalefactor=1
scrollimagesarray[i].scalefactor=scalefactor;
}



theimageobject=document.getElementById(imagelistid+"_si_"+scrollimagesarray[i].id);
putscrollimage(theimageobject,i);

//this condition added in racetech
if(showshadows){
theimageshadowobject=document.getElementById(imagelistid+"_sis_"+scrollimagesarray[i].id);
putscrollimageshadow(theimageshadowobject,i);
}

//added condition below in RACETECH to only render labels if specified 
if(showlabels){
theimagelabelobject=document.getElementById(imagelistid+"_sil_"+scrollimagesarray[i].id);
putscrollimagelabel(theimagelabelobject);
}

}
}
}
}

function updatebigimage(thumbimage){
//alert(thumbimage);
document.getElementById("bigimage").src=thumbimage.replace(/_m.jpg/,"_l.jpg");
//return false;
}
