//-----------------------------------------------------------------------------------------------------------------------
//function Span(sName,sId,sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility,sMouseOver,sMouseOut,sClick,sOverflow)
function Span(sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility,sMouseOver,sMouseOut,sClick,sOverflow)
{
	this.Properties = new Properties_List();

	this.Properties["Width"]                  =sWidth;
	this.Properties["Height"]                 =sHeight;
	this.Properties["Z-Index"]                =sZIndex;
	this.Properties["Left"]                   =sLeft;
	this.Properties["Top"]                    =sTop;
	this.Properties["Background Color"]       =sBackgroundColor;	
	this.Properties["Visibility"]             =sVisibility;	
	this.Properties["Mouse Over"]             =sMouseOver;
	this.Properties["Mouse Out"]              =sMouseOut;
	this.Properties["Click"]                  =sClick;
	this.Properties["Overflow"]               =sOverflow;
	this.Properties["Last Name"]              =null;
	this.Properties["Last Id"]                =null;
	
	function reOpen_Tag (sName,sId)
	{
		this.Properties["Last Name"] = sName;
		this.Properties["Last Id"] = sId;		

		var spanstr = "<span ";

	    spanstr = spanstr + 'name="' + sName + '" ';		   
		spanstr = spanstr + 'id="' + sId + '" ';

		if(this.Properties["Mouse Over"] != null){spanstr = spanstr + 'onMouseOver="' + this.Properties["Mouse Over"] + '" ';}
		if(this.Properties["Mouse Out"] != null){spanstr = spanstr + 'onMouseOut="' + this.Properties["Mouse Out"] + '" ';}
		if(this.Properties["Click"] != null){spanstr = spanstr + 'onClick="' + this.Properties["Click"] + '" ';}

		spanstr = spanstr + 'style="position:absolute; ';
		if(this.Properties["Visibility"] != null){spanstr = spanstr + "visibility:" + this.Properties["Visibility"] + "; ";}
		if(this.Properties["Width"] != null){spanstr = spanstr + "width:" + this.Properties["Width"] + "px; ";}
		if(this.Properties["Height"] != null){spanstr = spanstr + "height:" + this.Properties["Height"] + "px; ";}
		if(this.Properties["Z-Index"] != null){spanstr = spanstr + "z-index:" + this.Properties["Z-Index"] + "; ";}
		if(this.Properties["Left"] != null){spanstr = spanstr + "left:" + this.Properties["Left"] + "px; ";}
		if(this.Properties["Top"] != null){spanstr = spanstr + "top:" + this.Properties["Top"] + "px; ";}
		
    		if(this.Properties["Background Color"] != null){spanstr = spanstr + "background-color:" + this.Properties["Background Color"] + "; ";}
	        if(this.Properties["Background Color"] != null){spanstr = spanstr + "layer-background-color:" + this.Properties["Background Color"] + "; ";}
		spanstr = spanstr +  "border: 1px none #000000 ";
		
		if(this.Properties["Overflow"] != null){spanstr = spanstr + "overflow:" + this.Properties["Overflow"] + ";";}
		spanstr = spanstr + '">';

		//alert(spanstr);

		//write span open tag
		document.write(spanstr);		
	}

	function reClose_Tag()
	{
		document.write("</span>");
	}
	
	this.Open_Tag   = reOpen_Tag;
	this.Close_Tag  = reClose_Tag;
}
//-----------------------------------------------------------------------------------------------------------------------


//-----------------------------------------------------------------------------------------------------------------------
function Properties_List(){this.Description= "Span properties list";}
//-----------------------------------------------------------------------------------------------------------------------





//-----------------------------------------------------------------------------------------------------------------------
//function Span(sName,sId,sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility,sOverflow)
function Layer(sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility,sMouseOver,sMouseOut)
{
	if(document.layers != null)
	{
	
		this.Properties = new Layer_Properties_List();
	
		this.Properties["Width"]                  =sWidth;
		this.Properties["Height"]                 =sHeight;
		this.Properties["Z-Index"]                =sZIndex;
		this.Properties["Left"]                   =sLeft;
		this.Properties["Top"]                    =sTop;
		this.Properties["Background Color"]       =sBackgroundColor;	
		this.Properties["Visibility"]             =sVisibility;
		this.Properties["Mouse Over"]             =sMouseOver;
		this.Properties["Mouse Out"]              =sMouseOut;

		this.Properties["Last Name"]              =null;
		this.Properties["Last Id"]                =null;
			
		function reOpen_Tag (sName,sId)
		{
			this.Properties["Last Name"] = sName;
			this.Properties["Last Id"] = sId;		

			var layerstr = "<layer ";		
		        layerstr = layerstr + 'name="' + sName + '" ';		   
			layerstr = layerstr + 'id="' + sId + '" ';

			if(this.Properties["Mouse Over"] != null){layerstr = layerstr + 'onMouseOver="' + this.Properties["Mouse Over"] + '" ';}
			if(this.Properties["Mouse Out"] != null){layerstr = layerstr + 'onMouseOut="' + this.Properties["Mouse Out"] + '" ';}			

			if(this.Properties["Width"] != null){layerstr = layerstr + 'width="' + this.Properties["Width"] + '" ';}
			if(this.Properties["Height"] != null){layerstr = layerstr + 'height="' + this.Properties["Height"] + '" ';}
			if(this.Properties["Z-Index"] != null){layerstr = layerstr + 'z-index="' + this.Properties["Z-Index"] + '" ';}
			if(this.Properties["Left"] != null){layerstr = layerstr + 'left="' + this.Properties["Left"] + '" ';}
			if(this.Properties["Top"] != null){layerstr = layerstr + 'top="' + this.Properties["Top"] + '" ';} 	
			if(this.Properties["Background Color"] != null){layerstr = layerstr + 'bgcolor="' + this.Properties["Background Color"] + '" ';}        	
			if(this.Properties["Visibility"] != null){layerstr = layerstr + 'visibility="' + this.Properties["Visibility"] + '"';}
		
			layerstr = layerstr + ">";
	
			//write span open tag
			document.write(layerstr);		
		}		

	function reClose_Tag()
	{
		document.write("</layer>");
	}
	
	this.Open_Tag   = reOpen_Tag;
	this.Close_Tag  = reClose_Tag;
	
	}
}
//-----------------------------------------------------------------------------------------------------------------------


//-----------------------------------------------------------------------------------------------------------------------
function Layer_Properties_List(){this.Description= "Layers properties list";}
//-----------------------------------------------------------------------------------------------------------------------


browser = getBrowser();
version = browser[1];
browser = browser[0];


if(browser == "Netscape" && version == "5")
{
	browser = "Explorer";
}

//SPAN  : sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility,sOverflow
//LAYER : sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility

function Cross_Browser_Layer(sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility,sMouseOver,sMouseOut,sClick,sOverflow)
{
	if(browser=="Explorer")
	{
		//create a span
		var layer = new Span(sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility,sMouseOver,sMouseOut,sClick,sOverflow);
	}
	else
	{
		var layer = new Layer(sWidth,sHeight,sZIndex,sLeft,sTop,sBackgroundColor,sVisibility,sMouseOver,sMouseOut);
	}	

	this.Layer = layer;

	function reOpen_Tag(sName,sId)
	{
		layer.Open_Tag(sName,sId);
	}

	function reClose_Tag()
	{
		layer.Close_Tag();
	}
		
	this.Open_Tag = reOpen_Tag;
	this.Close_Tag = reClose_Tag;	
}