﻿var gv_newPopAC=new Array();
var gv_newPopName=new Array();
var gv_newPopIndex=0; 
var gv_newPopTotPage=0;
var gv_newPopCurPage=0
var gv_scrollCurPage=0;
var gv_scrollTotPage=0;
var gv_newPopRowH=20;
var gv_newPopNumPerPage=0;
var gv_newPopDataCategory=null;
var gv_tempTable;
var gv_newPopEditingData=0;
var gv_newPopEditedName=null;
var gv_newPopFocusIndex=0;
var gv_newPopEditedValue=null;
var addNewPopDropDownValue="";
var NewPopPartCode = "";
var NewPopiPage = 1;
var NewPopTotalPage = 1;
var NewPopListPD = 0;//pan duan showNewPopList(1);
function doNewPopList()
{
    if(document.getElementById('NewPopSupplier_ACRef')){ NewPopPartCode = document.getElementById('NewPopSupplier_ACRef').value;}
	var url = gv_rooturl+"?cmd=NewPopList"+"&NewPopPartCode="+NewPopPartCode+"&NewPopiPage="+NewPopiPage;
	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 newpoptotalpages=xmlhttp.responseXML.getElementsByTagName("NewPopTotalPage");
                NewPopTotalPage = parseInt(newpoptotalpages[0].firstChild.nodeValue);
			    renewNewPopList(xmlhttp.responseXML);
			}
			document.getElementById('idloading').style.visibility='hidden';
			
		}
	}
	xmlhttp.send(null);
	document.getElementById('idloading').style.visibility='visible';
}



function renewNewPopList(xmldoc)
{
	var newpops=xmldoc.getElementsByTagName("NewPop");
	gv_newPopAC.length=gv_newPopName.length=0;
	gv_newPopIndex=0;
	
    for(var i=0; i<newpops.length; i++) {
		var curNode=newpops[i].firstChild;
		gv_newPopAC[i]=gv_newPopName[i]="";
		while( curNode ) 
		{
			switch(curNode.nodeName){
				case "AC" : gv_newPopAC[i]=curNode.firstChild.nodeValue;  break;
				case "Name" : gv_newPopName[i]=curNode.firstChild.nodeValue;  break;
			}
			curNode=curNode.nextSibling;
		}
    }
    if(newpops.length==0) alert("No Newpops found!");
    else {
		gv_newPopTotPage=0;
		showNewPopList(0);
	}
}


function showNewPopList(NewPopStatus)
{
    if(NewPopStatus == 0)
    {
       gv_newPopTotPage=0;
       gv_newPopCurPage=0;
    }
    else if(NewPopStatus == 1)
    {}
    if(NewPopListPD == 1)
    {
        gv_newPopCurPage = NewPopListCurPage;
        gv_newPopTotPage = NewPopListTotPage;
    }
    NewPopListPD = 0;
	if(gv_newPopAC.length==0) return;
    gv_tempTable = document.getElementById('tempTable');
	var ycur=gv_tempTable.style.pixelTop=gv_device==Nokia ? 28:26;
	var tdstr="<td height='"+gv_newPopRowH+"px'>";
	var tabstr="<table border='1' cellpadding='1' cellspacing='0' style='position:absolute;width:"+(gv_winw-4)+"px;left:2px;'>"; 
	//var ixs=gv_newPopCurPage*gv_newPopNumPerPage;
	var idx=0;
    for(var i=0; i<gv_newPopAC.length; i++) {
		var imgName=idx==gv_newPopIndex ? 'radon.png':'radoff.png';
		var trColor=idx==gv_newPopIndex ? '#ffcc00':'#add8e6';
		var radstr="<td width='22px' height='"+gv_newPopRowH+"px'><input type='image' src='img/"+imgName+
			"' id='sup_img"+idx+"' onclick='newPopRowClicked(event);'";
		if(gv_device==Nokia) radstr+="onfocus='overNewPopItem(event);' onblur='leavNewPopItem(event);'></td>";
		else radstr+="onmouseover='overNewPopItem(event);' onmouseleave='leavNewPopItem(event);'></td>";
		tabstr+="<tr id='sup_row"+idx+"' onclick='newPopRowClicked(event);' style='background-color:"+
			trColor+";'>"+radstr + tdstr+gv_newPopAC[i]+"</td>"+tdstr+gv_newPopName[i]+"</td></tr>";
		//ycur+=gv_newPopRowH;
		//if(ycur+45>gv_winh) break; else 
		idx++;
    }
//    if(gv_newPopTotPage==0) {
//		gv_scrollCurPage=gv_newPopCurPage=0;
//		gv_newPopNumPerPage=i;
//		var ntt=gv_newPopAC.length;
//		gv_newPopTotPage=0;
//		while(ntt>0) {gv_newPopTotPage++; ntt-=gv_newPopNumPerPage; }
		gv_scrollTotPage=NewPopTotalPage;
		if(gv_device!=Nokia) {
			var mleft=document.getElementById('img_mleft4');
			mleft.onclick=newPopPageLeft;
			mleft.style.cursor='hand';
			var mright=document.getElementById('img_mright4');
			mright.onclick=newPopPageRight;
			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_newPopFocusIndex=gv_newPopIndex;
	
    var newpopcmd = document.getElementById('popCmds');
	newpopcmd.style.pixelLeft=gv_winw-newpopcmd.style.pixelWidth-1;
	newpopcmd.style.pixelTop = gv_winh-29;
    newpopcmd.style.visibility='visible';
    if(gv_device!=Nokia) {
		var btn1=document.getElementById('btnNewPopEdit');
		if(btn1==null) setNewPopPageScrollCommands(
			"<input type='button' id='btnNewPopEdit' value='OK' onclick='editNewPopDetail();' />",
			"<input type='button'   id='btnNewPopDetail' value='' onclick='editNewPopDetail();' />");
			document.getElementById('btnNewPopDetail').style.visibility='hidden';
	}
	setNewPopPageScroll();
	doNokiaMenuNewPopList();    
}

function doNokiaMenuNewPopList()
{
	if(window.widget) {
		window.menu.clear();
		var mEdit = new MenuItem('OK',2102);
		mEdit.onSelect=editNewPopDetail;
		window.menu.append(mEdit);
		}
}

function newPopRowClicked(ee)
{
	var srcele=getEventObject(ee);
	if(srcele.id.length<8) return;
	var newIndex=parseInt(srcele.id.substring(7));
	if(gv_newPopIndex==newIndex) return;
	document.getElementById('sup_row'+gv_newPopIndex).style.backgroundColor='#add8e6';
	document.getElementById('sup_img'+gv_newPopIndex).src='img/radoff.png';
	document.getElementById('sup_row'+newIndex).style.backgroundColor='#ffcc00';
	document.getElementById('sup_img'+newIndex).src='img/radon.png';
	gv_newPopIndex=newIndex;
}
function overNewPopItem(e_event)
{
	var srcobj=getEventObject(e_event);
	if(srcobj.id=='sup_img'+gv_newPopIndex) return; // Entering the current selection
	srcobj.src="img/radover.png";
}
function leavNewPopItem(e_event)
{
	var srcobj=getEventObject(e_event);
	if(srcobj.id=='sup_img'+gv_newPopIndex) return; // Leaving the current selection
	srcobj.src="img/radoff.png";
}

function getNewPopDetail()
{
	var ACIndex=gv_newPopCurPage*gv_newPopNumPerPage+gv_newPopIndex;
	var url = gv_rooturl+"?cmd=NewPopDetail&AC="+gv_newPopAC[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_newPopDataCategory=xmlhttp.responseXML.getElementsByTagName("DataCategory");
				if(gv_newPopDataCategory.length==0) alert("Cannot load details!");
				else {
					gv_scrollCurPage=0;
					gv_scrollTotPage=gv_newPopDataCategory.length;
					//document.getElementById('supCmds').style.visibility='hidden';
					//if(document.getElementById('savenewpopdata') != null) { document.getElementById('savenewpopdata').style.visibility = "visible"; }//getSupplist zhi hou xian shi save
					setNewPopPageScrollCommands("<input type='button' id='savenewpopdata' value='Save' onclick='saveNewPopData();' />","");//getSupplist zhi hou xian shi save
					showNewPopDataPage("Load");
				}
			}
			document.getElementById('idloading').style.visibility='hidden';
		}
	}
	xmlhttp.send(null);
	document.getElementById('idloading').style.visibility='visible';
	gv_newPopEditedName=null;
	gv_newPopEditedValue=null;
}

function showNewPopDetail(cmdid)
{
	gv_newPopEditingData=0;
	getNewPopDetail();
}

function editNewPopDetail()
{
	gv_newPopEditingData=1;
	getNewPopDetail();
}












function doNewPop()
{

	var url = gv_rooturl+"?cmd=NewPopDetail";
	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_newPopDataCategory=xmlhttp.responseXML.getElementsByTagName("DataCategory");
				if(gv_newPopDataCategory.length==0) alert("Cannot load details!");
			
				else 
				{
					gv_scrollCurPage=0;
					gv_scrollTotPage=gv_newPopDataCategory.length;
					gv_newPopEditingData=1;
					setNewPopPageScrollCommands("<input type='button' id='savenewpopdata' value='Save' onclick='saveNewPopData();' />","");
					showNewPopDataPage("FirstLoad");
				  }
				   
			}
			document.getElementById('idloading').style.visibility='hidden';
//			document.getElementById('popCmds').style.visibility='visible';
        }
     }
	xmlhttp.send(null);
	document.getElementById('idloading').style.visibility='visible';
}

function getNewPopSysTime()
{
  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 NewPopOrder_Date=getNewPopSysTime();
var NewPopOrder_Ref='',NewPopOrder_Number='',NewPopCustomer_Order_No='',NewPopProject_Ref='',NewPopCost_Code='',NewPopTotal_GBP='',NewPopTotal_VAT='',NewPopCarriage_GBP='',NewPopCarriage_VAT='',NewPopGross_GBP='',NewPopDelivery_Street1='',NewPopDelivery_Street2='',NewPopDelivery_Town='',NewPopDelivery_County='',NewPopDelivery_Post_Code='',NewPopCustomer_Tel_No='',NewPopCustomer_Contact='',NewPopNet_GBP='',NewPopTax_Code='',NewPopVAT_GBP='',NewPopNC='',NewPopGross_GBP='',NewPopDepartment='',Consign_Number='',NewPopCourier='',NewPopDays='',NewPopDiscount='',NewPopAmount_GBP='',NewPopSet_Gross_GBP,NewPopSet_Total_GBP='',NewPopSupplier_ACRef="",NewPopDelivery="",NewPopConsign_Number="";
var NewPopAddress1='',NewPopAddress2='',NewPopAddress3='',NewPopAddress4='',NewPopAddress5='',NewPopName='';
function showNewPopDataPage(HasStatus)
{
    gv_tempTable = document.getElementById('tempTable');
    var ycur=gv_tempTable.style.pixelTop=gv_device==Nokia ? 28:26;
	var tdh="height='"+gv_newPopRowH+"px'";  //height='24px'
    if(gv_device!=Nokia) {   
		var mleft=document.getElementById('img_mleft4');
			mleft.onclick=newPopPageLeft;
			mleft.style.cursor='hand';
			var mright=document.getElementById('img_mright4');
			mright.onclick=newPopPageRight;
			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";
	}
	
	var newpopcmd = document.getElementById('popCmds');
	newpopcmd.style.pixelLeft=gv_winw-newpopcmd.style.pixelWidth-1;
	newpopcmd.style.pixelTop = gv_winh-29;
	
    newpopcmd.style.visibility='visible';
	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</td><td><select class='edtxt' "+widstyle+" id='selnewpopcat' onchange='jumpToNewPopCat();'>";
    for(var ic=0; ic<gv_newPopDataCategory.length; ic++)
    {
		var attName0=gv_newPopDataCategory[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_newPopDataCategory.length; ic++) {
		var attName=gv_newPopDataCategory[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_newPopRowH;

		var curNode=gv_newPopDataCategory[ic].firstChild;
		var end_tdr = gv_newPopEditingData==1 ? "></td></tr>":" ReadOnly></td></tr>";
		while( curNode ) 
		{
			var itemName=curNode.nodeName;
			var itemId=ic.toString()+"_"+itemName;
//			 rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"</td>";
			var ndv=curNode.firstChild;
			var itemVal=getEditedNewPopData(itemId);
			
			if(itemVal==null) itemVal=ndv?ndv.nodeValue:'';
		if(HasStatus == "FirstLoad")
		{	
			if(itemName=="Supplier_ACRef")
			{
			  NewPopSupplier_ACRef="";
			  rowtxt+="<tr><td align=right "+tdh+">Supplier A/C Ref <span style = 'color: red'>*</span></td>";
			  rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' onchange='showSupplierList();' style='width:125px;height:20px;'value='"+NewPopSupplier_ACRef+"'  id='NewPopSupplier_ACRef'><input type='Button' value='Get' onclick='getSupplierACRef();' runat='server' style='color: blue; width: 35px;height: 20px; font-weight: bold; text-decoration: underline;' /></td>";
			}
			else if(itemName=="Order_Ref")
			{
			   NewPopOrder_Ref = "";
               rowtxt+="<tr><td align=right "+tdh+">Order Ref &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopOrder_Ref+"' id='NewPopOrder_Ref'>";	  

			}
			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='showSaveNewPopDataButton();' value='"+NewPopOrder_Date+"' id='NewPopOrder_Date'>";	  
			}
			else if(itemName=="Order_Number")
			{
			   NewPopOrder_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='showSaveNewPopDataButton();' value='"+NewPopOrder_Number+"' id='NewPopOrder_Number'>";	  
			}
//			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_No")
			{
			   NewPopCustomer_Order_No = "";
               rowtxt+="<tr><td align=right "+tdh+">Customer Order No &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopCustomer_Order_No+"' id='NewPopCustomer_Order_No'>";	  
			}
			else if(itemName=="Project_Ref")
			{
			   NewPopProject_Ref = "";
               rowtxt+="<tr><td align=right "+tdh+">Project Ref &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopProject_Ref+"' id='NewPopProject_Ref'>";	  

			}
			else if(itemName=="Cost_Code")
			{
			   NewPopCost_Code = "";
               rowtxt+="<tr><td align=right "+tdh+">Cost Code &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopCost_Code+"' id='NewPopCost_Code'>";	  

			}
            else if(itemName=="Total_GBP")
			{
			   NewPopTotal_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='showSaveNewPopDataButton();' value='"+NewPopTotal_GBP+"' id='NewPopTotal_GBP' ReadOnly>";	  

			}
			else if(itemName=="Total_VAT")
			{
			   NewPopTotal_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='showSaveNewPopDataButton();' value='"+NewPopTotal_VAT+"' id='NewPopTotal_VAT' ReadOnly>";	  

			}
			else if(itemName=="Carriage_GBP")
			{
			   NewPopCarriage_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='showSaveNewPopDataButton();' value='"+NewPopCarriage_GBP+"' id='NewPopCarriage_GBP'>";	  

			}
			else if(itemName=="Carriage_VAT")
			{
			   NewPopCarriage_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='showSaveNewPopDataButton();' value='"+NewPopCarriage_VAT+"' id='NewPopCarriage_VAT'>";	  

			}
			else if(itemName=="Gross_GBP")
			{
			   NewPopGross_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='showSaveNewPopDataButton();' value='"+NewPopGross_GBP+"' id='NewPopGross_GBP' ReadOnly>";	  

			}
			else if(itemName=="Delivery")
			{
			  NewPopDelivery="";
               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='showSaveNewPopDataButton();' value='"+NewPopDelivery+"' id='NewPopDelivery'>";	  
             
			}
			else if(itemName=="Address1")
			{
			  NewPopAddress1="";
               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='showSaveNewPopDataButton();' value='"+NewPopAddress1+"' id='NewPopAddress1'>";	  
             
			}
			else if(itemName=="Address2")
			{
			   NewPopAddress2 = "";
               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='showSaveNewPopDataButton();' value='"+NewPopAddress2+"' id='NewPopAddress2'>";	  
             
			}
			else if(itemName=="Address3")
			{
			   NewPopAddress3="";
               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='showSaveNewPopDataButton();' value='"+NewPopAddress3+"' id='NewPopAddress3'>";	  
             
			}
			else if(itemName=="Address4")
			{
			    NewPopAddress4="";
               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='showSaveNewPopDataButton();' value='"+NewPopAddress4+"' id='NewPopAddress4'>";	  
             
			}
			else if(itemName=="Address5")
			{
			   NewPopAddress5="";
               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='showSaveNewPopDataButton();' value='"+NewPopAddress5+"' id='NewPopAddress5'>";	  
             
			}
			else if(itemName=="Name")
			{
			   NewPopName="";
               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='showSaveNewPopDataButton();' value='"+NewPopName+"' id='NewPopName'>";	  
             
			}
			else if(itemName=="Delivery_Street1")
			{
			    NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Street1+"' id='NewPopDelivery_Street1'>";	  
              
			}
			else if(itemName=="Delivery_Street2")
			{
			   NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Street2+"' id='NewPopDelivery_Street2'>";	  
               
			}
			else if(itemName=="Delivery_Town")
			{
			   NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Town+"' id='NewPopDelivery_Town'>";	  
              
			}
			else if(itemName=="Delivery_County")
			{
			   NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_County+"' id='NewPopDelivery_County'>";	  
               
			}
			else if(itemName=="Delivery_Post_Code")
			{
			   NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Post_Code+"' id='NewPopDelivery_Post_Code'>";	  
              
			}
			else if(itemName=="Customer_Tel_No")
			{
                NewPopCustomer_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='showSaveNewPopDataButton();' value='"+NewPopCustomer_Tel_No+"' id='NewPopCustomer_Tel_No'>";	  
			}
			else if(itemName=="Customer_Contact")
			{
			   NewPopCustomer_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='showSaveNewPopDataButton();' value='"+NewPopCustomer_Contact+"' id='NewPopCustomer_Contact'>";	  
			}
			else if(itemName=="Net_GBP")
			{
			   NewPopNet_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='showSaveNewPopDataButton();' value='"+NewPopNet_GBP+"' id='NewPopNet_GBP' ReadOnly>";	  

			}

             else if(itemName=="Tax_Code")
             {
                NewPopTax_Code = "";
                 var rowJumpTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt'  id='NewPopTax_Code'  "+widstyle+"  onchange='TaxCode();'>";
                 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==NewPopTax_Code)  { rowJumpTaxCode+="selected=true"; }
                    if(NewPopTax_Code == "" && i == 1) { rowJumpTaxCode+="selected=true"; }
                    rowJumpTaxCode+=">"+attTaxCodeName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpTaxCode+"</select></td></tr>";
                   
	          }
              
	          
	          
			else if(itemName=="VAT_GBP")
			{
			   NewPopVAT_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='showSaveNewPopDataButton();' value='"+NewPopVAT_GBP+"' id='NewPopVAT_GBP'>";	  
			}
			else if(itemName=="NC")
			{
			   NewPopNC = "";
               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='showSaveNewPopDataButton();' value='"+NewPopNC+"' id='NewPopNC'>";	  
			}
			else if(itemName=="Set_Gross_GBP")
			{
			    NewPopGross_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='showSaveNewPopDataButton();' value='"+NewPopGross_GBP+"' id='NewPopSet_Gross_GBP' ReadOnly>";
               

			}
			else if(itemName=="Department")
            {
                NewPopDepartment = "";
                 var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt'  id='NewPopDepartment' "+widstyle+"  onchange='TaxCode();'>";
                 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==NewPopDepartment) {rowJumpDepartment+="selected=true";}
                    if(NewPopDepartment =="" && i == 0)  {rowJumpDepartment+="selected=true";}
                    
                    rowJumpDepartment+=">"+attDepartmentName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpDepartment+"</select></td></tr>";
	        }
			else if(itemName=="Consign_Number")
			{
			   NewPopConsign_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='showSaveNewPopDataButton();' value='"+NewPopConsign_Number+"' id='NewPopConsign_Number'>";	  

			}
			 else if(itemName=="Courier")
             {
                NewPopCourier = "";
                 var rowJumpCourier="<tr><td align='right'"+tdh+">Courier &nbsp</td><td><select class='edtxt'   id='NewPopCourier' "+widstyle+" onchange='TaxCode();'>";
                 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==NewPopCourier) {rowJumpCourier+="selected=true";}
                    if(NewPopCourier == "" && i == 0)  {rowJumpCourier+="selected=true";}
                    rowJumpCourier+=">"+attCourierName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpCourier+"</select></td></tr>";
	          }
			else if(itemName=="Days")
			{
			    NewPopDays="";
               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='showSaveNewPopDataButton();' value='"+NewPopDays+"' id='NewPopDays'>";	  
               NewPopDays=itemVal;
			}
			else if(itemName=="Discount")
			{
			  NewPopDiscount="";
               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='showSaveNewPopDataButton();' value='"+NewPopDiscount+"' id='NewPopDiscount'>";	  
               
			}
			else if(itemName=="Amount_GBP")
			{
			   NewPopAmount_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='showSaveNewPopDataButton();' value='"+NewPopAmount_GBP+"' id='NewPopAmount_GBP' ReadOnly>";	   

			}
			else if(itemName=="Set_Total_GBP")
			{
			   NewPopSet_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='showSaveNewPopDataButton();' value='"+NewPopSet_Total_GBP+"' id='NewPopSet_Total_GBP' ReadOnly>";	  

			}
			else if(itemName=="Item_No")//
			{
			   var rowJump1="<tr><td align=right "+tdh+">Item No &nbsp</td><td><select class='edtxt' "+widstyle+" id='selnewpopitempagecat'  onchange='jumpToPopItemPageCat();'>";
               var popItems = curNode.firstChild;
              for(var i=0; i<curNode.childNodes.length;i++) 
              { 
                var attName1=curNode.childNodes[i].childNodes[0].data;           
               if(attName1) 
               {
               var tname1=attName1.replace('_',' ');
                    rowJump1+="<option label='"+tname1+"'";
                      if(i==gv_scrollCurPage) rowJump1+=" selected=true";
                         rowJump1+=">"+tname1+"</option>"; 
                    
               }
               
             }  
              rowJump1+="<tr><td  colspan=2 align=center "+tdh+" style='color:blue;font-weight:bold;'>";
              rowJump1 += "<input type='Button'  value='AddItem' onclick='getNewPopItemPage();' runat='server' id='addnewpopitemturnbtn'  style='color: blue; width: 65px;height: 20px; font-weight: bold; text-decoration: underline;' />";
              rowJump1 += "&nbsp&nbsp&nbsp&nbsp&nbsp<input type='Button'  value='EditItem' id='editnewpopitemturnbtn'  onclick='getEditNewPopItemPage();' runat='server' style='color: blue; width: 65px;height: 20px; font-weight: bold; text-decoration: underline;' disabled='true' /></td></tr>";
	          rowtxt+= rowJump1;
	            
	             }
	             

			else
			{
			  rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"&nbsp&nbsp"+"</td>";
			  rowtxt+="<td "+tdh+"><input type='text' class='edtxt' onchange='showSaveNewPopDataButton();' "+widstyle+
				"value='' id='"+itemId+"'"+end_tdr;
			}
			}
			if(HasStatus == "Load")
			{
			    if(itemName=="Supplier_ACRef")
			    {
			      NewPopSupplier_ACRef=itemVal;
			      rowtxt+="<tr><td align=right "+tdh+">Supplier A/C Ref <span style = 'color: red'>*</span></td>";
			      rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' onchange='showSupplierList();' style='width:125px;height:20px;'value='"+NewPopSupplier_ACRef+"' id='NewPopSupplier_ACRef'><input type='Button' value='Get' onclick='getSupplierACRef();' runat='server' style='color: blue; width: 35px;height: 20px; font-weight: bold; text-decoration: underline;' /></td>";
			    }
			    else if(itemName=="Order_Ref")
			    {
			        NewPopOrder_Ref = itemVal;
                   rowtxt+="<tr><td align=right "+tdh+">Order Ref &nbsp</td>";
                   rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopOrder_Ref+"' id='NewPopOrder_Ref'>";	  
			    }
			    else if(itemName=="Order_Date")
			    {
			       NewPopOrder_Date = getNewPopSysTime();
                   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='showSaveNewPopDataButton();' value='"+NewPopOrder_Date+"' id='NewPopOrder_Date'>";	  
			    }
			    else if(itemName=="Order_Number")
			    {
			       NewPopOrder_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='showSaveNewPopDataButton();' value='"+NewPopOrder_Number+"' id='NewPopOrder_Number'>";	  
			    }
    //			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_No")
			    {
			       NewPopCustomer_Order_No = itemVal; 
                   rowtxt+="<tr><td align=right "+tdh+">Customer Order No &nbsp</td>";
                   rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopCustomer_Order_No+"' id='NewPopCustomer_Order_No'>";	  
			    }
			    else if(itemName=="Project_Ref")
			    {
			       NewPopProject_Ref = itemVal; 
                   rowtxt+="<tr><td align=right "+tdh+">Project Ref &nbsp</td>";
                   rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopProject_Ref+"' id='NewPopProject_Ref'>";	  
			    }
			    else if(itemName=="Cost_Code")
			    {
			        NewPopCost_Code = itemVal;
                   rowtxt+="<tr><td align=right "+tdh+">Cost Code &nbsp</td>";
                   rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopCost_Code+"' id='NewPopCost_Code'>";	  
			    }
                else if(itemName=="Total_GBP")
			    {
    			    NewPopTotal_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='showSaveNewPopDataButton();' value='"+NewPopTotal_GBP+"' id='NewPopTotal_GBP' ReadOnly>";	  
			    }
			    else if(itemName=="Total_VAT")
			    {
			       NewPopTotal_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='showSaveNewPopDataButton();' value='"+NewPopTotal_VAT+"' id='NewPopTotal_VAT' ReadOnly>";	  
			    }
			    else if(itemName=="Carriage_GBP")
			    {
			       NewPopCarriage_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='showSaveNewPopDataButton();' value='"+NewPopCarriage_GBP+"' id='NewPopCarriage_GBP'>";	  
			    }
			    else if(itemName=="Carriage_VAT")
			    {
			        NewPopCarriage_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='showSaveNewPopDataButton();' value='"+NewPopCarriage_VAT+"' id='NewPopCarriage_VAT'>";	  
			    }
			    else if(itemName=="Gross_GBP")
			    {
			        NewPopGross_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='showSaveNewPopDataButton();' value='"+NewPopGross_GBP+"' id='NewPopGross_GBP' ReadOnly>";	  
			    }
			    else if(itemName=="Delivery")
			    {
			       NewPopDelivery=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='showSaveNewPopDataButton();' value='"+NewPopDelivery+"' id='NewPopDelivery'>";	  
                 
			    }
			    else if(itemName=="Address1")
			    {
			       NewPopAddress1=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='showSaveNewPopDataButton();' value='"+NewPopAddress1+"' id='NewPopAddress1'>";	  
                 
			    }
			    else if(itemName=="Address2")
			    {
			       NewPopAddress2=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='showSaveNewPopDataButton();' value='"+NewPopAddress2+"' id='NewPopAddress2'>";	  
                 
			    }
			    else if(itemName=="Address3")
			    {
			       NewPopAddress3=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='showSaveNewPopDataButton();' value='"+NewPopAddress3+"' id='NewPopAddress3'>";	  
                 
			    }
			    else if(itemName=="Address4")
			    {
			      NewPopAddress4=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='showSaveNewPopDataButton();' value='"+NewPopAddress4+"' id='NewPopAddress4'>";	  
                 
			    }
			    else if(itemName=="Address5")
			    {
			       NewPopAddress5=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='showSaveNewPopDataButton();' value='"+NewPopAddress5+"' id='NewPopAddress5'>";	  
                 
			    }
			    else if(itemName=="Name")
			    {
			      NewPopName=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='showSaveNewPopDataButton();' value='"+NewPopName+"' id='NewPopName'>";	  
                 
			    }
			    else if(itemName=="Delivery_Street1")
			    {
			       NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Street1+"' id='NewPopDelivery_Street1'>";	  
                  
			    }
			    else if(itemName=="Delivery_Street2")
			    {
			        NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Street2+"' id='NewPopDelivery_Street2'>";	  
                   
			    }
			    else if(itemName=="Delivery_Town")
			    {
			        NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Town+"' id='NewPopDelivery_Town'>";	  
                  
			    }
			    else if(itemName=="Delivery_County")
			    {
			        NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_County+"' id='NewPopDelivery_County'>";	  
                   
			    }
			    else if(itemName=="Delivery_Post_Code")
			    {
			       NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Post_Code+"' id='NewPopDelivery_Post_Code'>";	  
                  
			    }
			    else if(itemName=="Customer_Tel_No")
			    {
                   NewPopCustomer_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='showSaveNewPopDataButton();' value='"+NewPopCustomer_Tel_No+"' id='NewPopCustomer_Tel_No'>";	  
			    }
			    else if(itemName=="Customer_Contact")
			    {
			       NewPopCustomer_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='showSaveNewPopDataButton();' value='"+NewPopCustomer_Contact+"' id='NewPopCustomer_Contact'>";	  
			    }
			    else if(itemName=="Net_GBP")
			    {
			      NewPopNet_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='showSaveNewPopDataButton();' value='"+NewPopNet_GBP+"' id='NewPopNet_GBP'>";	  

			    }

                 else if(itemName=="Tax_Code")
                 {
                     NewPopTax_Code = itemVal;
                     var rowJumpTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt'  id='NewPopTax_Code'  "+widstyle+"  onchange='TaxCode();'>";
                     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==NewPopTax_Code)  { rowJumpTaxCode+="selected=true"; }
                        else if(NewPopTax_Code == "" && i == 1) { rowJumpTaxCode+="selected=true"; }
                        rowJumpTaxCode+=">"+attTaxCodeName+"</option>"; 
                       }
                     }  
                         rowtxt+=rowJumpTaxCode+"</select></td></tr>";
                       
	              }
                  
    	          
    	          
			    else if(itemName=="VAT_GBP")
			    {
			       NewPopVAT_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='showSaveNewPopDataButton();' value='"+NewPopVAT_GBP+"' id='NewPopVAT_GBP'>";	  
			    }
			    else if(itemName=="NC")
			    {
			       NewPopNC = 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='showSaveNewPopDataButton();' value='"+NewPopNC+"' id='NewPopNC'>";	  
			    }
			    else if(itemName=="Set_Gross_GBP")
			    {
			       if(NewPopCarriage_GBP != "" && NewPopCarriage_VAT != "") 
			       {
			          var   m=/^\d+$/;   
			          if(m.test(NewPopCarriage_GBP.toString()))
			          {
			              if(m.test(NewPopCarriage_VAT.toString()))
			               {NewPopSet_Gross_GBP=parseFloat(NewPopCarriage_GBP) + parseFloat(NewPopCarriage_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='showSaveNewPopDataButton();' value='"+NewPopSet_Gross_GBP+"' id='NewPopSet_Gross_GBP' ReadOnly>";
                   

			    }
				 else if(itemName=="Department")
                 {
                    NewPopDepartment = itemVal;
                     var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt'  id='NewPopDepartment' "+widstyle+"  onchange='TaxCode();'>";
                     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==NewPopDepartment) {rowJumpDepartment+="selected=true";}
                        if(NewPopDepartment =="" && i == 0)  {rowJumpDepartment+="selected=true";}
                        
                        rowJumpDepartment+=">"+attDepartmentName+"</option>"; 
                       }
                     }  
                         rowtxt+=rowJumpDepartment+"</select></td></tr>";
	              }
			    else if(itemName=="Consign_Number")
			    {
			        NewPopConsign_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='showSaveNewPopDataButton();' value='"+NewPopConsign_Number+"' id='NewPopConsign_Number'>";	  
			    }
			     else if(itemName=="Courier")
                 {
                    NewPopCourier = itemVal;
                     var rowJumpCourier="<tr><td align='right'"+tdh+">Courier &nbsp</td><td><select class='edtxt'   id='NewPopCourier' "+widstyle+" onchange='TaxCode();'>";
                     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==NewPopCourier) {rowJumpCourier+="selected=true";}
                        if(NewPopCourier == "" && i == 0)  {rowJumpCourier+="selected=true";}
                        rowJumpCourier+=">"+attCourierName+"</option>"; 
                       }
                     }  
                         rowtxt+=rowJumpCourier+"</select></td></tr>";
	              }
			    else if(itemName=="Days")
			    {
			       NewPopDays=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='showSaveNewPopDataButton();' value='"+NewPopDays+"' id='NewPopDays'>";	  
			    }
			    else if(itemName=="Discount")
			    {
			       NewPopDiscount=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='showSaveNewPopDataButton();' value='"+NewPopDiscount+"' id='NewPopDiscount'>";	  
                   
			    }
			    else if(itemName=="Amount_GBP")
			    {
			       if(NewPopTotal_GBP != "" && NewPopDiscount != "") { NewPopAmount_GBP = NewPopTotal_GBP * NewPopDiscount / 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='showSaveNewPopDataButton();' value='"+NewPopAmount_GBP+"' id='NewPopAmount_GBP' ReadOnly>";	  

			    }
			    else if(itemName=="Set_Total_GBP")
			    {
			       if(NewPopGross_GBP != '' && NewPopAmount_GBP != '') { NewPopSet_Total_GBP = NewPopGross_GBP - NewPopAmount_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='showSaveNewPopDataButton();' value='"+NewPopSet_Total_GBP+"' id='NewPopSet_Total_GBP' ReadOnly>";	  

			    }
			    else if(itemName=="Item_No")//
			    {
			       var rowNewPopJump="<tr><td align=right "+tdh+">Item No &nbsp</td><td><select class='edtxt'  class='edtxt' "+widstyle+" id='selnewpopitempagecat'  onchange='jumpToPopItemPageCat();'>";
                   rowNewPopJump += addNewPopDropDownValue;
                     
                   rowNewPopJump += "</select></td></tr>";
                   rowNewPopJump+="<tr><td  colspan=2 align=center "+tdh+" style='color:blue;font-weight:bold;'>";
                   rowNewPopJump += "<input type='Button' value='AddItem' onclick='getNewPopItemPage();' runat='server' id='addnewpopitemturnbtn'  style='color: blue; width: 65px;height: 20px; font-weight: bold; text-decoration: underline;' />";
                   rowNewPopJump += "&nbsp&nbsp&nbsp&nbsp&nbsp<input type='Button' value='EditItem' id='editnewpopitemturnbtn'  onclick='getEditNewPopItemPage();' runat='server' style='color: blue; width: 65px;height: 20px; font-weight: bold; text-decoration: underline;' disabled='true';/></td></tr>";
	               rowtxt+= rowNewPopJump;
    	            
	            }
    	             
			    else
			    {
			      rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"&nbsp&nbsp"+"</td>";
			      rowtxt+="<td "+tdh+"><input type='text' class='edtxt' onchange='showSaveNewPopDataButton();' "+widstyle+
				    "value='"+itemVal+"' id='"+itemId+"'"+end_tdr;
			    }
			}
			if(HasStatus == "OtherLoad")
			{
						
			 if(itemName=="Supplier_ACRef")
			{
			  NewPopSupplier_ACRef=itemVal;
			  rowtxt+="<tr><td align=right "+tdh+">Supplier A/C Ref <span style = 'color: red'>*</span></td>";
			  rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' onchange='showSupplierList();' style='width:125px;height:20px;'value='"+NewPopSupplier_ACRef+"' id='NewPopSupplier_ACRef'><input type='Button' value='Get' onclick='getSupplierACRef();' runat='server' style='color: blue; width: 35px;height: 20px; font-weight: bold; text-decoration: underline;' /></td>";
			}
			else if(itemName=="Order_Ref")
			{
			   
               rowtxt+="<tr><td align=right "+tdh+">Order Ref &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopOrder_Ref+"' id='NewPopOrder_Ref'>";	  

			}
			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='showSaveNewPopDataButton();' value='"+NewPopOrder_Date+"' id='NewPopOrder_Date'>";	  
			}
			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='showSaveNewPopDataButton();' value='"+NewPopOrder_Number+"' id='NewPopOrder_Number'>";	  
			}
//			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_No")
			{
               rowtxt+="<tr><td align=right "+tdh+">Customer Order No &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopCustomer_Order_No+"' id='NewPopCustomer_Order_No'>";	  
			}
			else if(itemName=="Project_Ref")
			{
               rowtxt+="<tr><td align=right "+tdh+">Project Ref &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopProject_Ref+"' id='NewPopProject_Ref'>";	  
			}
			else if(itemName=="Cost_Code")
			{
               rowtxt+="<tr><td align=right "+tdh+">Cost Code &nbsp</td>";
               rowtxt+="<td align=center"+tdh+"><input type='text' class='edtxt' style='width:160px;height:20px;' onchange='showSaveNewPopDataButton();' value='"+NewPopCost_Code+"' id='NewPopCost_Code'>";	  
			}
            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='showSaveNewPopDataButton();' value='"+NewPopTotal_GBP+"' id='NewPopTotal_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='showSaveNewPopDataButton();' value='"+NewPopTotal_VAT+"' id='NewPopTotal_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='showSaveNewPopDataButton();' value='"+NewPopCarriage_GBP+"' id='NewPopCarriage_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='showSaveNewPopDataButton();' value='"+NewPopCarriage_VAT+"' id='NewPopCarriage_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='showSaveNewPopDataButton();' value='"+NewPopGross_GBP+"' id='NewPopGross_GBP' ReadOnly>";	  
			}
			else if(itemName=="Delivery")
			{
			   //if(NewPopDelivery =="") { NewPopDelivery=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='showSaveNewPopDataButton();' value='"+NewPopDelivery+"' id='NewPopDelivery'>";	  
			}
			else if(itemName=="Address1")
			{
			   //if(NewPopAddress1 == "") { NewPopAddress1=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='showSaveNewPopDataButton();' value='"+NewPopAddress1+"' id='NewPopAddress1'>";	  
			}
			else if(itemName=="Address2")
			{
			   //if(NewPopAddress2 == "")  { NewPopAddress2=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='showSaveNewPopDataButton();' value='"+NewPopAddress2+"' id='NewPopAddress2'>";	  
			}
			else if(itemName=="Address3")
			{
			   //if(NewPopAddress3 == "") { NewPopAddress3=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='showSaveNewPopDataButton();' value='"+NewPopAddress3+"' id='NewPopAddress3'>";	  
			}
			else if(itemName=="Address4")
			{
			  //if(NewPopAddress4 == ""){  NewPopAddress4=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='showSaveNewPopDataButton();' value='"+NewPopAddress4+"' id='NewPopAddress4'>";	  
			}
			else if(itemName=="Address5")
			{
			   //if(NewPopAddress5 == "") { NewPopAddress5=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='showSaveNewPopDataButton();' value='"+NewPopAddress5+"' id='NewPopAddress5'>";	  
             
			}
			else if(itemName=="Name")
			{
			  //if(NewPopName=="")  { NewPopName=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='showSaveNewPopDataButton();' value='"+NewPopName+"' id='NewPopName'>";	  
			}
			else if(itemName=="Delivery_Street1")
			{
			   //if(NewPopDelivery_Street1=="") {  NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Street1+"' id='NewPopDelivery_Street1'>";	  
              
			}
			else if(itemName=="Delivery_Street2")
			{
			   //if(NewPopDelivery_Street2 == "") { NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Street2+"' id='NewPopDelivery_Street2'>";	  
               
			}
			else if(itemName=="Delivery_Town")
			{
			  // if(NewPopDelivery_Town == "") { NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Town+"' id='NewPopDelivery_Town'>";	  
              
			}
			else if(itemName=="Delivery_County")
			{
			   //if(NewPopDelivery_County == "") { NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_County+"' id='NewPopDelivery_County'>";	  
			}
			else if(itemName=="Delivery_Post_Code")
			{
			   //if(NewPopDelivery_Post_Code == "") { NewPopDelivery_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='showSaveNewPopDataButton();' value='"+NewPopDelivery_Post_Code+"' id='NewPopDelivery_Post_Code'>";	  
			}
			else if(itemName=="Customer_Tel_No")
			{
               //if(NewPopCustomer_Tel_No == "") { NewPopCustomer_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='showSaveNewPopDataButton();' value='"+NewPopCustomer_Tel_No+"' id='NewPopCustomer_Tel_No'>";	  
			}
			else if(itemName=="Customer_Contact")
			{
			   //if(NewPopCustomer_Contact == "") { NewPopCustomer_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='showSaveNewPopDataButton();' value='"+NewPopCustomer_Contact+"' id='NewPopCustomer_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='showSaveNewPopDataButton();' value='"+NewPopNet_GBP+"' id='NewPopNet_GBP'>";	  
			}

             else if(itemName=="Tax_Code")
             {
                 var rowJumpTaxCode="<tr><td align='right'"+tdh+">Tax Code &nbsp</td><td><select class='edtxt'  id='NewPopTax_Code'  "+widstyle+"  onchange='TaxCode();'>";
                 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==NewPopTax_Code)  { rowJumpTaxCode+="selected=true"; }
                    if(NewPopTax_Code == "" && i == 1) { rowJumpTaxCode+="selected=true"; }
                    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='showSaveNewPopDataButton();' value='"+NewPopVAT_GBP+"' id='NewPopVAT_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='showSaveNewPopDataButton();' value='"+NewPopNC+"' id='NewPopNC'>";	  
			}
			else if(itemName=="Set_Gross_GBP")
			{
			   if(NewPopCarriage_GBP != "" && NewPopCarriage_VAT != "") 
			   {
			      var   m=/^\d+$/;   
			      if(m.test(NewPopCarriage_GBP.toString()))
			      {
			          if(m.test(NewPopCarriage_VAT.toString()))
			           {NewPopSet_Gross_GBP=parseFloat(NewPopCarriage_GBP) + parseFloat(NewPopCarriage_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='showSaveNewPopDataButton();' value='"+NewPopSet_Gross_GBP+"' id='NewPopSet_Gross_GBP' ReadOnly>";
               

			}
			 else if(itemName=="Department")
             {
                 var rowJumpDepartment="<tr><td align='right'"+tdh+">Department &nbsp</td><td><select class='edtxt'  id='NewPopDepartment' "+widstyle+"  onchange='TaxCode();'>";
                 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==NewPopDepartment) {rowJumpDepartment+="selected=true";}
                    if(NewPopDepartment =="" && i == 0)  {rowJumpDepartment+="selected=true";}
                    
                    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='showSaveNewPopDataButton();' value='"+NewPopConsign_Number+"' id='NewPopConsign_Number'>";	  

			}
			 else if(itemName=="Courier")
             {
                 var rowJumpCourier="<tr><td align='right'"+tdh+">Courier &nbsp</td><td><select class='edtxt'   id='NewPopCourier' "+widstyle+" onchange='TaxCode();'>";
                 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==NewPopCourier) {rowJumpCourier+="selected=true";}
                    if(NewPopCourier == "" && i == 0)  {rowJumpCourier+="selected=true";}
                    rowJumpCourier+=">"+attCourierName+"</option>"; 
                   }
                 }  
                     rowtxt+=rowJumpCourier+"</select></td></tr>";
	          }
			else if(itemName=="Days")
			{
			  // if(NewPopDays == "") { NewPopDays=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='showSaveNewPopDataButton();' value='"+NewPopDays+"' id='NewPopDays'>";	  
               //NewPopDays=itemVal;
			}
			else if(itemName=="Discount")
			{
			  // if(NewPopDiscount == "") { NewPopDiscount=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='showSaveNewPopDataButton();' value='"+NewPopDiscount+"' id='NewPopDiscount'>";	  
			}
			else if(itemName=="Amount_GBP")
			{
			   if(NewPopTotal_GBP != "" && NewPopDiscount != "") { NewPopAmount_GBP = NewPopTotal_GBP * NewPopDiscount / 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='showSaveNewPopDataButton();' value='"+NewPopAmount_GBP+"' id='NewPopAmount_GBP' ReadOnly>";	  

			}
			else if(itemName=="Set_Total_GBP")
			{
			   if(NewPopGross_GBP != '' && NewPopAmount_GBP != '') { NewPopSet_Total_GBP = NewPopGross_GBP - NewPopAmount_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='showSaveNewPopDataButton();' value='"+NewPopSet_Total_GBP+"' id='NewPopSet_Total_GBP' ReadOnly>";	  

			}
			else if(itemName=="Item_No")//
			{
			   var rowNewPopJump="<tr><td align=right "+tdh+">Item No &nbsp</td><td><select class='edtxt'  class='edtxt' "+widstyle+" id='selnewpopitempagecat'  onchange='jumpToPopItemPageCat();'>";
               rowNewPopJump += addNewPopDropDownValue;
                 
               rowNewPopJump += "</select></td></tr>";
               rowNewPopJump+="<tr><td  colspan=2 align=center "+tdh+" style='color:blue;font-weight:bold;'>";
               rowNewPopJump += "<input type='Button' value='AddItem' onclick='getNewPopItemPage();' runat='server' id='addnewpopitemturnbtn'  style='color: blue; width: 65px;height: 20px; font-weight: bold; text-decoration: underline;' />";
               rowNewPopJump += "&nbsp&nbsp&nbsp&nbsp&nbsp<input type='Button' value='EditItem' id='editnewpopitemturnbtn'  onclick='getEditNewPopItemPage();' runat='server' style='color: blue; width: 65px;height: 20px; font-weight: bold; text-decoration: underline;' disabled='true';/></td></tr>";
	           rowtxt+= rowNewPopJump;
	            
	        }
	             
			else
			{
			  rowtxt+="<tr><td align=right "+tdh+">"+itemName.replace('_',' ')+"&nbsp&nbsp"+"</td>";
			  rowtxt+="<td "+tdh+"><input type='text' class='edtxt' onchange='showSaveNewPopDataButton();' "+widstyle+
				"value='"+itemVal+"' id='"+itemId+"'"+end_tdr;
			}
			}
			curNode=curNode.nextSibling;
			ycur+=gv_newPopRowH;
		}
		//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(NewPopItemDDVal != "")
    {
        if(document.getElementById("editnewpopitemturnbtn")) { document.getElementById("editnewpopitemturnbtn").disabled = false; }
    }
    if(document.getElementById('savenewpopdata')==null) setNewPopPageScrollCommands('','');
	
	setNewPopPageScroll();
	setTopTitle('pop ->New Pop'); 
	doNokiaMenuNewPopPage();
}


function getNewPopItemPage()
{
    NewPopItemTurnPage = 1;
    doNewPopItem();
}

function getEditNewPopItemPage()
{
    EditNewPopItemStrRun = 1;
    NewPopItemTurnPage = 2;
    doEditNewPopItem();
}


function doNokiaMenuNewPopPage()
{
	if(window.widget) {
		window.menu.clear();
		var mBack = new MenuItem('Back',2102);
		mBack.onSelect=backPops;
		window.menu.append(mBack);		
	}
}


function TaxCode()
{
var NewPopTax=document.getElementById('NewPopTax_Code');
var NewPopDep=document.getElementById('NewPopDepartment');
var NewPopCou=document.getElementById('NewPopCourier');
  if(NewPopTax)
  {
  if(NewPopTax.options[NewPopTax.selectedIndex])
  NewPopTax_Code=NewPopTax.options[NewPopTax.selectedIndex].value; 
  }
  if(NewPopDep)
  {
   if(NewPopDep.options[NewPopDep.selectedIndex])
   NewPopDepartment=NewPopDep.options[NewPopDep.selectedIndex].value; 
  }
  if(NewPopCou)
  {
   if(NewPopCou.options[NewPopCou.selectedIndex])
   NewPopCourier=NewPopCou.options[NewPopCou.selectedIndex].value; 
  }
}

function getSupplierACRef()
{
   document.getElementById('savenewpopdata').style.visibility = "hidden";
   NewPopiPage = 1;
   doNewPopList();
 //document.getElementById('popCmds').style.visibility='hidden';
}


  
function setNewPopPageScroll()
{
    var pncur=document.getElementById('pn_cur4');
    pncur.innerHTML='Page '+(gv_scrollCurPage+1)+' of '+gv_scrollTotPage;
    var pnleft=document.getElementById('pn_left4');
    pnleft.innerHTML=gv_scrollCurPage>0 ? gv_scrollCurPage.toString():'';
    var pnright=document.getElementById('pn_right4');
    pnright.innerHTML=gv_scrollCurPage<gv_scrollTotPage-1 ? (gv_scrollCurPage+2).toString():'';   
 }
function newPopPageLeft()
{
	if(gv_scrollCurPage<=0) return;
	var selcat=document.getElementById('selnewpopcat');
	//var selitemcat=document.getElementById('selnewpopitemcat');
	//var selitemok=document.getElementById('btnNewPopItemOk');
	var divtab=document.getElementById('tempTable');
	var tleft=divtab.style.pixelLeft;
	if(tleft>=gv_winw-30) {	
		gv_scrollCurPage--;
		divtab.style.pixelLeft=0;
		if(selcat) 
		{
	       if(gv_newPopEditingData==1) checkNewPopPageEdited(gv_scrollCurPage+1); //Save any edited data to memory
			selcat.selectedIndex=gv_scrollCurPage;
			if(document.getElementById("NewPopSupplier_ACRef")){NewPopSupplier_ACRef = document.getElementById("NewPopSupplier_ACRef").value;}
			if(document.getElementById("NewPopOrder_Ref")){NewPopOrder_Ref = document.getElementById("NewPopOrder_Ref").value;}
			if(document.getElementById("NewPopOrder_Date")){NewPopOrder_Date = document.getElementById("NewPopOrder_Date").value;}
			if(document.getElementById("NewPopOrder_Number")){NewPopOrder_Number = document.getElementById("NewPopOrder_Number").value;}
			if(document.getElementById("NewPopCustomer_Order_No")){NewPopCustomer_Order_No = document.getElementById("NewPopCustomer_Order_No").value;}
			if(document.getElementById("NewPopProject_Ref")){NewPopProject_Ref = document.getElementById("NewPopProject_Ref").value;}
			if(document.getElementById("NewPopCost_Code")){NewPopCost_Code = document.getElementById("NewPopCost_Code").value;}
			if(document.getElementById("NewPopTotal_GBP")){NewPopTotal_GBP = document.getElementById("NewPopTotal_GBP").value;}
			if(document.getElementById("NewPopTotal_VAT")){NewPopTotal_VAT = document.getElementById("NewPopTotal_VAT").value;}
			if(document.getElementById("NewPopCarriage_GBP")){NewPopCarriage_GBP = document.getElementById("NewPopCarriage_GBP").value;}
			if(document.getElementById("NewPopCarriage_VAT")){NewPopCarriage_VAT = document.getElementById("NewPopCarriage_VAT").value;}
			if(document.getElementById("NewPopGross_GBP")){NewPopGross_GBP = document.getElementById("NewPopGross_GBP").value;}
			if(document.getElementById("NewPopCustomer_Tel_No")){NewPopCustomer_Tel_No = document.getElementById("NewPopCustomer_Tel_No").value;}
			if(document.getElementById("NewPopCustomer_Contact")){NewPopCustomer_Contact = document.getElementById("NewPopCustomer_Contact").value;}
			if(document.getElementById("NewPopNet_GBP")){NewPopNet_GBP = document.getElementById("NewPopNet_GBP").value;}
			if(document.getElementById("NewPopTax_Code")){NewPopTax_Code=document.getElementById('NewPopTax_Code').options[document.getElementById('NewPopTax_Code').selectedIndex].value;}
			if(document.getElementById("NewPopVAT_GBP")){NewPopVAT_GBP = document.getElementById("NewPopVAT_GBP").value;}
			if(document.getElementById("NewPopNC")){NewPopNC = document.getElementById("NewPopNC").value;}
			if(document.getElementById("NewPopSet_Gross_GBP")){NewPopSet_Gross_GBP = document.getElementById("NewPopSet_Gross_GBP").value;}
			if(document.getElementById("NewPopName")){NewPopName = document.getElementById("NewPopName").value;}
			if(document.getElementById("NewPopAddress1")){NewPopAddress1 = document.getElementById("NewPopAddress1").value;}
			if(document.getElementById("NewPopAddress2")){NewPopAddress2 = document.getElementById("NewPopAddress2").value;}
			if(document.getElementById("NewPopAddress3")){NewPopAddress3 = document.getElementById("NewPopAddress3").value;}
			if(document.getElementById("NewPopAddress4")){NewPopAddress4 = document.getElementById("NewPopAddress4").value;}
			if(document.getElementById("NewPopAddress5")){NewPopAddress5 = document.getElementById("NewPopAddress5").value;}
			if(document.getElementById("NewPopDelivery")){NewPopDelivery = document.getElementById("NewPopDelivery").value;}	

			if(document.getElementById("NewPopDelivery_Street1")){NewPopDelivery_Street1 = document.getElementById("NewPopDelivery_Street1").value;}
			if(document.getElementById("NewPopDelivery_Street2")){NewPopDelivery_Street2 = document.getElementById("NewPopDelivery_Street2").value;}
			if(document.getElementById("NewPopDelivery_Town")){NewPopDelivery_Town = document.getElementById("NewPopDelivery_Town").value;}
			if(document.getElementById("NewPopDelivery_County")){NewPopDelivery_County = document.getElementById("NewPopDelivery_County").value;}
			if(document.getElementById("NewPopDelivery_Post_Code")){NewPopDelivery_Post_Code = document.getElementById("NewPopDelivery_Post_Code").value;}
			if(document.getElementById("NewPopDepartment")){NewPopDepartment=document.getElementById('NewPopDepartment').options[document.getElementById('NewPopDepartment').selectedIndex].value;}
			if(document.getElementById("NewPopConsign_Number")){NewPopConsign_Number = document.getElementById("NewPopConsign_Number").value;}
			if(document.getElementById("NewPopCourier")){NewPopCourier=document.getElementById('NewPopCourier').options[document.getElementById('NewPopCourier').selectedIndex].value;}
			if(document.getElementById("NewPopDays")){NewPopDays = document.getElementById("NewPopDays").value;}
			if(document.getElementById("NewPopDiscount")){NewPopDiscount = document.getElementById("NewPopDiscount").value;}
			if(document.getElementById("NewPopAmount_GBP")){NewPopAmount_GBP = document.getElementById("NewPopAmount_GBP").value;}
			if(document.getElementById("NewPopSet_Total_GBP")){NewPopSet_Total_GBP = document.getElementById("NewPopSet_Total_GBP").value;}
			
			showNewPopDataPage("OtherLoad");
		}
//		else if(selitemcat)
//		{
//		 if(gv_proEditingData==1) checkNewPopItemPageEdited(gv_scrollCurPage+1); //Save any edited data to memory
//			selitemcat.selectedIndex=gv_scrollCurPage;
//						if(document.getElementById('NewPopItemProduct_Code')){NewPopItemProduct_Code=document.getElementById('NewPopItemProduct_Code').value;}
//			if(document.getElementById('NewPopItemDescription')){NewPopItemDescription=document.getElementById('NewPopItemDescription').value;}
//			if(document.getElementById('NewPopItemUnits')){NewPopItemUnits=document.getElementById('NewPopItemUnits').value;}
//			if(document.getElementById('NewPopItemComment1')){NewPopItemComment1=document.getElementById('NewPopItemComment1').value;}
//			if(document.getElementById('NewPopItemComment2')){NewPopItemComment2=document.getElementById('NewPopItemComment2').value;}
//			if(document.getElementById('NewPopItemProject_Ref')){NewPopItemProject_Ref=document.getElementById('NewPopItemProject_Ref').value;}
//			if(document.getElementById('NewPopItemCost_Code')){NewPopItemCost_Code=document.getElementById('NewPopItemCost_Code').value;}
//			if(document.getElementById('NewPopItemQuantity')){NewPopItemQuantity=document.getElementById('NewPopItemQuantity').value;}
//			if(document.getElementById('NewPopItemUnit_Price_GBP')){NewPopItemUnit_Price_GBP=document.getElementById('NewPopItemUnit_Price_GBP').value;}
//			if(document.getElementById('NewPopItemDiscount')){NewPopItemDiscount=document.getElementById('NewPopItemDiscount').value;}
//			if(document.getElementById('NewPopItemDiscount_GBP')){NewPopItemDiscount_GBP=document.getElementById('NewPopItemDiscount_GBP').value;}
//			if(document.getElementById('NewPopItemNet_GBP')){NewPopItemNet_GBP=document.getElementById('NewPopItemNet_GBP').value;}
//			if(document.getElementById('NewPopItemVAT_GBP')){NewPopItemVAT_GBP=document.getElementById('NewPopItemVAT_GBP').value;}
//			if(document.getElementById('NewPopItemNominal_Code')){NewPopItemNominal_Code=document.getElementById('NewPopItemNominal_Code').value;}
//			if(document.getElementById("NewPopItemTax_Code")){NewPopItemTax_Code=document.getElementById('NewPopItemTax_Code').options[document.getElementById('NewPopItemTax_Code').selectedIndex].value;}
//			if(document.getElementById("NewPopItemDepartment")){NewPopItemDepartment=document.getElementById('NewPopItemDepartment').options[document.getElementById('NewPopItemDepartment').selectedIndex].value;}
//			if(document.getElementById('NewPopItemLine_Information')){NewPopItemLine_Information=document.getElementById('NewPopItemLine_Information').value;}

//			if(document.getElementById('NewPopItemAllocated')){NewPopItemAllocated=document.getElementById('NewPopItemAllocated').value;}
//			if(document.getElementById('NewPopItemDespatched')){NewPopItemDespatched=document.getElementById('NewPopItemDespatched').value;}
//			if(document.getElementById('NewPopItemTo_Deliver')){NewPopItemTo_Deliver=document.getElementById('NewPopItemTo_Deliver').value;}
//			if(document.getElementById('NewPopItemIntrastat')){NewPopItemIntrastat=document.getElementById('NewPopItemIntrastat').value;}
//			if(document.getElementById('NewPopItemDue_Date')){NewPopItemDue_Date=document.getElementById('NewPopItemDue_Date').value;}
//			showNewPopItemDataPage("OtherLoad");
//		}
//		else if(selitemok)
//	   { 
//			gv_newPopItemCurPage=gv_scrollCurPage;		
//			gv_newPopItemIndex=0;
//            showNewPopItemList(1);
//		}
		else { //customer list
			gv_newPopCurPage=gv_scrollCurPage;		
			gv_newPopIndex=0;
			NewPopiPage--;
			if(NewPopiPage < 1)
			{
			    NewPopiPage = 1;
			    return;
			}
			NewPopListPD = 1;
			NewPopListCurPage = gv_newPopCurPage;
            NewPopListTotPage = gv_newPopTotPage;
			doNewPopList();
		}
	}
		else {
		divtab.style.pixelLeft=tleft+30;
		setTimeout("newPopPageLeft();",75);
		}
}
function newPopPageRight()
{
	if(gv_scrollCurPage>=gv_scrollTotPage-1) return;
	var selcat=document.getElementById('selnewpopcat');
//	var selitemcat=document.getElementById('selnewpopitemcat');
//	var selitemok=document.getElementById('btnNewPopItemOk');
	var divtab=document.getElementById('tempTable');
	var tleft=divtab.style.pixelLeft;
	if(tleft<30-gv_winw) {	
		gv_scrollCurPage++;
		divtab.style.pixelLeft=0;
		if(selcat) {
			selcat.selectedIndex=gv_scrollCurPage;
			if(gv_newPopEditingData==1) ;  checkNewPopPageEdited(gv_scrollCurPage-1); //Save any edited data to memory
			if(document.getElementById("NewPopSupplier_ACRef")){NewPopSupplier_ACRef = document.getElementById("NewPopSupplier_ACRef").value;}
			if(document.getElementById("NewPopOrder_Ref")){NewPopOrder_Ref = document.getElementById("NewPopOrder_Ref").value;}
			if(document.getElementById("NewPopOrder_Date")){NewPopOrder_Date = document.getElementById("NewPopOrder_Date").value;}
			if(document.getElementById("NewPopOrder_Number")){NewPopOrder_Number = document.getElementById("NewPopOrder_Number").value;}
			if(document.getElementById("NewPopCustomer_Order_No")){NewPopCustomer_Order_No = document.getElementById("NewPopCustomer_Order_No").value;}
			if(document.getElementById("NewPopProject_Ref")){NewPopProject_Ref = document.getElementById("NewPopProject_Ref").value;}
			if(document.getElementById("NewPopCost_Code")){NewPopCost_Code = document.getElementById("NewPopCost_Code").value;}
			if(document.getElementById("NewPopTotal_GBP")){NewPopTotal_GBP = document.getElementById("NewPopTotal_GBP").value;}
			if(document.getElementById("NewPopTotal_VAT")){NewPopTotal_VAT = document.getElementById("NewPopTotal_VAT").value;}
			if(document.getElementById("NewPopCarriage_GBP")){NewPopCarriage_GBP = document.getElementById("NewPopCarriage_GBP").value;}
			if(document.getElementById("NewPopCarriage_VAT")){NewPopCarriage_VAT = document.getElementById("NewPopCarriage_VAT").value;}
			if(document.getElementById("NewPopGross_GBP")){NewPopGross_GBP = document.getElementById("NewPopGross_GBP").value;}
			if(document.getElementById("NewPopCustomer_Tel_No")){NewPopCustomer_Tel_No = document.getElementById("NewPopCustomer_Tel_No").value;}
			if(document.getElementById("NewPopCustomer_Contact")){NewPopCustomer_Contact = document.getElementById("NewPopCustomer_Contact").value;}
			if(document.getElementById("NewPopNet_GBP")){NewPopNet_GBP = document.getElementById("NewPopNet_GBP").value;}
			if(document.getElementById("NewPopTax_Code")){NewPopTax_Code=document.getElementById('NewPopTax_Code').options[document.getElementById('NewPopTax_Code').selectedIndex].value;}
			if(document.getElementById("NewPopVAT_GBP")){NewPopVAT_GBP = document.getElementById("NewPopVAT_GBP").value;}
			if(document.getElementById("NewPopNC")){NewPopNC = document.getElementById("NewPopNC").value;}
			if(document.getElementById("NewPopSet_Gross_GBP")){NewPopSet_Gross_GBP = document.getElementById("NewPopSet_Gross_GBP").value;}
			if(document.getElementById("NewPopName")){NewPopName = document.getElementById("NewPopName").value;}
			if(document.getElementById("NewPopAddress1")){NewPopAddress1 = document.getElementById("NewPopAddress1").value;}
			if(document.getElementById("NewPopAddress2")){NewPopAddress2 = document.getElementById("NewPopAddress2").value;}
			if(document.getElementById("NewPopAddress3")){NewPopAddress3 = document.getElementById("NewPopAddress3").value;}
			if(document.getElementById("NewPopAddress4")){NewPopAddress4 = document.getElementById("NewPopAddress4").value;}
			if(document.getElementById("NewPopAddress5")){NewPopAddress5 = document.getElementById("NewPopAddress5").value;}
			if(document.getElementById("NewPopDelivery")){NewPopDelivery = document.getElementById("NewPopDelivery").value;}

			if(document.getElementById("NewPopDelivery_Street1")){NewPopDelivery_Street1 = document.getElementById("NewPopDelivery_Street1").value;}
			if(document.getElementById("NewPopDelivery_Street2")){NewPopDelivery_Street2 = document.getElementById("NewPopDelivery_Street2").value;}
			if(document.getElementById("NewPopDelivery_Town")){NewPopDelivery_Town = document.getElementById("NewPopDelivery_Town").value;}
			if(document.getElementById("NewPopDelivery_County")){NewPopDelivery_County = document.getElementById("NewPopDelivery_County").value;}
			if(document.getElementById("NewPopDelivery_Post_Code")){NewPopDelivery_Post_Code = document.getElementById("NewPopDelivery_Post_Code").value;}
			if(document.getElementById("NewPopDepartment")){NewPopDepartment=document.getElementById('NewPopDepartment').options[document.getElementById('NewPopDepartment').selectedIndex].value;}
			if(document.getElementById("NewPopConsign_Number")){NewPopConsign_Number = document.getElementById("NewPopConsign_Number").value;}
			if(document.getElementById("NewPopCourier")){NewPopCourier=document.getElementById('NewPopCourier').options[document.getElementById('NewPopCourier').selectedIndex].value;}
			if(document.getElementById("NewPopDays")){NewPopDays = document.getElementById("NewPopDays").value;}
			if(document.getElementById("NewPopDiscount")){NewPopDiscount = document.getElementById("NewPopDiscount").value;}
			if(document.getElementById("NewPopAmount_GBP")){NewPopAmount_GBP = document.getElementById("NewPopAmount_GBP").value;}
			if(document.getElementById("NewPopSet_Total_GBP")){NewPopSet_Total_GBP = document.getElementById("NewPopSet_Total_GBP").value;}
			showNewPopDataPage("OtherLoad");			
		}
//		else if(selitemcat)
//		{
//		 if(gv_newPopItemEditingData==1) checkNewPopItemPageEdited(gv_scrollCurPage+1); //Save any edited data to memory
//			selitemcat.selectedIndex=gv_scrollCurPage;
//			if(document.getElementById('NewPopItemProduct_Code')){NewPopItemProduct_Code=document.getElementById('NewPopItemProduct_Code').value;}
//			if(document.getElementById('NewPopItemDescription')){NewPopItemDescription=document.getElementById('NewPopItemDescription').value;}
//			if(document.getElementById('NewPopItemUnits')){NewPopItemUnits=document.getElementById('NewPopItemUnits').value;}
//			if(document.getElementById('NewPopItemComment1')){NewPopItemComment1=document.getElementById('NewPopItemComment1').value;}
//			if(document.getElementById('NewPopItemComment2')){NewPopItemComment2=document.getElementById('NewPopItemComment2').value;}
//			if(document.getElementById('NewPopItemProject_Ref')){NewPopItemProject_Ref=document.getElementById('NewPopItemProject_Ref').value;}
//			if(document.getElementById('NewPopItemCost_Code')){NewPopItemCost_Code=document.getElementById('NewPopItemCost_Code').value;}
//			if(document.getElementById('NewPopItemQuantity')){NewPopItemQuantity=document.getElementById('NewPopItemQuantity').value;}
//			if(document.getElementById('NewPopItemUnit_Price_GBP')){NewPopItemUnit_Price_GBP=document.getElementById('NewPopItemUnit_Price_GBP').value;}
//			if(document.getElementById('NewPopItemDiscount')){NewPopItemDiscount=document.getElementById('NewPopItemDiscount').value;}
//			if(document.getElementById('NewPopItemDiscount_GBP')){NewPopItemDiscount_GBP=document.getElementById('NewPopItemDiscount_GBP').value;}
//			if(document.getElementById('NewPopItemNet_GBP')){NewPopItemNet_GBP=document.getElementById('NewPopItemNet_GBP').value;}
//			if(document.getElementById('NewPopItemVAT_GBP')){NewPopItemVAT_GBP=document.getElementById('NewPopItemVAT_GBP').value;}
//			if(document.getElementById('NewPopItemNominal_Code')){NewPopItemNominal_Code=document.getElementById('NewPopItemNominal_Code').value;}
//			if(document.getElementById("NewPopItemTax_Code")){NewPopItemTax_Code=document.getElementById('NewPopItemTax_Code').options[document.getElementById('NewPopItemTax_Code').selectedIndex].value;}
//			if(document.getElementById("NewPopItemDepartment")){NewPopItemDepartment=document.getElementById('NewPopItemDepartment').options[document.getElementById('NewPopItemDepartment').selectedIndex].value;}
//			if(document.getElementById('NewPopItemLine_Information')){NewPopItemLine_Information=document.getElementById('NewPopItemLine_Information').value;}

//			if(document.getElementById('NewPopItemAllocated')){NewPopItemAllocated=document.getElementById('NewPopItemAllocated').value;}
//			if(document.getElementById('NewPopItemDespatched')){NewPopItemDespatched=document.getElementById('NewPopItemDespatched').value;}
//			if(document.getElementById('NewPopItemTo_Deliver')){NewPopItemTo_Deliver=document.getElementById('NewPopItemTo_Deliver').value;}
//			if(document.getElementById('NewPopItemIntrastat')){NewPopItemIntrastat=document.getElementById('NewPopItemIntrastat').value;}
//			if(document.getElementById('NewPopItemDue_Date')){NewPopItemDue_Date=document.getElementById('NewPopItemDue_Date').value;}
//			showNewPopItemDataPage("OtherLoad");
//		}
//		  else if(selitemok)
//		  { 
//			gv_newPopItemCurPage=gv_scrollCurPage;		
//			gv_newPopItemIndex=0;
//             showNewPopItemList(1);
//		  }
			else { //customer list
			gv_newPopCurPage=gv_scrollCurPage;		
			gv_newPopIndex=0;
			NewPopiPage++;
			if(NewPopiPage > NewPopTotalPage)
			{
			    NewPopiPage = NewPopTotalPage;
			    return;
			}
			NewPopListPD = 1;
			NewPopListCurPage = gv_newPopCurPage;
            NewPopListTotPage = gv_newPopTotPage;
			doNewPopList();
		}

	}
	
	else{
	divtab.style.pixelLeft=tleft-30;
	setTimeout("newPopPageRight();",75);
	}
}
function jumpToNewPopCat()
{
	var selcat = document.getElementById('selnewpopcat');
//    var NewPopTaxCode = document.getElementById('NewPopTax_Code');
    if(selcat)
    {
	  //if(gv_newPopEditingData==1); checkNewPopPageEdited(gv_scrollCurPage); //Save any edited data to memory
	  gv_scrollCurPage=selcat.selectedIndex;
	if(document.getElementById("NewPopSupplier_ACRef")){NewPopSupplier_ACRef = document.getElementById("NewPopSupplier_ACRef").value;}
    if(document.getElementById("NewPopOrder_Ref")){NewPopOrder_Ref = document.getElementById("NewPopOrder_Ref").value;}
    if(document.getElementById("NewPopOrder_Date")){NewPopOrder_Date = document.getElementById("NewPopOrder_Date").value;}
    if(document.getElementById("NewPopOrder_Number")){NewPopOrder_Number = document.getElementById("NewPopOrder_Number").value;}
    if(document.getElementById("NewPopCustomer_Order_No")){NewPopCustomer_Order_No = document.getElementById("NewPopCustomer_Order_No").value;}
    if(document.getElementById("NewPopProject_Ref")){NewPopProject_Ref = document.getElementById("NewPopProject_Ref").value;}
    if(document.getElementById("NewPopCost_Code")){NewPopCost_Code = document.getElementById("NewPopCost_Code").value;}
    if(document.getElementById("NewPopTotal_GBP")){NewPopTotal_GBP = document.getElementById("NewPopTotal_GBP").value;}
    if(document.getElementById("NewPopTotal_VAT")){NewPopTotal_VAT = document.getElementById("NewPopTotal_VAT").value;}
    if(document.getElementById("NewPopCarriage_GBP")){NewPopCarriage_GBP = document.getElementById("NewPopCarriage_GBP").value;}
    if(document.getElementById("NewPopCarriage_VAT")){NewPopCarriage_VAT = document.getElementById("NewPopCarriage_VAT").value;}
    if(document.getElementById("NewPopGross_GBP")){NewPopGross_GBP = document.getElementById("NewPopGross_GBP").value;}
    if(document.getElementById("NewPopCustomer_Tel_No")){NewPopCustomer_Tel_No = document.getElementById("NewPopCustomer_Tel_No").value;}
    if(document.getElementById("NewPopCustomer_Contact")){NewPopCustomer_Contact = document.getElementById("NewPopCustomer_Contact").value;}
    if(document.getElementById("NewPopNet_GBP")){NewPopNet_GBP = document.getElementById("NewPopNet_GBP").value;}
    if(document.getElementById("NewPopTax_Code")){NewPopTax_Code=document.getElementById('NewPopTax_Code').options[document.getElementById('NewPopTax_Code').selectedIndex].value;}
    if(document.getElementById("NewPopVAT_GBP")){NewPopVAT_GBP = document.getElementById("NewPopVAT_GBP").value;}
    if(document.getElementById("NewPopNC")){NewPopNC = document.getElementById("NewPopNC").value;}
    if(document.getElementById("NewPopSet_Gross_GBP")){NewPopSet_Gross_GBP = document.getElementById("NewPopSet_Gross_GBP").value;}
    if(document.getElementById("NewPopName")){NewPopName = document.getElementById("NewPopName").value;}
    if(document.getElementById("NewPopAddress1")){NewPopAddress1 = document.getElementById("NewPopAddress1").value;}
    if(document.getElementById("NewPopAddress2")){NewPopAddress2 = document.getElementById("NewPopAddress2").value;}
    if(document.getElementById("NewPopAddress3")){NewPopAddress3 = document.getElementById("NewPopAddress3").value;}
    if(document.getElementById("NewPopAddress4")){NewPopAddress4 = document.getElementById("NewPopAddress4").value;}
    if(document.getElementById("NewPopAddress5")){NewPopAddress5 = document.getElementById("NewPopAddress5").value;}
    if(document.getElementById("NewPopDelivery")){NewPopDelivery = document.getElementById("NewPopDelivery").value;}	
    if(document.getElementById("NewPopDelivery_Street1")){NewPopDelivery_Street1 = document.getElementById("NewPopDelivery_Street1").value;}
    if(document.getElementById("NewPopDelivery_Street2")){NewPopDelivery_Street2 = document.getElementById("NewPopDelivery_Street2").value;}
    if(document.getElementById("NewPopDelivery_Town")){NewPopDelivery_Town = document.getElementById("NewPopDelivery_Town").value;}
    if(document.getElementById("NewPopDelivery_County")){NewPopDelivery_County = document.getElementById("NewPopDelivery_County").value;}
    if(document.getElementById("NewPopDelivery_Post_Code")){NewPopDelivery_Post_Code = document.getElementById("NewPopDelivery_Post_Code").value;}
    if(document.getElementById("NewPopDepartment")){NewPopDepartment=document.getElementById('NewPopDepartment').options[document.getElementById('NewPopDepartment').selectedIndex].value;}
    if(document.getElementById("NewPopConsign_Number")){NewPopConsign_Number = document.getElementById("NewPopConsign_Number").value;}
    if(document.getElementById("NewPopCourier")){NewPopCourier=document.getElementById('NewPopCourier').options[document.getElementById('NewPopCourier').selectedIndex].value;}
    if(document.getElementById("NewPopDays")){NewPopDays = document.getElementById("NewPopDays").value;}
    if(document.getElementById("NewPopDiscount")){NewPopDiscount = document.getElementById("NewPopDiscount").value;}
    if(document.getElementById("NewPopAmount_GBP")){NewPopAmount_GBP = document.getElementById("NewPopAmount_GBP").value;}
    if(document.getElementById("NewPopSet_Total_GBP")){NewPopSet_Total_GBP = document.getElementById("NewPopSet_Total_GBP").value;}	
	showNewPopDataPage("OtherLoad");
	}
//	 else if(NewPopTaxCode)
//	 {
//	   NewPopTaxCode.value=NewPopTaxCode.selectedIndex;
//        
//	 }
}



function showSaveNewPopDataButton()
{
	if(document.getElementById('savenewpopdata'))
//	{ 
//	document.getElementById('savenewpopdata').style.visibility='visible';
	return;
//	}
	setNewPopPageScrollCommands("<input type='button' id='savenewpopdata' value='Save' onclick='saveNewPopData();' />","");
	
}

function setNewPopPageScrollCommands(cmd1,cmd2)
{
	document.getElementById('popbtn1').innerHTML=cmd1;
	document.getElementById('popbtn2').innerHTML=cmd2;
	var newpopcmd=document.getElementById('popCmds').style;
	var ncmds=cmd1.length<5 ? 0:1;
	if(cmd2.length>5) ncmds++;
	newpopcmd.pixelWidth=150+50*ncmds;
	newpopcmd.pixelLeft=gv_winw-newpopcmd.pixelWidth-1;
} 
function checkNewPopPageEdited(pagenum)
{
	var itemEle=null;
    for(var ic=pagenum; ic<gv_newPopDataCategory.length; ic++) {
		var attName=gv_newPopDataCategory[ic].attributes.getNamedItem("title");	
		if(attName==null) continue;
		var curNode=gv_newPopDataCategory[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) setEditNewPopData(itemId,newv);
			curNode=curNode.nextSibling;
		}
		if(itemEle==null) break;
    }
}

function setEditNewPopData(itemName,edValue)
{
	if(!gv_newPopEditedName) {
		gv_newPopEditedName=new Array();
		gv_newPopEditedValue=new Array();
	}
	
	for(var i=0; i<gv_newPopEditedName.length; i++){
		if(gv_newPopEditedName[i]==itemName) {	gv_newPopEditedValue[i]=edValue; return; }
	}
	gv_newPopEditedValue[gv_newPopEditedName.length]=edValue;	
	gv_newPopEditedName[gv_newPopEditedName.length]=itemName;
}
	
function getEditedNewPopData(itemName)
{
  if(!gv_newPopEditedName) return null;	
	for(var i=0; i<gv_newPopEditedName.length; i++) {
		if(gv_newPopEditedName[i]==itemName) 
//		gv_newPopEditedValue[i]=edValue;
    	return gv_newPopEditedValue[i];
	}

}



function setNewPopPageScrollCommands(Cmd1,Cmd2)
{
	document.getElementById('popbtn1').innerHTML=Cmd1;
	document.getElementById('popbtn2').innerHTML=Cmd2;
	var popcmd=document.getElementById('popCmds').style;
	var ncmds=Cmd1.length<5 ? 0:1;
	if(Cmd2.length>5) ncmds++;
	popcmd.pixelWidth=150+50*ncmds;
	popcmd.pixelLeft=gv_winw-popcmd.pixelWidth-1;
}

var strNewPopItem = "";
var PopHiddenField="<input type='hidden' name='PopHiddenField' id='PopHiddenField' value=''>";

function Button_onclick()
{
  var charSplitChar = ",";
  strNewPopItem += NewPopItemProduct_Code +charSplitChar;
  strNewPopItem += NewPopItemDescription +charSplitChar;
  strNewPopItem += NewPopItemUnits +charSplitChar;
  strNewPopItem += NewPopItemComment1 +charSplitChar;
  strNewPopItem += NewPopItemComment2 +charSplitChar;
  strNewPopItem += NewPopItemProject_Ref +charSplitChar;
  strNewPopItem += NewPopItemCost_Code +charSplitChar;
  strNewPopItem += NewPopItemQuantity +charSplitChar;
  strNewPopItem += NewPopItemUnit_Price_GBP +charSplitChar;
  strNewPopItem += NewPopItemDiscount +charSplitChar;
  strNewPopItem += NewPopItemDiscount_GBP +charSplitChar;
  strNewPopItem += NewPopItemNet_GBP +charSplitChar;
  strNewPopItem += NewPopItemVAT_GBP +charSplitChar;
  strNewPopItem += NewPopItemNominal_Code +charSplitChar;
  strNewPopItem += NewPopItemTax_Code +charSplitChar;
  strNewPopItem += NewPopItemDepartment +charSplitChar;
  strNewPopItem += NewPopItemAllocated +charSplitChar;
  strNewPopItem += NewPopItemDespatched +charSplitChar;
  strNewPopItem += NewPopItemTo_Deliver +charSplitChar;
  strNewPopItem += NewPopItemIntrastat +charSplitChar;
  strNewPopItem += NewPopItemDue_Date +charSplitChar;
  strNewPopItem += NewPopItemLine_Information;

  strNewPopItem += "|,|";
 document.getElementById('PopHiddenField').value =strNewPopItem;
}
    var  ItemPopProduct_Code, ItemPopDescription, ItemPopUnits, ItemPopComment1, ItemPopComment2, ItemPopProject_Ref, ItemPopCost_Code, ItemPopQuantity, ItemPopUnit_Price_GBP, ItemPopDiscount, ItemPopDiscount_GBP, ItemPopNet_GBP, ItemPopVAT_GBP, ItemPopNominal_Code, ItemPopTax_Code, ItemPopDepartment, ItemPopAllocated, ItemPopDespatched, ItemPopTo_Deliver, ItemPopIntrastat, ItemPopDue_Date;
    function ContactsData(strData)
    {
        var arrTemp = strData.split(",");
        ItemPopProduct_Code = arrTemp[0];
        ItemPopDescription = arrTemp[1];
        ItemPopUnits = arrTemp[2];
        ItemPopComment1 = arrTemp[3];
        ItemPopComment2 = arrTemp[4];
        ItemPopProject_Ref = arrTemp[5];
        ItemPopCost_Code = arrTemp[6];
        ItemPopQuantity = arrTemp[7];
        ItemPopUnit_Price_GBP = arrTemp[8];
        ItemPopDiscount = arrTemp[9];
        ItemPopDiscount_GBP = arrTemp[10];
        ItemPopNet_GBP = arrTemp[11];
        ItemPopVAT_GBP = arrTemp[12];
        ItemPopNominal_Code = arrTemp[13];
        ItemPopTax_Code = arrTemp[14];
        ItemPopDepartment = arrTemp[15];
        ItemPopAllocated = arrTemp[16];
        ItemPopDespatched = arrTemp[17];
        ItemPopTo_Deliver = arrTemp[18];
        ItemPopIntrastat = arrTemp[19];
        ItemPopDue_Date = arrTemp[20];
    }
    var NewPopItemDDVal="";
    function showNewPopCount()
    {
      var  strItems = document.getElementById('PopHiddenField').value;
        var arrItems = strItems.split("|,|");
        var SPopNet_GBP = 0, SPopVAT_GBP= 0;
        addNewPopDropDownValue = "";
        for (var i = 0; i < arrItems.length - 1; i++)
        {  
//        if(arrItems[i].substring(arrItems[i].length - 3,arrItems[i].length)=="|,|")   
//         { arrItems[i]= arrItems[i].substring(0,arrItems[i].length-3); }  
         ContactsData(arrItems[i]);
         var num = arrItems.length - 1;
         var j = i + 1;
         NewPopItemDDVal = j + ' ' + 'of' + ' '+ num;
         addNewPopDropDownValue += "<option>"+NewPopItemDDVal+"</option>";
         if(ItemPopNet_GBP == "") {ItemPopNet_GBP= "0";}
         if(ItemPopVAT_GBP == "") {ItemPopVAT_GBP = "0";}
  //       if(NewPopDiscount == "") {NewPopDiscount == "1";}
         SPopNet_GBP += parseFloat(ItemPopNet_GBP);
         SPopVAT_GBP += parseFloat(ItemPopVAT_GBP);
        }
         NewPopTotal_GBP = SPopNet_GBP;
         NewPopTotal_VAT = SPopVAT_GBP;
         NewPopGross_GBP = SPopNet_GBP + SPopVAT_GBP;
        // NewPopAmount_GBP = NewPopTotal_GBP * NewPopDiscount / 100;
        // NewPopSet_Total_GBP = NewPopGross_GBP - NewPopAmount_GBP;
         
        
    }
        
function saveNewPopData()
{    
			if(document.getElementById("NewPopSupplier_ACRef")){NewPopSupplier_ACRef = document.getElementById("NewPopSupplier_ACRef").value;}
			if(document.getElementById("NewPopOrder_Ref")){NewPopOrder_Ref = document.getElementById("NewPopOrder_Ref").value;}
			if(document.getElementById("NewPopOrder_Date")){NewPopOrder_Date = document.getElementById("NewPopOrder_Date").value;}
			if(document.getElementById("NewPopOrder_Number")){NewPopOrder_Number = document.getElementById("NewPopOrder_Number").value;}
			if(document.getElementById("NewPopCustomer_Order_No")){NewPopCustomer_Order_No = document.getElementById("NewPopCustomer_Order_No").value;}
			if(document.getElementById("NewPopProject_Ref")){NewPopProject_Ref = document.getElementById("NewPopProject_Ref").value;}
			if(document.getElementById("NewPopCost_Code")){NewPopCost_Code = document.getElementById("NewPopCost_Code").value;}
			if(document.getElementById("NewPopTotal_GBP")){NewPopTotal_GBP = document.getElementById("NewPopTotal_GBP").value;}
			if(document.getElementById("NewPopTotal_VAT")){NewPopTotal_VAT = document.getElementById("NewPopTotal_VAT").value;}
			if(document.getElementById("NewPopCarriage_GBP")){NewPopCarriage_GBP = document.getElementById("NewPopCarriage_GBP").value;}
			if(document.getElementById("NewPopCarriage_VAT")){NewPopCarriage_VAT = document.getElementById("NewPopCarriage_VAT").value;}
			if(document.getElementById("NewPopGross_GBP")){NewPopGross_GBP = document.getElementById("NewPopGross_GBP").value;}
			if(document.getElementById("NewPopCustomer_Tel_No")){NewPopCustomer_Tel_No = document.getElementById("NewPopCustomer_Tel_No").value;}
			if(document.getElementById("NewPopCustomer_Contact")){NewPopCustomer_Contact = document.getElementById("NewPopCustomer_Contact").value;}
			if(document.getElementById("NewPopNet_GBP")){NewPopNet_GBP = document.getElementById("NewPopNet_GBP").value;}
			if(document.getElementById("NewPopTax_Code")){NewPopTax_Code=document.getElementById('NewPopTax_Code').options[document.getElementById('NewPopTax_Code').selectedIndex].value;}
			if(document.getElementById("NewPopVAT_GBP")){NewPopVAT_GBP = document.getElementById("NewPopVAT_GBP").value;}
			if(document.getElementById("NewPopNC")){NewPopNC = document.getElementById("NewPopNC").value;}
			if(document.getElementById("NewPopSet_Gross_GBP")){NewPopSet_Gross_GBP = document.getElementById("NewPopSet_Gross_GBP").value;}
			if(document.getElementById("NewPopName")){NewPopName = document.getElementById("NewPopName").value;}
			if(document.getElementById("NewPopAddress1")){NewPopAddress1 = document.getElementById("NewPopAddress1").value;}
			if(document.getElementById("NewPopAddress2")){NewPopAddress2 = document.getElementById("NewPopAddress2").value;}
			if(document.getElementById("NewPopAddress3")){NewPopAddress3 = document.getElementById("NewPopAddress3").value;}
			if(document.getElementById("NewPopAddress4")){NewPopAddress4 = document.getElementById("NewPopAddress4").value;}
			if(document.getElementById("NewPopAddress5")){NewPopAddress5 = document.getElementById("NewPopAddress5").value;}
			if(document.getElementById("NewPopDelivery")){NewPopDelivery = document.getElementById("NewPopDelivery").value;}	

			if(document.getElementById("NewPopDelivery_Street1")){NewPopDelivery_Street1 = document.getElementById("NewPopDelivery_Street1").value;}
			if(document.getElementById("NewPopDelivery_Street2")){NewPopDelivery_Street2 = document.getElementById("NewPopDelivery_Street2").value;}
			if(document.getElementById("NewPopDelivery_Town")){NewPopDelivery_Town = document.getElementById("NewPopDelivery_Town").value;}
			if(document.getElementById("NewPopDelivery_County")){NewPopDelivery_County = document.getElementById("NewPopDelivery_County").value;}
			if(document.getElementById("NewPopDelivery_Post_Code")){NewPopDelivery_Post_Code = document.getElementById("NewPopDelivery_Post_Code").value;}
			if(document.getElementById("NewPopDepartment")){NewPopDepartment=document.getElementById('NewPopDepartment').options[document.getElementById('NewPopDepartment').selectedIndex].value;}
			if(document.getElementById("NewPopConsign_Number")){NewPopConsign_Number = document.getElementById("NewPopConsign_Number").value;}
			if(document.getElementById("NewPopCourier")){NewPopCourier=document.getElementById('NewPopCourier').options[document.getElementById('NewPopCourier').selectedIndex].value;}
			if(document.getElementById("NewPopDays")){NewPopDays = document.getElementById("NewPopDays").value;}
			if(document.getElementById("NewPopDiscount")){NewPopDiscount = document.getElementById("NewPopDiscount").value;}
			if(document.getElementById("NewPopAmount_GBP")){NewPopAmount_GBP = document.getElementById("NewPopAmount_GBP").value;}
			if(document.getElementById("NewPopSet_Total_GBP")){NewPopSet_Total_GBP = document.getElementById("NewPopSet_Total_GBP").value;}
   // checkNewPopPageEdited(gv_scrollCurPage);
    if(document.getElementById('NewPopTax_Code')) { NewPopTax_Code=NewPopTax_Code.slice(1,3).replace(/(\s*$)/g,""); } 
    if(document.getElementById('NewPopDepartment')) { NewPopDepartment=NewPopDepartment.slice(0,2).replace(/(\s*$)/g,""); }
    if(document.getElementById('NewPopCourier')) { NewPopCourier=NewPopCourier.slice(0,2).replace(/(\s*$)/g,""); }
    if(NewPopSupplier_ACRef == "" && NewPopItemDDVal != "")
    {
        alert("Please select account reference of supplier!");
        //showNewPopDataPage("OtherLoad");
        return;
    }
    if(NewPopSupplier_ACRef != "" && NewPopItemDDVal == "")
    {
        alert("Please Add Item For Purchase Order!");
       // showNewPopDataPage("OtherLoad");
        return;
    }
    if(NewPopSupplier_ACRef == "" && NewPopItemDDVal == "")
    {
        alert("Please select account reference of supplier and add item for purchase order! ");
        //showNewPopDataPage("OtherLoad");
        return;
    }
    if(NewPopName == "")
    {
        alert("Please enter the name! ");
        //showNewPopDataPage("OtherLoad");
        return;
    }
    var PopHiddenValue = document.getElementById("PopHiddenField").value;
    var ACIndex=gv_newPopCurPage*10+gv_newPopIndex;

	var url=gv_rooturl+"?cmd=SaveNewPopData&AC="+gv_newPopAC[gv_newPopIndex]+"&index="+ACIndex;
	url+="&HiddenValue="+PopHiddenValue+"&Order_Ref="+NewPopOrder_Ref+"&Supplier_ACRef="+NewPopSupplier_ACRef+"&Order_Date="+NewPopOrder_Date+"&Order_Number="+NewPopOrder_Number+"&Customer_Order_No="+NewPopCustomer_Order_No+"&Project_Ref="+NewPopProject_Ref+"&Cost_Code="+NewPopCost_Code+"&Total_GBP="+NewPopTotal_GBP+"&Carriage_VAT="+NewPopCarriage_VAT+"&Carriage_GBP="+NewPopCarriage_GBP+"&Carriage_VAT="+NewPopCarriage_VAT+"&Gross_GBP="+NewPopGross_GBP+"&Delivery="+NewPopDelivery+"&Address1="+NewPopAddress1+"&Address2="+NewPopAddress2+"&Address3="+NewPopAddress3+"&Address4="+NewPopAddress4+"&Address5="+NewPopAddress5+"&Name="+NewPopName+"&Delivery_Street1="+NewPopDelivery_Street1+"&Delivery_Street2="+NewPopDelivery_Street2+"&Delivery_Town="+NewPopDelivery_Town+"&Delivery_County="+NewPopDelivery_County+"&Delivery_Post_Code="+NewPopDelivery_Post_Code+"&Customer_Tel_No="+NewPopCustomer_Tel_No+"&Customer_Contact="+NewPopCustomer_Contact+"&Net_GBP="+NewPopNet_GBP+"&Tax_Code="+NewPopTax_Code+"&VAT_GBP="+NewPopVAT_GBP+"&NC="+NewPopNC+"&Gross_GBP="+NewPopGross_GBP+"&Department="+NewPopDepartment+"&Consign_Number="+NewPopConsign_Number+"&Courier="+NewPopCourier+"&Days="+NewPopDays+"&Discount="+NewPopDiscount+"&Amount_GBP="+NewPopAmount_GBP+"&TotalSet_GBP="+NewPopSet_Total_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_newPopEditedName=null;
				gv_newPopEditedValue=null;
				document.getElementById('savenewpopdata').style.visibility = "hidden";
				NewPopOrder_Date=getNewPopSysTime();
                NewPopOrder_Ref='',NewPopOrder_Number='',NewPopCustomer_Order_No='',NewPopProject_Ref='',NewPopCost_Code='',NewPopTotal_GBP='',NewPopTotal_VAT='',NewPopCarriage_GBP='',NewPopCarriage_VAT='',NewPopGross_GBP='';
                NewPopDelivery_Street1='',NewPopDelivery_Street2='',NewPopDelivery_Town='',NewPopDelivery_County='',NewPopDelivery_Post_Code='',NewPopCustomer_Tel_No='',NewPopCustomer_Contact='',NewPopNet_GBP='',NewPopTax_Code='';
                NewPopVAT_GBP='',NewPopNC='',NewPopGross_GBP='',NewPopDepartment='',Consign_Number='',NewPopCourier='',NewPopDays='',NewPopDiscount='',NewPopAmount_GBP='',NewPopSet_Gross_GBP,NewPopSet_Total_GBP='',NewPopSupplier_ACRef="";
                NewPopDelivery="",NewPopConsign_Number="", NewPopAddress1='',NewPopAddress2='',NewPopAddress3='',NewPopAddress4='',NewPopAddress5='',NewPopName='';
				backPops();
				//strNewPopItem = "";
				//addNewPopDropDownValue = "";
			}
			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';
}


