function Asset_Panel(itemID, Gesamtbreite, Gesamthoehe)
{
	this.getElements = function(elementDesc)
	{
		return ($("#" + this.ID + " " + elementDesc));
	}

	this.getItemElement = function(index)
	{
		return($(this.Items[index]));
	}

	this.getAktivIndex = function()
	{
		return(this.getElements(".panel_Item_Container").data(this.CONST_AKTIVITEM));
	}

	this.setAktivIndex = function(index)
	{
		return (this.getElements(".panel_Item_Container").data(this.CONST_AKTIVITEM, index));
	}

	this.getItemPosition = function(index)
	{
		var aktivIndex = this.getAktivIndex();
		var halbeBreite = this.Einzelbreite / 2;
		var neuePosition = 0;
		if (aktivIndex > -1)
		{
			for (var aI = 0; aI < index; aI++)
			{
				if (aI < aktivIndex || aI > aktivIndex)
				{
					neuePosition += halbeBreite
				}
				else if (aI == aktivIndex)
				{
					neuePosition += this.Einzelbreite + this.Textbreite;
				}
			}
		}
		else
		{
			neuePosition = this.Einzelbreite * index;
		}
		return (neuePosition);
	}

	this.getImageMaskWidth = function(index)
	{
		var aktivIndex = this.getAktivIndex();
		if (aktivIndex != -1)
		{
			if (aktivIndex != index)
			{
				return (Math.round(this.Einzelbreite / 2));
			}
			else
			{
				return (this.Einzelbreite);
			}
		}
		else
		{
			return (this.Einzelbreite);
		}
	}

	this.getImageMaskImagesLeft = function(index)
	{
		var aktivIndex = this.getAktivIndex();
		if (aktivIndex != -1)
		{
			if (aktivIndex != index)
			{
				return (Math.round(-1 * (this.Einzelbreite / 4)));
			}
			else
			{
				return (0);
			}
		}
		else
		{
			return (0);
		}
	}
	
	this.getTextLeft = function(index)
	{
		var aktivIndex = this.getAktivIndex();
		if (aktivIndex != -1)
		{
			if (aktivIndex != index)
			{
				return (Math.round(this.Einzelbreite / 2));
			}
			else
			{
				return (this.Einzelbreite);
			}
		}
		else
		{
			return (this.Einzelbreite);
		}
	}

	this.setItemsToNewPosition = function(bAnimate, bVonLinksNachrechts)
	{
		if (bVonLinksNachrechts)
		{
			for (var aI = 0; aI < this.Items.length; aI++)
			{
				if (bAnimate)
				{
					this.getItemElement(aI).dequeue().animate({ "left": this.getItemPosition(aI) }, { duration: this.CONST_VerschiebenEffektDauer, easing: "easeInOutQuad", queue: false });
					this.getItemElement(aI).find(".panel_Image_Mask").dequeue().animate({ "width": this.getImageMaskWidth(aI) }, { duration: this.CONST_VerschiebenEffektDauer, easing: "easeInOutQuad", queue: false });
					this.getItemElement(aI).find(".panel_Image_Mask img").dequeue().animate({ "left": this.getImageMaskImagesLeft(aI) }, { duration: this.CONST_VerschiebenEffektDauer, easing: "easeInOutQuad", queue: false });
					var obj = this;
					this.getItemElement(aI).find(".panel_Text").dequeue().animate({ "left": this.getTextLeft(aI) }, { duration: this.CONST_VerschiebenEffektDauer, easing: "easeInOutQuad", queue: false, complete: function()
					{
						obj.setItemsTextToStartPosition();
					}
					});
				}
				else
				{
					this.getItemElement(aI).css({ "left": this.getItemPosition(aI) });
					this.getItemElement(aI).find(".panel_Image_Mask").css({ "width": this.getImageMaskWidth(aI) });
					this.getItemElement(aI).find(".panel_Image_Mask img").css({ "left": this.getImageMaskImagesLeft(aI) });
					this.getItemElement(aI).find(".panel_Text").css({ "left": this.getTextLeft(aI) });
					this.setItemsTextToStartPosition();
				}
			}
		}
		else
		{
			for (var aI = this.Items.length-1; aI >= 0; aI--)
			{
				if (bAnimate)
				{
					this.getItemElement(aI).dequeue().animate({ "left": this.getItemPosition(aI) }, { duration: this.CONST_VerschiebenEffektDauer, easing: "easeInOutQuad", queue: false });
					this.getItemElement(aI).find(".panel_Image_Mask").dequeue().animate({ "width": this.getImageMaskWidth(aI) }, { duration: this.CONST_VerschiebenEffektDauer, easing: "easeInOutQuad", queue: false });
					this.getItemElement(aI).find(".panel_Image_Mask img").dequeue().animate({ "left": this.getImageMaskImagesLeft(aI) }, { duration: this.CONST_VerschiebenEffektDauer, easing: "easeInOutQuad", queue: false });
					var obj = this;
					this.getItemElement(aI).find(".panel_Text").dequeue().animate({ "left": this.getTextLeft(aI) }, { duration: this.CONST_VerschiebenEffektDauer, easing: "easeInOutQuad", queue: false, complete: function()
					{
						obj.setItemsTextToStartPosition();
					}
					});
				}
				else
				{
					this.getItemElement(aI).css({ "left": this.getItemPosition(aI) });
					this.getItemElement(aI).find(".panel_Image_Mask").css({ "width": this.getImageMaskWidth(aI) });
					this.getItemElement(aI).find(".panel_Image_Mask img").css({ "left": this.getImageMaskImagesLeft(aI) });
					this.getItemElement(aI).find(".panel_Text").css({ "left": this.getTextLeft(aI) });
					this.setItemsTextToStartPosition();
				}
			}
		}
	}

	this.setItemsTextToStartPosition = function()
	{
		var aktivIndex = this.getAktivIndex();
		if (aktivIndex != -1)
		{
			for (var aI = 0; aI < this.Items.length; aI++)
			{
				if (aI != aktivIndex)
				{
					$(this.getElements(".panel_Text")[aI]).css({ "left": Math.round(this.Einzelbreite / 2) });
				}
				else
				{
					$(this.getElements(".panel_Text")[aI]).css({ "left": this.Einzelbreite });
				}
			}
		}
		else
		{
			this.getElements(".panel_Text").css({ "left": this.Einzelbreite });
		}
	}

	this.makeItemAktiv = function(index)
	{
		for (var aI = 0; aI < this.Items.length; aI++)
		{
			if (aI != index)
			{
				$(this.getElements(".panel_Image_Aktiv")[aI]).dequeue().animate({ "opacity": 0.0 }, { duration: this.CONST_FarbigWerdenEffektDauer, queue: false });
			}
		}
		var alterIndex = this.getAktivIndex();
		this.setAktivIndex(index);
		var vonLinksNachRechts = false;
		if (alterIndex != null && alterIndex != undefined && alterIndex > index)
		{
			vonLinksNachRechts = true;
		}
		this.setItemsToNewPosition(index != -1, vonLinksNachRechts);
	}

	this.init = function(Gesamtbreite, Gesamthoehe)
	{
		this.Gesamtbreite = Gesamtbreite;
		this.Hoehe = Gesamthoehe;
		this.Einzelbreite = Math.round(Gesamtbreite / this.Items.length);
		this.Textbreite = this.Gesamtbreite - (((this.Items.length - 1) * (this.Einzelbreite / 2)) + this.Einzelbreite);

		this.getElements(".panel_Item_Container").css({"height":this.Hoehe, "width":this.Gesamtbreite, "position":"relative", "overflow":"hidden"});
		this.getElements(".panel_Item").css({"height":this.Hoehe, "width":this.Einzelbreite, "position":"absolute"});
		this.getElements(".panel_Image_Mask").css({"height":this.Hoehe, "width":this.Einzelbreite, "position":"absolute", "overflow":"hidden"});
		this.getElements(".panel_Image_Aktiv").css({/*"height" : this.Hoehe, "width":this.Einzelbreite, */"position":"relative", "top" : (-1 * this.Hoehe), "opacity": 0.0});
		this.getElements(".panel_Image_Inaktiv").css({/*"height" : this.Hoehe, "width":this.Einzelbreite,*/ "position":"relative"});
		this.getElements(".panel_Text").css({"height":this.Hoehe, "width" : this.Textbreite, "position":"absolute", "display":"block"});
		
		this.getElements(".panel_Image_Aktiv").bind("mouseover", { obj: this }, function(e)
		{
			$(this).dequeue().animate({ "opacity": 1.0 }, { duration: e.data.obj.CONST_FarbigWerdenEffektDauer, queue: false });
		})
		.bind("mouseout", { obj: this }, function(e)
		{
			if ($(this).data(e.data.obj.CONST_ITEMINDEX) != e.data.obj.getAktivIndex())
			{
				$(this).dequeue().animate({ "opacity": 0.0 }, { duration: e.data.obj.CONST_FarbigWerdenEffektDauer, queue: false });
			}
		})
		.bind("click", { obj: this }, function(e)
		{
			e.data.obj.makeItemAktiv($(this).data(e.data.obj.CONST_ITEMINDEX));
		});
		
		var aktivImages = this.getElements(".panel_Image_Aktiv");
		for (var aI = 0; aI < aktivImages.length; aI++)
		{
			$(aktivImages[aI]).data(this.CONST_ITEMINDEX, aI);
		}
		
		this.setAktivIndex(-1);
		this.makeItemAktiv(-1);
	}
	
	this.ID = itemID;
	this.Items = this.getElements(".panel_Item");
	
	this.Gesamtbreite = 0;
	this.Einzelbreite = 0;
	this.Textbreite = 0;
	this.Hoehe = 0;
		
	this.CONST_ITEMINDEX = "itemindex";
	this.CONST_AKTIVITEM = "aktivitem";
	this.CONST_FarbigWerdenEffektDauer = 750;
	this.CONST_VerschiebenEffektDauer = 1500;
	
	this.init(Gesamtbreite, Gesamthoehe);
}