﻿

var gv_newQuoAC=new Array();
var gv_newQuoName=new Array();
var gv_newQuoIndex=0; 
var gv_newQuoFocusIndex=0;
var gv_newQuoNumPerPage=0;
var gv_newQuoCurPage=0;
var gv_newQuoTotPage=0;
var gv_newQuoEditingData=0;
var gv_newQuoDataCategory=null;
var gv_newQuoEditedName=null; 
var gv_newQuoEditedValue=null; 
var gv_tempTable;
var gv_newQuoRowH=20;
var gv_scrollCurPage=0;
var gv_scrollTotPage=0;
var addNewQuoDropDownValue = "";
var NewQuoPartCode = "";
var NewQuoiPage = 1;
var NewQuoTotalPage = 1;
var NewQuoListPD = 0;//pan duan showNewQuoList(1);
function doNewQuoList()
{
    if(document.getElementById('NewQuoCustomer_ACRef')){ NewQuoPartCode = document.getElementById('NewQuoCustomer_ACRef').value;}
	var url = gv_rooturl+"?cmd=NewQuoList"+"&NewQuoPartCode="+NewQuoPartCode+"&NewQuoiPage="+NewQuoiPage;
	var xmlhttp = newHttpRequest(url,true);
	if( xmlhttp==null ) return;
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 ) {
			if( xmlhttp.status!=200 ) alert("Connection error");
			else
			{
			    var newquototalpages=xmlhttp.responseXML.getElementsByTagName("NewQuoTotalPage");
                NewQuoTotalPage = parseInt(newquototalpages[0].firstChild.nodeValue);			   
                renewNewQuoList(xmlhttp.responseXML);
			}
			document.getElementById('idloading').style.visibility='hidden';
			
		}
	}
	xmlhttp.send(null);
	document.getElementById('idloading').style.visibility='visible';
}


function renewNewQuoList(xmldoc)
{
	var newquos=xmldoc.getElementsByTagName("NewQuo");
	gv_newQuoAC.length=gv_newQuoName.length=0;
	gv_newQuoIndex=0;
	
    for(var i=0; i<newquos.length; i++) {
		var curNode=newquos[i].firstChild;
		gv_newQuoAC[i]=gv_newQuoName[i]="";
		while( curNode ) 
		{
			switch(curNode.nodeName){
			   	case "AC" :  gv_newQuoAC[i]=curNode.firstChild.nodeValue; break;
			   
				case "Name" : gv_newQuoName[i]=curNode.firstChild.nodeValue;  break;
			}
			curNode=curNode.nextSibling;
		}
    }
    if(newquos.length==0) alert("No New Quotations found!");
    else {
		gv_newQuoTotPage=0;
		showNewQuoList(0);
	}
}



function showNewQuoList(NewQuoStatus)
{
     if(NewQuoStatus == 0)
    {
       gv_newQuoTotPage=0;
       gv_newQuoCurPage=0;
    }
    else if(NewQuoStatus == 1)
    {}
    if(NewQuoListPD == 1)
    {
        gv_newQuoCurPage = NewQuoListCurPage;
        gv_newQuoTotPage = NewQuoListTotPage;
    }
    NewQuoListPD = 0;
	if(gv_newQuoAC.length==0) return;
    gv_tempTable = document.getElementById('tempTable');
	var ycur=gv_tempTable.style.pixelTop=gv_device==Nokia ? 28:26;
	var tdstr="<td height='"+gv_newQuoRowH+"px'>";
	var tabstr="<table border='1' cellpadding='1' cellspacing='0' style='position:absolute;width:"+(gv_winw-4)+"px;left:2px;'>"; 
	//var ixs=gv_newQuoCurPage*gv_newQuoNumPerPage;
	var idx=0;
    for(var i=0; i<gv_newQuoAC.length; i++) {
		var imgName=idx==gv_newQuoIndex ? 'radon.png':'radoff.png';
		var trColor=idx==gv_newQuoIndex ? '#ffcc00':'#add8e6';
		var radstr="<td width='22px' height='"+gv_newQuoRowH+"px'><input type='image' src='img/"+imgName+
			"' id='cus_img"+idx+"' onclick='newQuotationRowClicked(event);'";
		if(gv_device==Nokia) radstr+="onfocus='overNewQuoItem(event);' onblur='leavNewQuoItem(event);'></td>";
		else radstr+="onmouseover='overNewQuoItem(event);' onmouseleave='leavNewQuoItem(event);'></td>";
		tabstr+="<tr id='cus_row"+idx+"' onclick='newQuotationRowClicked(event);' style='background-color:"+
			trColor+";'>"+radstr + tdstr+gv_newQuoAC[i]+"</td>"+tdstr+gv_newQuoName[i]+"</td></tr>";
		//ycur+=gv_newQuoRowH;
		//if(ycur+45>gv_winh) break; else
		 idx++;
    }
//    if(gv_newQuoTotPage==0) {
//		gv_scrollCurPage=gv_newQuoCurPage=0;
//		gv_newQuoNumPerPage=i;
//		var ntt=gv_newQuoAC.length;
//		gv_newQuoTotPage=0;
//		while(ntt>0) {gv_newQuoTotPage++; ntt-=gv_newQuoNumPerPage; }
		gv_scrollTotPage=NewQuoTotalPage;
		if(gv_device!=Nokia) {
			var mleft=document.getElementById('img_mleft3');
			mleft.onclick=newQuoPageLeft;
			mleft.style.cursor='hand';
			var mright=document.getElementById('img_mright3');
			mright.onclick=newQuoPageRight;
			mright.style.cursor='hand';
		}
    //}
    gv_tempTable.innerHTML=tabstr+"</table>";
    gv_tempTable.style.left='0px';
    gv_tempTable.style.visibility='visible';
    if(gv_device!=Nokia) {
		var btnBack=document.getElementById("back2submenu");
		btnBack.style.pixelTop=gv_winh-28;
		btnBack.style.visibility = "hidden";
	}
	gv_newQuoFocusIndex=gv_newQuoIndex;
	
    var newquocmd = document.getElementById('sopCmds');
	newquocmd.style.pixelLeft=gv_winw-newquocmd.style.pixelWidth-1;
	newquocmd.style.pixelTop = gv_winh-29;
    newquocmd.style.visibility='visible';
    if(gv_device!=Nokia) {
		var btn1=document.getElementById('btnNewQuoDetail');
		if(btn1==null) setNewQuoPageScrollCommands(
			"<input type='button' id='btnNewQuoDetail' value='OK' onclick='editNewQuoDetail();' />",
			"<input type='button' id='btnNewQuoOK' value='OK' onclick='editNewQuoDetail();' />");
			document.getElementById('btnNewQuoOK').style.visibility="hidden";
	     }
	setNewQuoPageScroll();
	doNokiaMenuNewQuoList();    
}

function newQuotationRowClicked(ee)
{
	var srcele=getEventObject(ee);
	if(srcele.id.length<8) return;
	var newIndex=parseInt(srcele.id.substring(7));
	if(gv_newQuoIndex==newIndex) return;
	document.getElementById('cus_row'+gv_newQuoIndex).style.backgroundColor='#add8e6';
	document.getElementById('cus_img'+gv_newQuoIndex).src='img/radoff.png';
	document.getElementById('cus_row'+newIndex).style.backgroundColor='#ffcc00';
	document.getElementById('cus_img'+newIndex).src='img/radon.png';
	gv_newQuoIndex=newIndex;
}
function overNewQuoItem(e_event)
{
	var srcobj=getEventObject(e_event);
	if(srcobj.id=='cus_img'+gv_newQuoIndex) return; // Entering the current selection
	srcobj.src="img/radover.png";
}
function leavNewQuoItem(e_event)
{
	var srcobj=getEventObject(e_event);
	if(srcobj.id=='cus_img'+gv_newQuoIndex) return; // Leaving the current selection
	srcobj.src="img/radoff.png";
}

function doNokiaMenuNewQuoList()
{
	if(window.widget) {
		window.menu.clear();
		var mEdit = new MenuItem('OK',2102);
		mEdit.onSelect=editNewQuoDetail;
		window.menu.append(mEdit);
//		var mBack = new MenuItem('Back',2103);
//		mEdit.onSelect=backSops;
//		window.menu.append(mBack);
	}
}


function getNewQuoDetail()
{
	var ACIndex=gv_newQuoCurPage*gv_newQuoNumPerPage+gv_newQuoIndex;
	
	var url = gv_rooturl+"?cmd=NewQuoDetail&AC="+gv_newQuoAC[ACIndex]+"&index="+ACIndex;
		var xmlhttp = newHttpRequest(url,true);
	if( xmlhttp==null ) return;
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 ) {
			if( xmlhttp.status!=200 ) alert("Connection error");
			else {
				gv_newQuoDataCategory=xmlhttp.responseXML.getElementsByTagName("DataCategory");
				if(gv_newQuoDataCategory.length==0) alert("Cannot load details!");
				else {
					gv_scrollCurPage=0;
					gv_scrollTotPage=gv_newQuoDataCategory.length;
					//document.getElementById('cusCmds').style.visibility='hidden';
					setNewQuoPageScrollCommands("<input type='button' id='savenewquodata' value='Save' onclick='saveNewQuoData();' />","");
					showNewQuoDataPage("Load");
				}
			}
			document.getElementById('idloading').style.visibility='hidden';
		}
	}
	xmlhttp.send(null);
	document.getElementById('idloading').style.visibility='visible';
	gv_newQuoEditedName=null;
	gv_newQuoEditedValue=null;
}
function showNewQuoDetail(cmdid)
{
	gv_newQuoEditingData=0;
	getNewQuoDetail();

}
function editNewQuoDetail(cmdid)
{
	gv_newQuoEditingData=1;
	getNewQuoDetail();
}




function  doNewQuotation()
{
    var url = gv_rooturl+"?cmd=NewQuoDetail";
    var xmlhttp = newHttpRequest(url,true);
	if( xmlhttp==null ) return;
	xmlhttp.onreadystatechange=function() { 
		if (xmlhttp.readyState==4 ) {
			if( xmlhttp.status!=200 ) alert("Connection error");
			else 
			{
			gv_newQuoDataCategory=xmlhttp.responseXML.getElementsByTagName("DataCategory"); 
				if(gv_newQuoDataCategory.length==0) alert("Cannot load details!");
				else {
				    
					gv_scrollCurPage=0;
					gv_scrollTotPage=gv_newQuoDataCategory.length;
					gv_newQuoEditingData=1;
					setNewQuoPageScrollCommands("<input type='button' id='savenewquodata' value='Save' onclick='saveNewQuoData();' />","");
					showNewQuoDataPage("FirstLoad"); 
				}
			}
			document.getElementById('idloading').style.visibility='hidden';		
		}
			    
	}
	  
	xmlhttp.send(null);
	document.getElementById('idloading').style.visibility='visible';
	
}

function getNewQuoSysTime()
{
  var myDate,s = "";
  myDate = new Date();
  var Day = (myDate.getDate() > 9) ? myDate.getDate() : "0" + myDate.getDate();
  var Month = (myDate.getMonth() + 1) > 9 ? (myDate.getMonth() + 1) : "0" + (myDate.getMonth() + 1);
  s += Day + "/" + Month + "/" + myDate.getFullYear();
  return s;
}

var NewQuoOrder_Date = getNewQuoSysTime();
var NewQuoCustomer_ACRef="",NewQuoDelivery="", NewQuoOrder_Type='',NewQuoFormat='',NewQuoCustomer_Order_Number='',NewQuoOrder_Number='',NewQuoTotal_GBP='',NewQuoTotal_VAT='',NewQuoCarriage_GBP='',NewQuoCarriage_VAT='',NewQuoGross_GBP='',NewQuoCustomer_Tel_No='',NewQuoCustomer_Contact='',NewQuoNet_GBP='',NewQuoTax_Code='',NewQuoVAT_GBP='',NewQuoNC='',NewQuoDepartment='',NewQuoConsign_Number='',NewQuoCourier='',NewQuoDays='',NewQuoDiscount='',NewQuoAmount_GBP='',NewQuoSet_Total_GBP='',NewQuoSet_Gross_GBP,NewQuoDetails='',NewQuoPayment_Ref='',NewQuoBank_Account='';
var NewQuoPayment_Amount_GBP='',NewQuoAddress1="",NewQuoAddress2="",NewQuoAddress3="",NewQuoAddress4="",NewQuoAddress5="",NewQuoName="",NewQuoDelivery_Street1='',NewQuoDelivery_Street2='',NewQuoDelivery_Town='',NewQuoDelivery_County='',NewQuoDelivery_Post_Code="";
var NewQuoGlobal_Tax_Code = "";NewQuoGlobal_Department = "";NewQuoGlobal_NC = "";

function showNewQuoDataPage(NewQuoHasStatus)
{	  
     
 //if(gv_newsopAC.length==0) return;
    gv_tempTable = document.getElementById('tempTable');
	var ycur=gv_tempTable.style.pixelTop=gv_device==Nokia ? 28:26;	
	var tdh="height='"+gv_newQuoRowH+"px'";  //height='24px'
   	if(gv_device!=Nokia) {
			var mleft=document.getElementById('img_mleft3');
			mleft.onclick=newQuoPageLeft;
			mleft.style.cursor='hand';
			var mright=document.getElementById('img_mright3');
			mright.onclick=newQuoPageRight;
			mright.style.cursor='hand';
		}
    gv_tempTable.style.left='0px';
    gv_tempTable.style.visibility='visible';
    if(gv_device!=Nokia) {
		var btnBack=document.getElementById("back2submenu");
		btnBack.style.pixelTop=gv_winh-28;
		btnBack.style.visibility = "visible";
	}
	gv_newQuoFocusIndex=gv_newQuoIndex;
    var newquocmd = document.getElementById('sopCmds');
	newquocmd.style.pixelLeft=gv_winw-newquocmd.style.pixelWidth-1;
	newquocmd.style.pixelTop = gv_winh-29;
    newquocmd.style.visibility='visible';

 // gv_tempTable = document.getElementById('tempTable');
 	var widstyle="style='width:"+Math.round(gv_winw/2).toString()+"px' ";
	var tabstr="<table cellpadding='1' cellspacing='0' style='position:absolute;background-color:#98F898;width:"+(gv_winw-4)+"px;left:2px;'>"; 
	var rowJump="<tr><td align=right "+tdh+">Jump to Page &nbsp</td><td><select class='edtxt' "+widstyle+" id='selnewquocat' onchange='jumpToNewQuoCat();'>";
    for(var ic=0; ic<gv_newQuoDataCategory.length; ic++) {
		var attName0=gv_newQuoDataCategory[ic].attributes.getNamedItem("title");
		if(attName0) {
			var tname=attName0.value.replace('_',' ');
			rowJump+="<option label='"+tname+"'";
			if(ic==gv_scrollCurPage) rowJump+=" selected=true";
			rowJump+=">"+tname+"</option>";
		}
	}	
	rowJump+="</select></td></tr>";	       
 for(var ic=gv_scrollCurPage; ic<gv_newQuoDataCategory.length; ic++) {
		var attName=gv_newQuoDataCategory[ic].attributes.getNamedItem("title");	
		if(attName==null) continue;
		var rowtxt=ic==gv_scrollCurPage ? rowJump:'';
		rowtxt += "<tr><td colspan=2 align=center "+tdh+" style='color:blue;font-weight:bold;text-decoration:underline;'>"
			+attName.value+"</td></tr>";	                   
			ycur+=gv_newQuoRowH;
	var curNode=gv_newQuoDataCategory[ic].firstChild;
		var end_tdr = gv_newQuoEditingData==1 ? "></td></tr>":" ReadOnly></td></tr>";	
    while( curNode ) 
		{
			var itemName=curNode.nodeName;
			var itemId=ic.toString()+"_"+itemName;	
			var ndv=curNode.firstChild;
	        var itemVal=getEditedNewQuoData(itemId);
		   	if(itemVal==null) itemVal=ndv?ndv.nodeValue:'';
		if(NewQuoHasStatus == "FirstLoad")  
		{
					if(curNode.nodeName=='Customer_ACRef')	
  			 {
  		        NewQuoCustomer_ACRef="";         
	            rowtxt+="<tr><td align=right "+tdh+">Customer A/C &nbsp<br>Ref <span style='color:red'>*</span></td>";
			    rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' onchange='showSaveNewQuoDataButton();' style='width:125px;height:20px;'value='"+NewQuoCustomer_ACRef+"' id='NewQuoCustomer_ACRef'><input type='Button'  Value='Get' id='newQuoGetCustomer_ACRef' onclick='newQuoGetCustomer_ACRef()'    Runat='server' style='color:blue;font-weight:bold;width:35px;height:20px;text-decoration:underline;'/></td></tr>";//<input type='Button' value='Get' onclick='getSupplierACRef();' runat='server' style='color: blue; width: 35px;height: 20px; font-weight: bold; text-decoration: underline;' /></td>";
			   // NewQuoCustomer_ACRef=itemVal;
  		     }
      
	
			 else if(itemName=="Order_Type")
             {
                 var rowJumpOrder_Type="<tr><td align='right'"+tdh+">Order Type &nbsp</td><td><select class='edtxt' id='NewQuoOrder_Type' ReadOnly "+widstyle+"  onchange='NewQuoTaxCode();'>"
                 rowJumpOrder_Type+="<option value='Quote' selected = 'true'";
                rowJumpOrder_Type+=">Quote</option>";
                 rowtxt+=rowJumpOrder_Type+"</select></td></tr>";
	          }
	          
			 else if(itemName=="Format")
             {
                 var rowJumpFormat="<tr><td align='right'"+tdh+">Format &nbsp</td><td><select class='edtxt' id='NewQuoFormat' "+widstyle+"  onchange='NewQuoTaxCode();'>"
                 rowJumpFormat+="<option value='Product'>Product</option><option value='Service'"
                 if(NewQuoFormat == 'Service'){ rowJumpFormat+="selected = 'true'";}
                rowJumpFormat+=">Service</option>";
                 rowtxt+=rowJumpFormat+"</select></td></tr>";
	          }
			else if(itemName=="Order_Date")
			{
			   //NewQuoOrder_Date="";
               rowtxt+="<tr><td align=right "+tdh+">Order Date &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoOrder_Date+"' id='NewQuoOrder_Date'>";	  

			}
//			else if(itemName=="Order_Number")
//			{
//               rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"</td>";
//               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;'value='"+gv_supName[gv_supIndex]+"' id='"+itemId+"'>";	  

//			}
			
			
			else if(itemName=="Customer_Order_Number")
			{
			   NewQuoCustomer_Order_Number = "";
               rowtxt+="<tr><td align=right "+tdh+">Customer Order &nbsp<br>Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Order_Number+"' id='NewQuoCustomer_Order_No'>";	  

			}
			else if(itemName=="Order_Number")
			{
			   NewQuoOrder_Number = "";
               rowtxt+="<tr><td align=right "+tdh+">Order Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoOrder_Number+"' id='NewQuoProject_ACRef'>";	  

			}
			
            else if(itemName=="Total_GBP")
			{
			   NewQuoTotal_GBP ="";
               rowtxt+="<tr><td align=right "+tdh+">Total GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoTotal_GBP+"' id='NewQuoTotal_GBP' ReadOnly>";	  

			}
			else if(itemName=="Total_VAT")
			{
			   NewQuoTotal_VAT = "";
               rowtxt+="<tr><td align=right "+tdh+">Total VAT &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoTotal_VAT+"' id='NewQuoTotal_VAT' ReadOnly >";	  

			}
			else if(itemName=="Carriage_GBP")
			{
			   NewQuoCarriage_GBP = "";
               rowtxt+="<tr><td align=right "+tdh+">Carriage GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCarriage_GBP+"' id='NewQuoCarriage_GBP'>";	  

			}
			else if(itemName=="Carriage_VAT")
			{
			   NewQuoCarriage_VAT = "";
               rowtxt+="<tr><td align=right "+tdh+">Carriage VAT &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCarriage_VAT+"' id='NewQuoCarriage_VAT'>";	  

			}
			else if(itemName=="Gross_GBP")
			{
			   NewQuoGross_GBP = "";
               rowtxt+="<tr><td align=right "+tdh+">Gross GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoGross_GBP+"' id='NewQuoGross_GBP' ReadOnly >";	  
			}
			else if(itemName=="Delivery")
			{
			   NewQuoDelivery="";
               rowtxt+="<tr><td align=right "+tdh+">Delivery &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery+"' id='NewQuoDelivery'>";	  
			}
			else if(itemName=="Address1")
			{
			   NewQuoAddress1="";
               rowtxt+="<tr><td align=right "+tdh+">Address1 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress1+"' id='NewQuoAddress1'>";	  
			}
			else if(itemName=="Address2")
			{
			   NewQuoAddress2="";
               rowtxt+="<tr><td align=right "+tdh+">Address2 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress2+"' id='NewQuoAddress2'>";	  
			}
			else if(itemName=="Address3")
			{
			   NewQuoAddress3="";
               rowtxt+="<tr><td align=right "+tdh+">Address3 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress3+"' id='NewQuoAddress3'>";	  
			}
			else if(itemName=="Address4")
			{
			   NewQuoAddress4="";
               rowtxt+="<tr><td align=right "+tdh+">Address4 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress4+"' id='NewQuoAddress4'>";	  
			}
			else if(itemName=="Address5")
			{
			   NewQuoAddress5="";
               rowtxt+="<tr><td align=right "+tdh+">Address5 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress5+"' id='NewQuoAddress5'>";	  
			}
			else if(itemName=="Name")
			{
			   NewQuoName="";
               rowtxt+="<tr><td align=right "+tdh+">Name <span style='color:red'>*</span></td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoName+"' id='NewQuoName'>";	  
			}
	       else if(itemName=="Delivery_Street1")
			{
               NewQuoDelivery_Street1="";
               rowtxt+="<tr><td align=right "+tdh+">Delivery Street1 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Street1+"' id='NewQuoDelivery_Street1'>";	  
			}
			else if(itemName=="Delivery_Street2")
			{
               NewQuoDelivery_Street2="";
               rowtxt+="<tr><td align=right "+tdh+">Delivery Street2 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Street2+"' id='NewQuoDelivery_Street2'>";	  
			}
			else if(itemName=="Delivery_Town")
			{
               NewQuoDelivery_Town="";
               rowtxt+="<tr><td align=right "+tdh+">Delivery Town &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Town+"' id='NewQuoDelivery_Town'>";	  
			}
			else if(itemName=="Delivery_County")
			{
               NewQuoDelivery_County="";
               rowtxt+="<tr><td align=right "+tdh+">Delivery County &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_County+"' id='NewQuoDelivery_County'>";	  
			}
			else if(itemName=="Delivery_Post_Code")
			{
			   NewQuoDelivery_Post_Code="";
               rowtxt+="<tr><td align=right "+tdh+">Delivery Post Code &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Post_Code+"' id='NewQuoDelivery_Post_Code'>";	  
			}
			
			else if(itemName=="Customer_Tel_No")
			{
               NewQuoCustomer_Tel_No="";
               rowtxt+="<tr><td align=right "+tdh+">Customer Tel No &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Tel_No+"' id='NewQuoCustomer_Tel_No'>";	  
			}
			else if(itemName=="Customer_Contact")
			{
               NewQuoCustomer_Contact="";
               rowtxt+="<tr><td align=right "+tdh+">Customer Contact &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Contact+"' id='NewQuoCustomer_Contact'>";	  
			}
			else if(itemName=="Net_GBP")
			{
			   NewQuoNet_GBP = "";
               rowtxt+="<tr><td align=right "+tdh+">Net GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoNet_GBP+"' id='NewQuoNet_GBP'>";	  

			}
//			else if(itemName=="Tax_Code")
//			{
//               rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"</td>";
//               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewSopDataButton();' value='"+NewSopTax_Code+"' id='Tax_Code'>";	  

//			}
              else if(itemName=="Tax_Code")
             {
                 var rowJumpTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt' id='NewQuoTax_Code'  "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attTaxCodeName=curNode.childNodes[i].childNodes[0].data;                      
                   if(attTaxCodeName) 
                   {
                    rowJumpTaxCode+="<option value='"+attTaxCodeName+"'";
                    
                    if(attTaxCodeName==NewQuoTax_Code) {rowJumpTaxCode+="selected=true";}
                    if(NewQuoTax_Code =="" && i == 1) 
                    { 
                       rowJumpTaxCode+="selected=true";
                       NewQuoTax_Code = attTaxCodeName;
                    }
                    rowJumpTaxCode+=">"+attTaxCodeName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpTaxCode+"</select></td></tr>";
	          }

			else if(itemName=="VAT_GBP")
			{
			   NewQuoVAT_GBP = "";
               rowtxt+="<tr><td align=right "+tdh+">V.A.T GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoVAT_GBP+"' id='NewQuoVAT_GBP'>";	  

			}
			else if(itemName=="NC")
			{
			   NewQuoNC = "";
               rowtxt+="<tr><td align=right "+tdh+">N/C &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoNC+"' id='NewQuoNC'>";	  

			}
			
            else if(itemName=="Department")
             {
                 var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt' id='NewQuoDepartment' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attDepartmentName=curNode.childNodes[i].childNodes[0].data;                       
                   if(attDepartmentName) 
                   {
                    rowJumpDepartment+="<option value='"+attDepartmentName+"'";
                    if(attDepartmentName==NewQuoDepartment) {rowJumpDepartment+="selected=true";}
                    if(NewQuoDepartment == "" && i ==0)  {rowJumpDepartment+="selected=true";NewQuoDepartment =attDepartmentName; }
                    rowJumpDepartment+=">"+attDepartmentName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpDepartment+"</select></td></tr>";
	          }

			else if(itemName=="Consign_Number")
			{
			   NewQuoConsign_Number = "";
               rowtxt+="<tr><td align=right "+tdh+">Consign. Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoConsign_Number+"' id='NewQuoConsign_Number'>";	  

			}

            else if(itemName=="Courier")
             {
                 var rowJumpCourier="<tr><td align='right'"+tdh+">Courier &nbsp</td><td><select class='edtxt'  id='NewQuoCourier' "+widstyle+" onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attCourierName=curNode.childNodes[i].childNodes[0].data;                        
                   if(attCourierName) 
                   {
                    rowJumpCourier+="<option value='"+attCourierName+"'";
                    if(attCourierName==NewQuoCourier) {rowJumpCourier+="selected=true";}
                    if(NewQuoCourier == "" && i == 0)  {rowJumpCourier+="selected=true"; NewQuoCourier = attCourierName;}
                    rowJumpCourier+=">"+attCourierName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpCourier+"</select></td></tr>";
	          }

			else if(itemName=="Days")
			{
               NewQuoDays="";
               rowtxt+="<tr><td align=right "+tdh+">Days &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDays+"' id='NewQuoDays'>";	  
			}
			else if(itemName=="Discount")
			{
               NewQuoDiscount="";
               rowtxt+="<tr><td align=right "+tdh+">Discount% &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDiscount+"' id='NewQuoDiscount'>";	  
			}
			else if(itemName=="Amount_GBP")
			{
			   NewQuoAmount_GBP = "";
               rowtxt+="<tr><td align=right "+tdh+">Amount GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAmount_GBP+"' id='NewQuoAmount_GBP' ReadOnly >";	  

			}
			else if(itemName=="Set_Total_GBP")
			{
			   NewQuoSet_Total_GBP = "";
               rowtxt+="<tr><td align=right "+tdh+">Total GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoSet_Total_GBP+"' id='NewQuoSet_Total_GBP' ReadOnly >";	  

			}  
			else if(itemName=="Set_Gross_GBP")
			{
			   NewQuoSet_Gross_GBP = "";
               rowtxt+="<tr><td align=right "+tdh+">Gross GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoSet_Gross_GBP+"' id='NewQuoSet_Gross_GBP' ReadOnly >";	  
			}
			 else if(itemName=="G_NC")
			{
			   NewQuoGlobal_NC = "";
               rowtxt+="<tr><td align=right "+tdh+">N/C &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoGlobal_NC+"' id='NewQuoGlobal_NC'>";	  

			}  
			else if(itemName=="Details")
			{
               NewQuoDetails="";
               rowtxt+="<tr><td align=right "+tdh+">Details &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDetails+"' id='NewQuoDetails'>";	  
			}  

             else if(itemName=="G_Tax_Code")
             {
                 var rowJumpGTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt' id='NewQuoG_Tax_Code'  "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attGTaxCodeName=curNode.childNodes[i].childNodes[0].data;                    
                   if(attGTaxCodeName) 
                   {
                    rowJumpGTaxCode+="<option value='"+attGTaxCodeName+"'";
                    if(attGTaxCodeName==NewQuoGlobal_Tax_Code)  {rowJumpGTaxCode+="selected=true";}
                    if(NewQuoGlobal_Tax_Code == "" && i == 1)  {rowJumpGTaxCode+="selected=true";}
                    rowJumpGTaxCode+=">"+attGTaxCodeName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpGTaxCode+"</select></td></tr>";
                   
	          }
			 else if(itemName=="G_Department")
             {
                 var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt' id='NewQuoG_Department' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attDepartmentName=curNode.childNodes[i].childNodes[0].data;                      
                   if(attDepartmentName) 
                   {
                    rowJumpDepartment+="<option value='"+attDepartmentName+"'";
                    if(attDepartmentName==NewQuoGlobal_Department) {rowJumpDepartment+="selected=true";}
                    if(NewQuoGlobal_Department == "" && i == 0)   {rowJumpDepartment+="selected=true";}
                    rowJumpDepartment+=">"+attDepartmentName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpDepartment+"</select></td></tr>";
	          }
			else if(itemName=="Payment_Ref")
			{
               NewQuoPayment_Ref="";
               rowtxt+="<tr><td align=right "+tdh+">Payment Ref &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoPayment_Ref+"' id='NewQuoPayment_Ref'>";	  
			} 
			else if(itemName=="Bank_Account")
             {
                 var rowJumpBank_Account="<tr><td align='right'"+tdh+">Bank Account &nbsp</td><td><select class='edtxt' id='NewQuoBank_Account' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attBank_AccountName=curNode.childNodes[i].childNodes[0].data;                        
                   if(attBank_AccountName) 
                   {
                    rowJumpBank_Account+="<option value='"+attBank_AccountName+"'";
                    if(attBank_AccountName==NewQuoBank_Account) { rowJumpBank_Account+="selected=true";}
                    if(NewQuoBank_Account == "" && i == 0)  { rowJumpBank_Account+="selected=true";}
                    rowJumpBank_Account+=">"+attBank_AccountName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpBank_Account+"</select></td></tr>";
	          }

			else if(itemName=="Payment_Amount_GBP")
			{
			   NewQuoPayment_Amount_GBP = "";
               rowtxt+="<tr><td align=right "+tdh+">Payment Amount &nbsp<br>GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoPayment_Amount_GBP+"' id='NewQuoPayment_Amount_GBP'>";	  

			}  
     
      else 	if(curNode.nodeName=='Item_No')	
			 {
			 var rowNewQuoJump="<tr><td align=right "+tdh+">Item No &nbsp</td><td><select class='edtxt' "+widstyle+" id='selnewquoitempagecat'>";
                  
                     var sopItems = curNode.firstChild;	 
                  for(var i=0; i<curNode.childNodes.length;i++)   
	           {
	           var attNewQuoName=curNode.childNodes[i].childNodes[0].data;                          
	             	if(attNewQuoName) 
	             	{
			            var tname1=attNewQuoName.replace('_',' ');
		                  rowNewQuoJump+="<option label='"+tname1+"'";
		                   	if(i==gv_scrollCurPage) rowNewQuoJump+=" selected=true";
		                       rowNewQuoJump+=">"+tname1+"</option>";		   
		             }
            	}	 
                  
                  
	                 rowNewQuoJump+="<tr><td colspan=2 align=center "+tdh+" style='color:blue;font-weight:bold';><input type='Button'  Value='AddItem' id='addnewquoitemturnbtn'  onclick='getNewQuoItemPage()' Runat='server' style='color:blue;font-weight:bold;width:65px;height:20px;text-decoration:underline;'/>";
	                 rowNewQuoJump+="&nbsp&nbsp&nbsp&nbsp&nbsp<input type='Button'  Value='EditItem' id='editnewquoitemturnbtn'  onclick='getEditNewQuoItemPage()' Runat='server' style='color:blue;font-weight:bold;width:65px;height:20px;text-decoration:underline;'  disabled='true';/></td></tr>";
	                  rowtxt+=rowNewQuoJump;
	               
	          
	           }
		} 	
		if(NewQuoHasStatus == "Load")  
		{
			if(curNode.nodeName=='Customer_ACRef')	
  			 {
  		        NewQuoCustomer_ACRef=itemVal;         
	            rowtxt+="<tr><td align=right "+tdh+">Customer A/C &nbsp<br>Ref <span style='color:red'>*</span></td>";
			    rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' onchange='showSaveNewQuoDataButton();' style='width:125px;height:20px;'value='"+NewQuoCustomer_ACRef+"' id='NewQuoCustomer_ACRef'><input type='Button'  Value='Get' id='newQuoGetCustomer_ACRef' onclick='newQuoGetCustomer_ACRef()'    Runat='server' style='color:blue;font-weight:bold;width:35px;height:20px;text-decoration:underline;'/></td></tr>";//<input type='Button' value='Get' onclick='getSupplierACRef();' runat='server' style='color: blue; width: 35px;height: 20px; font-weight: bold; text-decoration: underline;' /></td>";
			    //NewQuoCustomer_ACRef=itemVal;
  		     }
      
	
			 else if(itemName=="Order_Type")
             {
                 var rowJumpOrder_Type="<tr><td align='right'"+tdh+">Order Type &nbsp</td><td><select class='edtxt' id='NewQuoOrder_Type' ReadOnly  "+widstyle+"  onchange='NewQuoTaxCode();'>"
                 rowJumpOrder_Type+="<option value='Quote' selected = 'true'";
                rowJumpOrder_Type+=">Quote</option>";
                 rowtxt+=rowJumpOrder_Type+"</select></td></tr>";
	          }
	          
			 else if(itemName=="Format")
             {
                 var rowJumpFormat="<tr><td align='right'"+tdh+">Format &nbsp</td><td><select class='edtxt' id='NewQuoFormat' "+widstyle+"  onchange='NewQuoTaxCode();'>"
                 rowJumpFormat+="<option value='Product'>Product</option><option value='Service'"
                 if(NewQuoFormat == 'Service'){ rowJumpFormat+="selected = 'true'";}
                rowJumpFormat+=">Service</option>";
                 rowtxt+=rowJumpFormat+"</select></td></tr>";
	          }
			else if(itemName=="Order_Date")
			{
               rowtxt+="<tr><td align=right "+tdh+">Order Date &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoOrder_Date+"' id='NewQuoOrder_Date'>";	  

			}
//			else if(itemName=="Order_Number")
//			{
//               rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"</td>";
//               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;'value='"+gv_supName[gv_supIndex]+"' id='"+itemId+"'>";	  

//			}
			
			
			else if(itemName=="Customer_Order_Number")
			{
			   NewQuoCustomer_Order_Number = itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Customer Order &nbsp<br>Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Order_Number+"' id='NewQuoCustomer_Order_Number'>";	  

			}
			else if(itemName=="Order_Number")
			{
			    NewQuoOrder_Number = itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Order Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoOrder_Number+"' id='NewQuoOrder_Number'>";	  

			}
			
            else if(itemName=="Total_GBP")
			{
			   NewQuoTotal_GBP = itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Total GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoTotal_GBP+"' id='NewQuoTotal_GBP' ReadOnly >";	  
			}
			else if(itemName=="Total_VAT")
			{
			    NewQuoTotal_VAT = itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Total VAT &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoTotal_VAT+"' id='NewQuoTotal_VAT' ReadOnly >";	  
			}
			else if(itemName=="Carriage_GBP")
			{
			    NewQuoCarriage_GBP = itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Carriage GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCarriage_GBP+"' id='NewQuoCarriage_GBP'>";	  

			}
			else if(itemName=="Carriage_VAT")
			{
			   NewQuoCarriage_VAT = itemVal; 
               rowtxt+="<tr><td align=right "+tdh+">Carriage VAT &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCarriage_VAT+"' id='NewQuoCarriage_VAT'>";	  

			}
			else if(itemName=="Gross_GBP")
			{
			   NewQuoGross_GBP = itemVal; 
               rowtxt+="<tr><td align=right "+tdh+">Gross GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoGross_GBP+"' id='NewQuoGross_GBP' ReadOnly >";	  
			}
			else if(itemName=="Delivery")
			{
			   NewQuoDelivery=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Delivery &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery+"' id='NewQuoDelivery'>";	  
			}
			else if(itemName=="Address1")
			{
			   NewQuoAddress1=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Address1 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress1+"' id='NewQuoAddress1'>";	  
			}
			else if(itemName=="Address2")
			{
			   NewQuoAddress2=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Address2 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress2+"' id='NewQuoAddress2'>";	  
			}
			else if(itemName=="Address3")
			{
			   NewQuoAddress3=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Address3 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress3+"' id='NewQuoAddress3'>";	  
			}
			else if(itemName=="Address4")
			{
			   NewQuoAddress4=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Address4 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress4+"' id='NewQuoAddress4'>";	  
			}
			else if(itemName=="Address5")
			{
			   NewQuoAddress5=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Address5 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress5+"' id='NewQuoAddress5'>";	  
			}
			else if(itemName=="Name")
			{
			   NewQuoName=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Name <span style='color:red'>*</span></td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoName+"' id='NewQuoName'>";	  
			}
	       else if(itemName=="Delivery_Street1")
			{
               NewQuoDelivery_Street1=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Delivery Street1 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Street1+"' id='NewQuoDelivery_Street1'>";	  
			}
			else if(itemName=="Delivery_Street2")
			{
               NewQuoDelivery_Street2=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Delivery Street2 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Street2+"' id='NewQuoDelivery_Street2'>";	  
			}
			else if(itemName=="Delivery_Town")
			{
               NewQuoDelivery_Town=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Delivery Town &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Town+"' id='NewQuoDelivery_Town'>";	  
			}
			else if(itemName=="Delivery_County")
			{
               NewQuoDelivery_County=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Delivery County &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_County+"' id='NewQuoDelivery_County'>";	  
			}
			else if(itemName=="Delivery_Post_Code")
			{
			   NewQuoDelivery_Post_Code=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Delivery Post Code &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Post_Code+"' id='NewQuoDelivery_Post_Code'>";	  
			}
			
			else if(itemName=="Customer_Tel_No")
			{
               NewQuoCustomer_Tel_No=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Customer Tel No &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Tel_No+"' id='NewQuoCustomer_Tel_No'>";	  
			}
			else if(itemName=="Customer_Contact")
			{
               NewQuoCustomer_Contact=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Customer Contact &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Contact+"' id='NewQuoCustomer_Contact'>";	  
			}
			else if(itemName=="Net_GBP")
			{
			   NewQuoNet_GBP = itemVal; 
               rowtxt+="<tr><td align=right "+tdh+">Net GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoNet_GBP+"' id='NewQuoNet_GBP'>";	  

			}
//			else if(itemName=="Tax_Code")
//			{
//               rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"</td>";
//               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewSopDataButton();' value='"+NewSopTax_Code+"' id='Tax_Code'>";	  

//			}
              else if(itemName=="Tax_Code")
             {
                 var rowJumpTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt' id='NewQuoTax_Code'  "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attTaxCodeName=curNode.childNodes[i].childNodes[0].data;                     
                   if(attTaxCodeName) 
                   {
                    rowJumpTaxCode+="<option value='"+attTaxCodeName+"'";
                    
                    if(attTaxCodeName==NewQuoTax_Code) {rowJumpTaxCode+="selected=true";}
                    if(NewQuoTax_Code =="" && i == 1) 
                    { 
                       rowJumpTaxCode+="selected=true";
                       NewQuoTax_Code = attTaxCodeName;
                    }
                    rowJumpTaxCode+=">"+attTaxCodeName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpTaxCode+"</select></td></tr>";
	          }

			else if(itemName=="VAT_GBP")
			{
			    NewQuoVAT_GBP = itemVal;
               rowtxt+="<tr><td align=right "+tdh+">V.A.T GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoVAT_GBP+"' id='NewQuoVAT_GBP'>";	  

			}
			else if(itemName=="NC")
			{
			    NewQuoNC = itemVal;
               rowtxt+="<tr><td align=right "+tdh+">N/C &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoNC+"' id='NewQuoNC'>";	  

			}
			
            else if(itemName=="Department")
             {
                 var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt' id='NewQuoDepartment' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attDepartmentName=curNode.childNodes[i].childNodes[0].data;               
                   if(attDepartmentName) 
                   {
                    rowJumpDepartment+="<option value='"+attDepartmentName+"'";
                    if(attDepartmentName==NewQuoDepartment) {rowJumpDepartment+="selected=true";}
                    if(NewQuoDepartment == "" && i ==0)  {rowJumpDepartment+="selected=true";NewQuoDepartment =attDepartmentName; }
                    rowJumpDepartment+=">"+attDepartmentName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpDepartment+"</select></td></tr>";
	          }

			else if(itemName=="Consign_Number")
			{
			    NewQuoConsign_Number = itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Consign. Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoConsign_Number+"' id='NewQuoConsign_Number'>";	  

			}

            else if(itemName=="Courier")
             {
                 var rowJumpCourier="<tr><td align='right'"+tdh+">Courier &nbsp</td><td><select class='edtxt'  id='NewQuoCourier' "+widstyle+" onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attCourierName=curNode.childNodes[i].childNodes[0].data;                        
                   if(attCourierName) 
                   {
                    rowJumpCourier+="<option value='"+attCourierName+"'";
                    if(attCourierName==NewQuoCourier) {rowJumpCourier+="selected=true";}
                    if(NewQuoCourier == "" && i == 0)  {rowJumpCourier+="selected=true"; NewQuoCourier = attCourierName;}
                    rowJumpCourier+=">"+attCourierName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpCourier+"</select></td></tr>";
	          }

			else if(itemName=="Days")
			{
               NewQuoDays=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Days &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDays+"' id='NewQuoDays'>";	  
			}
			else if(itemName=="Discount")
			{
               NewQuoDiscount=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Discount% &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDiscount+"' id='NewQuoDiscount'>";	  
			}
			else if(itemName=="Amount_GBP")
			{
			  if(NewQuoTotal_GBP != "" && NewQuoDiscount != "") { NewQuoAmount_GBP = NewQuoTotal_GBP * NewQuoDiscount / 100;}
               rowtxt+="<tr><td align=right "+tdh+">Amount GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAmount_GBP+"' id='NewQuoAmount_GBP' ReadOnly >";	  

			}
			else if(itemName=="Set_Total_GBP")
			{
			   if(NewQuoGross_GBP != '' && NewQuoAmount_GBP != '') { NewQuoSet_Total_GBP = NewQuoGross_GBP - NewQuoAmount_GBP;}
			
               rowtxt+="<tr><td align=right "+tdh+">Total GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoSet_Total_GBP+"' id='NewQuoSet_Total_GBP' ReadOnly >";	  

			}  
			else if(itemName=="Set_Gross_GBP")
			{
				if(NewQuoCarriage_GBP != "" && NewQuoCarriage_VAT != "") 
			    {NewQuoSet_Gross_GBP=parseFloat(NewQuoCarriage_GBP) + parseFloat(NewQuoCarriage_VAT);}
               rowtxt+="<tr><td align=right "+tdh+">Gross GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoSet_Gross_GBP+"' id='NewQuoSet_Gross_GBP' ReadOnly >";	  
			}
			 else if(itemName=="G_NC")
			{
			   NewQuoGlobal_NC = itemVal; 
               rowtxt+="<tr><td align=right "+tdh+">N/C &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoGlobal_NC+"' id='NewQuoGlobal_NC'>";	  

			}  
			else if(itemName=="Details")
			{
               NewQuoDetails=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Details &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDetails+"' id='NewQuoDetails'>";	  
			}  

             else if(itemName=="G_Tax_Code")
             {
                 var rowJumpGTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt' id='NewQuoG_Tax_Code'  "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attGTaxCodeName=curNode.childNodes[i].childNodes[0].data;                         
                   if(attGTaxCodeName) 
                   {
                    rowJumpGTaxCode+="<option value='"+attGTaxCodeName+"'";
                    if(attGTaxCodeName==NewQuoGlobal_Tax_Code)  {rowJumpGTaxCode+="selected=true";}
                    if(NewQuoGlobal_Tax_Code == "" && i == 1)  {rowJumpGTaxCode+="selected=true";}
                    rowJumpGTaxCode+=">"+attGTaxCodeName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpGTaxCode+"</select></td></tr>";
                   
	          }
			 else if(itemName=="G_Department")
             {
                 var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt' id='NewQuoG_Department' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attDepartmentName=curNode.childNodes[i].childNodes[0].data;                     
                   if(attDepartmentName) 
                   {
                    rowJumpDepartment+="<option value='"+attDepartmentName+"'";
                    if(attDepartmentName==NewQuoGlobal_Department) {rowJumpDepartment+="selected=true";}
                    if(NewQuoGlobal_Department == "" && i == 0)   {rowJumpDepartment+="selected=true";}
                    rowJumpDepartment+=">"+attDepartmentName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpDepartment+"</select></td></tr>";
	          }
			else if(itemName=="Payment_Ref")
			{
               NewQuoPayment_Ref=itemVal;
               rowtxt+="<tr><td align=right "+tdh+">Payment Ref &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoPayment_Ref+"' id='NewQuoPayment_Ref'>";	  
			} 
			else if(itemName=="Bank_Account")
             {
                 var rowJumpBank_Account="<tr><td align='right'"+tdh+">Bank Account &nbsp</td><td><select class='edtxt' id='NewQuoBank_Account' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attBank_AccountName=curNode.childNodes[i].childNodes[0].data;                      
                   if(attBank_AccountName) 
                   {
                    rowJumpBank_Account+="<option value='"+attBank_AccountName+"'";
                    if(attBank_AccountName==NewQuoBank_Account) { rowJumpBank_Account+="selected=true";}
                    if(NewQuoBank_Account == "" && i == 0)  { rowJumpBank_Account+="selected=true";}
                    rowJumpBank_Account+=">"+attBank_AccountName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpBank_Account+"</select></td></tr>";
	          }

			else if(itemName=="Payment_Amount_GBP")
			{
               rowtxt+="<tr><td align=right "+tdh+">Payment Amount &nbsp<br>GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoPayment_Amount_GBP+"' id='NewQuoPayment_Amount_GBP'>";	  

			}  
     
             else if(curNode.nodeName=='Item_No')	
			 {
			     var rowNewQuoJump="<tr><td align=right "+tdh+">Item No &nbsp</td><td><select class='edtxt' "+widstyle+" id='selnewquoitempagecat' >";
                 rowNewQuoJump += addNewQuoDropDownValue;
                 
                 rowNewQuoJump += "</select></td></tr>";

	             rowNewQuoJump+="<tr><td colspan=2 align=center "+tdh+" style='color:blue;font-weight:bold;'><input type='Button'  Value='Add Item' id='addnewquoitemturnbtn'  onclick='getNewQuoItemPage()' Runat='server' style='color:blue;font-weight:bold;width:65px;height:20px;text-decoration:underline;'/>";
	             rowNewQuoJump+="&nbsp&nbsp&nbsp&nbsp&nbsp<input type='Button'  Value='EditItem' id='editnewquoitemturnbtn' onclick='getEditNewQuoItemPage()' Runat='server' style='color:blue;font-weight:bold;width:65px;height:20px;text-decoration:underline;'  disabled='true';/></td></tr>";

	             rowtxt+=rowNewQuoJump;
	               
	          
	           }
         }
        if(NewQuoHasStatus == "OtherLoad")  
		{
			if(curNode.nodeName=='Customer_ACRef')	
  			 {
  		        NewQuoCustomer_ACRef=itemVal;         
	            rowtxt+="<tr><td align=right "+tdh+">Customer A/C &nbsp<br>Ref <span style='color:red'>*</span></td>";
			    rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' onchange='showSaveNewQuoDataButton();' style='width:125px;height:20px;'value='"+NewQuoCustomer_ACRef+"' id='NewQuoCustomer_ACRef'><input type='Button'  Value='Get' id='newQuoGetCustomer_ACRef' onclick='newQuoGetCustomer_ACRef()'    Runat='server' style='color:blue;font-weight:bold;width:35px;height:20px;text-decoration:underline;'/></td></tr>";//<input type='Button' value='Get' onclick='getSupplierACRef();' runat='server' style='color: blue; width: 35px;height: 20px; font-weight: bold; text-decoration: underline;' /></td>";
			    //NewQuoCustomer_ACRef=itemVal;
  		     }
      
	
			 else if(itemName=="Order_Type")
             {
                 var rowJumpOrder_Type="<tr><td align='right'"+tdh+">Order Type &nbsp</td><td><select class='edtxt' id='NewQuoOrder_Type' ReadOnly  "+widstyle+"  onchange='NewQuoTaxCode();'>"
                 rowJumpOrder_Type+="<option value='Quote' selected = 'true'";
                rowJumpOrder_Type+=">Quote</option>";
                 rowtxt+=rowJumpOrder_Type+"</select></td></tr>";
	          }
	          
			 else if(itemName=="Format")
             {
                 var rowJumpFormat="<tr><td align='right'"+tdh+">Format &nbsp</td><td><select class='edtxt' id='NewQuoFormat' "+widstyle+"  onchange='NewQuoTaxCode();'>"
                 rowJumpFormat+="<option value='Product'>Product</option><option value='Service'"
                 if(NewQuoFormat == 'Service'){ rowJumpFormat+="selected = 'true'";}
                rowJumpFormat+=">Service</option>";
                 rowtxt+=rowJumpFormat+"</select></td></tr>";
	          }
			else if(itemName=="Order_Date")
			{
               rowtxt+="<tr><td align=right "+tdh+">Order Date &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoOrder_Date+"' id='NewQuoOrder_Date'>";	  

			}
//			else if(itemName=="Order_Number")
//			{
//               rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"</td>";
//               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;'value='"+gv_supName[gv_supIndex]+"' id='"+itemId+"'>";	  

//			}
			
			
			else if(itemName=="Customer_Order_Number")
			{
               rowtxt+="<tr><td align=right "+tdh+">Customer Order &nbsp<br>Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Order_Number+"' id='NewQuoCustomer_Order_No'>";	  

			}
			else if(itemName=="Order_Number")
			{
               rowtxt+="<tr><td align=right "+tdh+">Order Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoOrder_Number+"' id='NewQuoProject_ACRef'>";	  

			}
			
            else if(itemName=="Total_GBP")
			{
               rowtxt+="<tr><td align=right "+tdh+">Total GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoTotal_GBP+"' id='NewQuoTotal_GBP' ReadOnly >";	  

			}
			else if(itemName=="Total_VAT")
			{
               rowtxt+="<tr><td align=right "+tdh+">Total VAT &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoTotal_VAT+"' id='NewQuoTotal_VAT' ReadOnly >";	  

			}
			else if(itemName=="Carriage_GBP")
			{
               rowtxt+="<tr><td align=right "+tdh+">Carriage GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCarriage_GBP+"' id='NewQuoCarriage_GBP'>";	  

			}
			else if(itemName=="Carriage_VAT")
			{
               rowtxt+="<tr><td align=right "+tdh+">Carriage VAT &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCarriage_VAT+"' id='NewQuoCarriage_VAT'>";	  

			}
			else if(itemName=="Gross_GBP")
			{
               rowtxt+="<tr><td align=right "+tdh+">Gross GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoGross_GBP+"' id='NewQuoGross_GBP' ReadOnly >";	  
			}
			else if(itemName=="Delivery")
			{
			  // if(NewQuoDelivery == "") { NewQuoDelivery=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Delivery &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery+"' id='NewQuoDelivery'>";	  
			}
			else if(itemName=="Address1")
			{
			   //if(NewQuoAddress1 == "") { NewQuoAddress1=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Address1 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress1+"' id='NewQuoAddress1'>";	  
			}
			else if(itemName=="Address2")
			{
			   //if(NewQuoAddress2 == "") { NewQuoAddress2=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Address2 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress2+"' id='NewQuoAddress2'>";	  
			}
			else if(itemName=="Address3")
			{
			   //if(NewQuoAddress3 == "") { NewQuoAddress3=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Address3 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress3+"' id='NewQuoAddress3'>";	  
			}
			else if(itemName=="Address4")
			{
			   //if(NewQuoAddress4 == "") { NewQuoAddress4=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Address4 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress4+"' id='NewQuoAddress4'>";	  
			}
			else if(itemName=="Address5")
			{
			   //if(NewQuoAddress5 == "") { NewQuoAddress5=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Address5 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAddress5+"' id='NewQuoAddress5'>";	  
			}
			else if(itemName=="Name")
			{
			   //if(NewQuoName == "")  { NewQuoName=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Name <span style='color:red'>*</span></td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoName+"' id='NewQuoName'>";	  
			}
	       else if(itemName=="Delivery_Street1")
			{
               //if(NewQuoDelivery_Street1 == "") { NewQuoDelivery_Street1=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Delivery Street1 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Street1+"' id='NewQuoDelivery_Street1'>";	  
			}
			else if(itemName=="Delivery_Street2")
			{
               //if(NewQuoDelivery_Street2 == "") { NewQuoDelivery_Street2=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Delivery Street2 &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Street2+"' id='NewQuoDelivery_Street2'>";	  
			}
			else if(itemName=="Delivery_Town")
			{
               //if(NewQuoDelivery_Town == "") { NewQuoDelivery_Town=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Delivery Town &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Town+"' id='NewQuoDelivery_Town'>";	  
			}
			else if(itemName=="Delivery_County")
			{
               //if(NewQuoDelivery_County == "") { NewQuoDelivery_County=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Delivery County &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_County+"' id='NewQuoDelivery_County'>";	  
			}
			else if(itemName=="Delivery_Post_Code")
			{
			   //if(NewQuoDelivery_Post_Code == "") { NewQuoDelivery_Post_Code=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Delivery Post Code &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDelivery_Post_Code+"' id='NewQuoDelivery_Post_Code'>";	  
			}
			
			else if(itemName=="Customer_Tel_No")
			{
              //if(NewQuoCustomer_Tel_No == "")  { NewQuoCustomer_Tel_No=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Customer Tel No &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Tel_No+"' id='NewQuoCustomer_Tel_No'>";	  
			}
			else if(itemName=="Customer_Contact")
			{
               //if(NewQuoCustomer_Contact == "") { NewQuoCustomer_Contact=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Customer Contact &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoCustomer_Contact+"' id='NewQuoCustomer_Contact'>";	  
			}
			else if(itemName=="Net_GBP")
			{
               rowtxt+="<tr><td align=right "+tdh+">Net GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoNet_GBP+"' id='NewQuoNet_GBP'>";	  

			}
//			else if(itemName=="Tax_Code")
//			{
//               rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"</td>";
//               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewSopDataButton();' value='"+NewSopTax_Code+"' id='Tax_Code'>";	  

//			}
              else if(itemName=="Tax_Code")
             {
                 var rowJumpTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt' id='NewQuoTax_Code'  "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attTaxCodeName=curNode.childNodes[i].childNodes[0].data;                     
                   if(attTaxCodeName) 
                   {
                    rowJumpTaxCode+="<option value='"+attTaxCodeName+"'";
                    
                    if(attTaxCodeName==NewQuoTax_Code) {rowJumpTaxCode+="selected=true";}
                    if(NewQuoTax_Code =="" && i == 1) 
                    { 
                       rowJumpTaxCode+="selected=true";
                       NewQuoTax_Code = attTaxCodeName;
                    }
                    rowJumpTaxCode+=">"+attTaxCodeName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpTaxCode+"</select></td></tr>";
	          }

			else if(itemName=="VAT_GBP")
			{
               rowtxt+="<tr><td align=right "+tdh+">V.A.T GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoVAT_GBP+"' id='NewQuoVAT_GBP'>";	  

			}
			else if(itemName=="NC")
			{
               rowtxt+="<tr><td align=right "+tdh+">N/C &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoNC+"' id='NewQuoNC'>";	  

			}
			
            else if(itemName=="Department")
             {
                 var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt' id='NewQuoDepartment' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attDepartmentName=curNode.childNodes[i].childNodes[0].data;               
                   if(attDepartmentName) 
                   {
                    rowJumpDepartment+="<option value='"+attDepartmentName+"'";
                    if(attDepartmentName==NewQuoDepartment) {rowJumpDepartment+="selected=true";}
                    if(NewQuoDepartment == "" && i ==0)  {rowJumpDepartment+="selected=true";NewQuoDepartment =attDepartmentName; }
                    rowJumpDepartment+=">"+attDepartmentName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpDepartment+"</select></td></tr>";
	          }

			else if(itemName=="Consign_Number")
			{
               rowtxt+="<tr><td align=right "+tdh+">Consign. Number &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoConsign_Number+"' id='NewQuoConsign_Number'>";	  

			}

            else if(itemName=="Courier")
             {
                 var rowJumpCourier="<tr><td align='right'"+tdh+">Courier &nbsp</td><td><select class='edtxt'  id='NewQuoCourier' "+widstyle+" onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attCourierName=curNode.childNodes[i].childNodes[0].data;                        
                   if(attCourierName) 
                   {
                    rowJumpCourier+="<option value='"+attCourierName+"'";
                    if(attCourierName==NewQuoCourier) {rowJumpCourier+="selected=true";}
                    if(NewQuoCourier == "" && i == 0)  {rowJumpCourier+="selected=true"; NewQuoCourier = attCourierName;}
                    rowJumpCourier+=">"+attCourierName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpCourier+"</select></td></tr>";
	          }

			else if(itemName=="Days")
			{
               //if(NewQuoDays = "") { NewQuoDays=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Days &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDays+"' id='NewQuoDays'>";	  
			}
			else if(itemName=="Discount")
			{
               //if(NewQuoDiscount == "") { NewQuoDiscount=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Discount% &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDiscount+"' id='NewQuoDiscount'>";	  
			}
			else if(itemName=="Amount_GBP")
			{
			  if(NewQuoTotal_GBP != "" && NewQuoDiscount != "") { NewQuoAmount_GBP = NewQuoTotal_GBP * NewQuoDiscount / 100;}
               rowtxt+="<tr><td align=right "+tdh+">Amount GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoAmount_GBP+"' id='NewQuoAmount_GBP' ReadOnly >";	  

			}
			else if(itemName=="Set_Total_GBP")
			{
			   if(NewQuoGross_GBP != '' && NewQuoAmount_GBP != '') { NewQuoSet_Total_GBP = NewQuoGross_GBP - NewQuoAmount_GBP;}
			
               rowtxt+="<tr><td align=right "+tdh+">Total GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoSet_Total_GBP+"' id='NewQuoSet_Total_GBP' ReadOnly >";	  

			}  
			else if(itemName=="Set_Gross_GBP")
			{
				if(NewQuoCarriage_GBP != "" && NewQuoCarriage_VAT != "") 
			    {NewQuoSet_Gross_GBP=parseFloat(NewQuoCarriage_GBP) + parseFloat(NewQuoCarriage_VAT);}
               rowtxt+="<tr><td align=right "+tdh+">Gross GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoSet_Gross_GBP+"' id='NewQuoSet_Gross_GBP' ReadOnly >";	  
			}
			 else if(itemName=="G_NC")
			{
               rowtxt+="<tr><td align=right "+tdh+">N/C &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoGlobal_NC+"' id='NewQuoGlobal_NC'>";	  

			}  
			else if(itemName=="Details")
			{
               //if(NewQuoDetails == "") { NewQuoDetails=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Details &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoDetails+"' id='NewQuoDetails'>";	  
			}  

             else if(itemName=="G_Tax_Code")
             {
                 var rowJumpGTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt' id='NewQuoG_Tax_Code'  "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attGTaxCodeName=curNode.childNodes[i].childNodes[0].data;                         
                   if(attGTaxCodeName) 
                   {
                    rowJumpGTaxCode+="<option value='"+attGTaxCodeName+"'";
                    if(attGTaxCodeName==NewQuoGlobal_Tax_Code)  {rowJumpGTaxCode+="selected=true";}
                    if(NewQuoGlobal_Tax_Code == "" && i == 1)  {rowJumpGTaxCode+="selected=true";}
                    rowJumpGTaxCode+=">"+attGTaxCodeName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpGTaxCode+"</select></td></tr>";
                   
	          }
			 else if(itemName=="G_Department")
             {
                 var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt' id='NewQuoG_Department' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attDepartmentName=curNode.childNodes[i].childNodes[0].data;                     
                   if(attDepartmentName) 
                   {
                    rowJumpDepartment+="<option value='"+attDepartmentName+"'";
                    if(attDepartmentName==NewQuoGlobal_Department) {rowJumpDepartment+="selected=true";}
                    if(NewQuoGlobal_Department == "" && i == 0)   {rowJumpDepartment+="selected=true";}
                    rowJumpDepartment+=">"+attDepartmentName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpDepartment+"</select></td></tr>";
	          }
			else if(itemName=="Payment_Ref")
			{
              // if(NewQuoPayment_Ref =="") { NewQuoPayment_Ref=itemVal;}
               rowtxt+="<tr><td align=right "+tdh+">Payment Ref &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoPayment_Ref+"' id='NewQuoPayment_Ref'>";	  
			} 
			else if(itemName=="Bank_Account")
             {
                 var rowJumpBank_Account="<tr><td align='right'"+tdh+">Bank Account &nbsp</td><td><select class='edtxt' id='NewQuoBank_Account' "+widstyle+"  onchange='NewQuoTaxCode();'>";
                 for(var i=0; i< curNode.childNodes.length; i++) 
                 { 
                   var attBank_AccountName=curNode.childNodes[i].childNodes[0].data;                      
                   if(attBank_AccountName) 
                   {
                    rowJumpBank_Account+="<option value='"+attBank_AccountName+"'";
                    if(attBank_AccountName==NewQuoBank_Account) { rowJumpBank_Account+="selected=true";}
                    if(NewQuoBank_Account == "" && i == 0)  { rowJumpBank_Account+="selected=true";}
                    rowJumpBank_Account+=">"+attBank_AccountName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpBank_Account+"</select></td></tr>";
	          }

			else if(itemName=="Payment_Amount_GBP")
			{
               rowtxt+="<tr><td align=right "+tdh+">Payment Amount &nbsp<br>GBP &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewQuoDataButton();' value='"+NewQuoPayment_Amount_GBP+"' id='NewQuoPayment_Amount_GBP'>";	  

			}  
     
             else if(curNode.nodeName=='Item_No')	
			 {
			     var rowNewQuoJump="<tr><td align=right "+tdh+">Item No &nbsp</td><td><select class='edtxt' "+widstyle+" id='selnewquoitempagecat' >";
                 rowNewQuoJump += addNewQuoDropDownValue;
                 
                 rowNewQuoJump += "</select></td></tr>";

	             rowNewQuoJump+="<tr><td colspan=2 align=center "+tdh+" style='color:blue;font-weight:bold;'><input type='Button'  Value='Add Item' id='addnewquoitemturnbtn'  onclick='getNewQuoItemPage()' Runat='server' style='color:blue;font-weight:bold;width:65px;height:20px;text-decoration:underline;'/>";
	             rowNewQuoJump+="&nbsp&nbsp&nbsp&nbsp&nbsp<input type='Button'  Value='EditItem' id='editnewquoitemturnbtn' onclick='getEditNewQuoItemPage()' Runat='server' style='color:blue;font-weight:bold;width:65px;height:20px;text-decoration:underline;'  disabled='true';/></td></tr>";

	             rowtxt+=rowNewQuoJump;
	               
	          
	           }
         }
       
//	      else
//			{ 	
//		       rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"</td>";
//		         	var ndv=curNode.firstChild;
//			        var itemVal=getEditedNewQuoData(itemId);
//		          	if(itemVal==null) itemVal=ndv?ndv.nodeValue:'';
//		            	rowtxt+="<td "+tdh+"><input type='text' class='edtxt' onchange='showSaveNewQuoDataButton();' "+widstyle+
//			        	"value='"+itemVal+"' id='"+itemId+"'"+end_tdr;
//            }
			curNode=curNode.nextSibling;
			           ycur+=gv_newQuoRowH;
		}
          //if(ic==gv_scrollCurPage || ycur+45<gv_winh) tabstr+=rowtxt; else break;
          if(ic==gv_scrollCurPage) tabstr+=rowtxt;
   }
    tabstr += "</table>";   
    gv_tempTable.innerHTML = tabstr;
    if(NewQuoItemDDVal != "")
    {
        if(document.getElementById("editnewquoitemturnbtn")) { document.getElementById("editnewquoitemturnbtn").disabled = false; }
    }
     	if(document.getElementById('savenewquodata')==null) setNewQuoPageScrollCommands('','');
          setNewQuoPageScroll();
   setTopTitle('Sop -> New Quo ');
   doNokiaMenuNewQuoPage();
}

function getNewQuoItemPage()
{
    NewQuoItemTurnPage = 1;
    document.getElementById('savenewquodata').style.visibility = "hidden";
    doAddNewQuoItem();
}

function getEditNewQuoItemPage()
{
    EditNewQuoItemStrRun = 1;
    NewQuoItemTurnPage = 2;
    doEditNewQuoItem();
}

function doNokiaMenuNewQuoPage()
{
	if(window.widget) {
		window.menu.clear();
		var mBack = new MenuItem('Back',2102);
		mBack.onSelect=backSops;
		window.menu.append(mBack);
	}
}


function NewQuoTaxCode()
{
var NewQuoType=document.getElementById('NewQuoOrder_Type');
var NewQuoFor=document.getElementById('NewQuoFormat');
var NewQuoTax=document.getElementById('NewQuoTax_Code');
var NewQuoDep=document.getElementById('NewQuoDepartment');
var NewQuoCou=document.getElementById('NewQuoCourier');
var NewQuoGTax=document.getElementById('NewQuoG_Tax_Code');
var NewQuoG_Dep=document.getElementById('NewQuoG_Department');
var NewQuoBank=document.getElementById('NewQuoBank_Account');
 if(NewQuoType)
 {
      NewQuoOrder_Type=NewQuoType.options[NewQuoType.selectedIndex].value;

 }
 if(NewQuoFor)
 {
      NewQuoFormat=NewQuoFor.options[NewQuoFor.selectedIndex].value;

 }
  if(NewQuoTax)
  {

  NewQuoTax_Code=NewQuoTax.options[NewQuoTax.selectedIndex].value;

  }
  if(NewQuoDep)
  {

   NewQuoDepartment = NewQuoDep.options[NewQuoDep.selectedIndex].value; 
  }
  if(NewQuoCou)
  {
   NewQuoCourier=NewQuoCou.options[NewQuoCou.selectedIndex].value; 
  }
  if(NewQuoGTax)
  {
  NewQuoGlobal_Tax_Code=NewQuoGTax.options[NewQuoGTax.selectedIndex].value; 
  }
  if(NewQuoG_Dep)
  {
   NewQuoGlobal_Department=NewQuoG_Dep.options[NewQuoG_Dep.selectedIndex].value; 
  }
  
  if(NewQuoBank)
  {
  NewQuoBank_Account=NewQuoBank.options[NewQuoBank.selectedIndex].value; 
  }
}



function newQuoGetCustomer_ACRef()
{
     //setNewQuoPageScrollCommands("<input type='button' id='savenewquodata' value='Save' onclick='saveNewQuoData();' />","");
     document.getElementById('savenewquodata').style.visibility = "hidden"; 
     NewQuoiPage = 1;
     doNewQuoList();
 //document.getElementById('sopCmds').style.visibility='hidden';
}

function setNewQuoPageScroll()

{   var pncur=document.getElementById('pn_cur3');
    pncur.innerHTML='Page '+(gv_scrollCurPage+1)+' of '+gv_scrollTotPage;
    var pnleft=document.getElementById('pn_left3');
    pnleft.innerHTML=gv_scrollCurPage>0 ? gv_scrollCurPage.toString():'';
    var pnright=document.getElementById('pn_right3');
    pnright.innerHTML=gv_scrollCurPage<gv_scrollTotPage-1 ? (gv_scrollCurPage+2).toString():'';  
}

function  jumpToNewQuoCat()
{
var selcat = document.getElementById('selnewquocat');
//	if(gv_newQuoEditingData==1) checkNewQuoPageEdited(gv_scrollCurPage); //Save any edited data to memory
    if(document.getElementById("NewQuoCustomer_ACRef")){NewQuoCustomer_ACRef = document.getElementById("NewQuoCustomer_ACRef").value;}
    if(document.getElementById("NewQuoOrder_Type")){NewQuoOrder_Type=document.getElementById('NewQuoOrder_Type').options[document.getElementById('NewQuoOrder_Type').selectedIndex].value; }
    if(document.getElementById("NewQuoFormat")){NewQuoFormat=document.getElementById('NewQuoFormat').options[document.getElementById('NewQuoFormat').selectedIndex].value; }
    if(document.getElementById("NewQuoOrder_Date")){NewQuoOrder_Date = document.getElementById("NewQuoOrder_Date").value;}
    if(document.getElementById("NewQuoCustomer_Order_Number")){NewQuoCustomer_Order_Number = document.getElementById("NewQuoCustomer_Order_Number").value;}
    if(document.getElementById("NewQuoOrder_Number")){NewQuoOrder_Number = document.getElementById("NewQuoOrder_Number").value;}
    if(document.getElementById("NewQuoTotal_GBP")){NewQuoTotal_GBP = document.getElementById("NewQuoTotal_GBP").value;}
    if(document.getElementById("NewQuoTotal_VAT")){NewQuoTotal_VAT = document.getElementById("NewQuoTotal_VAT").value;}
    if(document.getElementById("NewQuoCarriage_GBP")){NewQuoCarriage_GBP = document.getElementById("NewQuoCarriage_GBP").value;}
    if(document.getElementById("NewQuoCarriage_VAT")){NewQuoCarriage_VAT = document.getElementById("NewQuoCarriage_VAT").value;}
    if(document.getElementById("NewQuoDelivery")){NewQuoDelivery = document.getElementById("NewQuoDelivery").value;}
    if(document.getElementById("NewQuoAddress1")){NewQuoAddress1 = document.getElementById("NewQuoAddress1").value;}
    if(document.getElementById("NewQuoAddress2")){NewQuoAddress2 = document.getElementById("NewQuoAddress2").value;}
    if(document.getElementById("NewQuoAddress3")){NewQuoAddress3 = document.getElementById("NewQuoAddress3").value;}
    if(document.getElementById("NewQuoAddress4")){NewQuoAddress4 = document.getElementById("NewQuoAddress4").value;}
    if(document.getElementById("NewQuoAddress5")){NewQuoAddress5 = document.getElementById("NewQuoAddress5").value;}
    if(document.getElementById("NewQuoName")){NewQuoName = document.getElementById("NewQuoName").value;}
    if(document.getElementById("NewQuoDelivery_Street1")){NewQuoDelivery_Street1 = document.getElementById("NewQuoDelivery_Street1").value;}
    if(document.getElementById("NewQuoDelivery_Street2")){NewQuoDelivery_Street2 = document.getElementById("NewQuoDelivery_Street2").value;}
    if(document.getElementById("NewQuoDelivery_Town")){NewQuoDelivery_Town = document.getElementById("NewQuoDelivery_Town").value;}
    if(document.getElementById("NewQuoDelivery_County")){NewQuoDelivery_County = document.getElementById("NewQuoDelivery_County").value;}
    if(document.getElementById("NewQuoDelivery_Post_Code")){NewQuoDelivery_Post_Code = document.getElementById("NewQuoDelivery_Post_Code").value;}
    if(document.getElementById("NewQuoCustomer_Tel_No")){NewQuoCustomer_Tel_No = document.getElementById("NewQuoCustomer_Tel_No").value;}
    if(document.getElementById("NewQuoCustomer_Contact")){NewQuoCustomer_Contact = document.getElementById("NewQuoCustomer_Contact").value;}
    if(document.getElementById("NewQuoNet_GBP")){NewQuoNet_GBP = document.getElementById("NewQuoNet_GBP").value;}
    if(document.getElementById("NewQuoTax_Code")){NewQuoTax_Code=document.getElementById('NewQuoTax_Code').options[document.getElementById('NewQuoTax_Code').selectedIndex].value; }
    if(document.getElementById("NewQuoVAT_GBP")){NewQuoVAT_GBP = document.getElementById("NewQuoVAT_GBP").value;}
    if(document.getElementById("NewQuoNC")){NewQuoNC = document.getElementById("NewQuoNC").value;}
    if(document.getElementById("NewQuoGlobal_NC")){NewQuoGlobal_NC = document.getElementById("NewQuoGlobal_NC").value;}
    if(document.getElementById("NewQuoGross_GBP")){NewQuoGross_GBP = document.getElementById("NewQuoGross_GBP").value;}
    if(document.getElementById("NewQuoSet_Gross_GBP")){NewQuoSet_Gross_GBP = document.getElementById("NewQuoSet_Gross_GBP").value;}

    if(document.getElementById("NewQuoDepartment")){NewQuoDepartment = document.getElementById("NewQuoDepartment").value;}
    if(document.getElementById("NewQuoConsign_Number")){NewQuoConsign_Number = document.getElementById("NewQuoConsign_Number").value;}
    if(document.getElementById("NewQuoCourier")){NewQuoCourier = document.getElementById("NewQuoCourier").value;}
    if(document.getElementById("NewQuoDays")){NewQuoDays = document.getElementById("NewQuoDays").value;}
    if(document.getElementById("NewQuoDiscount")){NewQuoDiscount = document.getElementById("NewQuoDiscount").value;}
    if(document.getElementById("NewQuoAmount_GBP")){NewQuoAmount_GBP = document.getElementById("NewQuoAmount_GBP").value;}
    if(document.getElementById("NewQuoSet_Total_GBP")){NewQuoSet_Total_GBP = document.getElementById("NewQuoSet_Total_GBP").value;}
    if(document.getElementById("NewQuoDetails")){NewQuoDetails = document.getElementById("NewQuoDetails").value;}
    if(document.getElementById("NewQuoPayment_Ref")){NewQuoPayment_Ref = document.getElementById("NewQuoPayment_Ref").value;}
    if(document.getElementById("NewQuoBank_Account")){NewQuoBank_Account = document.getElementById("NewQuoBank_Account").value;}
    if(document.getElementById("NewQuoPayment_Amount_GBP")){NewQuoPayment_Amount_GBP = document.getElementById("NewQuoPayment_Amount_GBP").value;}
	gv_scrollCurPage=selcat.selectedIndex;	
	showNewQuoDataPage("OtherLoad");

}

function checkNewQuoPageEdited(pagenum)
{
	var itemEle=null;
    for(var ic=pagenum; ic<gv_newQuoDataCategory.length; ic++) {
		var attName=gv_newQuoDataCategory[ic].attributes.getNamedItem("title");	
		if(attName==null) continue;
		var curNode=gv_newQuoDataCategory[ic].firstChild;
		while( curNode ) 
		{
			var ndv=curNode.firstChild;
			var oldv=ndv?ndv.nodeValue:''
			var itemId=ic.toString()+"_"+curNode.nodeName;
			itemEle=document.getElementById(itemId);
			if(itemEle==null) break;
			var newv=itemEle.value;
			if(oldv!=newv) setEditNewQuoData(itemId,newv);
			curNode=curNode.nextSibling;
		}
		if(itemEle==null) break;
    }
}
function setEditNewQuoData(itemName,edValue)
{
	if(!gv_newQuoEditedName) {
		gv_newQuoEditedName=new Array();
		gv_newQuoEditedValue=new Array();
	}
	for(var i=0; i<gv_newQuoEditedName.length; i++){
		if(gv_newQuoEditedName[i]==itemName) {	gv_newQuoEditedValue[i]=edValue; return; }
	}
	gv_newQuoEditedValue[gv_newQuoEditedName.length]=edValue;	
	gv_newQuoEditedName[gv_newQuoEditedName.length]=itemName;
}
//return: edited string value, null if not edited
function getEditedNewQuoData(itemName)
{
	if(!gv_newQuoEditedName) return null;	
	for(var i=0; i<gv_newQuoEditedName.length; i++) {
		if(gv_newQuoEditedName[i]==itemName) return gv_newQuoEditedValue[i];
	}
}

function newQuoPageLeft()
{
	if(gv_scrollCurPage<=0) return;
    
   
	var selcat=document.getElementById('selnewquocat');
	var selitemcat=document.getElementById('selnewquoitemcat');
	var divtab=document.getElementById('tempTable');
	var tleft=divtab.style.pixelLeft;

	if(tleft>=gv_winw-30) {	
		gv_scrollCurPage--;
		divtab.style.pixelLeft=0;
		if(selcat) { //Customer data
			if(gv_newQuoEditingData==1) checkNewQuoPageEdited(gv_scrollCurPage+1); //Save any edited data to memory
			selcat.selectedIndex=gv_scrollCurPage;
			if(document.getElementById("NewQuoCustomer_ACRef")){NewQuoCustomer_ACRef = document.getElementById("NewQuoCustomer_ACRef").value;}
			if(document.getElementById("NewQuoOrder_Type")){NewQuoOrder_Type=document.getElementById('NewQuoOrder_Type').options[document.getElementById('NewQuoOrder_Type').selectedIndex].value; }
			if(document.getElementById("NewQuoFormat")){NewQuoFormat=document.getElementById('NewQuoFormat').options[document.getElementById('NewQuoFormat').selectedIndex].value; }
    		if(document.getElementById("NewQuoOrder_Date")){NewQuoOrder_Date = document.getElementById("NewQuoOrder_Date").value;}
			if(document.getElementById("NewQuoCustomer_Order_Number")){NewQuoCustomer_Order_Number = document.getElementById("NewQuoCustomer_Order_Number").value;}
			if(document.getElementById("NewQuoOrder_Number")){NewQuoOrder_Number = document.getElementById("NewQuoOrder_Number").value;}
			if(document.getElementById("NewQuoTotal_GBP")){NewQuoTotal_GBP = document.getElementById("NewQuoTotal_GBP").value;}
			if(document.getElementById("NewQuoTotal_VAT")){NewQuoTotal_VAT = document.getElementById("NewQuoTotal_VAT").value;}
			if(document.getElementById("NewQuoCarriage_GBP")){NewQuoCarriage_GBP = document.getElementById("NewQuoCarriage_GBP").value;}
			if(document.getElementById("NewQuoCarriage_VAT")){NewQuoCarriage_VAT = document.getElementById("NewQuoCarriage_VAT").value;}
			if(document.getElementById("NewQuoDelivery")){NewQuoDelivery = document.getElementById("NewQuoDelivery").value;}
			if(document.getElementById("NewQuoAddress1")){NewQuoAddress1 = document.getElementById("NewQuoAddress1").value;}
			if(document.getElementById("NewQuoAddress2")){NewQuoAddress2 = document.getElementById("NewQuoAddress2").value;}
			if(document.getElementById("NewQuoAddress3")){NewQuoAddress3 = document.getElementById("NewQuoAddress3").value;}
			if(document.getElementById("NewQuoAddress4")){NewQuoAddress4 = document.getElementById("NewQuoAddress4").value;}
			if(document.getElementById("NewQuoAddress5")){NewQuoAddress5 = document.getElementById("NewQuoAddress5").value;}
			if(document.getElementById("NewQuoName")){NewQuoName = document.getElementById("NewQuoName").value;}
			if(document.getElementById("NewQuoDelivery_Street1")){NewQuoDelivery_Street1 = document.getElementById("NewQuoDelivery_Street1").value;}
			if(document.getElementById("NewQuoDelivery_Street2")){NewQuoDelivery_Street2 = document.getElementById("NewQuoDelivery_Street2").value;}
			if(document.getElementById("NewQuoDelivery_Town")){NewQuoDelivery_Town = document.getElementById("NewQuoDelivery_Town").value;}
			if(document.getElementById("NewQuoDelivery_County")){NewQuoDelivery_County = document.getElementById("NewQuoDelivery_County").value;}
			if(document.getElementById("NewQuoDelivery_Post_Code")){NewQuoDelivery_Post_Code = document.getElementById("NewQuoDelivery_Post_Code").value;}
			if(document.getElementById("NewQuoCustomer_Tel_No")){NewQuoCustomer_Tel_No = document.getElementById("NewQuoCustomer_Tel_No").value;}
			if(document.getElementById("NewQuoCustomer_Contact")){NewQuoCustomer_Contact = document.getElementById("NewQuoCustomer_Contact").value;}
			if(document.getElementById("NewQuoNet_GBP")){NewQuoNet_GBP = document.getElementById("NewQuoNet_GBP").value;}
			if(document.getElementById("NewQuoTax_Code")){NewQuoTax_Code=document.getElementById('NewQuoTax_Code').options[document.getElementById('NewQuoTax_Code').selectedIndex].value; }
			if(document.getElementById("NewQuoVAT_GBP")){NewQuoVAT_GBP = document.getElementById("NewQuoVAT_GBP").value;}
			if(document.getElementById("NewQuoNC")){NewQuoNC = document.getElementById("NewQuoNC").value;}
			if(document.getElementById("NewQuoGlobal_NC")){NewQuoGlobal_NC = document.getElementById("NewQuoGlobal_NC").value;}
			if(document.getElementById("NewQuoGross_GBP")){NewQuoGross_GBP = document.getElementById("NewQuoGross_GBP").value;}
			if(document.getElementById("NewQuoSet_Gross_GBP")){NewQuoSet_Gross_GBP = document.getElementById("NewQuoSet_Gross_GBP").value;}

			if(document.getElementById("NewQuoDepartment")){NewQuoDepartment = document.getElementById("NewQuoDepartment").value;}
			if(document.getElementById("NewQuoConsign_Number")){NewQuoConsign_Number = document.getElementById("NewQuoConsign_Number").value;}
			if(document.getElementById("NewQuoCourier")){NewQuoCourier = document.getElementById("NewQuoCourier").value;}
			if(document.getElementById("NewQuoDays")){NewQuoDays = document.getElementById("NewQuoDays").value;}
			if(document.getElementById("NewQuoDiscount")){NewQuoDiscount = document.getElementById("NewQuoDiscount").value;}
			if(document.getElementById("NewQuoAmount_GBP")){NewQuoAmount_GBP = document.getElementById("NewQuoAmount_GBP").value;}
			if(document.getElementById("NewQuoSet_Total_GBP")){NewQuoSet_Total_GBP = document.getElementById("NewQuoSet_Total_GBP").value;}
			if(document.getElementById("NewQuoDetails")){NewQuoDetails = document.getElementById("NewQuoDetails").value;}
			if(document.getElementById("NewQuoPayment_Ref")){NewQuoPayment_Ref = document.getElementById("NewQuoPayment_Ref").value;}
			if(document.getElementById("NewQuoBank_Account")){NewQuoBank_Account = document.getElementById("NewQuoBank_Account").value;}
			if(document.getElementById("NewQuoPayment_Amount_GBP")){NewQuoPayment_Amount_GBP = document.getElementById("NewQuoPayment_Amount_GBP").value;}

			showNewQuoDataPage("OtherLoad");
		}
		else if(selitemcat)
		{
		 if(gv_newQuoItemEditingData==1) checkNewQuoItemPageEdited(gv_scrollCurPage+1); //Save any edited data to memory
			selitemcat.selectedIndex=gv_scrollCurPage;
			showNewQuoItemDataPage(NewQuoItemOtherLoad);
		}
		else
		 { //customer list
			gv_newQuoCurPage=gv_scrollCurPage;		
			gv_newQuoIndex=0;
			NewQuoiPage--;
			if(NewQuoiPage < 1)
			{
			    NewQuoiPage = 1;
			    return;
			}
			NewQuoListPD = 1;
			NewQuoListCurPage = gv_newQuoCurPage;
            NewQuoListTotPage = gv_newQuoTotPage;
			doNewQuoList();
		}
	}
	else {
		divtab.style.pixelLeft=tleft+30;
		setTimeout("newQuoPageLeft();",75);
	}
}
 
function newQuoPageRight()
{
         

	if(gv_scrollCurPage>=gv_scrollTotPage-1) return;

	var selcat=document.getElementById('selnewquocat'); //If null, then in Customer List.
	var selitemcat=document.getElementById('selnewquoitemcat');
	var divtab=document.getElementById('tempTable');
	var tleft=divtab.style.pixelLeft;
	if(tleft<30-gv_winw) {	
		gv_scrollCurPage++;
		divtab.style.pixelLeft=0;
		if(selcat) { //Customer data
			selcat.selectedIndex=gv_scrollCurPage;
			if(document.getElementById("NewQuoCustomer_ACRef")){NewQuoCustomer_ACRef = document.getElementById("NewQuoCustomer_ACRef").value;}
			if(document.getElementById("NewQuoOrder_Type")){NewQuoOrder_Type=document.getElementById('NewQuoOrder_Type').options[document.getElementById('NewQuoOrder_Type').selectedIndex].value; }
			if(document.getElementById("NewQuoFormat")){NewQuoFormat=document.getElementById('NewQuoFormat').options[document.getElementById('NewQuoFormat').selectedIndex].value; }
    		if(document.getElementById("NewQuoOrder_Date")){NewQuoOrder_Date = document.getElementById("NewQuoOrder_Date").value;}
			if(document.getElementById("NewQuoCustomer_Order_Number")){NewQuoCustomer_Order_Number = document.getElementById("NewQuoCustomer_Order_Number").value;}
			if(document.getElementById("NewQuoOrder_Number")){NewQuoOrder_Number = document.getElementById("NewQuoOrder_Number").value;}
			if(document.getElementById("NewQuoTotal_GBP")){NewQuoTotal_GBP = document.getElementById("NewQuoTotal_GBP").value;}
			if(document.getElementById("NewQuoTotal_VAT")){NewQuoTotal_VAT = document.getElementById("NewQuoTotal_VAT").value;}
			if(document.getElementById("NewQuoCarriage_GBP")){NewQuoCarriage_GBP = document.getElementById("NewQuoCarriage_GBP").value;}
			if(document.getElementById("NewQuoCarriage_VAT")){NewQuoCarriage_VAT = document.getElementById("NewQuoCarriage_VAT").value;}
			if(document.getElementById("NewQuoDelivery")){NewQuoDelivery = document.getElementById("NewQuoDelivery").value;}
						if(document.getElementById("NewQuoAddress1")){NewQuoAddress1 = document.getElementById("NewQuoAddress1").value;}
			if(document.getElementById("NewQuoAddress2")){NewQuoAddress2 = document.getElementById("NewQuoAddress2").value;}
			if(document.getElementById("NewQuoAddress3")){NewQuoAddress3 = document.getElementById("NewQuoAddress3").value;}
			if(document.getElementById("NewQuoAddress4")){NewQuoAddress4 = document.getElementById("NewQuoAddress4").value;}
			if(document.getElementById("NewQuoAddress5")){NewQuoAddress5 = document.getElementById("NewQuoAddress5").value;}
			if(document.getElementById("NewQuoName")){NewQuoName = document.getElementById("NewQuoName").value;}
			if(document.getElementById("NewQuoDelivery_Street1")){NewQuoDelivery_Street1 = document.getElementById("NewQuoDelivery_Street1").value;}
			if(document.getElementById("NewQuoDelivery_Street2")){NewQuoDelivery_Street2 = document.getElementById("NewQuoDelivery_Street2").value;}
			if(document.getElementById("NewQuoDelivery_Town")){NewQuoDelivery_Town = document.getElementById("NewQuoDelivery_Town").value;}
			if(document.getElementById("NewQuoDelivery_County")){NewQuoDelivery_County = document.getElementById("NewQuoDelivery_County").value;}
			if(document.getElementById("NewQuoDelivery_Post_Code")){NewQuoDelivery_Post_Code = document.getElementById("NewQuoDelivery_Post_Code").value;}
			if(document.getElementById("NewQuoCustomer_Tel_No")){NewQuoCustomer_Tel_No = document.getElementById("NewQuoCustomer_Tel_No").value;}
			if(document.getElementById("NewQuoCustomer_Contact")){NewQuoCustomer_Contact = document.getElementById("NewQuoCustomer_Contact").value;}
			if(document.getElementById("NewQuoNet_GBP")){NewQuoNet_GBP = document.getElementById("NewQuoNet_GBP").value;}
			if(document.getElementById("NewQuoTax_Code")){NewQuoTax_Code=document.getElementById('NewQuoTax_Code').options[document.getElementById('NewQuoTax_Code').selectedIndex].value; }
			if(document.getElementById("NewQuoVAT_GBP")){NewQuoVAT_GBP = document.getElementById("NewQuoVAT_GBP").value;}
			if(document.getElementById("NewQuoNC")){NewQuoNC = document.getElementById("NewQuoNC").value;}
			if(document.getElementById("NewQuoGlobal_NC")){NewQuoGlobal_NC = document.getElementById("NewQuoGlobal_NC").value;}
			if(document.getElementById("NewQuoGross_GBP")){NewQuoGross_GBP = document.getElementById("NewQuoGross_GBP").value;}
			if(document.getElementById("NewQuoSet_Gross_GBP")){NewQuoSet_Gross_GBP = document.getElementById("NewQuoSet_Gross_GBP").value;}
			if(document.getElementById("NewQuoDepartment")){NewQuoDepartment = document.getElementById("NewQuoDepartment").value;}
			if(document.getElementById("NewQuoConsign_Number")){NewQuoConsign_Number = document.getElementById("NewQuoConsign_Number").value;}
			if(document.getElementById("NewQuoCourier")){NewQuoCourier = document.getElementById("NewQuoCourier").value;}
			if(document.getElementById("NewQuoDays")){NewQuoDays = document.getElementById("NewQuoDays").value;}
			if(document.getElementById("NewQuoDiscount")){NewQuoDiscount = document.getElementById("NewQuoDiscount").value;}
			if(document.getElementById("NewQuoAmount_GBP")){NewQuoAmount_GBP = document.getElementById("NewQuoAmount_GBP").value;}
			if(document.getElementById("NewQuoSet_Total_GBP")){NewQuoSet_Total_GBP = document.getElementById("NewQuoSet_Total_GBP").value;}
			if(document.getElementById("NewQuoDetails")){NewQuoDetails = document.getElementById("NewQuoDetails").value;}
			if(document.getElementById("NewQuoPayment_Ref")){NewQuoPayment_Ref = document.getElementById("NewQuoPayment_Ref").value;}
			if(document.getElementById("NewQuoBank_Account")){NewQuoBank_Account = document.getElementById("NewQuoBank_Account").value;}
			if(document.getElementById("NewQuoPayment_Amount_GBP")){NewQuoPayment_Amount_GBP = document.getElementById("NewQuoPayment_Amount_GBP").value;}
			showNewQuoDataPage("OtherLoad");
		}
		else if(selitemcat)
		{
		 if(gv_newQuoItemEditingData==1) checkNewQuoItemPageEdited(gv_scrollCurPage+1); //Save any edited data to memory
			selitemcat.selectedIndex=gv_scrollCurPage;
			showNewQuoItemDataPage(NewQuoItemOtherLoad);
		}
		
		
		else { //customer list
		gv_newQuoCurPage=gv_scrollCurPage;		
			gv_newQuoIndex=0;
			NewQuoiPage++;
			if(NewQuoiPage > NewQuoTotalPage)
			{
			    NewQuoiPage = NewQuoTotalPage;
			    return;
			}
			NewQuoListPD = 1;
			NewQuoListCurPage = gv_newQuoCurPage;
            NewQuoListTotPage = gv_newQuoTotPage;
			doNewQuoList();
		}
	}
	else
	 {
		divtab.style.pixelLeft=tleft-30;
	
		  setTimeout("newQuoPageRight();",75);
	 }
}




function setNewQuoPageScrollCommands(Cmd1,Cmd2)
{
	document.getElementById('sopbtn1').innerHTML=Cmd1;
	document.getElementById('sopbtn2').innerHTML=Cmd2;
	var newquocmd=document.getElementById('sopCmds').style;
	var ncmds=Cmd1.length<5 ? 0:1;
	if(Cmd2.length>5) ncmds++;
	newquocmd.pixelWidth=150+50*ncmds;
	newquocmd.pixelLeft=gv_winw-newquocmd.pixelWidth-1;
}

function showSaveNewQuoDataButton()
{
	if(document.getElementById('savenewquodata'))  return;
	setNewQuoPageScrollCommands("<input type='button' id='savenewquodata' value='Save' onclick='saveNewQuoData();' />","");
}

var strNewQuoItem = "";
var QuoHiddenField="<input type='hidden' name='QuoHiddenField' id='QuoHiddenField' value=''>";

function ButtonNewQuoItem_onclick()
{
  var charSplitChar = ",";
  strNewQuoItem += NewQuoItemProduct_Code +charSplitChar;
  strNewQuoItem += NewQuoItemDescription +charSplitChar;
  strNewQuoItem += NewQuoItemUnits +charSplitChar;
  strNewQuoItem += NewQuoItemComment1 +charSplitChar;
  strNewQuoItem += NewQuoItemComment2 +charSplitChar;
  strNewQuoItem += NewQuoItemOrder_Reference +charSplitChar;
  strNewQuoItem += NewQuoItemOrder_Line_Reference +charSplitChar;
  strNewQuoItem += NewQuoItemQuantity +charSplitChar;
  strNewQuoItem += NewQuoItemUnit_Price_GBP +charSplitChar;
  strNewQuoItem += NewQuoItemDiscount +charSplitChar;
  strNewQuoItem += NewQuoItemDiscount_GBP +charSplitChar;
  strNewQuoItem += NewQuoItemNet_GBP +charSplitChar;
  strNewQuoItem += NewQuoItemVAT_GBP +charSplitChar;
  strNewQuoItem += NewQuoItemNominal_Code +charSplitChar;
  strNewQuoItem += NewQuoItemTax_Code +charSplitChar;
  strNewQuoItem += NewQuoItemDepartment +charSplitChar;
  strNewQuoItem += NewQuoItemLine_Information +charSplitChar;
  strNewQuoItem += NewQuoItemAllocated +charSplitChar;
  strNewQuoItem += NewQuoItemDespatched +charSplitChar;
  strNewQuoItem += NewQuoItemTo_Deliver +charSplitChar;
  strNewQuoItem += NewQuoItemIntrastat +charSplitChar;
  strNewQuoItem += NewQuoItemDue_Date;
  strNewQuoItem += "|,|";
 document.getElementById('QuoHiddenField').value =strNewQuoItem;
}
          var ItemQuoProduct_Code, ItemQuoDescription, ItemQuoUnits, ItemQuoComment1, ItemQuoComment2, ItemQuoOrder_Reference, ItemQuoOrder_Line_Reference;
         var ItemQuoQuantity, ItemQuoUnit_Price_GBP, ItemQuoDiscount, ItemQuoDiscount_GBP, ItemQuoNet_GBP, ItemQuoVAT_GBP, ItemQuoNominal_Code, ItemQuoTax_Code; 
         var ItemQuoDepartment,ItemQuoLineInformation, ItemQuoAllocated, ItemQuoDespatched, ItemQuoTo_Deliver, ItemQuoIntrastat, ItemQuoDue_Date;
    
    function ContactsNewQuoItemData(strData)
    {
        
        var arrTemp = strData.split(",");
        ItemQuoProduct_Code = arrTemp[0];
        ItemQuoDescription = arrTemp[1];
        ItemQuoUnits = arrTemp[2];
        ItemQuoComment1 = arrTemp[3];
        ItemQuoComment2 = arrTemp[4];
        ItemQuoOrder_Reference = arrTemp[5];
        ItemQuoOrder_Line_Reference = arrTemp[6];
        ItemQuoQuantity = arrTemp[7];
        ItemQuoUnit_Price_GBP = arrTemp[8];
        ItemQuoDiscount = arrTemp[9];
        ItemQuoDiscount_GBP = arrTemp[10];
        ItemQuoNet_GBP = arrTemp[11];
        ItemQuoVAT_GBP = arrTemp[12];
        ItemQuoNominal_Code = arrTemp[13];
        ItemQuoTax_Code = arrTemp[14];
        ItemQuoDepartment = arrTemp[15];
        ItemQuoLineInformation = arrTemp[16];
        ItemQuoAllocated = arrTemp[17];
        ItemQuoDespatched = arrTemp[18];
        ItemQuoTo_Deliver = arrTemp[19];
        ItemQuoIntrastat = arrTemp[20];
        ItemQuoDue_Date = arrTemp[21];
    }
   var NewQuoItemDDVal = "";
     function showNewQuoCount()
    {
        var  strItems = document.getElementById('QuoHiddenField').value;
        var arrItems = strItems.split("|,|");
        var SQuoNet_GBP = 0, SQuoVAT_GBP= 0;
        addNewQuoDropDownValue = "";
        for (var i = 0; i < arrItems.length - 1; i++)
        {  
         ContactsNewQuoItemData(arrItems[i]);
         var num = arrItems.length - 1;
         var j = i + 1;
         NewQuoItemDDVal = j + ' ' + 'of' + ' '+ num;
         addNewQuoDropDownValue += "<option>"+NewQuoItemDDVal+"</option>";
         if(ItemQuoNet_GBP == "") {ItemQuoNet_GBP= "0";}
         if(ItemQuoVAT_GBP == "") {ItemQuoVAT_GBP = "0";}
         SQuoNet_GBP += parseFloat(ItemQuoNet_GBP);
         SQuoVAT_GBP += parseFloat(ItemQuoVAT_GBP);
        }
         NewQuoTotal_GBP = SQuoNet_GBP;
         NewQuoTotal_VAT = SQuoVAT_GBP;
         NewQuoGross_GBP = SQuoNet_GBP + SQuoVAT_GBP;
        
    }

 
function saveNewQuoData()
{
	checkNewQuoPageEdited(gv_scrollCurPage);
			if(document.getElementById("NewQuoCustomer_ACRef")){NewQuoCustomer_ACRef = document.getElementById("NewQuoCustomer_ACRef").value;}
			if(document.getElementById("NewQuoOrder_Type")){NewQuoOrder_Type=document.getElementById('NewQuoOrder_Type').options[document.getElementById('NewQuoOrder_Type').selectedIndex].value; }
			if(document.getElementById("NewQuoFormat")){NewQuoFormat=document.getElementById('NewQuoFormat').options[document.getElementById('NewQuoFormat').selectedIndex].value; }
    		if(document.getElementById("NewQuoOrder_Date")){NewQuoOrder_Date = document.getElementById("NewQuoOrder_Date").value;}
			if(document.getElementById("NewQuoCustomer_Order_Number")){NewQuoCustomer_Order_Number = document.getElementById("NewQuoCustomer_Order_Number").value;}
			if(document.getElementById("NewQuoOrder_Number")){NewQuoOrder_Number = document.getElementById("NewQuoOrder_Number").value;}
			if(document.getElementById("NewQuoTotal_GBP")){NewQuoTotal_GBP = document.getElementById("NewQuoTotal_GBP").value;}
			if(document.getElementById("NewQuoTotal_VAT")){NewQuoTotal_VAT = document.getElementById("NewQuoTotal_VAT").value;}
			if(document.getElementById("NewQuoCarriage_GBP")){NewQuoCarriage_GBP = document.getElementById("NewQuoCarriage_GBP").value;}
			if(document.getElementById("NewQuoCarriage_VAT")){NewQuoCarriage_VAT = document.getElementById("NewQuoCarriage_VAT").value;}
			if(document.getElementById("NewQuoDelivery")){NewQuoDelivery = document.getElementById("NewQuoDelivery").value;}
			if(document.getElementById("NewQuoAddress1")){NewQuoAddress1 = document.getElementById("NewQuoAddress1").value;}
			if(document.getElementById("NewQuoAddress2")){NewQuoAddress2 = document.getElementById("NewQuoAddress2").value;}
			if(document.getElementById("NewQuoAddress3")){NewQuoAddress3 = document.getElementById("NewQuoAddress3").value;}
			if(document.getElementById("NewQuoAddress4")){NewQuoAddress4 = document.getElementById("NewQuoAddress4").value;}
			if(document.getElementById("NewQuoAddress5")){NewQuoAddress5 = document.getElementById("NewQuoAddress5").value;}
			if(document.getElementById("NewQuoName")){NewQuoName = document.getElementById("NewQuoName").value;}
			if(document.getElementById("NewQuoDelivery_Street1")){NewQuoDelivery_Street1 = document.getElementById("NewQuoDelivery_Street1").value;}
			if(document.getElementById("NewQuoDelivery_Street2")){NewQuoDelivery_Street2 = document.getElementById("NewQuoDelivery_Street2").value;}
			if(document.getElementById("NewQuoDelivery_Town")){NewQuoDelivery_Town = document.getElementById("NewQuoDelivery_Town").value;}
			if(document.getElementById("NewQuoDelivery_County")){NewQuoDelivery_County = document.getElementById("NewQuoDelivery_County").value;}
			if(document.getElementById("NewQuoDelivery_Post_Code")){NewQuoDelivery_Post_Code = document.getElementById("NewQuoDelivery_Post_Code").value;}
			if(document.getElementById("NewQuoCustomer_Tel_No")){NewQuoCustomer_Tel_No = document.getElementById("NewQuoCustomer_Tel_No").value;}
			if(document.getElementById("NewQuoCustomer_Contact")){NewQuoCustomer_Contact = document.getElementById("NewQuoCustomer_Contact").value;}
			if(document.getElementById("NewQuoNet_GBP")){NewQuoNet_GBP = document.getElementById("NewQuoNet_GBP").value;}
			if(document.getElementById("NewQuoTax_Code")){NewQuoTax_Code=document.getElementById('NewQuoTax_Code').options[document.getElementById('NewQuoTax_Code').selectedIndex].value; }
			if(document.getElementById("NewQuoVAT_GBP")){NewQuoVAT_GBP = document.getElementById("NewQuoVAT_GBP").value;}
			if(document.getElementById("NewQuoNC")){NewQuoNC = document.getElementById("NewQuoNC").value;}
			if(document.getElementById("NewQuoGlobal_NC")){NewQuoGlobal_NC = document.getElementById("NewQuoGlobal_NC").value;}
			if(document.getElementById("NewQuoGross_GBP")){NewQuoGross_GBP = document.getElementById("NewQuoGross_GBP").value;}
			if(document.getElementById("NewQuoSet_Gross_GBP")){NewQuoSet_Gross_GBP = document.getElementById("NewQuoSet_Gross_GBP").value;}

			if(document.getElementById("NewQuoDepartment")){NewQuoDepartment = document.getElementById("NewQuoDepartment").value;}
			if(document.getElementById("NewQuoConsign_Number")){NewQuoConsign_Number = document.getElementById("NewQuoConsign_Number").value;}
			if(document.getElementById("NewQuoCourier")){NewQuoCourier = document.getElementById("NewQuoCourier").value;}
			if(document.getElementById("NewQuoDays")){NewQuoDays = document.getElementById("NewQuoDays").value;}
			if(document.getElementById("NewQuoDiscount")){NewQuoDiscount = document.getElementById("NewQuoDiscount").value;}
			if(document.getElementById("NewQuoAmount_GBP")){NewQuoAmount_GBP = document.getElementById("NewQuoAmount_GBP").value;}
			if(document.getElementById("NewQuoSet_Total_GBP")){NewQuoSet_Total_GBP = document.getElementById("NewQuoSet_Total_GBP").value;}
			if(document.getElementById("NewQuoDetails")){NewQuoDetails = document.getElementById("NewQuoDetails").value;}
			if(document.getElementById("NewQuoPayment_Ref")){NewQuoPayment_Ref = document.getElementById("NewQuoPayment_Ref").value;}
			if(document.getElementById("NewQuoBank_Account")){NewQuoBank_Account = document.getElementById("NewQuoBank_Account").value;}
			if(document.getElementById("NewQuoPayment_Amount_GBP")){NewQuoPayment_Amount_GBP = document.getElementById("NewQuoPayment_Amount_GBP").value;}
    NewQuoTax_Code = NewQuoTax_Code.slice(1,3).replace(/(\s*$)/g,"");
    NewQuoDepartment = NewQuoDepartment.slice(0,2).replace(/(\s*$)/g,"");
    NewQuoGlobal_Tax_Code = NewQuoGlobal_Tax_Code.slice(1,3).replace(/(\s*$)/g,"");
    NewQuoGlobal_Department = NewQuoGlobal_Department.slice(0,2).replace(/(\s*$)/g,"");
    NewQuoCourier = NewQuoCourier.slice(0,2).replace(/(\s*$)/g,"");
//    NewSopBank_Account = NewSopTax_Code.slice(1,3).replace(/(\s*$)/g,"");
    if(NewQuoCustomer_ACRef == "" && NewQuoItemDDVal != "")
    {
        alert("Please select account reference of customer!");
        //showNewQuoDataPage("OtherLoad");
        return;
    }
    if(NewQuoCustomer_ACRef != "" && NewQuoItemDDVal == "")
    {
        alert("Please Add Item For Sales Order!");
        //showNewQuoDataPage("OtherLoad");
        return;
    }
    if(NewQuoCustomer_ACRef == "" && NewQuoItemDDVal == "")
    {
        alert("Please select account reference of customer and add item for sales order! ");
        //showNewQuoDataPage("OtherLoad");
        return;
    }
    var QuoHiddenValue = document.getElementById("QuoHiddenField").value;
    var ACIndex=gv_newQuoCurPage*10+gv_newQuoIndex;

	var url=gv_rooturl+"?cmd=SaveNewQuoData&AC="+gv_newQuoAC[gv_newQuoIndex]+"&index="+ACIndex;
url+="&NewQuoHiddenValue="+QuoHiddenValue+"&0_Customer_ACRef="+NewQuoCustomer_ACRef+"&0_Order_Type="+NewQuoOrder_Type+"&0_Format="+NewQuoFormat+"&0_Order_Date="+NewQuoOrder_Date+"&0_Customer_Order_Number="+NewQuoCustomer_Order_Number+"&0_Order_Number="+NewQuoOrder_Number+"&1_Total_GBP="+NewQuoTotal_GBP+"&1_Total_VAT="+NewQuoTotal_VAT+"&1_Carriage_GBP="+NewQuoCarriage_GBP+"&1_Carriage_VAT="+NewQuoCarriage_VAT+"&1_Gross_GBP="+NewQuoGross_GBP+"&2_Delivery="+NewQuoDelivery+"&2_Address1="+NewQuoAddress1+"&2_Address2="+NewQuoAddress2+"&2_Address3="+NewQuoAddress3+"&2_Address4="+NewQuoAddress4+"&2_Address5="+NewQuoAddress5+"&2_Name="+NewQuoName+"&2_Delivery_Street1="+NewQuoDelivery_Street1+"&2_Delivery_Street2="+NewQuoDelivery_Street2+"&2_Delivery_Town="+NewQuoDelivery_Town+"&2_Delivery_County="+NewQuoDelivery_County+"&2_Delivery_Post_Code="+NewQuoDelivery_Post_Code+"&2_Customer_Tel_No="+NewQuoCustomer_Tel_No+"&2_Customer_Contact="+NewQuoCustomer_Contact+"&3_Net_GBP="+NewQuoNet_GBP+"&3_Tax_Code="+NewQuoTax_Code+"&3_VAT_GBP="+NewQuoVAT_GBP+"&3_NC="+NewQuoNC+"&3_Gross_GBP="+NewQuoGross_GBP+"&3_Department="+NewQuoDepartment+"&3_Consign_Number="+NewQuoConsign_Number+"&3_Courier="+NewQuoCourier+"&4_Days="+NewQuoDays+"&4_Discount="+NewQuoDiscount+"&4_Amount_GBP="+NewQuoAmount_GBP+"&4_Total_GBP="+NewQuoTotal_GBP+"&5_NC="+NewQuoGlobal_NC+"&5_Details="+NewQuoDetails+"&5_Tax_Code="+NewQuoGlobal_Tax_Code+"&5_Department="+NewQuoGlobal_Department+"&6_Payment_Ref="+NewQuoPayment_Ref+"&6_Bank_Account="+NewQuoBank_Account+"&6_Payment_Amount_GBP="+NewQuoPayment_Amount_GBP;
var xmlhttp = newHttpRequest(url,true);
	if( xmlhttp==null ) return;
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4 ) {
			if( xmlhttp.status!=200 ) alert("Connection error");
			else if(xmlhttp.responseText=='1') {
				alert("Data saved OK.");
				gv_newQuoEditedName=null;
		        gv_newQuoEditedValue=null;
		        document.getElementById('savenewquodata').style.visibility = "hidden";
		        NewQuoOrder_Date = getNewQuoSysTime();
                NewQuoCustomer_ACRef="",NewQuoDelivery="", NewQuoOrder_Type='',NewQuoFormat='',NewQuoCustomer_Order_Number='',NewQuoOrder_Number='',NewQuoTotal_GBP='',NewQuoTotal_VAT='',NewQuoCarriage_GBP='',NewQuoCarriage_VAT='';
                NewQuoGross_GBP='',NewQuoCustomer_Tel_No='',NewQuoCustomer_Contact='',NewQuoNet_GBP='',NewQuoTax_Code='',NewQuoVAT_GBP='',NewQuoNC='',NewQuoDepartment='',NewQuoConsign_Number='',NewQuoCourier='',NewQuoDays='';
                NewQuoDiscount='',NewQuoAmount_GBP='',NewQuoSet_Total_GBP='',NewQuoSet_Gross_GBP,NewQuoDetails='',NewQuoPayment_Ref='',NewQuoBank_Account='';
                NewQuoPayment_Amount_GBP='',NewQuoAddress1="",NewQuoAddress2="",NewQuoAddress3="",NewQuoAddress4="",NewQuoAddress5="",NewQuoName="",NewQuoDelivery_Street1='',NewQuoDelivery_Street2='',NewQuoDelivery_Town='';
                NewQuoDelivery_County='',NewQuoDelivery_Post_Code="",NewQuoGlobal_Tax_Code = "";NewQuoGlobal_Department = "";NewQuoGlobal_NC = "";
		    	backSops();  
		    	//strNewQuoItem = "";  
		    	//addNewQuoDropDownValue = ""; 
			}
			else alert("Server error!");
			document.getElementById('idloading').style.visibility='hidden';
			document.getElementById('idSaving').style.visibility='hidden';
		}
	}
	xmlhttp.send(null);
	document.getElementById('idloading').style.visibility='visible';
	document.getElementById('idSaving').style.visibility='visible';	
	
}


