/**
* @author	André Dietisheim (dietisheim@sphere.ch)
* @version 1.0, 2005-05-11 (created on 2005-05-11)
* Copyright (c) 2001-2005 André Dietisheim
*/

function CompatibleStyle( iOffsetX, iOffsetY, iW, iH, fading, clickedStyle, mouseoutStyle, mouseoverStyle )
{
	this.iOffsetX = iOffsetX;
	this.iOffsetY = iOffsetY;
	this.iW = iW;
	this.iH = iH;
	this.fading = fading;
	this.clickedStyle = clickedStyle;
	this.mouseoutStyle = mouseoutStyle;
	this.mouseoverStyle = mouseoverStyle;	
}

CompatibleStyle.prototype.highlight = function( bHighlight, xlayer )
{
	var style = ( bHighlight )? this.mouseoverStyle : this.mouseoutStyle;
	xlayer.setBgColor( style[ 0 ] );	
	if ( !is.nn4up && !is.iemac5up )  // nn4 crashes, iemac stops rendering
		xlayer.setFgColor( style[ 1 ] );
}

CompatibleStyle.prototype.highlightClicked = function( bHighlight, xlayer )
{
	if ( bHighlight )
	{
		xlayer.setBgColor( this.clickedStyle[ 0 ] );
		xlayer.setFgColor( this.clickedStyle[ 1 ] );
	}
	else
	{
		this.highlight( false, xlayer );
	}
}

CompatibleStyle.prototype.getXlayer = function( iX, iY, iW, iH, iZindex, xparentLayer, events, sSpacerUrl, child, sText )
{
	var fading = this.fading;
	var bgcolor = this.mouseoutStyle[ 0 ];
	
	var bBold = this.mouseoutStyle[ 7 ];
	var sAlign = this.mouseoutStyle[ 2 ];
	var iTopTextBorder = this.mouseoutStyle[ 3 ];
	var iRightTextBorder = this.mouseoutStyle[ 4 ];
	var iBottomTextBorder = this.mouseoutStyle[ 5 ];
	var iLeftTextBorder = this.mouseoutStyle[ 6 ];
	var sFgcolor = this.mouseoutStyle[ 1 ];
	var sHref = ( is.nn4up )? "#" : null; // nn4 always need a href to process clicks
	var sFontface = this.mouseoutStyle[ 8 ];
	var iFontsize = this.mouseoutStyle[ 9 ];
	if ( this.mouseoutStyle[ 11 ] )
	{	// icon defined
		var sIcon = ( child || this.mouseoutStyle[ 10 ] )? this.mouseoutStyle[ 11 ] : sSpacerUrl;
		var iIconWidth = this.mouseoutStyle[ 12 ];
		var iIconHeight = this.mouseoutStyle[ 13 ];
		var iIconBorder = this.mouseoutStyle[ 14 ];
	}
	else
	{	// icon not defined
		var sIcon = null;
		var iIconWidth = 0;
		var iIconHeight = 0;
		var iIconBorder = 0;
	}
	 
	return new CompatibleXlayer( null, xparentLayer, "left", "top", iX, iY, iW, iH, 0, iW, iH, 0, iZindex, false, bgcolor, fading, events, null, sSpacerUrl, sText, bBold, sAlign, iTopTextBorder, iRightTextBorder, iBottomTextBorder, iLeftTextBorder, sFgcolor, sHref, sFontface, iFontsize, sIcon, iIconWidth, iIconHeight, iIconBorder );
}
