// JavaScript Document
function prodImg () {
	
	var _largeImgBox;	// Objekt: <div>-Container fuer Grossansicht
	var _imgBigBoxVis;	// Sichtbarkeit des Grafik-Containers
	var _largeImg;		// Objekt: <img> fuer die Grossansicht
	var _prodImg;		// Objekt: Standardansicht
	var _prodHeadline;	// Objekt: <h3> Titel der Produktansicht
	var _imgBigSrc;
	var _imgBigWidth;
	var _imgBigHeight;
	var _imgTitle;
	var _imgHead;		// Headline des Produktfotos (Name und Farbe)
	var _imgDesc;		// weitere Angaben: Farbe des Centers, Variantenbezeichnung
	
	
	// init
	this.__init = function (src, title, bSrc, bWidth, bHeight) 
	{
		_largeImgBox = document.getElementById("largeImgBox");
		_largeImg = document.getElementById("largeImg");
		this.setImgBigSrc(bSrc);
		this.setImgBigWidth(bWidth);
		this.setImgBigHeight(bHeight);
		this.setImgTitle(title);
		this.setProdImg();
		this.getImgBigBoxVis();
		this.setImgBigBoxVis("hide");
		this.writeImgBig();	// Grossansicht schreiben
	}
	
	
	// Setter
    this.setImgBigSrc = function (val) 
    {
        // Plausibilitätsprüfung
        _imgBigSrc = val;
        return _imgBigSrc;
    }
    this.setImgBigWidth = function (val) 
    {
        _imgBigWidth = val;
        return _imgBigWidth;
    }
    this.setImgBigHeight = function (val) 
    {
        _imgBigHeight = val;
        return _imgBigHeight;
    }
    this.setImgTitle = function (val) 
    {
        _imgTitle = val;
        return _imgTitle;
    }
    this.setImgHead = function (val) 
    {
        _imgHead = val;
        return _imgHead;
    }
    this.setImgDesc = function (val) 
    {
        _imgDesc = val;
        return _imgDesc;
    }
    this.setImgBigBoxVis = function (val) 
    {
        _imgBigBoxVis = val;	
		if(val == "hide") {
			_largeImgBox.style.display = "none";
		}
		if(val == "show") {
			_largeImgBox.style.display = "block";
		}
        return _imgTitle;
    }
    this.getImgHead = function () 
    {
        return _imgHead;
    }
    this.getImgDesc = function () 
    {
        return _imgDesc;
    }
    this.setProdImg = function()
	{
		_prodImg = document.getElementById("prodView");
		return _prodImg;
	}
    this.setNewProdImg = function(src)
	{
		_prodImg = src;
		return _prodImg;
	}
    
	
	// Getter
	this.getImgBigSrc = function ()
    {
        return _imgBigSrc;
    }
    this.getImgBigWidth = function () 
    {
       return _imgBigWidth;
    }
    this.getImgBigHeight = function () 
    {
        return _imgBigHeight;
    }
    this.getImgTitle = function () 
    {
        return _imgTitle;
    }
    this.getImgBigBoxVis = function () 
    {
		if(_largeImgBox.style.display == "none") {
			_imgBigBoxVis = "hide";
		}
		if(_largeImgBox.style.display == "block") {
			_imgBigBoxVis = "show";
		}
        return _imgBigBoxVis;
    }
	
	
	// Funktionen
	this.showLargeView = function ()
	{
		this.setImgBigBoxVis("show");
		return false;
	}
	this.hideLargeView = function ()
	{
		this.setImgBigBoxVis("hide");
		return false;
	}
	this.switchProdView = function (src, title, bSrc, bWidth, bHeight, head, desc)
	{
		// Grossansicht setzen
		_imgBigSrc = bSrc;
		_imgBigWidth = bWidth;
		_imgBigHeight = bHeight;
		_imgTitle = title;
		
		// fuer Produktansicht:
		_imgHead = head;	// Headline des Produktfotos
		_imgDesc = desc;
		
		// DOM fuer Produktansicht
		_prodImg.src = src;
		_prodImg.title = title;
		_prodImg.alt = title;
		// Titel aendern
		document.getElementById("wheelPicTitle").innerHTML = head;
		document.getElementById("wheelPicDesc").innerHTML = desc;
		// Grossansicht aendern
		this.writeImgBig();
		return false;
	}
	this.writeImgBig = function ()
	{
		// DOM aendern
		_largeImg.src = _imgBigSrc;
		_largeImg.width = _imgBigWidth;
		_largeImg.height = _imgBigHeight;
		_largeImg.title = _imgTitle;
		_largeImg.alt = _imgTitle;
		document.getElementById("largeImg_title").innerHTML = _imgTitle;
	}
}