function DESemail(emailname,emailserver) {
	document.write("<a href='mailto:" + emailname + "@" + emailserver +"'>");
	document.write(emailname + "@" + emailserver); 
	document.write("</a>"); 
}
function showPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('placeholder').src = whichpic.href;
  if (whichpic.title) {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
  } else {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
  }
  return false;
 } else {
  return true;
 }
}
function addRowToTable()
{
  	var numi = document.getElementById('theValue');
	var num = (document.getElementById("theValue").value -1)+ 2;
	numi.value = num;
  var tbl = document.getElementById('pdetails');
  var theLength = tbl.rows.length;
  if (theLength <= 15) {
     var lastRow = tbl.rows.length;
     // if there's no header row in the table, then iteration = lastRow + 1
     var iteration = lastRow;
     var row = tbl.insertRow(lastRow);
		
		var cellLeft = row.insertCell(0);
     var pl = document.createElement('p');
     pl.className = 'req';
	  pl.innerHTML = iteration + ':';
	  
     var cellMiddle = row.insertCell(1);
     var te = document.createElement('input');
     te.type = 'text';
     te.className = 'req';
	  //te.value = '$_POST["dn' + iteration + '"]';
     te.name = 'dn' + iteration;
     te.id = 'dn' + iteration;
     
     // right cell
     var cellRight = row.insertCell(2);
     var el = document.createElement('input');
     el.type = 'text';
     el.className = 'req2';
     el.name = 'st' + iteration;
     el.id = 'st' + iteration;
     
	  cellLeft.appendChild(pl);
     cellMiddle.appendChild(te);
     cellRight.appendChild(el);
     
     te.focus();
  }
  else {
  		alert('Maximun Number of Drugs Reached');
	}
}
/* Not Used
function removeRowFromTable()
{
  var tbl = document.getElementById('pdetails');
  var lastRow = tbl.rows.length;
  if (lastRow > 2) tbl.deleteRow(lastRow - 1);
}
*/