/*
* JavaScript file 4 Lamar
*
* by Tunker >:)
*
* mail: rafal@linet.com.pl
*/

function sendMyForm()
{
  document.formSend.submit();
}

function changeVisibility()
{
  myObj = document.getElementById("subMenu");
  myVal = myObj.style.display;

  switch (myVal)
  {
      case "none":
           myObj.style.display="block";
           break;
      case "block":
           myObj.style.display="none";
           break;
  };
}

var myCounter = 0;

function addLine()
{
  var name1 = "name" + myCounter;
  var name2 = "brand" + myCounter;
  var name3 = "color" + myCounter;
  var name4 = "number" + myCounter;

  myObj = document.getElementById("myFormTable");
  //myObj = document.getElementById("aaa");

  var myTBody = document.createElement("tbody");
  var myTr = document.createElement("tr");
  var myTd1 = document.createElement("td");
      myTd1.setAttribute('class','td2');
  var myTd2 = document.createElement("td");
      myTd2.setAttribute('class','td2');
  var myTd3 = document.createElement("td");
      myTd3.setAttribute('class','td2');
  var myTd4 = document.createElement("td");
      myTd4.setAttribute('class','td2');

  var myInput1 = document.createElement("input");
      myInput1.setAttribute('class','td2');
      myInput1.setAttribute('type','text');
      myInput1.setAttribute('className','input2');
      myInput1.setAttribute('class','input2');
      myInput1.setAttribute('name',name1);

  var myInput2 = document.createElement("input");
      myInput2.setAttribute('class','td2');
      myInput2.setAttribute('type','text');
      myInput2.setAttribute('class','input2');
      myInput2.setAttribute('className','input2');
      myInput2.setAttribute('name',name2);

  var myInput3 = document.createElement("input");
      myInput3.setAttribute('class','td2');
      myInput3.setAttribute('type','text');
      myInput3.setAttribute('className','input2');
      myInput3.setAttribute('class','input2');
      myInput3.setAttribute('name',name3);

  var myInput4 = document.createElement("input");
      myInput4.setAttribute('class','td2');
      myInput4.setAttribute('type','text');
      myInput4.setAttribute('className','input2');
      myInput4.setAttribute('class','input2');
      myInput4.setAttribute('name',name4);

  myTd1.appendChild(myInput1);
  myTd2.appendChild(myInput2);
  myTd3.appendChild(myInput3);
  myTd4.appendChild(myInput4);

  myTr.appendChild(myTd1);
  myTr.appendChild(myTd2);
  myTr.appendChild(myTd3);
  myTr.appendChild(myTd4);

  myTBody.appendChild(myTr);
  myObj.appendChild(myTBody);

  myObj = document.getElementById("number");
  myObj.value=myCounter;

  myCounter ++;

}

function displayWindow(url, width, height) {
      var Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=1,menubar=no' );
}