/* $Id: multirow.js,v 1.2 2008/06/09 14:04:30 zaa Exp $ */

var multirowInputSets = {};

/*
	Add new row (first row onclick event handler)
*/
function add_inputset(name, obj, isLined) {

	if (!name)
		return false;

	var buttonTD = obj;
    while (buttonTD.tagName.toUpperCase() != 'TD' && buttonTD.parentNode)
        buttonTD = buttonTD.parentNode;

	if (buttonTD.tagName.toUpperCase() != 'TD')
		return false;

	if (!buttonTD.inheritedRows) {
		buttonTD.inheritedRows = [];
	}

	buttonTD.isLined = isLined;

	return add_inputset_row(name, buttonTD, buttonTD.parentNode);
}

/*
	Add new row
*/
function add_inputset_row(name, buttonTD, lastTR) {
	var regexp = new RegExp('^'+name+'_box', 'ig');

	/* Get last cloned row */
	var maxI = -1;
	if (buttonTD.inheritedRows.length > 0) {
		for (var i in buttonTD.inheritedRows) {
			maxI = i;
		}
	}

	if (!lastTR)
		lastTR = (maxI >= 0) ? buttonTD.inheritedRows[maxI] : buttonTD.parentNode;
	var origTable = lastTR.parentNode.parentNode;
	var origTR = lastTR;

	/* Clone row */
	maxI++;
	lastTR = origTable.insertRow(lastTR.rowIndex+1);
	buttonTD.inheritedRows[maxI] = lastTR;

	/* Copy row attributes */
	for (var x = 0; x < origTR.attributes.length; x++) {
		if(!origTR.attributes[x].specified)
			continue;
		var newAttr = document.createAttribute(origTR.attributes[x].name);
		newAttr.value = origTR.attributes[x].value
		lastTR.attributes.setNamedItem(newAttr);
	}

	lastTR.buttonTD = buttonTD;
	lastTR.mark = name;
	lastTR.inheritedRowIndex = maxI;
	lastTR.cssText = origTR.cssText;

	for (var x = 0; x < origTR.cells.length; x++) {
		if (origTR.cells[x].id.search(regexp) == -1)
			continue;

		/* Clone cell */
		var curTD = lastTR.appendChild(origTR.cells[x].cloneNode(true));
		curTD.id = name+'_box_'+x+'_'+lastTR.inheritedRowIndex;

		/* Change clone element name (in clone cell) */
		for (var y = 0; y < curTD.childNodes.length; y++) {
			var elm = curTD.childNodes[y];
			if (!elm.tagName)
				continue;

			var tName = elm.tagName.toUpperCase();
			if (tName == 'INPUT' || tName == 'SELECT' || tName == 'TEXTAREA') {
				if (elm.name.search(/\[\]$/) != -1) {
					elm.name = elm.name.replace(/\[[0-9]+\]\[\]$/, '['+(lastTR.inheritedRowIndex+1)+'][]');
				} else {
					elm.name = elm.name.replace(/\[[0-9]+\]$/, '['+(lastTR.inheritedRowIndex+1)+']');
				}

				/* Clear cloned element content if noCloneContent option is enabled for this multirow inputset */
				if (multirowInputSets[name] && multirowInputSets[name].noCloneContent) {
					if ((tName == 'INPUT' && elm.type == 'text') || tName == 'TEXTAREA')
						elm.value = '';
				}
			}
		}
	}

	/* Add service cell (with + / - buttons) */
	curTD = lastTR.insertCell(-1);
	curTD.noWrap = true;
	if (!window.lbl_remove_row)
		lbl_remove_row = "Remove row";
	if (!window.lbl_add_row)
		lbl_add_row = "Add row";

	if (window.inputset_plus_img && window.inputset_minus_img)
		curTD.innerHTML = '<img src="'+inputset_plus_img+'" alt="'+lbl_add_row+'" onclick="javascript: add_inputset_subrow(this);" style="cursor: pointer;">&nbsp;&nbsp;<img src="'+inputset_minus_img+'" alt="'+lbl_remove_row+'" onclick="javascript: remove_inputset(this);" style="cursor: pointer;">';
	else
		curTD.innerHTML = '<a href="javascript: void(0);" onclick="javascript: add_inputset_subrow(this);">'+lbl_add_row+'</a>&nbsp;&nbsp;<a href="javascript: void(0);" onclick="javascript: remove_inputset(this);">'+lbl_remove_row+'</a>';

	lined_inputset(buttonTD);

	return lastTR;
}

/*
	Add new row (onclick event handler)
*/
function add_inputset_subrow(tr) {
    while (tr.tagName.toUpperCase() != 'TR' && tr.parentNode)
        tr = tr.parentNode;

	if (tr.tagName.toUpperCase() != 'TR')
		return false;

	add_inputset_row(tr.mark, tr.buttonTD, tr);
}

/*
	Remove row from rows set
*/
function remove_inputset(tr) {
	while (tr.tagName.toUpperCase() != 'TR' && tr.parentNode)
		tr = tr.parentNode;

	if (tr.tagName.toUpperCase() != 'TR')
		return false;

	if (!tr.buttonTD.inheritedRows[tr.inheritedRowIndex])
		return false;

	tr.parentNode.parentNode.deleteRow(tr.rowIndex);
	lined_inputset(tr.buttonTD);
	tr.buttonTD.inheritedRows[tr.inheritedRowIndex] = null;
	delete tr;

	return true;
}

/*
	Display rows set as lined
*/
function lined_inputset(buttonTD) {
	if (!buttonTD.isLined || buttonTD.inheritedRows.length == 0)
		return false;

	var origTable = buttonTD;
	while (origTable.tagName.toUpperCase() != 'TABLE' && origTable.parentNode)
		origTable = origTable.parentNode;

	if (origTable.tagName.toUpperCase() != 'TABLE')
		return false;

	var maxRowIndex = buttonTD.parentNode.rowIndex;
	for (var i in buttonTD.inheritedRows) {
		if (buttonTD.inheritedRows[i] && maxRowIndex < buttonTD.inheritedRows[i].rowIndex)
			maxRowIndex = buttonTD.inheritedRows[i].rowIndex;
	}

	var flag = true;
	for (var i = 0; i < origTable.rows.length; i++) {
		if (origTable.rows[i].rowIndex > buttonTD.parentNode.rowIndex && origTable.rows[i].rowIndex <= maxRowIndex) {
			origTable.rows[i].className = flag ? 'TableSubHead' : '';
			flag = !flag;
		}
	}
}

/*
	Add row with preset data
*/
function add_inputset_preset(name, obj, isLined, preset) {
	var tr = add_inputset(name, obj, isLined);
	if (!tr)
		return false;

	for (var p = 0; p < preset.length; p++) {
		var elm = false;
		for (var i = 0; i < tr.cells.length && !elm; i++) {

			/* Get element */
			var elm = add_inputset_search_element(tr.cells[i], preset[p].regExp);
			if (!elm)
				continue;

			var tName = elm.tagName.toUpperCase();
			if (tName == 'INPUT' && (elm.type == 'text' || elm.type == 'hidden')) {
				elm.value = preset[p].value;

			} else if (tName == 'INPUT' && elm.type == 'checkbox') {
				elm.checked = preset[p].value;

			} else if (tName == 'INPUT' && elm.type == 'radio') {
				var elms = elm.form.elements[elm.name];
				if (elms) {
					for (var y = 0; y < elms.length; y++)
						elms[y].checked =  (elms[y].value == preset[p].value);
				}

			} else if (tName == 'SELECT') {
				for (var y = 0; y < elm.options.length; y++)
					if (elm.options[y].value == preset[p].value) {
						elm.options[y].selected = true;
						break;
					}

			} else if (tName == 'TEXTAREA') {
				elm.value = preset[p].value;
			}
		
		}
	}
}

/*
	Search element by name (RegExp) recursive
*/
function add_inputset_search_element(parent, regExp) {
	if (parent.childNodes.length == 0)
		return false;

	for (var i = 0; i < parent.childNodes.length; i++) {
		if (!parent.childNodes[i].tagName || !parent.childNodes[i].name)
			continue;

		var tName = parent.childNodes[i].tagName.toUpperCase();
		if ((tName == 'INPUT' || tName == 'SELECT' || tName == 'TEXTAREA') && parent.childNodes[i].name.search(regExp) != -1) {
			return parent.childNodes[i];
		}

		if (parent.childNodes[i].parentChilds && parent.childNodes[i].parentChilds.length > 0) {
			var r = add_inputset_search_element(parent.childNodes[i], regExp);
			if (r)
				return r;
		}
	}

	return false;
}


function foo(px,py,pw,ph,baseElement,fid)
{
var win = document.getElementById(this.fid);
}


function dropdown_menu_hack(el)
{
if(el.runtimeStyle.behavior.toLowerCase()=="none"){return;}
el.runtimeStyle.behavior="none";

var ie5 = (document.namespaces==null);
el.ondblclick = function(e)
{
window.event.returnValue=false;
return false;
}

if(window.createPopup==null)
{

var fid = "dropdown_menu_hack_" + Date.parse(new Date());

window.createPopup = function()
{
if(window.createPopup.frameWindow==null)
{
el.insertAdjacentHTML("AfterEnd","<iframe id='"+fid+"' name='"+fid+"' src='about:blank' frameborder='1' scrolling='no'></></iframe>");
var f = document.frames[fid];
f.document.open();
f.document.write("<html><body></body></html>");
f.document.close();
f.fid = fid;


var fwin = document.getElementById(fid);
fwin.style.cssText="position:absolute;top:0;left:0;display:none;z-index:99999;";


f.show = function(px,py,pw,ph,baseElement)
{
py = py + baseElement.getBoundingClientRect().top + Math.max( document.body.scrollTop, document.documentElement.scrollTop) ;
px = px + baseElement.getBoundingClientRect().left + Math.max( document.body.scrollLeft, document.documentElement.scrollLeft) ;
fwin.style.width = pw + "px";
fwin.style.height = ph + "px";
fwin.style.posLeft =px ;
fwin.style.posTop = py ;
fwin.style.display="block";
}


f_hide = function(e)
{
if(window.event && window.event.srcElement && window.event.srcElement.tagName && window.event.srcElement.tagName.toLowerCase()=="select"){return true;}
fwin.style.display="none";
}
f.hide = f_hide;
document.attachEvent("onclick",f_hide);
document.attachEvent("onkeydown",f_hide);

}
return f;
}
}

function showMenu()
{

function selectMenu(obj)
{
var o = document.createElement("option");
o.value = obj.value;
o.innerHTML = obj.innerHTML;
while(el.options.length>0){el.options[0].removeNode(true);}
el.appendChild(o);
el.title = o.innerHTML;
el.contentIndex = obj.selectedIndex ;
el.menu.hide();
}


el.menu.show(0 , el.offsetHeight , 10, 10, el);
var mb = el.menu.document.body;

mb.style.cssText ="border:solid 1px black;margin:0;padding:0;overflow-y:auto;overflow-x:auto;background:white;text-aligbn:center;font-family:Verdana;font-size:12px;";
var t = el.contentHTML;
t = t.replace(/<select/gi,'<ul');
t = t.replace(/<option/gi,'<li');
t = t.replace(/<\/option/gi,'</li');
t = t.replace(/<\/select/gi,'</ul');
mb.innerHTML = t;


el.select = mb.all.tags("ul")[0];
el.select.style.cssText="list-style:none;margin:0;padding:0;";
mb.options = el.select.getElementsByTagName("li");

for(var i=0;i<mb.options.length;i++)
{
mb.options[i].selectedIndex = i;
mb.options[i].style.cssText = "list-style:none;margin:0;padding:1px 2px;width/**/:100%;cursor:hand;cursor:pointer;white-space:nowrap;"
mb.options[i].title =mb.options[i].innerHTML;
mb.options[i].innerHTML ="<nobr>" + mb.options[i].innerHTML + "</nobr>";
mb.options[i].onmouseover = function()
{
if( mb.options.selected ){mb.options.selected.style.background="white";mb.options.selected.style.color="black";}
mb.options.selected = this;
this.style.background="#333366";this.style.color="white";
}

mb.options[i].onmouseout = function(){this.style.background="white";this.style.color="black";}
mb.options[i].onmousedown = function(){selectMenu(this); }
mb.options[i].onkeydown = function(){selectMenu(this); }


if(i == el.contentIndex)
{
mb.options[i].style.background="#333366";
mb.options[i].style.color="white";
mb.options.selected = mb.options[i];
}
}


var mw = Math.max( ( el.select.offsetWidth + 22 ), el.offsetWidth + 22 );
mw = Math.max( mw, ( mb.scrollWidth+22) );
var mh = mb.options.length * 15 + 8 ;

var mx = (ie5)?-3:0;
var my = el.offsetHeight -2;
var docH = document.documentElement.offsetHeight ;
var bottomH = docH - el.getBoundingClientRect().bottom ;

mh = Math.min(mh, Math.max(( docH - el.getBoundingClientRect().top - 50),100) );

if(( bottomH < mh) )
{

mh = Math.max( (bottomH - 12),10);
if( mh <100 )
{
my = -100 ;

}
mh = Math.max(mh,100);
}


self.focus();

el.menu.show( mx , my , mw, mh , el);
sync=null;
if(mb.options.selected)
{
mb.scrollTop = mb.options.selected.offsetTop;
}




window.onresize = function(){el.menu.hide()};
}

function switchMenu()
{
if(event.keyCode)
{
if(event.keyCode==40){ el.contentIndex++ ;}
else if(event.keyCode==38){ el.contentIndex--; }
}
else if(event.wheelDelta )
{
if (event.wheelDelta >= 120)
el.contentIndex++ ;
else if (event.wheelDelta <= -120)
el.contentIndex-- ;
}else{return true;}




if( el.contentIndex > (el.contentOptions.length-1) ){ el.contentIndex =0;}
else if (el.contentIndex<0){el.contentIndex = el.contentOptions.length-1 ;}

var o = document.createElement("option");
o.value = el.contentOptions[el.contentIndex].value;
o.innerHTML = el.contentOptions[el.contentIndex].text;
while(el.options.length>0){el.options[0].removeNode(true);}
el.appendChild(o);
el.title = o.innerHTML;
}

if(dropdown_menu_hack.menu ==null)
{
dropdown_menu_hack.menu = window.createPopup();
document.attachEvent("onkeydown",dropdown_menu_hack.menu.hide);
}
el.menu = dropdown_menu_hack.menu ;
el.contentOptions = new Array();
el.contentIndex = el.selectedIndex;
el.contentHTML = el.outerHTML;

for(var i=0;i<el.options.length;i++)
{
el.contentOptions [el.contentOptions.length] =
{
"value": el.options[i].value,
"text": el.options[i].innerHTML
}

if(!el.options[i].selected){el.options[i].removeNode(true);i--;};
}


el.onkeydown = switchMenu;
el.onclick = showMenu;
el.onmousewheel= switchMenu;

}


var gRowId = 2;
function display_div(checkname,divname)
	{

		if(document.getElementById(checkname).checked==true)
		{
		document.getElementById(divname).style.display='';
		}if(document.getElementById(checkname).checked==false)
		{
		document.getElementById(divname).style.display='none';
		}
	}



function delRow(button)
{
var row = button.parentNode.parentNode;
var tbody = document.getElementById('FootTable').getElementsByTagName('tbody')[0];
tbody.removeChild(row);
}

function addRow()
{
var tbody = document.getElementById('FootTable').getElementsByTagName('tbody')[0];

var row = document.createElement('TR');

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');
cell1.setAttribute('align','left');
cell2.setAttribute('align','left');
cell3.setAttribute('align','left');
cell4.setAttribute('align','left');
cell5.setAttribute('align','left');
cell1.className='form-heading';
cell3.className='form-heading';

//onkeyup="javascript:checkNumber(this);"

var inp1 =  document.createElement('INPUT');
var inp2 = document.createElement('INPUT');
var inp3 = document.createElement('INPUT');

inp1.setAttribute('type','text');
//inp1.onkeyup=function(){checkNumber(this);}
inp1.setAttribute('name','squarefoot[]');
inp1.setAttribute('size','5');
inp1.className='input';
inp2.setAttribute('type','button');
inp2.setAttribute('value','Remove');
//inp2.setAttribute('class','button');
inp2.className='button';
inp2.onclick=function(){delRow(this);}
inp3.setAttribute('type','text');
//inp3.onkeyup=function(){checkNumber(this);}
//inp3.setAttribute('onkeyup','checkNumber(this)');
inp3.setAttribute('name','spaceid[]');
inp3.setAttribute('size','5');
//inp3.setAttribute('class','input');
inp3.className='input';
cell1.innerHTML = "&nbsp;&nbsp;Square Foot";

cell2.appendChild(inp1);
cell3.innerHTML= "&nbsp;&nbsp;&nbsp;Space Id";
cell4.appendChild(inp3);
cell5.appendChild(inp2);
row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3);
row.appendChild(cell4);
row.appendChild(cell5);
tbody.appendChild(row);

gRowId++;
}

var pdfId = 2;
function delpdfRow(button)
{
var row = button.parentNode.parentNode;
var tbody = document.getElementById('pdfTable').getElementsByTagName('tbody')[0];
tbody.removeChild(row);
}

function addpdfRow()
{
	
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=parseFloat(b_version);
  


var materialtext=new Array();
materialtext[0]="Coolaroo Commercial 95";
materialtext[1]="Textilene SuperScreen";
materialtext[2]="Textilene 80";
materialtext[3]="Textilene 90";
//materialtext[4]="PolyCB2 Ultra Strong 20/17 Fine Weave 47% Solar/UV";
//materialtext[5]="PolyCB2 HD60 (Topside 60% Solar/UV) Multi-Core";
//materialtext[6]="PolyCB2 MX-90 Premium Solar/Privacy 90% UV Block";

var materialvalue=new Array();
materialvalue[0]="Coolaroo Commercial 95";
materialvalue[1]="Textilene SuperScreen";
materialvalue[2]="Textilene 80";
materialvalue[3]="Textilene 90";
//materialvalue[4]="PCPV80";
//materialvalue[5]="PCHD60";
//materialvalue[5]="PCMX90";

var codetext = new Array();
codetext[0] = "all four sides";
codetext[1] = "1 width / 2 lengths";
codetext[2] = "1 length / 2 widths";
codetext[3] = "1 length / 1 width";
codetext[4] = "1 width / 0 lengths";
codetext[5] = "0 width / 1 length";
codetext[6] = "0 width / 2 lengths";
codetext[7] = "2 widths / 0 lengths";


var codevalue = new Array();
codevalue[0] = "all four sides";
codevalue[1] = "1 width / 2 lengths";
codevalue[2] = "1 length / 2 widths";
codevalue[3] = "1 length / 1 width";
codevalue[4] = "1 width / 0 lengths";
codevalue[5] = "0 width / 1 length";
codevalue[6] = "0 width / 2 lengths";
codevalue[7] = "2 widths / 0 lengths";

//alert("HELLO");
var tbody = document.getElementById('pdfTable').getElementsByTagName('tbody')[0];

var row = document.createElement('TR');

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');
var cell8 = document.createElement('TD');
var cell9 = document.createElement('TD');
var cell10 = document.createElement('TD');

cell1.setAttribute('align','left');
cell2.setAttribute('align','left');
cell3.setAttribute('align','left');
cell4.setAttribute('align','left');
cell5.setAttribute('align','left');
cell6.setAttribute('align','left');
cell7.setAttribute('align','left');
cell8.setAttribute('align','left');
cell9.setAttribute('align','left');
cell10.setAttribute('align','center');
//cell1.className='form-heading';

var inp1 =  document.createElement('INPUT'); // Quantity
var inp2 = document.createElement('SELECT'); // material SELECT BOX
var inp3 = document.createElement('INPUT');  // size width
var inp4 =  document.createElement('INPUT'); // size length
var inp5 = document.createElement('SELECT'); // Code
var inp6 = document.createElement('INPUT'); // horizontal
var inp7 = document.createElement('INPUT'); // vertical
var inp8 = document.createElement('span'); // horizontal spacing
var inp9 = document.createElement('span'); // vertical spacing
var inp10 = document.createElement('img'); // Remove


inp1.setAttribute('type','text');
inp1.setAttribute('name','qty[]');
inp1.setAttribute('maxlength','3');
inp1.setAttribute('size','1');
inp1.onkeyup=function(){checkNumber(this,0);}

inp2.setAttribute('name','material[]');


for(i=0; i<4; i++) { 

theOption=document.createElement("OPTION");
theText=document.createTextNode(materialtext[i]);
theOption.appendChild(theText);
//this option has a value, an URL, so we set the value
theOption.setAttribute("value",materialvalue[i]);
inp2.appendChild(theOption);
}

var styleData = 'width:270px; margin-right:5px;  font-size:10px;';

if ( browser=="Microsoft Internet Explorer")
  {
   inp1.style.setAttribute('cssText',  'width:18px; margin-right:0px;  font-size:11px;');
     inp2.style.setAttribute('cssText',  'width:230px; margin-right:5px;  font-size:11px;');
     inp3.style.setAttribute('cssText', 'width:25px;  margin-right:0px;  font-size:11px;');
     inp4.style.setAttribute('cssText', 'width:25px;  margin-right:0px;  font-size:11px;');
     inp5.style.setAttribute('cssText', 'width:140px; margin-right:5px; font-size:11px;');
     inp6.style.setAttribute('cssText', 'width:25px;   margin-right:5px;  font-size:11px;');
     inp7.style.setAttribute('cssText', 'width:25px;   margin-right:5px;  font-size:11px;');
     inp8.style.setAttribute('cssText', 'width:30px; *width:30px;  margin-right:5px;  font-size:11px;');
     inp9.style.setAttribute('cssText', 'width:30px; *width:30px;  margin-right:5px;  font-size:11px;');
		  
		  

  }
else
  {
     inp1.setAttribute('style',  'width:18px; margin-right:0px;  font-size:11px;');
     inp2.setAttribute('style',  'width:230px; margin-right:5px;  font-size:11px;');
	 inp3.setAttribute('style','width:25px;  margin-right:5px;  font-size:11px;');
	 inp4.setAttribute('style','width:25px;  margin-right:5px;  font-size:11px;');
     inp5.setAttribute('style', 'width:140px; margin-right:5px; font-size:11px;');
 	inp6.setAttribute('style','width:25px;   margin-right:5px;  font-size:11px;');
	inp7.setAttribute('style','width:25px;   margin-right:5px;  font-size:11px;');
	inp8.setAttribute('style','width:30px; *width:30px;  margin-right:5px;  font-size:11px;');
	inp9.setAttribute('style','width:30px; *width:30px;  margin-right:5px;  font-size:11px;');
	 
	 
  }
//alert(isIE);
  //if(!isIE){
	 // alert("1");
    //use the correct DOM Method
  //} else {
    //use the .cssText hack
 // }
//inp2.setAttribute('style','width:270px; margin-right:5px;  font-size:10px;');


//inp1.setAttribute('class','input');
//inp1.className='input';
//inp2.setAttribute('type','text');
//inp2.setAttribute('value','PDF Title');
//inp2.onclick=function(){checkval(inp2);}
//inp2.setAttribute('name','pdftitle[]');
//inp2.setAttribute('class','input');
//inp2.className='input';
inp3.setAttribute('type','text');
inp3.setAttribute('name','size_width[]');
inp3.setAttribute('maxlength','3');
inp3.setAttribute('size','1');
//inp3.setAttribute('style','width:30px;  margin-right:5px;  font-size:10px;');
inp3.onclick=function(){checkvalue(this);}
inp3.onkeyup=function(){checkNumber(this,0);}
inp3.setAttribute('maxlength','3');
inp3.setAttribute('size','1');
inp4.setAttribute('type','text');
inp4.setAttribute('name','size_length[]');
inp4.setAttribute('maxlength','3');
inp4.setAttribute('size','1');
inp4.onclick=function(){checkvalue(this);}
inp4.onkeyup=function(){checkNumber(this,0);}
//inp4.setAttribute('style','width:30px;  margin-right:5px;  font-size:10px;');
inp5.setAttribute('name','code[]');
var styleData = 'width:95px; margin-right:5px; font-size:10px;';
if ( browser=="Microsoft Internet Explorer")
  {
//	      inp5.style.setAttribute('cssText', styleData);

  }
else
  {
	//      inp5.setAttribute('style', styleData);

  }

//inp5.setAttribute('style','width:95px; margin-right:5px; font-size:10px;');

for(i=0; i<8; i++) { 

theOption=document.createElement("OPTION");
theText=document.createTextNode(codetext[i]);
theOption.appendChild(theText);
//this option has a value, an URL, so we set the value
theOption.setAttribute("value",codevalue[i]);
inp5.appendChild(theOption);
}
inp6.setAttribute('type','text');
inp6.setAttribute('name','horizontal[]');
inp6.onkeyup=function(){checkNumber(this,2);}
inp6.onblur=function(){checkNumber(this,2);}

//inp6.setAttribute('style','width:30px; *width:51px;  margin-right:5px;  font-size:10px;');
inp6.setAttribute('size','1');

inp7.setAttribute('type','text');
inp7.setAttribute('name','vertical[]');
//inp7.setAttribute('style','width:30px;  margin-right:5px;  font-size:10px;');
inp7.setAttribute('size','1');
inp7.onkeyup=function(){checkNumber(this,1);}
inp7.onblur=function(){checkNumber(this,1);}



inp8.innerHTML="0";//('i','0');
inp8.setAttribute('name','vspacing[]');
inp8.setAttribute('maxlength','3');

inp9.innerHTML="0";
//inp9.setAttribute('value','0');

inp9.setAttribute('name','hspacing[]');
inp9.setAttribute('maxlength','3');
inp10.setAttribute('src',window.inputset_minus_img);
//<img src="'+inputset_plus_img+'" alt="'+lbl_add_row+'" onclick="javascript: add_inputset_subrow(this);" style="cursor: pointer;">
//inp10.setAttribute('type','button');
inp10.setAttribute('src',window.inputset_minus_img);

//inp10.setAttribute('value','Remove');
//inp3.className='button';
inp10.onclick=function(){delpdfRow(this);}

//inp3.setAttribute('type','button');
//inp3.setAttribute('value','Remove');
//inp3.className='button';
//inp3.onclick=function(){delpdfRow(this);}
cell1.appendChild(inp1);
cell2.appendChild(inp2);
cell3.appendChild(inp3);
cell4.appendChild(inp4);
cell5.appendChild(inp5);
cell6.appendChild(inp6);
cell7.appendChild(inp7);
cell8.appendChild(inp8);
cell9.appendChild(inp9);
cell10.appendChild(inp10);

row.appendChild(cell1);
row.appendChild(cell2);
row.appendChild(cell3);
row.appendChild(cell4);
row.appendChild(cell5);
row.appendChild(cell6);
row.appendChild(cell7);
row.appendChild(cell8);
row.appendChild(cell9);
row.appendChild(cell10);
//row.appendChild(cell3);

tbody.appendChild(row);

pdfId++;
}

function  checkval(form)
	{
	
	if(form.value == 'PDF Title' )
	{
	form.value="";
	}
	
	} 

function checkstate(state)
{
if(state.value=="Arizona")
{


document.getElementById('city').style.display="";
}
else
{
document.getElementById('city').style.display="none";
}


}


