﻿// JScript File

var taskid = 2;
var taskcount = 0;
function AddPart()
{     
      if(taskid > 10)
      {
        alert("You can submit only 10 Parts at a time.");
        return;
      }
      if(taskcount-1 == 0)
      {
        alert("You have exceeded your Part Number Searches(RFQ's).");
        return;
      }
      var attr = "class";
      if(navigator.appName == "Microsoft Internet Explorer" && (navigator.appVersion.indexOf("MSIE 6.0;") >= 0 || navigator.appVersion.indexOf("MSIE 7.0;") >= 0))
      {
        attr = "className";
      }
	  var labeltag1 = document.createElement("label");
      labeltag1.setAttribute(attr, 'TextMainArial');
	  labeltag1.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Part Number:";

	  var texttag = document.createElement("input");
      texttag.setAttribute('type', 'text');
      texttag.setAttribute('name', "Part"+taskid+"");
      texttag.setAttribute('id', "Part"+taskid+"");
      texttag.setAttribute(attr, 'FormInput');
      texttag.setAttribute('size', '25');
      texttag.setAttribute('onblur', 'getImage(this)');
      texttag.setAttribute('tabindex', '2');
      
      var labeltag2 = document.createElement("label");
      labeltag2.setAttribute(attr, 'TextMainArial');
	  labeltag2.innerHTML = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Quantity:";
	  
      var texttag2 = document.createElement("input");
      texttag2.setAttribute('type', 'text');
      texttag2.setAttribute('name', "Qty"+taskid+"");
      texttag2.setAttribute('id', "Qty"+taskid+"");
      texttag2.setAttribute(attr, 'FormInput');
      texttag2.setAttribute('size', '10');
      texttag2.setAttribute('tabindex', '2');
      
      var labeltag3 = document.createElement("label");
      labeltag3.setAttribute(attr, 'TextMainArial');
      labeltag3.setAttribute('id', "LBLPart"+taskid+"");
      
	 
      var tbody = document.getElementById('tbody');
      var row = document.createElement("tr");
      
      row.setAttribute('height', "50px");
      
      //empty cells
      var cell1 = document.createElement("td");
      var cell2 = document.createElement("td");
      var cell3 = document.createElement("td");
      var cell4 = document.createElement("td");
      var cell5 = document.createElement("td");
      var cell6 = document.createElement("td");
      var cell7 = document.createElement("td");
      
      cell7.setAttribute('align', "center");

      cell1.appendChild(labeltag1);
      cell2.appendChild(texttag);
      
      cell4.appendChild(labeltag2);
      cell5.appendChild(texttag2);
      
      cell7.appendChild(labeltag3);
      
      row.appendChild(cell1);
      row.appendChild(cell2);
      row.appendChild(cell3);
      row.appendChild(cell4);
      row.appendChild(cell5);
      row.appendChild(cell6);
      row.appendChild(cell7);
      
      tbody.appendChild(row);
      taskid++;
      taskcount--;
}

function SetPartNumberCount(val)
{
    taskcount = val;
}
