function classPG_GFX()
{
	this.sGfxPath = 'gfx/';
	this.sGfxSubPathImages = 'img/';
	// this.sGfxSubPathSecurityCode = 'securitycode/';
	
	this.destroy = function()
	{
		// set all properties to null...
		this.sGfxPath = null;
		this.sGfxSubPathImages = null;

		// cleanup all properties...
		delete this.sGfxPath;
		delete this.sGfxSubPathImages;

		// cleanup all methods...
		delete this.setGfxPath;
		delete this.getGfxPath;
		delete this.setElementOpacity;
		delete this.rgbToHex;
		delete this.toHex;
		delete this.hexToRed;
		delete this.hexToGreen;
		delete this.hexToBlue;
		delete this.cutHex;
		delete this.img2;
		delete this.image2;
		delete this.loadImage2;
		delete this.img;
		delete this.image;
		delete this.loadImage;
		delete this.destroy;
	}

	this.setGfxPath = function(_sPath) {this.sGfxPath = _sPath;}
	this.getGfxPath = function() {return this.sGfxPath;}
	this.setGfxSubPathImages = function(_sPath) {this.sGfxSubPathImages = _sPath;}
	this.getGfxSubPathImages = function() {return this.sGfxSubPathImages;}

	this.setElementOpacity = function(_oElement, _iOpacityPercent)
	{
		if (_oElement)
		{
			if (typeof(_oElement.style.opacity) != 'undefined') {_oElement.style.opacity = _iOpacityPercent/100;}
			else if (typeof(_oElement.style.MozOpacity) != 'undefined') {_oElement.style.MozOpacity = _iOpacityPercent/100;}
			else if (typeof(_oElement.style.filter) != 'undefined') {_oElement.style.filter = "Alpha(opacity=" + _iOpacityPercent + ")";}
			else if (typeof(_oElement.style.msFilter) != 'undefined') {_oElement.style.msFilter = 'progid:DXImageTransform.Microsoft.Alpha(Opacity='+_iOpacityPercent+')';}
		}
	}
	
	this.getElementOpacity = function(_oElement)
	{
		if (_oElement)
		{
			if (typeof(_oElement.style.opacity) != 'undefined') {return parseFloat(_oElement.style.opacity)*100;}
			else if (typeof(_oElement.style.MozOpacity) != 'undefined') {return parseFloat(_oElement.style.MozOpacity)*100;}
			else if (typeof(_oElement.filters) != 'undefined')
			{
				if (typeof(_oElement.filters.alpha) != 'undefined')
				{
					if (typeof(_oElement.filters.alpha.opacity) != 'undefined')
					{
						return parseInt(_oElement.filters.alpha.opacity);
					}
				}
				else if (typeof(_oElement.filters['DXImageTransform.Microsoft.Alpha']) != 'undefined')
				{
					if (typeof(_oElement.filters['DXImageTransform.Microsoft.Alpha'].opacity) != 'undefined')
					{
						return _oElement.filters['DXImageTransform.Microsoft.Alpha'].opacity;
					}
				}
			}
		}
		return 0;
	}

	this.rgbToHex = function(_iRed, _iGreen, _iBlue)
	{
		return this.toHex(_iRed) + this.toHex(_iGreen) + this.toHex(_iBlue);
	}

	this.toHex = function(_iNumber)
	{
		if (_iNumber == null) {return "00";}
		_iNumber = parseInt(_iNumber);
		if ((_iNumber == 0) || (isNaN(_iNumber))) {return "00";}
		_iNumber = Math.max(0, _iNumber);
		_iNumber = Math.min(_iNumber, 255);
		_iNumber = Math.round(_iNumber);
		return "0123456789ABCDEF".charAt((_iNumber-_iNumber%16)/16) + "0123456789ABCDEF".charAt(_iNumber%16);
	}

	this.hexToRed = function(_sHexColor)
	{
		return parseInt((cutHex(_sHexColor)).substring(0,2),16);
	}

	this.hexToGreen = function(_sHexColor)
	{
		return parseInt((cutHex(_sHexColor)).substring(2,4),16);
	}

	this.hexToBlue = function(_sHexColor)
	{
		return parseInt((cutHex(_sHexColor)).substring(4,6),16);
	}

	this.cutHex = function(_sHexColor)
	{
		return (_sHexColor.charAt(0) == "#") ? _sHexColor.substring(1,7):_sHexColor;
	}
	
	this.img2 = function(_sImagePath, _xSizeX, _xSizeY, _sTitle, _sAddTag, _sAddStyle, _sClass)
	{
		return this.loadImage2(_sImagePath, _xSizeX, _xSizeY, _sTitle, _sAddTag, _sAddStyle, _sClass);
	}
	this.image2 = function(_sImagePath, _xSizeX, _xSizeY, _sTitle, _sAddTag, _sAddStyle, _sClass)
	{
		return this.loadImage2(_sImagePath, _xSizeX, _xSizeY, _sTitle, _sAddTag, _sAddStyle, _sClass);
	}
	this.loadImage2 = function(_sImagePath, _xSizeX, _xSizeY, _sTitle, _sAddTag, _sAddStyle, _sClass)
	{
		var _sReturn = '';

		/*
		if ($_xSizeX == '')
		{
			$_iSizeY = str_replace("px", "", $_xSizeY);
			if ((strpos($_iSizeY, "%") === false) && ($_iSizeY != '')) {$_sSizeX = round($_aiSize[0]/$_aiSize[1]*(int)$_iSizeY, 0).'px';}
			else {$_xSizeX = $_aiSize[0];}
		}
		if ($_xSizeY == '')
		{
			$_iSizeX = str_replace("px", "", $_xSizeX);
			if ((strpos($_iSizeX, "%") === false) && ($_iSizeX != '')) {$_sSizeY = round($_aiSize[1]/$_aiSize[0]*(int)$_iSizeX, 0).'px';}
			else {$_xSizeY = $_aiSize[1];}
		}
		*/
	
		// if ((strpos(_xSizeX, 'px') == false) && (strpos(_xSizeX, '%') == false)) {_xSizeX += 'px';}
		// if ((strpos(_xSizeY, 'px') == false) && (strpos(_xSizeY, '%') == false)) {_xSizeY += 'px';}
		
		if (((_sClass == '') || (_sClass == null)) && ((_sAddStyle == '') || (_sAddStyle == null))) {_sAddStyle = 'border-width:0px; ';}
		// if (($_asPathInfo['extension'] == 'png') && // TODO
		if ((oPGBrowser.getBrowserName() == PG_BROWSER_INTERNET_EXPLORER)
		&& (Math.floor(oPGBrowser.getBrowserVersion()) < 7))
		{
			$_sReturn += '<div style="';
			$_sReturn += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+this.sGfxPath+this.sGfxSubPathImages+_sImagePath+'\', sizingMethod=\'image\'); ';
			$_sReturn += 'width:'+_xSizeX+'; height:'+_xSizeY+'; '+_sAddStyle+'" ';
			if ((_sClass != '') && (_sClass != null)) {_sReturn += 'class="'+_sClass+'" ';}
			if ((_sAddTag != '') && (_sAddTag != null)) {_sReturn += _sAddTag+' ';}
			if ((_sTitle != '') && (_sTitle != null)) {_sReturn += 'title="'+_sTitle+'" ';}
			_sReturn += 'unselectable="on"></div>';
		}
		else
		{
			_sReturn += '<img src="'+this.sGfxPath+this.sGfxSubPathImages+_sImagePath+'" style="width:'+_xSizeX+'; height:'+_xSizeY+'; '+_sAddStyle+'" ';
			if ((_sClass != '') && (_sClass != null)) {_sReturn += 'class="'+_sClass+'" ';}
			if ((_sAddTag != '') && (_sAddTag != null)) {_sReturn += _sAddTag+' ';}
			if ((_sTitle != '') && (_sTitle != null)) {_sReturn += 'title="'+_sTitle+'" alt="'+_sTitle+'" ';}
			_sReturn += 'unselectable="on" />';
		}
		return _sReturn;
	}
	
	this.img = function(_sImagePath) {return this.loadImage(_sImagePath);}
	this.image = function(_sImagePath) {return this.loadImage(_sImagePath);}
	this.loadImage = function(_sImagePath) {return this.loadImage2(_sImagePath, null, null, null, null, null, null);}
}

var oPGGFX = new classPG_GFX();

