function ProductLineImages()
{
    var PhysicalWidth;    
    var Width;
    var MaxWidth=1000;    
    var CallingContext;
    this.LastCaptionID="";
    this.ProductLineID=0;
    this.Images= Array();    
    this.LargeImageUrl;

    this.AddImage = function(ID,ImageName,Caption)
    {        
        this.Images.push(new ProductImage(ID,ImageName,Caption));        
    }    
    
    this.SetContext = function(ProductLineID,Context)
    {
        this.ProductLineID=ProductLineID;
        CallingContext=Context;
    }
    //makes sure we do our measuring after load.    
    this.OnLoadHandler = function()
    {
        CallingContext.ComputeBoundaries();
    }
    
    this.ComputeBoundaries=function()
    {
        if($("ProductLineImageContainer") == null)
            return;
                
        var PhysicalWidth	= $("ProductLineImageContainer").offsetWidth;        
	    var menuwidth	= $("ProductLineImageBarContainer").offsetWidth;    
        var objzoom_slider = $('ThumbSlider');
        var objhandle      = $("ThumbHandle");
    }
        
    this.HideCaption=function()
    {
        $("CaptionHolder").style.display='none';
        $("CaptionEmpty").style.display='block';
    }
    
    this.ShowImage = function(ID)
    {
        var Image=this.FindImageById(ID);
        if(Image != null)
        {
            $("FormImage").src="/images/products/"+this.ProductLineID+"/200x150_"+Image.ImageName;
            $("MainImageAnchor").href="/images/products/"+this.ProductLineID+"/"+Image.ImageName;
            $("CaptionHolder").innerHTML=Image.Caption;
            $("CaptionHolder").style.display='block';
            $("CaptionEmpty").style.display='none';
        }            
    }
    
    this.FindCaptionById=function(ID)
    {
        var Object=this.FindImageById(ID);
        if(Object == null)
            return null;
        
        return Object.Caption;        
    }
    
    this.FindImageById=function(ID)
    {
        for(var c=0;c<this.Images.length;c++)
        {
            if(this.Images[c].ID ==ID)
                return this.Images[c];
        }
        return null;
    }
    
    function ProductImage(ID,ImageName,Caption)
    {
        this.ID         = ID;
        this.ImageName  = ImageName;
        this.Caption    = Caption;
    }    
}
