function openTarget (page)
{
    var sizedwindow2 = window.open (page, '_blanc');
    if (sizedwindow2.opener == null)
    {
        sizedwindow2.opener = self;
    }
    sizedwindow2.focus ();

}

var BnAColors = new Array(
 "#000000", "#ffffff", "#eb7c13", "#e8e8e8", "#80ff80", "#00ff80", "#80ffff",
 "#0080ff", "#ff80c0", "#ff80ff", "#ff0000", "#ffff00",
 "#80ff00", "#00ff40", "#00ffff", "#0080c0", "#8080c0",
 "#ff00ff", "#804040", "#ff8040", "#00ff00", "#008080",
 "#004080", "#8080ff", "#800040", "#ff0080", "#800000",
 "#ff8000", "#008000", "#008040", "#0000ff", "#0000a0",
 "#800080", "#8000ff", "#400000", "#804000", "#004000",
 "#004040", "#000080", "#000040", "#400040", "#400080",
 "#808000", "#808040", "#808080", "#408080", "#c0c0c0", "#404040"
);

var BnAWerte = new Array ("px","pt","pc","in","mm","ex","em","cm","%" );
var BnASizes = new Array ("0", "20", "40", "60", "80", "100" );
var BnASmall = new Array ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" );
var BnALeer = new Array ();
var BnABorderStyle = new Array ("none","hidden","dotted","dashed",
    "solid","double","groove","ridge","inset","outset");

var BnAnm = new Array(
new Array ("background-color","background-image","background-position","background-repeat",
	"border-color","border-style","border-width",
	"border-top-color","border-top-style","border-top-width",
	"border-left-color","border-left-style","border-left-width",
	"border-right-color","border-right-style","border-right-width",
	"border-bottom-color","border-bottom-style","border-bottom-width",
    "clear","color",
	"float","font-family","font-size","font-style","font-weight",
	"height","left",
	"margin","margin-top","margin-left","margin-right","margin-bottom",
	"overflow","position",
	"padding","padding-top","padding-left","padding-right","padding-bottom",
	"right","top",
	"text-align","text-decoration","vertical-align","width","z-index")
);

var BnAmulti = new Array(0,0,0,0,
	0,0,0,
	0,0,0,
	0,0,0,
	0,0,0,
	0,0,0,
	0,0,
	0,3,0,0,0,
	0,0,
	0,0,0,0,0,
	0,0,
	0,0,0,0,0,
	0,0,
	0,3,0,0,0);


var BnAel = new Array(
	BnAColors,new Array ("url()"),new Array ("left", "right", "top", "bottom","center"),new Array ("repeat", "repeat-x", "repeat-y", "no-repeat" ),
	BnAColors,BnABorderStyle,BnASmall,
	BnAColors,BnABorderStyle,BnASmall,
	BnAColors,BnABorderStyle,BnASmall,
	BnAColors,BnABorderStyle,BnASmall,
	BnAColors,BnABorderStyle,BnASmall,
	new Array ("left", "right", "both" ),BnAColors,
	new Array ("left", "right", "none" ),
	new Array ("Arial", "Helvetica", "sans-serif", "serif", "cursive", "fantasy", "monospace"),
	new Array ("8", "9", "10", "11", "12", "14", "16"),
	new Array ("italic", "oblique", "normal" ),
	new Array ("bold", "bolder", "lighter", "normal"),
	BnASizes,BnASmall,
	BnASmall,BnASmall,BnASmall,BnASmall,BnASmall,
	new Array ("auto", "hidden", "scroll", "visible"),new Array ("absolute", "relative", "static", "fixed"),
	BnASmall,BnASmall,BnASmall,BnASmall,BnASmall,
	BnASmall,BnASmall,
	new Array ("left", "right","center", "justify"),new Array ( "underlined","overline","line-through","blink","none"), new Array("top","middle","bottom"),BnASizes, BnASmall
);

var BnAext = new Array(
	BnALeer, BnALeer, BnALeer, BnALeer,
	BnALeer, BnALeer,BnAWerte,
	BnALeer, BnALeer,BnAWerte,
	BnALeer, BnALeer,BnAWerte,
	BnALeer, BnALeer,BnAWerte,
	BnALeer, BnALeer,BnAWerte,
	BnALeer, BnALeer,
	BnALeer, BnALeer, BnAWerte, BnALeer,  BnALeer,
	BnAWerte,BnAWerte,
	BnAWerte,BnAWerte,BnAWerte,BnAWerte,BnAWerte,
	BnALeer,BnALeer,
	BnAWerte,BnAWerte,BnAWerte,BnAWerte,BnAWerte,
	BnAWerte,BnAWerte,
	BnALeer, BnALeer, BnALeer, BnAWerte, BnALeer
);


var BnAposel = 0;
var BnAposex = 0;
var BnA_IE = 0;
var BnAhas_init = 0;
var BnAhas_trd = false;
var BnAColorstr = null;
var BnAColorTab = null;

function BnAfillit(name, cnt)
{
	  var pos = 0;
	  var npos = null;
	  if ( BnA_IE == 1 )
	     npos = BnAnm[cnt].length;

	  for ( ; pos < BnAnm[cnt].length; ++pos) {
	     var Eintrag = document.createElement("option");
	     Eintrag.text = BnAnm[cnt][pos];
         Eintrag.value = Eintrag.text;
	     document.getElementsByName(name)[0].add(Eintrag,npos);
	  } 

	  BnAfillsecond( "elcss", cnt );
	  BnAfillthird( "excss", cnt );
}


function BnAfillsecond(name, cnt)
{
	  var element = document.getElementsByName(name)[0];
	  var npos = null;
	  if ( BnA_IE == 1 )
	     npos = BnAel[cnt].length;

	  if ( BnAel[cnt] == BnAColors )
	  {
          BnAshowcolor2( 1 );
	  }
      else
      {
          BnAshowcolor2( null );
      }

	  if ( BnAmulti[cnt] > 0 )
	  {
	     element.multiple = 1;
	     element.size = BnAmulti[cnt];
	  }
	  else 
	  {
	     element.multiple = 0;
	     element.size = 1;
	  }

	  for ( ; BnAposel < BnAel[cnt].length; ++BnAposel) {
	     var Eintrag = document.createElement("option");
	     Eintrag.text = BnAel[cnt][BnAposel];
         Eintrag.value = Eintrag.text;
	     if ( BnAposel == 0 )
	        Eintrag.selected = 1;
	     element.add(Eintrag,npos);
	  } 
}

function BnAfillthird(name, cnt)
{
   if ( BnAext[cnt].length > 0 )
   {  
	  var objekt = null;
	  if ( BnAhas_trd == false )
	  {
	      objekt = document.getElementById("trd");
	      var nel = document.createElement("select");
          nel.name = "excss";
          nel.id = "csstrd";
	      objekt.appendChild(nel);

	      if ( BnA_IE == 1 )
	      {
	         objekt.lastChild.name = "excss";
	         objekt.lastChild.id = "csstrd";
          }

	      objekt = document.getElementById("csstrd");
	      BnAhas_trd = true;
	  }
      else
	  {
	      objekt = document.getElementById("csstrd");
	  }

	  var npos = null;
	  if ( BnA_IE == 1 )
	     npos = BnAext[cnt].length;

	  
	  for ( ; BnAposex < BnAext[cnt].length; ++BnAposex) {
	     var Eintrag = document.createElement("option");
	     Eintrag.text = BnAext[cnt][BnAposex];
         Eintrag.value = Eintrag.text;
	     objekt.add(Eintrag,npos);
	  } 
  }
}


function BnAswapit( name1, name2, name3 )
{
	  delsec( name2 );
	  delthird();
	  var cnt = document.getElementsByName(name1)[0].selectedIndex;
	  BnAfillsecond(name2, cnt);
	  BnAfillthird(name3, cnt);
	  
}

function delsec( name )
{
	  var cnt = document.getElementsByName(name)[0].size;
	  for ( ; BnAposel != 0; --BnAposel) {
	    document.getElementsByName(name)[0].remove(BnAposel);
	  }	  
	  document.getElementsByName(name)[0].remove(BnAposel);
}

function delthird()
{
	  var objekt = document.getElementById("trd");
	  if ( objekt.hasChildNodes() )
	  {
	     while( objekt.hasChildNodes() )
	     {
             objekt.removeChild(objekt.firstChild);
	     }
	     BnAhas_trd = false;
         BnAposex = 0;
	  }
/*
	     var cnt = document.getElementsByName(name)[0].size;
	  for ( ; BnAposex != 0; --BnAposex) {
	    document.getElementsByName(name)[0].remove(BnAposex);
	  }	  
	  document.getElementsByName(name)[0].remove(BnAposex);
*/
}


function BnAprint( name1, name2, name3 )
{
	  var element = document.getElementsByName(name2)[0];
	  var key = document.getElementsByName(name1)[0].value;
	  var ex = "";
	  if ( document.getElementById("trd").hasChildNodes() ) 
	     ex = document.getElementById("trd").lastChild.value;
	  var val;
	  if ( element.type == "select-multiple" )
	  {
	      var option = element.options;
	      var a = 0;
	      /*var ii = 0;*/
	      for (var ii = 0; ii < BnAposel; ii++)
	      {
	         if ( element.options[ii].selected )
	         /*if ( 1 )*/
	         {
	             if ( a == 1 )
	             {
	                 val += ", " + option[ii].value + ex; 
	             }
                 else
	             {
	                 val = option[ii].value + ex;
	                 a = 1;
	             }
	         }
	      }

	      if ( a == 1 )
	      {
	          val += ";\n";
	      }
	      document.getElementById("tarea").value += "  " + key + ": " + val;
	  }
	  else
	  {
	      val = element.value;
	      document.getElementById("tarea").value += "  " + key + ": " + val + ex +";\n";
	  }
}


function BnAload()
{
	BnAinit('nmcss', 'elcss','excss', 0);
}


function BnAinit( name1, name2, name3, cnt )
{
	  if ( BnAhas_init != 0 )
	     return;

	  if (navigator.appName == "Microsoft Internet Explorer")
	      BnA_IE = 1;

	  BnAhas_init = 1;

  try 
  {		
	if ( name1 )
	{
		document.getElementsByName(name1)[0].remove(0);
	}
	if ( name2 )
	{
		document.getElementsByName(name2)[0].remove(0);
	}
	delthird();
	BnAfillit('nmcss', 0);
  }
  catch ( e )
  {
  }
}


function BnAshowcolor2( ctl )
{
	  var objekt = document.getElementById("cancolor");
	  if ( ctl )
	  {
	     if ( BnAColorTab )
         {
             objekt.appendChild( BnAColorTab );
             return;
         }

	     var cnt = 0;
	     var txt = null;
	     var nel = document.createElement("TABLE");
		 nel.id = "colortb";

	     objekt.appendChild(nel);
	     var tabelle = objekt.lastChild;
         var divtp = document.createElement("div");
	     txt = document.createTextNode(".");
         divtp.appendChild(txt);
	     if ( BnA_IE )
	     {
	        divtp.style.width = "20px";
	        divtp.style.height = "10px";
	        tabelle.style.cursor = "pointer";
	        tabelle.width  = "100%";
	        tabelle.border = "0";
	        tabelle.cellpadding = "0";
	        tabelle.style.fontSize = "8px";
	     }
         else
	     {
	        divtp.setAttribute( "style",  "width:15px; height:15px;");
	        tabelle.setAttribute( "cellpadding", "0");
	        tabelle.setAttribute( "border", "0");
	        tabelle.setAttribute( "width",  "100%");
	        tabelle.setAttribute( "style",  "font-size: 8px; cursor:pointer;");
	     }

	     nel = document.createElement("TBODY");
	     tabelle.appendChild(nel);
	     var tbody = objekt.lastChild;

	     var row = null;
	     for( var i=0; i<BnAColors.length; i++ )
	     {
	        cnt++;
            if ( cnt == 1 )
	        {
	             if ( BnA_IE )
	             {
	                     nel = document.createElement("TBODY");
	                     tabelle.appendChild(nel);
	                     tbody = tabelle.lastChild;
	             }
	             nel = document.createElement("TR");
	             tbody.appendChild(nel);
	             row = tbody.lastChild;
	        }
	     
	        nel = document.createElement("TD");
	        if ( BnA_IE )
	        {
	           nel.style.color = BnAColors[i];
	           nel.style.backgroundColor = BnAColors[i];
	        }
            else
	        {
	           nel.setAttribute( "style",  "color:"+BnAColors[i]+";background-color:"
                   +BnAColors[i]+";");
	        }
	        nel.id = i;
	        nel.name = BnAColors[i];
	        nel.onclick = function (){ debug( this );};
	        
            row.appendChild(nel);

	        txt = document.createTextNode(".");
	        row.lastChild.appendChild( divtp.cloneNode(true));

            if ( cnt == 6 )
	        {
	            cnt = 0;
	        }
         }
         BnAColorTab = objekt.lastChild;
	  }
      else 
	  {
	      if ( objekt.hasChildNodes() )
          {
	          objekt.removeChild(objekt.firstChild);
          }
	  }
}


function css_clear()
{
	document.getElementById("tarea").value='';
}

function debug( obj )
{
	document.getElementsByName("elcss")[0].options[obj.id].selected = 1;
}

if (window.addEventListener)
	window.addEventListener("load", BnAload, false);
else if (window.attachEvent)
	window.attachEvent("onload", BnAload);

