
//this scroll object controls the scroll bar of a div
myscrollobj = {
    mylayerId : 'gallery_container',
    myobj : document.getElementById(this.mylayerId),
    mytimerid : -1,
    scrollspeed : 3,
    acceleration : 1,
	refresh_rate : 25,
    f_getobj : function(){
        this.myobj = document.getElementById(this.mylayerId);
    },
    f_reset_accel : function(){
        this.acceleration = 1;
    },
    f_scrolldown : function(){
        if(!this.myobj){this.f_getobj();}
        this.myobj.scrollTop-= (this.scrollspeed*this.acceleration);
    },
    f_scrollup : function(){
        if(!this.myobj){this.f_getobj();}
        this.myobj.scrollTop+= (this.scrollspeed*this.acceleration);
    },
    scrolldown : function(){
        this.mytimerid = setInterval("myscrollobj.f_scrolldown()", this.refresh_rate);
    },
    scrollup : function(){
        this.mytimerid = setInterval("myscrollobj.f_scrollup()", this.refresh_rate);
    },
    scrollstop : function(){
        if(this.mytimerid != -1){
            clearInterval(this.mytimerid);
            this.mytimerid = -1;
            this.f_reset_accel();
        }
    },
    scrollfaster : function(){
        this.acceleration = 2;
    }
};
//-------------------------------
//these are page accessors, allow page to call scroll object methods
	function scroll_up(){
		myscrollobj.scrolldown();
	}
	function scroll_down(){
		//alert("test");
		myscrollobj.scrollup();
	}
    function scroll_stop(){
        myscrollobj.scrollstop();
    }
    function scroll_faster(){
        myscrollobj.scrollfaster();
    }
    function scroll_speedreset(){
        myscrollobj.f_reset_accel();
    }
//-------------------------------
//get full image path
function FullImagePath(imgDir,imgSrc) {
	return "images/portfolio/"+imgDir+"/"+imgSrc;
}
//get thumbnail image path
function ThumbImagePath(imgDir,imgSrc) {
	return "images/portfolio/"+imgDir+"/thumbs/"+imgSrc;
}
//-------------------------------
//generate thumbnail images html code
function genThumbnail(imgDir,imgSrc){
    result = "<a href=\"javascript:ShowImage('";
    result += FullImagePath(imgDir, imgSrc);
    result += "');\"><img src=\"";
    result += ThumbImagePath(imgDir,imgSrc);
    result += "\" /></a><br />";
    return result;
}
//-------------------------------
//set gallery main image
function ShowImage(imgSrc) {
	imgObj = document.getElementById("product_image");
    if(imgObj){imgObj.src = imgSrc;}
}
//-------------------------------

