// CSS Function
// returns CSS syntax for generated layers

// Copyright (C) 1999 Dan Steinman
// Distributed under the terms of the GNU Library General Public License
// Available at http://www.dansteinman.com/dynduo/

function css(id,left,top,width,height,color,fam,size,vis,z,foco,other)
	{
	if (id=="START") return '<STYLE TYPE="text/css">\n'
	else if (id=="END") return '</STYLE>'
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px;' : '#'+id+' {position:relative;'

	if (arguments.length>=3 && top!=null)
		{
		str += ' top:'+top+'px;'
		if (id=='textgross') str += (document.layers)? ' top:'+top+'px;' : ' top:'+(top)+'px;'
		}

	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null)
		{
		str += ' height:'+height+'px;'
		if (arguments.length<12 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
		}
	if (arguments.length>=6 && color!=null) str += (document.layers)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=7 && fam!=null) str += ' font-family:'+fam+';'
	if (arguments.length>=8 && size!=null) str += (document.layers)? ' font-size:'+size+'px;' : ' font-size:'+(size)+'px;'
	if (arguments.length>=9 && vis!=null) str += ' text-align:'+vis+';'
	if (arguments.length>=10 && z!=null) str += ' vertical-align:'+z+';'
	if (arguments.length>=11 && foco!=null) str += ' color:'+foco+';'
	if (arguments.length==12 && other!=null) str += ' '+other
	str += '}\n'
	return str
	}

function writeCSS(str,showAlert)
	{
	str = css('START')+str+css('END')
	document.write(str)
	if (showAlert) alert(str)
	}

