ns = (document.layers)? true:false
ie = (document.all)? true:false

function Button( aCaption ) {
  R = "<INPUT CLASS=sButton TYPE=submit VALUE='"+aCaption+"'>&nbsp";
  document.write( R );
}

function EditBox( aName, aDefault, aSize, aMaxLength, Ex ) {
  ML = (aMaxLength != null) ? aMaxLength : aSize;
  SI = (ns)?(aSize*20/40):aSize;
  R = "<INPUT CLASS='sEdit' NAME='"+aName+"' SIZE='"+SI+"' VALUE='"+aDefault+"' MAXLENGTH='"+ML+"' "+Ex+">";
  document.write( R );
}

function EditBoxErr( aName, aDefault, aSize, aMaxLength, Ex ) {
  ML = (aMaxLength != null) ? aMaxLength : aSize;
  SI = (ns)?(aSize*20/40):aSize;
  R = "<INPUT CLASS='sEditErr' NAME='"+aName+"' SIZE='"+SI+"' VALUE='"+aDefault+"' MAXLENGTH='"+ML+"' "+Ex+">";
  document.write( R );
}

function EditBox2( aName, aDefault, aSize, aMaxLength, Ex ) {
  ML = (aMaxLength != null) ? aMaxLength : aSize;
  SI = (ns)?(aSize*20/40):aSize;
  R = "<INPUT CLASS='sEdit2' NAME='"+aName+"' SIZE='"+SI+"' VALUE='"+aDefault+"' MAXLENGTH='"+ML+"' "+Ex+">";
  document.write( R );
}

// zakończ tę funkcję   </TEXTAREEA>
function MemoBox( aName, aRows, aCols, Ex ) {
  if (ns) R = "<DIV CLASS='sEdit'>"; else R = "";
  SI = (ns)?(aCols*13/20):aCols;
  R = "<TEXTAREA CLASS='sEdit' NAME='"+aName+"' ROWS='"+aRows+"' COLS='"+SI+"' "+Ex+">";
  document.write( R );
}

function MemoBox2( aName, aRows, aCols, Ex ) {
  if (ns) R = "<DIV CLASS='sEdit2'>"; else R = "";
  SI = (ns)?(aCols*13/20):aCols;
  R = "<TEXTAREA CLASS='sEdit2' NAME='"+aName+"' ROWS='"+aRows+"' COLS='"+SI+"' "+Ex+">";
  document.write( R );
}

function ListBox( aName, aItems, aDefault, aSize, aEx, aHTML ) {
  if (aDefault==null) aDefault = "''";
  if (ns) R = "<DIV CLASS='sEdit'>"; else R = "";
  R = R + "<SELECT CLASS='sEdit' NAME='"+aName+"' SIZE='"+aSize+"' "+aEx+">";
  for(i=0; i<aItems.size; i++) {
    S3 = (aItems[i].value==aDefault)? " SELECTED>" : ">";
    R = R + "<OPTION VALUE='"+aItems[i].value+"'"+S3+aItems[i].text;
  }
  R = R + "</SELECT>";
  if (aHTML != null ) R = R + aHTML;
  if (ns) R = R + "</DIV>";
  document.write( R );
}

function ListBox2( aName, aItems, aDefault, aSize, aEx, aHTML ) {
  if (aDefault==null) aDefault = "''";
  if (ns) R = "<DIV CLASS='sEdit2'>"; else R = "";
  R = R + "<SELECT CLASS='sEdit2' NAME='"+aName+"' SIZE='"+aSize+"' "+aEx+">";
  for(i=0; i<aItems.size; i++) {
    S3 = (aItems[i].value==aDefault)? " SELECTED>" : ">";
    R = R + "<OPTION VALUE='"+aItems[i].value+"'"+S3+aItems[i].text;
  }
  R = R + "</SELECT>";
  if (aHTML != null ) R = R + aHTML;
  if (ns) R = R + "</DIV>";
  document.write( R );
}

function ComboBox( aName, aItems, aDefault, aEx, aHTML ) {
  ListBox( aName, aItems, aDefault, 0, aEx, aHTML );
}

function ComboBox2( aName, aItems, aDefault, aEx, aHTML ) {
  ListBox2( aName, aItems, aDefault, 0, aEx, aHTML );
}

function CheckBox( aCaption, aName, aValue, aChecked ) {
  R = "<INPUT TYPE=CHECKBOX NAME="+aName+" VALUE="+aValue+((aChecked==aValue) ? " CHECKED>" : ">")+aCaption;
  document.write( R );
}

function TabPage( aName, aItems, aDefault, aImgPath, aOnClick ) {
  if (aDefault==null) aDefault = -1;
  R = "<table border='0' cellpadding='0' cellspacing='0' align='right'><tr>"
  for(i=0; i<aItems.size; i++) {
    if (i != aDefault) {
      R += "<td onclick='"+aOnClick+"("+i+")'><img src='"+aImgPath+"tab"+((i==0)?"0":"1")+"_off.gif'></td>"
         + "<td onclick='"+aOnClick+"("+i+")' background='"+aImgPath+"tab2_off.gif'><a class='fon3' style='color: black' href='#' onclick='"+aOnClick+"("+i+"); return false;'>"+aItems[i].text+"</a></td>"
         + "<td onclick='"+aOnClick+"("+i+")'><img src='"+aImgPath+"tab3_off.gif'></td>";
	} else {
      R += "<td><img src='"+aImgPath+"tab"+((i==0)?"0":"1")+"_on.gif'></td>"
         + "<td background='"+aImgPath+"tab2_on.gif'><font class='fon3'><b>"+aItems[i].text+"</b></font></td>"
         + "<td><img src='"+aImgPath+"tab3_on.gif'></td>";
	}
  }
  R += "</tr></table>";
  document.write( R );
}

function ButtonID( aCaption, aName ) {
  document.write("<DIV ID=div"+aName+">");
  Button( aCaption );
  document.write("</DIV>");
}

function EditBoxID( aCaption, aName, aDefault, aSize, aMaxLength, aEx ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel2>"+aCaption+"<DIV>");
  EditBox( aName, aDefault, aSize, aMaxLength, aEx );
  document.write("</DIV></DIV>");
}

function EditBoxErrID( aCaption, aName, aDefault, aSize, aMaxLength, aEx ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabelErr2 >"+aCaption+"<DIV>");
  EditBoxErr( aName, aDefault, aSize, aMaxLength, aEx );
  document.write("</DIV></DIV>");
}

function EditBox2ID( aCaption, aName, aDefault, aSize, aMaxLength, aEx ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel2>"+aCaption+"<DIV>");
  EditBox2( aName, aDefault, aSize, aMaxLength, aEx );
  document.write("</DIV></DIV>");
}

// zakończ tę funkcję   </TEXTAREEA></DIV></DIV>
function MemoBoxID( aCaption, aName, aRows, aCols, Ex ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel2>"+aCaption+"<DIV>");
  MemoBox( aName, aRows, aCols, Ex );
}

function MemoBox2ID( aCaption, aName, aRows, aCols, Ex ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel2>"+aCaption+"<DIV>");
  MemoBox2( aName, aRows, aCols, Ex );
}

function ListBoxID( aCaption, aName, aItems, aDefault, aSize, aEx, aHTML ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel2>"+aCaption+"<DIV>");
  ListBox( aName, aItems, aDefault, aSize, aEx, aHTML );
  document.write("</DIV></DIV>");
}

function ListBox2ID( aCaption, aName, aItems, aDefault, aSize, aEx, aHTML ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel2>"+aCaption+"<DIV>");
  ListBox( aName, aItems, aDefault, aSize, aEx, aHTML );
  document.write("</DIV></DIV>");
}

function ComboBoxID( aCaption, aName, aItems, aDefault, aEx, aPic, aHTML ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel2>"+aCaption+"<DIV>");
  ComboBox( aName, aItems, aDefault, aEx, aHTML );
  if (aPic != null)
     document.write("&nbsp;<IMG NAME='img"+aName+"' SRC='"+aPic+"' HEIGHT=17 WIDTH=17 BORDER=0>");
  document.write("</DIV></DIV>");
}

function ComboBox2ID( aCaption, aName, aItems, aDefault, aEx, aPic, aHTML ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel2>"+aCaption+"<DIV>");
  ComboBox2( aName, aItems, aDefault, aEx, aHTML );
  if (aPic != null)
     document.write("&nbsp;<IMG NAME='img"+aName+"' SRC='"+aPic+"' HEIGHT=17 WIDTH=17 BORDER=0>");
  document.write("</DIV></DIV>");
}

function CheckBoxID( aCaption, aName, aValue, aChecked  ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabelBig>");
  CheckBox( aCaption, aName, aValue, aChecked  );
  document.write("</DIV>");
}

function CheckBox2ID( aCaption, aName, aValue, aChecked  ) {
  document.write("<DIV ID=div"+aName+" CLASS=sLabel>");
  CheckBox( aCaption, aName, aValue, aChecked  );
  document.write("</DIV>");
}
