PageSourceSearch

https://shop.centremapslive.co.uk/js/suppliers2.js?ver=4

js centremapslive.co.uk collected 2026-09-26 15:12:51 UTC 109,166 bytes, 1,858 lines download raw bytes

1/*--------------------------------------------------------------
2suppliers2.js
3For CentreMapsLive Ver. 2
4Code for retrieving and outputting data supplier info
5Lovell Johns Ltd.
601/01/10
7--------------------------------------------------------------*/
8
9//----------------------------------------------------------GLOBALS
10
11
12var supplierNames = new Array('Cities Revealed','Getmapping','Blom','Infoterra','The Envrionment Agency','bluesky','Blom',"Ordnance Survey");
13var supplierCodes = new Array('CR','GM','BLOM','IT','EA','BLUESKY',"BLM","OS");		//!!!CHECK FOR FULL LIST
14var getSuppliersReq;						//Request object for retrieving suppliers for defined area			
15var getOverviewHeightSuppliersReq;				//Request object for retrieving suppliers for map centre point
16var getOverviewAerialSuppliersReq;
17var getHeightSuppliersReq;					//Request object for retrieving suppliers for the defined area
18var getAerialSuppliersReq;
19var toCheckDateAsDate = null;
20var isBestHeightAerial = false;   //Flag to define id we get best options pre going to basket
21var	currentInfoX = 0;
22var	currentInfoY = 0; 
23
24//-------------------------------------------------------------------------GETTING SUPPLIER INFO
25function getOverlaySupplierInfo(theType,showArea,lookupType){
26	
27	isBestHeightAerial = false;   //Flag that we are NOT getting the best options pre going to basket
28	var theSelectedProductIndex = getSelectedProductIndex();
29	var theExtentID = document.getElementById("extent" + theSelectedProductIndex).value;
30	if((theExtentID == "") && (showArea)){
31		showArea = false;
32	}
33	if((showArea) && (document.getElementById("heightAerialSuppliers").style.display != "block")){
34		var outputHTMLString = "<p align='right' style='margin-right:10px;'><a href='javascript:closeSupplierListing(\"overlay\");'>Close [x]</a></p>"					
35		outputHTMLString += "<div id='supplierinfoAerial_layer2'></div>";		
36		outputHTMLString += "<div id='supplierinfoHeight_layer2'></div>";
37		document.getElementById("productsAvailable2").innerHTML = outputHTMLString;
38		document.getElementById("heightAerialSuppliers").style.display = "block";	
39	}	
40	if(theType == "aerial"){		
41		if(showArea == false){
42			document.getElementById("supplierinfoAerial_layer").innerHTML = "<p style='color:#3E3E3E;margin-bottom:10px;'>The following tables will show the suppliers of aerial imagery and height data in this area.<br/>These can be selected as natural additions to the OS MasterMap product.<br/><br/><img src='images/loader.gif' alt='Retrieving suppliers...'>   Please wait while retrieving aerial suppliers ........Alternatively cancel this search <a href='javascript:cancelSupplierReq2(\"aerial\");'>here</a></p>";   			
43		}else{
44			document.getElementById("supplierinfoAerial_layer2").innerHTML = "<p style='color:#3E3E3E;margin-bottom:10px;'>The following tables will show the suppliers of aerial imagery and height data in this area.<br/>These can be selected as natural additions to the OS MasterMap product.<br/><img src='images/loader.gif' alt='Retrieving suppliers...'>   Please wait while retrieving aerial suppliers ........Alternatively cancel this search <a href='javascript:cancelSupplierReq2(\"aerial\");'>here</a></p>";			
45		}			
46	}
47	if((theType == "height") || (lookupType == "mastermap")){
48		if(showArea == false){
49			document.getElementById("supplierinfoHeight_layer").innerHTML = "<p style='color:#3E3E3E;margin-bottom:10px;'><img src='images/loader.gif' alt='Retrieving suppliers...'>   Please wait while retrieving height suppliers ........Alternatively cancel this search <a href='javascript:cancelSupplierReq2(\"height\");'>here</a></p>";   			
50		}else{
51			document.getElementById("supplierinfoHeight_layer2").innerHTML = "<p style='color:#3E3E3E;margin-bottom:10px;'><img src='images/loader.gif' alt='Retrieving suppliers...'>   Please wait while retrieving height suppliers ........Alternatively cancel this search <a href='javascript:cancelSupplierReq2(\"height\");'>here</a></p>";			
52		}
53	}
54	if(showArea){
55			//Get products that intesect map extent (Full info)	
56			var extentGeom = getExtentGeomByID(theExtentID);
57			var geomString = String(extentGeom).substring(9,(String(extentGeom).length -2))	
58			aDate = new Date();	
59			if(theType == "aerial"){		
60				var qstring = "&data=NULL_AERIAL&type=overlay&xtent=" + geomString + "&thecountry=" + document.varform.regi
60on.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&site=" + document.varform.thesite.value;
61				getSuppliersReq = new ajaxObject('getSupplierInfo2.php', handleGetSupplierInfo);
62				getSuppliersReq.update(qstring,'POST');
63			}else if(theType == "height"){
64				var qstring = "&data=NULL_HEIGHT&type=overlay&xtent=" + geomString + "&thecountry=" + document.varform.region.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&site=" + document.varform.thesite.value;
65				clearTimeout(timerId);
66				getSuppliersReq = new ajaxObject('getSupplierInfo2.php', handleGetSupplierInfo);
67				getSuppliersReq.update(qstring,'POST');			
68			}
69	}else{	
70		//Get suppliers that intersect the centre point of the map (Reduced info) - Called when clicking the "Height" or "Aerial" product category	
71		aDate = new Date();
72		if(theType == "aerial"){
73			var qstring = "&data=NULL_AERIAL&type=overlay&thecountry=" + document.varform.region.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&centrex=" + map.getCenter().lon + "&centrey=" + map.getCenter().lat + "&site=" + document.varform.thesite.value;;
74			if(getOverviewAerialSuppliersReq != null){
75				getOverviewAerialSuppliersReq.abort();
76			}
77			getOverviewAerialSuppliersReq = new ajaxObject('getOverviewSupplierInfo2.php', handleGetSupplierInfo);
78			getOverviewAerialSuppliersReq.update(qstring,'POST');
79		}else if(theType == "height"){
80			var qstring = "&data=NULL_HEIGHT&type=overlay&thecountry=" + document.varform.region.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&centrex=" + map.getCenter().lon + "&centrey=" + map.getCenter().lat + "&site=" + document.varform.thesite.value;;
81			clearTimeout(timerId);
82			if(getOverviewHeightSuppliersReq != null){
83				getOverviewHeightSuppliersReq.abort();
84			}
85			getOverviewHeightSuppliersReq = new ajaxObject('getOverviewSupplierInfo2.php', handleGetSupplierInfo);
86			getOverviewHeightSuppliersReq.update(qstring,'POST');
87		}
88	}
89}
90
91//****************Get supplier info for a specific product - called when product selected
92function getSupplierInfo(showArea){
93	//Ensure area for supplier info is visible
94	isBestHeightAerial = false;   //Flag that we are NOT getting the best options pre going to basket
95	if(showArea){					//Show full details  for products  for chosen area			
96		var outputHTMLString = "<p align='right' style='margin-right:10px;'><a href='javascript:closeSupplierListing(\"full\");'>Close [x]</a></p>"			
97		if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "OSNI_AERIAL")){
98			outputHTMLString += "<div id='supplierinfoAerial_layer2'></div>";		
99		}else if((document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_HEIGHT")){
100			outputHTMLString += "<div id='supplierinfoHeight_layer2'></div>";
101		}		
102		document.getElementById("productsAvailable2").innerHTML = outputHTMLString;
103		document.getElementById("heightAerialSuppliers").style.display = "block";
104	}
105	//if((document.getElementById("supplierinfoAerial_layer2") != null) && (document.getElementById("supplierinfoHeight_layer2") != null)){		
106		if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "OSNI_AERIAL")){
107			if(showArea == false){
108				document.getElementById("supplierinfoAerial_layer").innerHTML = "<p style='color:#3E3E3E;'>The following table will show the suppliers of aerial imagery in this area.<br/><img src='images/loader.gif' alt='Retrieving suppliers...'>   Please wait while retrieving aerial suppliers ........Alternatively cancel this search <a href='javascript:cancelSupplierReq2(\"aerial\");'>here</a></p>";   			
109			}else{
110				document.getElementById("supplierinfoAerial_layer2").innerHTML = "<p style='color:#3E3E3E;'><br/>The following table will show the suppliers of aerial imagery for your chosen data area. Please choose a supplier from this table.<br/><img src='images/loader.gif' alt='Retrieving suppliers...'>   Please wait while retrieving aerial suppliers ........Alternatively cancel this search <a href='javascript:cancelSupplierReq2(\"aerial\");'>here</a></p>";			
111			}
112		}else if((document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_HEIGHT")){
113			if(showArea == false){
114				document.getElementById("supplierinfoHeight_layer").innerHTML = "<p style='color:#3E3E3E;'>The following table will show the suppliers of height data in this area.<br/><img src='images/loader.gif' alt='Retrieving suppliers...'>   Please wait while retrieving height suppliers ........Alternatively cancel this search <a href='javascript:cancelSupplierReq2(\"height\");'>here</a></p>";   			
115			}else{
116				document.getElementById("supplierinfoHeight_layer2").innerHTML = "<p style='color:#3E3E3E;'><br/>The following table will show the suppliers of height data for your chosen data area. Please choose a supplier from this table.<br/><img src='images/loader.gif' alt='Retrieving suppliers...'>   Please wait while retrieving height suppliers ........Alternatively cancel this search <a href='javascript:cancelSupplierReq2(\"height\");'>here</a></p>";			
117			}
118		}
119		
120		if(showArea){			
121			var theSelectedProductIndex = getSelectedProductIndex();
122			var theExtentID = document.getElementById("extent" + theSelectedProductIndex).value;
123			if(theExtentID != ""){											//Get products that intesect map extent (Full info)	
124				var extentGeom = getExtentGeomByID(theExtentID);
125				var geomString = String(extentGeom).substring(9,(String(extentGeom).length -2))
126				aDate = new Date();
127				var qstring = "&data=" + document.varform.data.value + "&type=product&xtent=" + geomString + "&thecountry=" + document.varform.regi
127on.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&site=" + document.varform.thesite.value;
128				if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "OSNI_AERIAL")){
129					getAerialSuppliersReq = new ajaxObject('getSupplierInfo2.php', handleGetSupplierInfo);
130					getAerialSuppliersReq.update(qstring,'POST');
131				}else if((document.varform.data.value == "NULL_HEIGHT")  || (document.varform.data.value == "OSNI_HEIGHT")){		
132					getHeightSuppliersReq = new ajaxObject('getSupplierInfo2.php', handleGetSupplierInfo);
133					getHeightSuppliersReq.update(qstring,'POST');
134				}
135			}else{															//Get products that centre of the view (Reduced info)
136				document.getElementById("heightAerialSuppliers").style.display = "none";
137				aDate = new Date();
138				var qstring = "&data=" + document.varform.data.value + "&type=product&thecountry=" + document.varform.region.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&centrex=" + map.getCenter().lon + "&centrey=" + map.getCenter().lat;
139				if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "OSNI_AERIAL")){
140					getProductsInCategory("5");
141				}else if((document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_HEIGHT")){				
142					getProductsInCategory("4");
143				}	
144			}
145		}else{
146			//Get suppliers that intersect the centre point of the map (Reduced info) - Called when clicking the "Height" or "Aerial" product category	
147			aDate = new Date();
148			var qstring = "&data=" + document.varform.data.value + "&type=product&thecountry=" + document.varform.region.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&centrex=" + map.getCenter().lon + "&centrey=" + map.getCenter().lat + "&site=" + document.varform.thesite.value;;
149			if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "OSNI_AERIAL")){
150				getOverviewAerialSuppliersReq = new ajaxObject('getOverviewSupplierInfo2.php', handleGetSupplierInfo);
151				getOverviewAerialSuppliersReq.update(qstring,'POST');
152			}else if((document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_HEIGHT")){				
153				getOverviewHeightSuppliersReq = new ajaxObject('getOverviewSupplierInfo2.php', handleGetSupplierInfo);
154				getOverviewHeightSuppliersReq.update(qstring,'POST');
155			}
156		}
157	//}
158}
159
160//***********************Run query to get the latest ie most suitable aerial and height product
161function getBestOverlaySupplierInfo(theType,indexToUse){
162	//Ensure the progress image shows
163	document.getElementById("bestprog").style.display = "block";
164	document.getElementById("bestHeightAerialSupplierSubHeader").style.display = "block";
165	//Get the extent am look up the supplier info
166	var theExtentID = document.getElementById("extent" + String(indexToUse)).value;	
167	var extentGeom = getExtentGeomByID(theExtentID);
168	var geomString = String(extentGeom).substring(9,(String(extentGeom).length -2));
169	aDate = new Date();
170	isBestHeightAerial = true;   //Flag that we are getting the best options pre going to basket	
171	if(theType == "aerial"){		
172		var qstring = "&data=NULL_AERIAL&type=overlay&xtent=" + geomString + "&thecountry=" + document.varform.region.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&querytype=best" + "&site=" + document.varform.thesite.value + "&productindex=" + indexToUse;
173		getSuppliersReq = new ajaxObject('getSupplierInfo2.php', handleGetSupplierInfo);
174		getSuppliersReq.update(qstring,'POST');
175	}else if(theType == "height"){
176		var qstring = "&data=NULL_HEIGHT&type=overlay&xtent=" + geomString + "&thecountry=" + document.varform.region.value.toUpperCase() + "&thetime=" + String(aDate.getTime()) + "&querytype=best" + "&site=" + document.varform.thesite.value + "&productindex=" + indexToUse;
177		clearTimeout(timerId);
178		getSuppliersReq = new ajaxObject('getSupplierInfo2.php', handleGetSupplierInfo);
179		getSuppliersReq.update(qstring,'POST');			
180	}
181}
182
183//****************Handles the response from getting supplier info
184function handleGetSupplierInfo(responseText){
185	responseText = trim(responseText)
186	responseText = trim(responseText)
187		if(responseText == ""){
188			var supplierinfoHtml = "<p class='error'><br/>Due to the size of area selected or another issue, we have been unable to produce a listing.<br/><a href='javascript:getSupplierInfo(false);'>Click here to try again</a> or alternatively <a href='javascript:sendQuoteReq();'>request a quote here.</a></p>";				
189			if(document.getElementById("supplierinfoAerial_layer2") != null){
190				document.getElementById("supplierinfoAerial_layer2").innerHTML = supplierinfoHtml;
191			}else if(document.getElementById("supplierinfoHeight_layer2") != null){
192				document.getElementById("supplierinfoHeight_layer2").innerHTML = supplierinfoHtml;
193			}else{			
194				showDialog('Warning','Due to the size of area selected or another issue, we have been unable to produce a listing.<br/><br/><input type="button" value="Close" id="closeButton" onclick="hideDialog();" >','warning');
195			}
196		}else{
197			//Store info for aerial and height info in arrays 
198			var theSupplierOptions = new Array();
199			var theAerialInfo = new Array();
200			var theHeightInfo = new Array();
201			var aerialCnt = 0;
202			var heightCnt = 0;		
203			var tempArray = responseText.split("~");			
204			var theOutputType = tempArray[0];
205			var theOutputType2 = tempArray[1];
206			var theMinPriceToApply = tempArray[3];
207			var indexToUse = tempArray[4];
208			theSupplierOptions = tempArray[2].split("|");
209
210			for(s=0;s<theSupplierOptions.length;s++){
211				var theSupplierInfo = new Array();
212				var theSupplierInfo = theSupplierOptions[s].split(",");
213			
214				if(theSupplierInfo[1] == "AERIAL"){
215					theAerialInfo[aerialCnt] = theSupplierInfo;
216					aerialCnt += 1;	
217				}else if(theSupplierInfo[1] == "HEIGHT"){
218					theHeightInfo[heightCnt] = theSupplierInfo;
219					heightCnt += 1;
220				}
221			}
222		
223			//--Reformat info into HTML
224			var supplierinfoHtml = "";
225			var supplierinfoHtmlBest = "";			
226			
227			//************************************************Show Aerial suppliers
228			if(theAerialInfo.length > 0){
229				if(theOutputType == "full"){			//Showing full listing - set no. cols and table width
230					var thecolspan = "8";
231					var theTableWidth = "670px";
232				}else{									//Showing overview listing - set no. cols and table width
233					var thecolspan = "3";
234					var theTableWidth = "500px";
235				}
236				supplierinfoHtml += "<table width='" + theTableWidth + "' cellpadding='0' cellspacing='0'>";
237				if(theOutputType == "full"){
238					supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'><h2>Aerial Data</h2></td></tr>";			
239					supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'><p style='color:#3E3E3E;margin-top:5px;'>The following suppliers have been found in this area. Please select one or more options from the available datasets listed.</p><br/></td></tr>";										
240					//Content for best option choice
241					supplierinfoHtmlBest += "<table width='" + theTableWidth + "'>";
242					//Ver 1 supplierinfoHtmlBest += "<tr valign='top'><td colspan='" + thecolspan + "'><p style='color:#3E3E3E;margin-top:20px;font-size:20px;font-weight:bold;'>Aerial Imagery - <span style='font-size:12px;font-weight:normal;'>add context (e.g. white lines, foliage, roof types, parked cars, surface types &amp; more ...)</span></p></td></tr>";									
243
244				}else{
245					if(theOutputType2 == "overlay"){
246						//supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'><p>The following suppliers have been found in this area. To purchase choose the product above and define your data area.<br/>You will then be able to choose the specific data supplier.</p><br/></td></tr>";			
247					}else{
248						//supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'><p>The following suppliers have been found in this area. To purchase choose the product above and define your data area.<br/>You will then be able to choose the specific data supplier.</p><br/></td></tr>";								
249						//document.getElementById("supplierMessages").innerHTML = "<p>The following is available for this location.<br/>To purchase choose the product to the left and define your data area.<br/>You will then be able to choose the specific data supplier for price and availability.";			
250					}
251					document.getElementById("supplierMessages").innerHTML = "<div class='newButton' style='width:80px;padding:5px;font-size:13px;font-weight:bold;' onclick='getProductInfo(\"NULL_AERIAL\",\"new\");'>SEARCH</div><div style='clear:both;'></div><p style='margin-top:3px;color:#3E3E3E;'>(After selection define your data area.<br/>You will then be able to choose the specific data supplier for price and availability.)</p>";			
252				}
253					
254				if(theOutputType != "full"){	
255					supplierinfoHtml += "<tr valign='top'><td colspan='3'><p style='margin-bottom:3px;'>The following aerial datasets are available for this location.</p></td></tr>";	
256				}	
257				//Write header
258				supplierinfoHtml += "<tr valign='top'>";
259
260				if(theOutputType == "full"){
261					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Res.<br/>(cm)</strong></p></td>";
262					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Dates</strong></p></td>";
263					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supplier</strong></p></td>";
264					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Preview</strong></p></td>";
265					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>% Cover</strong></p></td>";
266					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supply<br/>Res.(cm)</strong></p></td>";						
267					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Price<br/>(excl. VAT)</strong></p></td>";
268					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Add?</strong></p></td>";					
269				}else{
270					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Res.(cm)</strong></p></td>";
271					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Dates</strong></p></td>";
272					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supplier</strong></p></td>";
273				}
274				supplierinfoHtml += "</tr>";								
275				//Re-replace back in " " and "," in the date entries
276				for(c=0;c<theAerialInfo.length;c++){
277					theAerialInfo[c][3] = theAerialInfo[c][3].replace(/-space-/g, " ");
278					theAerialInfo[c][3] = theAerialInfo[c][3].replace(/-comma-/g, ",");
279					theAerialInfo[c][11] = theAerialInfo[c][11].replace(/-space-/g, " ");
280					theAerialInfo[c][11] = theAerialInfo[c][11].replace(/-comma-/g, ",");
281				}					
282				//Sort the array by end date.
283				//Supplier info array = [ProductCode,Category,PixelSize,Date,Supplier,Cost,PreviewURL]
284				for(c=0;c<theAerialInfo.length;c++){
285					for(c2=c;c2<theAerialInfo.length;c2++){				
286						//Get the year (get start date where range specified)					
287						//Get defined end date
288						var toCheckDateAsDate1 = theAerialInfo[c][11];
289						var toCheckDateAsDate2 = theAerialInfo[c2][11];
290
291						var reOrder = false;
292						if((toCheckDateAsDate1 != null) && (toCheckDateAsDate2 != null)){		
293							if(toCheckDateAsDate1 < toCheckDateAsDate2){
294								reOrder = true;
295							}
296						}							
297						if(reOrder){
298							holding = theAerialInfo[c2][0];
299							theAerialInfo[c2][0] = theAerialInfo[c][0];
300							theAerialInfo[c][0] = holding; 
301							holding = theAerialInfo[c2][1];
302							theAerialInfo[c2][1] = theAerialInfo[c][1];
303							theAerialInfo[c][1] = holding; 
304							holding = theAerialInfo[c2][2];
305							theAerialInfo[c2][2] = theAerialInfo[c][2];
306							theAerialInfo[c][2] = holding;  
307							holding = theAerialInfo[c2][3];
308							theAerialInfo[c2][3] = theAerialInfo[c][3];
309							theAerialInfo[c][3] = holding;  						
310							holding = theAerialInfo[c2][4];
311							theAerialInfo[c2][4] = theAerialInfo[c][4];
312							theAerialInfo[c][4] = holding; 
313							holding = theAerialInfo[c2][5];
314							theAerialInfo[c2][5] = theAerialInfo[c][5];
315							theAerialInfo[c][5] = holding;
316							holding = theAerialInfo[c2][6];
317							theAerialInfo[c2][6] = theAerialInfo[c][6];
318							theAerialInfo[c][6] = holding;
319							holding = theAerialInfo[c2][7];
320							theAerialInfo[c2][7] = theAerialInfo[c][7];
321							theAerialInfo[c][7] = holding;
322							holding = theAerialInfo[c2][8];
323							theAerialInfo[c2][8] = theAerialInfo[c][8];
324							theAerialInfo[c][8] = holding;
325							holding = theAerialInfo[c2][9];
326							theAerialInfo[c2][9] = theAerialInfo[c][9];
327							theAerialInfo[c][9] = holding;
328							holding = theAerialInfo[c2][10];
329							theAerialInfo[c2][10] = theAerialInfo[c][10];
330							theAerialInfo[c][10] = holding;
331							holding = theAerialInfo[c2][11];
332							theAerialInfo[c2][11] = theAerialInfo[c][11];
333							theAerialInfo[c][11] = holding;
334							holding = theAerialInfo[c2][12];
335							theAerialInfo[c2][12] = theAerialInfo[c][12];
336							theAerialInfo[c][12] = holding;
337							holding = theAerialInfo[c2][13];
338							theAerialInfo[c2][13] = theAerialInfo[c][13];
339							theAerialInfo[c][13] = holding;
340							holding = theAerialInfo[c2][14];
341							theAerialInfo[c2][14] = theAerialInfo[c][14];
342							theAerialInfo[c][14] = holding;
343						}
344					}
345				}
346				
347				//---Sort the array by productcode.
348				for(c=0;c<theAerialInfo.length;c++){
349					for(c2=c;c2<theAerialInfo.length;c2++){
350						//Get the year (get start date where range specified)
351						//var toCheckDate1 = getCheckDate(theAerialInfo[c][3]);
352						//var toCheckDateAsDate1 = toCheckDateAsDate;
353						//var toCheckDate2 = getCheckDate(theAerialInfo[c2][3]);							
354						//var toCheckDateAsDate2 = toCheckDateAsDate;
355						var isSameDate = false;
356						//if((toCheckDateAsDate1 != null) && (toCheckDateAsDate2 != null)){		
357					//		if(toCheckDateAsDate1 == toCheckDateAsDate2){
358						//		isSameDate = true;
359						//	}
360						//}else{
361							if(theAerialInfo[c][3] == theAerialInfo[c2][3]){
362								isSameDate = true;
363							}
364						//}
365						if((theAerialInfo[c][0] > theAerialInfo[c2][0]) && (isSameDate)){   //(toCheckDate1 == toCheckDate2)){ 
366							holding = theAerialInfo[c2][0];
367							theAerialInfo[c2][0] = theAerialInfo[c][0];
368							theAerialInfo[c][0] = holding; 
369							holding = theAerialInfo[c2][1];
370							theAerialInfo[c2][1] = theAerialInfo[c][1];
371							theAerialInfo[c][1] = holding; 
372							holding = theAerialInfo[c2][2];
373							theAerialInfo[c2][2] = theAerialInfo[c][2];
374							theAerialInfo[c][2] = holding;  
375							holding = theAerialInfo[c2][3];
376							theAerialInfo[c2][3] = theAerialInfo[c][3];
377							theAerialInfo[c][3] = holding;  						
378							holding = theAerialInfo[c2][4];
379							theAerialInfo[c2][4] = theAerialInfo[c][4];
380							theAerialInfo[c][4] = holding; 
381							holding = theAerialInfo[c2][5];
382							theAerialInfo[c2][5] = theAerialInfo[c][5];
383							theAerialInfo[c][5] = holding;
384							holding = theAerialInfo[c2][6];
385							theAerialInfo[c2][6] = theAerialInfo[c][6];
386							theAerialInfo[c][6] = holding;
387							holding = theAerialInfo[c2][7];
388							theAerialInfo[c2][7] = theAerialInfo[c][7];
389							theAerialInfo[c][7] = holding;
390							holding = theAerialInfo[c2][8];
391							theAerialInfo[c2][8] = theAerialInfo[c][8];
392							theAerialInfo[c][8] = holding;
393							holding = theAerialInfo[c2][9];
394							theAerialInfo[c2][9] = theAerialInfo[c][9];
395							theAerialInfo[c][9] = holding;
396							holding = theAerialInfo[c2][10];
397							theAerialInfo[c2][10] = theAerialInfo[c][10];
398							theAerialInfo[c][10] = holding;
399							holding = theAerialInfo[c2][11];
400							theAerialInfo[c2][11] = theAerialInfo[c][11];
401							theAerialInfo[c][11] = holding;
402							holding = theAerialInfo[c2][12];
403							theAerialInfo[c2][12] = theAerialInfo[c][1];
404							theAerialInfo[c][12] = holding;
405							holding = theAerialInfo[c2][13];
406							theAerialInfo[c2][13] = theAerialInfo[c][13];
407							theAerialInfo[c][13] = holding;
408							holding = theAerialInfo[c2][14];
409							theAerialInfo[c2][14] = theAerialInfo[c][14];
410							theAerialInfo[c][14] = holding;	
411						} 	
412					}
413				}
414				//Sort the array by resolution.
415				for(c=0;c<theAerialInfo.length;c++){
416					for(c2=c;c2<theAerialInfo.length;c2++){
417						var isSameDate = false;
418						if(theAerialInfo[c][3] == theAerialInfo[c2][3]){
419							isSameDate = true;
420						}
421						if((Number(theAerialInfo[c][2]) > Number(theAerialInfo[c2][2])) && (theAerialInfo[c][0] == theAerialInfo[c2][0]) && (isSameDate) && (theAerialInfo[c][4] == theAerialInfo[c2][4])){    //(toCheckDate1 == toCheckDate2)
422							holding = theAerialInfo[c2][0];
423							theAerialInfo[c2][0] = theAerialInfo[c][0];
424							theAerialInfo[c][0] = holding; 
425							holding = theAerialInfo[c2][1];
426							theAerialInfo[c2][1] = theAerialInfo[c][1];
427							theAerialInfo[c][1] = holding; 
428							holding = theAerialInfo[c2][2];
429							theAerialInfo[c2][2] = theAerialInfo[c][2];
430							theAerialInfo[c][2] = holding;  
431							holding = theAerialInfo[c2][3];
432							theAerialInfo[c2][3] = theAerialInfo[c][3];
433							theAerialInfo[c][3] = holding;  						
434							holding = theAerialInfo[c2][4];
435							theAerialInfo[c2][4] = theAerialInfo[c][4];
436							theAerialInfo[c][4] = holding; 
437							holding = theAerialInfo[c2][5];
438							theAerialInfo[c2][5] = theAerialInfo[c][5];
439							theAerialInfo[c][5] = holding;
440							holding = theAerialInfo[c2][6];
441							theAerialInfo[c2][6] = theAerialInfo[c][6];
442							theAerialInfo[c][6] = holding;
443							holding = theAerialInfo[c2][7];
444							theAerialInfo[c2][7] = theAerialInfo[c][7];
445							theAerialInfo[c][7] = holding;
446							holding = theAerialInfo[c2][8];
447							theAerialInfo[c2][8] = theAerialInfo[c][8];
448							theAerialInfo[c][8] = holding;
449							holding = theAerialInfo[c2][9];
450							theAerialInfo[c2][9] = theAerialInfo[c][9];
451							theAerialInfo[c][9] = holding;
452							holding = theAerialInfo[c2][10];
453							theAerialInfo[c2][10] = theAerialInfo[c][10];
454							theAerialInfo[c][10] = holding;
455							holding = theAerialInfo[c2][11];
456							theAerialInfo[c2][11] = theAerialInfo[c][11];
457							theAerialInfo[c][11] = holding;
458							holding = theAerialInfo[c2][12];
459							theAerialInfo[c2][12] = theAerialInfo[c][12];
460							theAerialInfo[c][12] = holding;
461							holding = theAerialInfo[c2][13];
462							theAerialInfo[c2][13] = theAerialInfo[c][13];
463							theAerialInfo[c][13] = holding;
464							holding = theAerialInfo[c2][14];
465							theAerialInfo[c2][14] = theAerialInfo[c][14];
466							theAerialInfo[c][14] = holding;
467						} 	
468					}
469				}
470								
471				var nofSuppliers = theAerialInfo.length;
472				a= 0;
473				while(a<nofSuppliers){
474					var baseDate = theAerialInfo[a][3];
475					var baseCode = theAerialInfo[a][0];
476					uptoIndex = -1;
477					hasMatches = false;
478					for(a1=(a+1);a1<theAerialInfo.length;a1++){
479						var checkDate = theAerialInfo[a1][3];
480						var checkCode = theAerialInfo[a1][0];
481						if((baseDate == checkDate) && (baseCode == checkCode)){
482							hasMatches = true;
483						}else{
484							uptoIndex = a1;
485							break
486						}
487					}
488					
489					if((hasMatches) && (uptoIndex == -1)){
490						uptoIndex = theAerialInfo.length;						
491					}
492						
493					if(uptoIndex == -1){		//Nothing with the same date (Print as is)
494						//Get Supplier name
495						/*var supplierName = "Not Defined";
496						for(s=0;s<supplierCodes.length;s++){
497							if(theAerialInfo[a][4] == supplierCodes[s]){
498								supplierName = supplierNames[s];
499								break;
500							}
501						}*/
502						
503						//NEW ADDED!!!
504						supplierName = theAerialInfo[a][4]; 
505						
506						var theResolution = String(Number(theAerialInfo[a][2]) * 100);
507						if(theResolution.indexOf(".") != -1){
508							theResolution = Math.round(Number(theResolution)*10)/10;
509						}
510						supplierinfoHtml += "<tr align='center' valign='top'>";						
511						supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + theResolution + "</td>";
512
513						supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + formatSupplierDate(theAerialInfo[a][3]) + "</td>";						
514						supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + supplierName + "</td>";  //+ ": " + theAerialInfo[a][9] + "</td>";							
515						if(theAerialInfo[a][6] != ""){
516							supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo' style='text-align:center;'><img src='images/photo.jpg' witdh='22' height='18' style='cursor:pointer;' alt='Click for sample' border='0' onclick='showSupplierExtent(\"" + theAerialInfo[a][6] + "\");' /></td>";
517						}else{
518							if(theOutputType == "full"){
519								supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>&nbsp;</td>";
520							}
521						}						
522						if(theOutputType == "full"){					
523							if(theAerialInfo[a][7] == ""){
524								theAerialInfo[a][7] = "100";
525							}else if(Number(theAerialInfo[a][7]) > 100) {
526								theAerialInfo[a][7] = "100";
527							}
528							if((Math.round(Number(theAerialInfo[a][7])*10)/10) == 100) {
529								outputCoverage = "<p style='color:#00FF00;font-weight:bold;'>";
530							}else if((Math.round(Number(theAerialInfo[a][7])*10)/10) < 90){
531								outputCoverage = "<p style='color:#FF0000;font-weight:bold;'>";
532							}else{
533								outputCoverage = "<p style='color:#FF9900;font-weight:bold;'>";
534							}
535							outputCoverage += String(Math.round(Number(theAerialInfo[a][7])*10)/10) + "&nbsp;&nbsp;<a href='javascript:showSupplierExtent(\"" + theAerialInfo[a][6] + "\");'>view</a></p>";
536			
537							supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + outputCoverage + "</td>";							
538							supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + theResolution + "</td>";
539							//Ensure price is not less than the minimum allowed
540							if(Number(theAerialInfo[a][5]) < Number(theMinPriceToApply)){
541								theAerialInfo[a][5] = theMinPriceToApply;
542							}												
543							supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>+&pound;" + formatPrice(theAerialInfo[a][5]) + "</td>"											
544
545							//Define if this need to be selected ie. showing a selected product need to list the suppliers chosen	
546							var selectedProductIndex = getSelectedProductIndex();
547							var isChecked = false;
548							if(document.getElementById("productLayers" + selectedProductIndex).value != ""){
549								var selectedSupplierInfoArray = document.getElementById("productLayers" + selectedProductIndex).value.split(",");
550								for(s=0;s<selectedSupplierInfoArray.length;s++){
551									var storedSupplierInfo = selectedSupplierInfoArray[s];
552									var retrievedSupplierInfo = theAerialInfo[a][9] + "|" + theAerialInfo[a][3] + "|" + theAerialInfo[a][2] + "|" + theAerialInfo[a][0] + "|" + theAerialInfo[a][10] + "|" + theAerialInfo[a][13] + "|" + theAerialInfo[a][14]  + "|" + String(Math.round(Number(theAerialInfo[a][7])*10)/10);
553									retrievedSupplierInfo = retrievedSupplierInfo.replace(/,/g,"-com-");	//Adjustments to make agree with what been stored/
554									if(retrievedSupplierInfo.indexOf("*") == 0){			
555										retrievedSupplierInfo = retrievedSupplierInfo.substring(1,retrievedSupplierInfo.length);
556									}
557									if(storedSupplierInfo == retrievedSupplierInfo){
558										isChecked = true
559										break;
560									}
561								}
562							}
563							supplierinfoHtml += "<td class='supplierinfo' style='text-align:center;'><input type='checkbox' name='supp1' onclick='setSupplier(this,\"" + theAerialInfo[a][9] + "|" + theAerialInfo[a][3] + "|"  + theAerialInfo[a][2] + "|" + theAerialInfo[a][0] + "|" + theAerialInfo[a][10] + "|" + theAerialInfo[a][13] + "|" + theAerialInfo[a][14] + "\",\""  + theAerialInfo[a][5] + "\",\""  + String(Math.round(Number(theAerialInfo[a][7])*10)/10) + "\",\"aerial\",\"" + theAerialInfo[a][8] + "\" );'";
564							if(isChecked){
565								supplierinfoHtml += " checked ";
566							}
567							supplierinfoHtml += "></td>";
568							
569							//Define the content for the best supplier will just be the first eleme4nt as only one is returned
570							/*Ver 1 supplierinfoHtmlBest += "<tr><td colspan='6'></td><td>&nbsp;</td><td><p style='font-weight:bold;font-style:oblique;text-align: center'>Add</p></td></tr>";
571							supplierinfoHtmlBest += "<tr><td colspan='6'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;'><span style='font-weight:bold;'>" + theResolution + "cm</span> resolution from <span style='font-weight:bold;'>" +  formatSupplierDate(theAerialInfo[a][3]) + "</span> from " + supplierName + "</p></td>";
572							supplierinfoHtmlBest += "<td><p style='color:#3E3E3E;font-size:14px;font-weight:normal;text-align: right;padding-right: 10px;'>&pound;" + formatPrice(theAerialInfo[a][5]) + " + VAT</p></td><td><p style='color:#3E3E3E;font-size:14px;font-weight:normal;text-align: center'><input type='checkbox' name='chkBestAerialItem' id='chkBestAerialItem' onclick='setSupplier(this,\"" + theAerialInfo[a][9] + "|" + theAerialInfo[a][3] + "|"  + theAerialInfo[a][2] + "|" + theAerialInfo[a][0] + "|" + theAerialInfo[a][10] + "|" + theAerialInfo[a][13] + "|" + theAerialInfo[a][14] + "\",\""  + theAerialInfo[a][5] + "\",\""  + String(Math.round(Number(theAerialInfo[a][7])*10)/10) + "\",\"aerial\",\"" + theAerialInfo[a][8] + "\" );'></p></td></tr>";
573							supplierinfoHtmlBest += "<tr><td colspan='8'>&nbsp;</td></tr>";		*/
574							//supplierinfoHtmlBest += "<tr><td colspan='6'></td><td>&nbsp;</td><td><p style='font-weight:bold;font-style:oblique;text-align: center'>Add?</p></td></tr>";
575							supplierinfoHtmlBest += "<tr><td style='width:150px;'><span style='font-weight:bold;color:#3E3E3E;font-size:14px;'>Aerial Imagery</td><td colspan='4' style='width:220px;'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;'>" + theResolution + "cm, " +  formatSupplierDate(theAerialInfo[a][3]) + "</p></td><td style='width:20px;'><img src='images/info.jpg' alt='info' width='16' height='16' class='clickable' onclick='getExtraLayerInfo(\"NULL_AERIAL\");' /></td>";
576							supplierinfoHtmlBest += "<td style='width:90px;'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;text-align: right;padding-right: 10px;'>&pound;" + formatPrice(theAerialInfo[a][5]) + "</p></td><td style='width:20px;'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;text-align: center'><input type='checkbox' name='chkBestAerialItem' id='chkBestAerialItem' onclick='setSupplier(this,\"" + theAerialInfo[a][9] + "|" + theAerialInfo[a][3] + "|"  + theAerialInfo[a][2] + "|" + theAerialInfo[a][0] + "|" + theAerialInfo[a][10] + "|" + theAerialInfo[a][13] + "|" + theAerialInfo[a][14] + "\",\""  + theAerialInfo[a][5] + "\",\""  + String(Math.round(Number(theAerialInfo[a][7])*10)/10) + "\",\"aerial\",\"" + theAerialInfo[a][8] + "\" );'></p></td></tr>";
577							supplierinfoHtmlBest += "<tr><td colspan='8'>&nbsp;</td></tr>";	
578							
579						}
580						supplierinfoHtml += "</tr>";
581						a++;
582																									
583					}else{
584						var lineCnt = 0;
585						for(p=a;p<uptoIndex;p++){
586							lineCnt++;
587							//Get Supplier name
588							supplierName = theAerialInfo[p][4];
589				
590							supplierinfoHtml += "<tr align='center' valign='top'>";
591							if(lineCnt ==1){			//Define class to disply table cells with
592								var classToUse = "supplierinfoNoBot";
593							}
593else if(lineCnt == (uptoIndex-a)){			
594								var classToUse = "supplierinfoNoTop";
595							}else{
596								var classToUse = "supplierinfoNoTopBot";
597							}
598							var theResolution = String(Number(theAerialInfo[p][2]) * 100);
599							if(theResolution.indexOf(".") != -1){
600								theResolution = Math.round(Number(theResolution)*10)/10;
601							}
602							if(lineCnt ==1){
603								supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>" + theResolution + "</td>";
604								supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>" + formatSupplierDate(theAerialInfo[p][3]) + "</td>";
605								
606								//if(theOutputType == "full"){
607								//	supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>" + supplierName + ": " + theAerialInfo[p][9] + "</td>";
608								//}else{
609									supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>" + supplierName + "</td>";
610								//}
611								if(theAerialInfo[p][6] != ""){
612									supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'  style='text-align:center;'><img src='images/photo.jpg' style='cursor:pointer;' witdh='22' height='18' alt='Click for sample' border='0' onclick='showSupplierExtent(\"" + theAerialInfo[a][6] + "\");' /></td>";			
613								}else{
614									if(theOutputType == "full"){
615										supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
616									}
617								}
618				
619								if(theOutputType == "full"){	
620									if(theAerialInfo[a][7] == ""){
621										theAerialInfo[a][7] = "100";
622									}
623									if(Number(theAerialInfo[a][7]) == 100){
624										outputCoverage = "<p style='color:#00FF00;font-weight:bold;'>";
625									}else if(Number(theAerialInfo[a][7])  < 90){
626										outputCoverage = "<p style='color:#FF0000;font-weight:bold;'>";
627									}else{
628										outputCoverage = "<p style='color:#FF9900;font-weight:bold;'>";
629									}
630									outputCoverage += String(Math.round(Number(theAerialInfo[a][7])*10)/10) + "&nbsp;&nbsp;<a href='javascript:showSupplierExtent(\"" + theAerialInfo[a][6] + "\");'>view</a></p>";
631									supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>" + outputCoverage + "</td>";
632								}	
633							}else{							
634								if(theOutputType == "full"){
635									supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
636									supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
637									supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
638									supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
639									supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
640								}
641							}
642							if(theOutputType == "full"){								
643								supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + theResolution + "</td>";
644								//Ensure price is not less than the minimum allowed
645								if(Number(theAerialInfo[p][5]) < Number(theMinPriceToApply)){
646									theAerialInfo[p][5] = theMinPriceToApply;
647								}
648								supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>+&pound;" + formatPrice(theAerialInfo[p][5]) + "</td>";							
649								//Define if this need to be selected ie. showing a selcted product need to list the suppliers chosen	
650								var selectedProductIndex = getSelectedProductIndex();
651								var isChecked = false;
652								if(document.getElementById("productLayers" + selectedProductIndex).value != ""){
653									var selectedSupplierInfoArray = document.getElementById("productLayers" + selectedProductIndex).value.split(",");
654									for(s=0;s<selectedSupplierInfoArray.length;s++){
655										var storedSupplierInfo = selectedSupplierInfoArray[s];
656										var retrievedSupplierInfo = theAerialInfo[p][9] + "|" + theAerialInfo[p][3] + "|" + theAerialInfo[p][2] + "|" + theAerialInfo[p][0]  + "|" + theAerialInfo[p][10] + "|" + theAerialInfo[p][13] + "|" + theAerialInfo[p][14] + "|" + String(Math.round(Number(theAerialInfo[p][7])*10)/10);
657										retrievedSupplierInfo = retrievedSupplierInfo.replace(/,/g,"-com-");	//Adjustments to make agree with what been stored/
658										if(retrievedSupplierInfo.indexOf("*") == 0){			
659											retrievedSupplierInfo = retrievedSupplierInfo.substring(1,retrievedSupplierInfo.length);
660										}
661										if(storedSupplierInfo == retrievedSupplierInfo){
662											isChecked = true
663											break;
664										}
665									}
666								}
667								supplierinfoHtml += "<td class='supplierinfo' style='text-align:center;'><input type='checkbox' name='supp1' onclick='setSupplier(this,\"" + theAerialInfo[p][9] + "|" + theAerialInfo[p][3] + "|" + theAerialInfo[p][2] + "|" + theAerialInfo[p][0]  + "|" + theAerialInfo[p][10] + "|" + theAerialInfo[p][13] + "|" + theAerialInfo[p][14] + "\",\""  + theAerialInfo[p][5] + "\",\""  + String(Math.round(Number(theAerialInfo[p][7])*10)/10) + "\",\"aerial\",\"" + theAerialInfo[p][8] + "\" );'";
668
669								if(isChecked){
670									supplierinfoHtml += " checked ";
671								}
672								supplierinfoHtml += "></td>";			
673							}
674							supplierinfoHtml += "</tr>";		
675						}
676						a = uptoIndex;
677					}
678				}
679				supplierinfoHtml += "</table>";
680			}
681				
682						
683			//************************************************Show Height suppliers
684			if(theHeightInfo.length > 0){
685				if(theOutputType == "full"){
686					var thecolspan = "8";
687					var theTableWidth = "670px";
688				}else{
689					var thecolspan = "3";
690					var theTableWidth = "500px";
691				}
692				supplierinfoHtml += "<table width='" + theTableWidth + "' cellpadding='0' cellspacing='0'>";
693				if(theOutputType == "full"){
694					supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'><h2>Height Data</h2></td></tr>";				
695					supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'><p style='color:#3E3E3E;margin-top:5px;'>The following suppliers have been found in this area. Please select one or more options from the available datasets listed.</p><br/></td></tr>";								
696				
697					//Content for best option choice
698					supplierinfoHtmlBest += "<table width='" + theTableWidth + "'>";    //cellpadding='0' cellspacing='0'
699					//supplierinfoHtmlBest += "<tr valign='top'><td colspan='" + thecolspan + "'><p style='color:#3E3E3E;margin-top:20px;font-size:20px;font-weight:bold;'>Height Data - <span style='font-size:12px;font-weight:normal;'>available as contours or surfaces</span></p></td></tr>";			
700				}else{
701					if(theOutputType2 != "overlay"){
702					//	supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'>The following suppliers have been found in this area. To purchase choose the product above and define your data area.<br/>You will then be able to choose the specific data supplier.</p><br/></td></tr>";			
703					}
704					//supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'><h2>Height Data</h2></td></tr>";
705					//document.getElementById("supplierMessages").innerHTML = "<p>The following is available for this location.<br/>To purchase choose the product to the left and define your data area.<br/>You will then be able to choose the specific data supplier for price and availability.";			
706					//document.getElementById("supplierMessages").innerHTML = "<p><img src='images/select.jpg' alt='Select Now!' onmouseover='this.src=\"images/selectON.jpg\"' onmouseout='this.src=\"images/select.jpg\"' onclick='getProductInfo(\"NULL_HEIGHT\",\"new\");'/><br/>(After selection define your data area.<br/>You will then be able to choose the specific data supplier for price and availability.)</p>";			
707					document.getElementById("supplierMessages").innerHTML = "<div class='newButton' style='width:80px;padding:5px;font-size:13px;font-weight:bold;' onclick='getProductInfo(\"NULL_HEIGHT\",\"new\");'>SEARCH</div><div style='clear:both;'></div><p style='margin-top:3px;color:#3E3E3E;'>(After selection define your data area.<br/>You will then be able to choose the specific data supplier for price and availability.)</p>";			
708				}
709				if(theOutputType != "full"){	
710					supplierinfoHtml += "<tr valign='top'><td colspan='3'><p style='margin-bottom:3px;'>The following height datasets are available for this location.</p></td></tr>";	
711				}
712		
713				//Write header
714				supplierinfoHtml += "<tr valign='top'>";
715				if(theOutputType == "full"){	
716					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Dates</strong></p></td>";
717					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supplier</strong></p></td>";
718					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Res.(cm)</strong></p></td>";
719					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Type</strong></p></td>";	
720					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Preview</strong></p></td>";		
721					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>% Cover</strong></p></td>";
722					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Price<br/>(excl. VAT)</strong></p></td>";
723					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Add?</strong></p></td>";					
724				}else{				
725					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Dates</strong></p></td>";
726					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supplier</strong></p></td>";
727					supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Res.(cm)</strong></p></td>";
728				}
729				supplierinfoHtml += "</tr>";
730											
731				//Re-replace back in " " and "," in the date entries
732				for(c=0;c<theHeightInfo.length;c++){
733					theHeightInfo[c][3] = theHeightInfo[c][3].replace(/-space-/g, " ");
734					theHeightInfo[c][3] = theHeightInfo[c][3].replace(/-comma-/g, ",");
735					theHeightInfo[c][3] = theHeightInfo[c][3].replace(/'/g, "");
736					theHeightInfo[c][11] = theHeightInfo[c][11].replace(/-space-/g, " ");
737					theHeightInfo[c][11] = theHeightInfo[c][11].replace(/-comma-/g, ",");
738					theHeightInfo[c][11] = theHeightInfo[c][11].replace(/'/g, "");
739				}
740				
741				//Sort the array by end  date.
742				for(c=0;c<theHeightInfo.length;c++){
743					for(c2=c;c2<theHeightInfo.length;c2++){
744
745						//Get defined end date
746						var toCheckDateAsDate1 = theHeightInfo[c][11];
747						var toCheckDateAsDate2 = theHeightInfo[c2][11];
748
749						var reOrder = false;
750						if((toCheckDateAsDate1 != null) && (toCheckDateAsDate2 != null)){		
751							if(toCheckDateAsDate1 < toCheckDateAsDate2){
752								reOrder = true;
753							}
754						}							
755						if(reOrder){
756							holding = theHeightInfo[c2][0];
757							theHeightInfo[c2][0] = theHeightInfo[c][0];
758							theHeightInfo[c][0] = holding; 
759							holding = theHeightInfo[c2][1];
760							theHeightInfo[c2][1] = theHeightInfo[c][1];
761							theHeightInfo[c][1] = holding; 
762							holding = theHeightInfo[c2][2];
763							theHeightInfo[c2][2] = theHeightInfo[c][2];
764							theHeightInfo[c][2] = holding;  
765							holding = theHeightInfo[c2][3];
766							theHeightInfo[c2][3] = theHeightInfo[c][3];
767							theHeightInfo[c][3] = holding;  						
768							holding = theHeightInfo[c2][4];
769							theHeightInfo[c2][4] = theHeightInfo[c][4];
770							theHeightInfo[c][4] = holding; 
771							holding = theHeightInfo[c2][5];
772							theHeightInfo[c2][5] = theHeightInfo[c][5];
773							theHeightInfo[c][5] = holding;
774							holding = theHeightInfo[c2][6];
775							theHeightInfo[c2][6] = theHeightInfo[c][6];
776							theHeightInfo[c][6] = holding;
777							holding = theHeightInfo[c2][7];
778							theHeightInfo[c2][7] = theHeightInfo[c][7];
779							theHeightInfo[c][7] = holding;
780							holding = theHeightInfo[c2][8];
781							theHeightInfo[c2][8] = theHeightInfo[c][8];
782							theHeightInfo[c][8] = holding;
783							holding = theHeightInfo[c2][9];
784							theHeightInfo[c2][9] = theHeightInfo[c][9];
785							theHeightInfo[c][9] = holding;
786							holding = theHeightInfo[c2][10];
787							theHeightInfo[c2][10] = theHeightInfo[c][10];
788							theHeightInfo[c][10] = holding;
789							holding = theHeightInfo[c2][11];
790							theHeightInfo[c2][11] = theHeightInfo[c][11];
791							theHeightInfo[c][11] = holding;
792							holding = theHeightInfo[c2][12];
793							theHeightInfo[c2][12] = theHeightInfo[c][12];
794							theHeightInfo[c][12] = holding;
795							holding = theHeightInfo[c2][13];
796							theHeightInfo[c2][13] = theHeightInfo[c][13];
797							theHeightInfo[c][13] = holding;
798							holding = theHeightInfo[c2][14];
799							theHeightInfo[c2][14] = theHeightInfo[c][14];
800							theHeightInfo[c][14] = holding;
801						}
802					}
803				}
804				
805				
806				//--------------------NEW 
807				var nofSuppliers = theHeightInfo.length;
808				h= 0;
809				while(h<nofSuppliers){
810					var baseDate = theHeightInfo[h][3];
811					var baseCode = theHeightInfo[h][0];
812					var baseRes = theHeightInfo[h][2];
813					uptoIndex = -1;
814					hasMatches = false;
815					for(a1=(h+1);a1<theHeightInfo.length;a1++){
816						var checkDate = theHeightInfo[a1][3];
817						var checkCode = theHeightInfo[a1][0];
818						var checkRes = theHeightInfo[a1][2];
819						if((baseDate == checkDate) && (baseCode == checkCode) && (baseRes == checkRes)){
820							hasMatches = true;
821						}else{
822							uptoIndex = a1;
823							break
824						}
825					}
826					
827				
828					if((hasMatches) && (uptoIndex == -1)){
829						uptoIndex = theHeightInfo.length;
830					}
831
832					if(uptoIndex == -1){		//Nothing with the same date (Print as is)
833				
834						supplierinfoHtml += "<tr valign='top'>";	
835						supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + theHeightInfo[h][3] + "</td>";
836						supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + theHeightInfo[h][4] + "</td>";
837						supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + Number(theHeightInfo[h][2]) * 100 + " cm.</td>";
838						if(theOutputType == "full"){
839	
840							supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + theHeightInfo[h][12] + "</td>";
841	
842							if(theHeightInfo[h][6] != ""){
843								supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo' style='text-align:center;'><img src='images/photo.jpg' style='cursor:pointer;' witdh='22' height='18' alt='Click for sample' border='0' onclick='showSupplierExtent(\"" + theHeightInfo[h][6] + "\");' /></td>";
844							}else{		
845								supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>&nbsp;</td>";
846							}
847						
848							if(theHeightInfo[h][7] == ""){
849								theHeightInfo[h][7] = "100";
850							}
851							if(Number(theHeightInfo[h][7]) == 100){
852								outputCoverage = "<p style='color:#00FF00;font-weight:bold;'>";
853							}else if(Number(theHeightInfo[h][7])  < 90){
854								outputCoverage = "<p style='color:#FF0000;font-weight:bold;'>";
855							}else{
856								outputCoverage = "<p style='color:#FF9900;font-weight:bold;'>";
857							}
858							outputCoverage += String(Math.round(Number(theHeightInfo[h][7])*10)/10)+ "&nbsp;&nbsp;<a href='javascript:showSupplierExtent(\"" + theHeightInfo[h][6] + "\");'>view</a></p>";
859							supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + outputCoverage + "</td>";
860							
861							//Esure price is not less than the minimum allowed
862							if(Number(theHeightInfo[h][5]) < Number(theMinPriceToApply)){
863								theHeightInfo[h][5] = theMinPriceToApply;
864							}
865							supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>+&pound;" + formatPrice(theHeightInfo[h][5]) + "</td>";													
866							//Define if this need to be selected ie. showing a selcted product need to list the suppliers chosen	
867							var selectedProductIndex = getSelectedProductIndex();
868							var isChecked = false;
869
870							if(document.getElementById("productLayers" + selectedProductIndex).value != ""){
871								var selectedSupplierInfoArray = document.getElementById("productLayers" + selectedProductIndex).value.split(",");
872								for(s=0;s<selectedSupplierInfoArray.length;s++){
873									var storedSupplierInfo = selectedSupplierInfoArray[s];
874					
875									//var retrievedSupplierInfo = theHeightInfo[h][0] + "|" + theHeightInfo[h][3] + "|" + theHeightInfo[h][12] + "|" + theHeightInfo[h][2] + "|"  + String(Math.round(Number(theHeightInfo[h][7])*10)/10);
876									var retrievedSupplierInfo = theHeightInfo[h][9] + "|" + theHeightInfo[h][3] + "|" + theHeightInfo[h][2] + "|" + theHeightInfo[h][0]  + "|" + theHeightInfo[h][10]  + "|" + theHeightInfo[h][12] + "|" + theHeightInfo[h][13] + "|" + theHeightInfo[h][14] + "|" +  String(Math.round(Number(theHeightInfo[h][7])*10)/10);
877	
878									retrievedSupplierInfo = retrievedSupplierInfo.replace(/,/g,"-com-");	//Adjustments to make agree with what been stored/
879									if(retrievedSupplierInfo.indexOf("*") == 0){			
880										retrievedSupplierInfo = retrievedSupplierInfo.substring(1,retrievedSupplierInfo.length);
881									}
882									if(storedSupplierInfo == retrievedSupplierInfo){
883										isChecked = true
884										break;
885									}
886								}
887							}		
888						}	
889						if(theOutputType == "full"){
890							//supplierinfoHtml += "<td class='supplierinfo' style='text-align:center;'><input type='checkbox' name='supp1' onclick='setSupplier(this,\"" + theHeightInfo[h][0] + "|" + theHeightInfo[h][3] + "|" + theHeightInfo[h][12] + "|" + theHeightInfo[h][2] + "\",\""  + theHeightInfo[h][5]  + "\",\""  + String(Math.round(Number(theHeightInfo[h][7])*10)/10) + "\",\"height\",\"" + theHeightInfo[h][8] + "\");'"; 				
891							supplierinfoHtml += "<td class='supplierinfo' style='text-align:center;'><input type='checkbox' name='supp1' onclick='setSupplier(this,\"" + theHeightInfo[h][9] + "|" + theHeightInfo[h][3] + "|" + theHeightInfo[h][2] + "|" + theHeightInfo[h][0] +  "|" + theHeightInfo[h][10] + "|" + theHeightInfo[h][12] + "|" + theHeightInfo[h][13] + "|" + theHeightInfo[h][14] + "\",\""  + theHeightInfo[h][5]  + "\",\""  + String(Math.round(Number(theHeightInfo[h][7])*10)/10) + "\",\"height\",\"" + theHeightInfo[h][8] + "\");'"; 				
892							if(isChecked){
893								supplierinfoHtml += " checked ";
894							}else{
895							supplierinfoHtml += ">";
896							}	
897						}
898						supplierinfoHtml += "</td>";
899						supplierinfoHtml += "</tr>";
900
901						//Define the content for the best supplier will just be the first element as only one is returned
902						//supplierinfoHtmlBest += "<tr><td colspan='6'></td><td>&nbsp;</td><td><p style='font-weight:bold;font-style:oblique;text-align: center;'>Add?</p></td></tr>";
903						supplierinfoHtmlBest += "<tr><td style='width:150px;'><span style='font-weight:bold;color:#3E3E3E;font-size:14px;'>Height Data</td><td colspan='4' style='width:220px;'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;'>" + theHeightInfo[h][2] + "m, " +  theHeightInfo[h][3] + "</p></td><td style='width:20px;'><img src='images/info.jpg' alt='info' width='16' height='16' class='clickable' onclick='getExtraLayerInfo(\"NULL_HEIGHT\");' /></td>";
904						supplierinfoHtmlBest += "<td style='width:90px;'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;text-align: right;padding-right: 10px;'>&pound;" + formatPrice(theHeightInfo[h][5]) + "</p></td><td style='width:20px;'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;text-align: center;'><input type='checkbox' name='chkBestHeightItem' id='chkBestHeightItem' onclick='setSupplier(this,\"" + theHeightInfo[h][9] + "|" + theHeightInfo[h][3] + "|" + theHeightInfo[h][2] + "|" + theHeightInfo[h][0] +  "|" + theHeightInfo[h][10] + "|" + theHeightInfo[h][12] + "|" + theHeightInfo[h][13] + "|" + theHeightInfo[h][14] + "\",\""  + theHeightInfo[h][5]  + "\",\""  + String(Math.round(Number(theHeightInfo[h][7])*10)/10) + "\",\"height\",\"" + theHeightInfo[h][8] + "\");'></p></td></tr>";
905						supplierinfoHtmlBest += "<tr><td colspan='8'>&nbsp;</td></tr>";
906						h++;
907				
908					}else{
909						
910						var lineCnt = 0;
911						for(p=h;p<uptoIndex;p++){
912							lineCnt++;
913	
914							if(lineCnt ==1){			//Define class to disply table cells with
915								var classToUse = "supplierinfoNoBot";
916							}else if(lineCnt == (uptoIndex-p)){			
917								var classToUse = "supplierinfoNoTop";
918							}else{
919								if(uptoIndex == theHeightInfo.length){
920									var classToUse = "supplierinfoNoTop";
921								}else{
922									var classToUse = "supplierinfoNoTopBot";
923								}
924							}
925	
926							supplierinfoHtml += "<tr valign='top'>";
927							
928							
929							if((lineCnt == 1) || (theOutputType != "full")){
930								supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>" + theHeightInfo[p][3] + "</td>";
931								supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>" + theHeightInfo[p][4] + "</td>";
932								supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>" + Number(theHeightInfo[p][2]) * 100 + " cm.</td>";
933							}else{
934								supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
935								supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
936								supplierinfoHtml = supplierinfoHtml + "<td class='" + classToUse + "'>&nbsp;</td>";
937							}
938							
939							if(theOutputType == "full"){
940		
941								supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + theHeightInfo[p][12] + "</td>";
942		
943								if(theHeightInfo[p][6] != ""){
944									supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo' style='text-align:center;'><img src='images/photo.jpg' style='cursor:pointer;' witdh='22' height='18' alt='Click for sample' border='0' onclick='showSupplierExtent(\"" + theHeightInfo[p][6] + "\");' /></td>";
945								}else{		
946									supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>&nbsp;</td>";
947								}
948							
949								if(theHeightInfo[p][7] == ""){
950									theHeightInfo[p][7] = "100";
951								}
952								if(Number(theHeightInfo[h][7]) == 100){
953									outputCoverage = "<p style='color:#00FF00;font-weight:bold;'>";
954								}else if(Number(theHeightInfo[h][7])  < 90){
955									outputCoverage = "<p style='color:#FF0000;font-weight:bold;'>";
956								}else{
957									outputCoverage = "<p style='color:#FF9900;font-weight:bold;'>";
958								}
959								outputCoverage += String(Math.round(Number(theHeightInfo[p][7])*10)/10)+ "&nbsp;&nbsp;<a href='javascript:showSupplierExtent(\"" + theHeightInfo[p][6] + "\");'>view</a></p>";
960								supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>" + outputCoverage + "</td>";
961								
962								//Esure price is not less than the minimum allowed
963								if(Number(theHeightInfo[p][5]) < Number(theMinPriceToApply)){
964									theHeightInfo[p][5] = theMinPriceToApply;
965								}
966								supplierinfoHtml = supplierinfoHtml + "<td class='supplierinfo'>+&pound;" + formatPrice(theHeightInfo[p][5]) + "</td>";													
967								//Define if this need to be selected ie. showing a selcted product need to list the suppliers chosen	
968								var selectedProductIndex = getSelectedProductIndex();
969								var isChecked = false;
970	
971								if(document.getElementById("productLayers" + selectedProductIndex).value != ""){
972									var selectedSupplierInfoArray = document.getElementById("productLayers" + selectedProductIndex).value.split(",");
973									for(s=0;s<selectedSupplierInfoArray.length;s++){
974										var storedSupplierInfo = selectedSupplierInfoArray[s];
975										//var retrievedSupplierInfo = theHeightInfo[p][0] + "|" + theHeightInfo[p][3] + "|" + theHeightInfo[p][12] + "|"  + theHeightInfo[p][2] + "|" + String(Math.round(Number(theHeightInfo[p][7])*10)/10);
976										var retrievedSupplierInfo = theHeightInfo[p][9] + "|" + theHeightInfo[p][3] + "|" + theHeightInfo[p][2] + "|" + theHeightInfo[p][0]  + "|" + theHeightInfo[p][10]  + "|" + theHeightInfo[p][12] + "|" + theHeightInfo[p][13] + "|" + theHeightInfo[p][14] + "|" + String(Math.round(Number(theHeightInfo[p][7])*10)/10);
977
978										retrievedSupplierInfo = retrievedSupplierInfo.replace(/,/g,"-com-");	//Adjustments to make agree with what been stored/
979										if(retrievedSupplierInfo.indexOf("*") == 0){			
980											retrievedSupplierInfo = retrievedSupplierInfo.substring(1,retrievedSupplierInfo.length);
981										}
982										if(storedSupplierInfo == retrievedSupplierInfo){
983											isChecked = true
984											break;
985										}
986									}
987								}		
988							}	
989							if(theOutputType == "full"){
990								//supplierinfoHtml += "<td class='supplierinfo' style='text-align:center;'><input type='checkbox' name='supp1' onclick='setSupplier(this,\"" + theHeightInfo[p][0] + "|" + theHeightInfo[p][3] + "|" + theHeightInfo[p][12] + "|" + theHeightInfo[p][2] + "\",\""  + theHeightInfo[p][5]  + "\",\""  + String(Math.round(Number(theHeightInfo[p][7])*10)/10) + "\",\"height\",\"" + theHeightInfo[p][8] + "\");'"; 				
991								supplierinfoHtml += "<td class='supplierinfo' style='text-align:center;'><input type='checkbox' name='supp1' onclick='setSupplier(this,\"" + theHeightInfo[p][9] + "|" + theHeightInfo[p][3] + "|" + theHeightInfo[p][2] + "|" + theHeightInfo[p][0] +  "|" + theHeightInfo[p][10] +  "|" + theHeightInfo[p][12] + "|" + theHeightInfo[p][13] + "|" + theHeightInfo[p][14] + "\",\""  + theHeightInfo[p][5]  + "\",\""  + String(Math.round(Number(theHeightInfo[p][7])*10)/10) + "\",\"height\",\"" + theHeightInfo[p][8] + "\");'"; 				
992
993								if(isChecked){
994									supplierinfoHtml += " checked ";
995								}else{
996								supplierinfoHtml += ">";
997								}	
998							}
999							supplierinfoHtml += "</td>";
1000							supplierinfoHtml += "</tr>";
1001	
1002				
1003						}
1004						
1005						h = uptoIndex;
1006				
1007					}
1008				}
1009				//--------------------END NEW
1010
1011				supplierinfoHtml += "</table>";	
1012			}
1013					
1014			//-------------Define footer info
1015			if(((aerialCnt != 0 ) || (heightCnt =! 0)) && (theOutputType == "full")){
1016				supplierinfoHtml += "<table width='" + theTableWidth + "' cellpadding='0' cellspacing='0'>";
1017				if(heightCnt != 0){
1018					supplierinfoHtml += "<tr valign='top'>";	
1019					supplierinfoHtml += "<td colspan='" + thecolspan + "'><br/><p style='color:#3E3E3E;padding-bottom:10px;font-size:12px;'>DTM - Digital Terrain Model (bare earth)<br/>";
1020					supplierinfoHtml += "DSM - Digital Surface Model (vegetation & buildings included)</p></td>";
1021					supplierinfoHtml += "</tr>";					
1022					supplierinfoHtml += "<tr  valign='top'>";	
1023					supplierinfoHtml += "<td colspan='" + thecolspan + "'><p style='padding-bottom:5px'>Contour format available in shopping basket</p></td>";
1024					supplierinfoHtml += "</tr>";
1025				}				
1026				supplierinfoHtml += "<tr  valign='top'>";	
1027				supplierinfoHtml += "<td colspan='" + thecolspan + "'><p style='padding-bottom:5px'>*Please allow up to 1 business day</p>";			
1028				//Get the url of further info
1029				if(String(window.location).indexOf("map.php") != -1){
1030					var theSiteURL = String(window.location).substring(0,(String(window.location).length - 8));
1031				}else{
1032					var theSiteURL = String(window.location);
1033				}
1034				supplierinfoHtml += "<p><a href='javascript:openNew(\"" + theSiteURL + "\",\"\",\"supplierinfo\")'>Click here</a> for information on the details shown.</p></td>";
1035				supplierinfoHtml += "</tr>";
1036			}
1037			
1038			if(theOutputType == "full"){
1039				//if(((theOutputType2 == "overlay") && (theSupplierInfo[1] == "HEIGHT")) || (theOutputType2 != "overlay")) {
1040					//supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'>&nbsp;</td></tr>";
1041					supplierinfoHtml += "<tr valign='top'>";	
1042					//supplierinfoHtml += "<td colspan='" + thecolspan + "'><p align='right'><img src='images/ok.jpg' alt='ok' onmouseover='this.src=\"images/okON.jpg\"' onmouseout='this.src=\"images/ok.jpg\"' onclick='closeSupplierListing(\"full\");' /></p></td>";				
1043					supplierinfoHtml += "<td colspan='" + thecolspan + "'><div class='newButton' style='width:50px;padding:5px;font-size:13px;font-weight:bold;float:right;' onclick='closeSupplierListing(\"full\");'>OK</div></td>";
1044					supplierinfoHtml += "</tr>";
1045					supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'>&nbsp;</td></tr>";
1046				//}	
1047			}
1048			supplierinfoHtml += "</table>";
1049	
1050			if(theSupplierInfo[1] == "HEIGHT"){
1051				//supplierinfoHtmlBest  += "<tr><td colspan='5'><p style='color:#999999;'>NOTE: these are just some of the options available. Check the product categories or contact us via chat, email or telephone if you can't see what you  are looking for.</p></td><td colspan='3'><div class='newButton' style='width:50px;padding:5px;font-size:13px;font-weight:bold;float:right;' onclick='closeSupplierListing(\"full\");'>OK</div></td>";
1052				//supplierinfoHtmlBest  += "<tr><td colspan='8'>&nbsp;</td></tr>";
1053			}
1054						
1055			supplierinfoHtmlBest += "</table>";			
1056			if(theSupplierInfo[1] == "HEIGHT"){	
1057				supplierinfoHtmlBest  += "<div style='padding:10px 10px 10px 0px;overflow:auto;float:left;color: #3E3E3E;font-size: 14px;margin-top:10px;'>NOTE: More options available - check the products or contact us by chat / email / telephone for advice.</p></div></div>";
1058			}   
1059						
1060	
1061			//------Write all info to the layer
1062			if(theOutputType == "full"){										//Write Full listing
1063
1064				//***Content for all suppliers
1065				if(!isBestHeightAerial){				
1066					if(theSupplierInfo[1] == "AERIAL"){
1067						document.getElementById("supplierinfoAerial_layer2").innerHTML = supplierinfoHtml; 			
1068					}else if(theSupplierInfo[1] == "HEIGHT"){
1069						document.getElementById("supplierinfoHeight_layer2").innerHTML = supplierinfoHtml; 	
1070					}else{										//No Data has been returned
1071						
1072						/* Upadte - show nothing if not available
1073						if(document.getElementById("supplierinfoAerial_layer2") != null){					//Searching  Aerial
1074							supplierinfoHtml = "<table width='670px' cellpadding='0' cellspacing='0'>";
1075							supplierinfoHtml += "<tr valign='top'><td colspan='8'><h2>Aerial Data</h2></td></tr>";			
1076							supplierinfoHtml += "<tr valign='top'><td colspan='8'><p style='color:#3E3E3E;margin-top:5px;'>The following suppliers have been found in this area. Please select one or more options from the available datasets listed.</p><br/></td></tr>";							
1077							supplierinfoHtml += "<tr valign='top'><td class='supplierinfoheader'><p><strong>Res.<br/>(cm)</strong></p></td>";
1078							supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Dates</strong></p></td>";
1079							supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supplier</strong></p></td>";
1080							supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Preview</strong></p></td>";
1081							supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>% Cover</strong></p></td>";
1082							supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supply<br/>Res.(cm)</strong></p></td>";						
1083							supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Price<br/>(excl. VAT)</strong></p></td>";
1084							supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Add?</strong></p></td></tr>";
1085							supplierinfoHtml += "<tr><td class='supplierinfo' colspan='8'><p class='error' style='text-align:center;'><em>No suppliers found in this area</em></p></td></tr>";					
1086							supplierinfoHtml += "</table><br/><br/><br/>";
1087							document.getElementById("supplierinfoAerial_layer2").innerHTML = supplierinfoHtml;
1088						//}else if(document.getElementById("supplierinfoHeight_layer2") != null){
1089						}
1089else if(document.getElementById("supplierinfoHeight_layer2") == ""){	
1090							
1091							supplierinfoHtml = "<table width='670px' cellpadding='0' cellspacing='0'>";
1092							//supplierinfoHtml += "<tr valign='top'><td colspan='" + thecolspan + "'><h2>Height Data</h2></td></tr>";			
1093							//supplierinfoHtml += "<tr valign='top'><td colspan='8'><p style='color:#3E3E3E;margin-top:5px;'>The following suppliers have been found in this area. Please select one or more options from the available datasets listed.</p><br/></td></tr>";							
1094							//supplierinfoHtml += "<tr><td class='supplierinfoheader'><p><strong>Dates</strong></p></td>";
1095							//supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supplier</strong></p></td>";
1096							//supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Res.(cm)</strong></p></td>";
1097							//supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Type</strong></p></td>";	
1098							//supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Preview</strong></p></td>";		
1099							//supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>% Cover</strong></p></td>";
1100							//supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Price<br/>(excl. VAT)</strong></p></td>";
1101							//supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Add?</strong></p></td></tr>";
1102							supplierinfoHtml += "<tr><td class='supplierinfo' colspan='8'><p class='error' style='text-align:center;'><em>No 'Height Data' suppliers found in this area</em></p></td></tr>";					
1103							supplierinfoHtml += "</table><br/><br/><br/>";
1104							document.getElementById("supplierinfoHeight_layer2").innerHTML  = supplierinfoHtml;
1105						}*/
1106					}
1107					//Ensure the content to show the info is visible
1108					document.getElementById("heightAerialSuppliers").style.display = "block";
1109											
1110				//***Content for best supplier
1111				}else{
1112					if(theSupplierInfo[1] == "AERIAL"){
1113						document.getElementById("bestSupplierinfoAerial_layer2").innerHTML = supplierinfoHtmlBest; //supplierinfoHtml; 			
1114					}else if(theSupplierInfo[1] == "HEIGHT"){
1115						document.getElementById("bestSupplierinfoHeight_layer2").innerHTML = supplierinfoHtmlBest; 	
1116					}else{										//No Data has been returned
1117						if(document.getElementById("supplierinfoAerial_layer2") != null){					//Searching  Aerial
1118							//Content for best option choice
1119							supplierinfoHtmlBest = "<table width='" + theTableWidth + "'>";
1120							supplierinfoHtmlBest += "<tr valign='top'><td colspan='" + thecolspan + "'><p style='color:#3E3E3E;margin-top:0px;font-size:20px;font-weight:bold;'>Height Data - <span style='font-size:12px;font-weight:normal;'>available as contours or surfaces</span></p></td></tr>";			
1121							supplierinfoHtmlBest += "<tr valign='top'><td colspan='" + thecolspan + "'><p style='color:#3E3E3E;margin-top:5px;font-size:14px;'>Our best immediately available data is:</p></td></tr>";							
1122							supplierinfoHtmlBest += "<tr><td class='supplierinfo' colspan='8'><p class='error' style='text-align:center;'><em>No suppliers found in this area</em></p></td></tr>";						
1123							supplierinfoHtmlBest += "</table><br/><br/><br/>";
1124							document.getElementById("supplierinfoAerial_layer2").innerHTML = supplierinfoHtmlBest;
1125						}else if(document.getElementById("supplierinfoHeight_layer2") != null){
1126							//Content for best option choice
1127							supplierinfoHtmlBest = "<table width='" + theTableWidth + "'>";
1128							supplierinfoHtmlBest += "<tr valign='top'><td colspan='" + thecolspan + "'><p style='color:#3E3E3E;margin-top:0px;font-size:20px;font-weight:bold;'>Height Data - <span style='font-size:12px;font-weight:normal;'>available as contours or surfaces</span></p></td></tr>";			
1129							supplierinfoHtmlBest += "<tr valign='top'><td colspan='" + thecolspan + "'><p style='color:#3E3E3E;margin-top:5px;font-size:14px;'>Our best immediately available data is:</p></td></tr>";							
1130							supplierinfoHtmlBest += "<tr><td class='supplierinfo' colspan='8'><p class='error' style='text-align:center;'><em>No suppliers found in this area</em></p></td></tr>";					
1131							supplierinfoHtmlBest += "</table><br/><br/><br/>";
1132							document.getElementById("supplierinfoHeight_layer2").innerHTML  = supplierinfoHtmlBest;
1133						}
1134					}
1135										
1136					//Ensure the content to show the info is visible				
1137					if((document.getElementById("bestHeightAerialSuppliers").style.display === "block") && (document.getElementById("bestSupplierinfoAerial_layer2").innerHTML !== "") && (document.getElementById("bestSupplierinfoHeight_layer2").innerHTML !== "")){
1138						//We have gotten both height and aerial best supplier
1139						document.getElementById("bestprog").style.display = "none";	
1140						isBestHeightAerial = false;     //Reset getting best flag
1141						//Add on for product layers
1142						let qstring = "prodcode=" +  document.getElementById("data" + indexToUse).value + "&type=new&site=" + document.varform.thesite.value + "&productindex=" + indexToUse;
1143						let getProductInfoReq = new ajaxObject('getProductInfo.php', handleGetProductInfoLayersResponse);
1144						getProductInfoReq.update(qstring,'POST');
1145
1146					}else{
1147						document.getElementById("otherProductsAvailable").style.display = "none";
1148						document.getElementById("otherProductsAvailable").innerHTML = "";
1149						document.getElementById("bestHeightAerialSuppliers").style.display = "block";
1150						document.getElementById("bestHeightAerialSupplierSubHeader").style.display = "block";
1151						document.getElementById("prebasketMessage").innerHTML  = "<p style='color:#FFFFFF;font-size:28px;font-weight:bold;'>Price " + document.getElementById("topPrice").innerHTML + " + VAT.<br/>";  //Show price
1152
1153						//Ensure the dialog mask shows
1154						if(!document.getElementById('dialog-mask2')) {
1155							dialogmask = document.createElement('div');
1156							dialogmask.id = 'dialog-mask2';
1157							document.body.appendChild(dialogmask);
1158						}else{
1159							document.getElementById('dialog-mask2').style.visibility = "visible";
1160						}
1161					}				
1162				}
1163								
1164			}else{
1165			
1166				//Write overview listing
1167				//Show supplier data 
1168				if(theSupplierInfo[1] == "AERIAL"){
1169					document.getElementById("supplierinfoAerial_layer").innerHTML = supplierinfoHtml; 			
1170				}else if(theSupplierInfo[1] == "HEIGHT"){
1171					document.getElementById("supplierinfoHeight_layer").innerHTML = supplierinfoHtml; 	
1172				}else{										//No Data has been returned
1173					if(document.getElementById("supplierinfoAerial_layer") != null){
1174						supplierinfoHtml += "<table width='500px' cellpadding='0' cellspacing='0'>";
1175						supplierinfoHtml += "<tr valign='top'><td colspan='3'><p style='margin-bottom:3px;'>The following are available for this location.</p></td></tr>";	
1176						supplierinfoHtml += "<tr valign='top'><td class='supplierinfoheader'><p><strong>Res.(cm)</strong></p></td>";
1177						supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Dates</strong></p></td>";
1178						supplierinfoHtml += "<td class='supplierinfoheader'><p><strong>Supplier</strong></p></td></tr>";
1179						supplierinfoHtml += "<tr><td class='supplierinfo' colspan='3'><p class='error' style='text-align:center;'><em>No suppliers found in this area</em></p></td></tr>";					
1180						supplierinfoHtml += "</table>";
1181						document.getElementById("supplierinfoAerial_layer").innerHTML = supplierinfoHtml;
1182						document.getElementById("supplierinfoHeight_layer").innerHTML = "";
1183					}	
1184				}
1185				//Ensure the content to show the info is visible
1186				jQuery('#zchmContent').animate({width:'750px'},800);
1187			}	
1188		}
1189}
1190
1191//****************Get product description and show in window - called from info button on the best height/aeri
1191al listing
1192function getProductInfoForPopup(e,passedProdCode){
1193	evt = e || window.event;
1194	currentInfoX = Number(evt.clientX)
1195	currentInfoY = Number(evt.clientY) 
1196	var qstring = "prodcode=" + passedProdCode + "&type=lookup";	
1197	var getProductInfoReq = new ajaxObject('getProductInfo.php', handleInfoForPopupResponse);
1198	getProductInfoReq.update(qstring,'POST');	
1199}
1200
1201function handleInfoForPopupResponse(responseText, responseStatus){
1202	if(responseStatus == 200){
1203		if(responseText != ""){		
1204			var responseArray = responseText.split("~");
1205			var responseArray1 = responseArray[1].split("|");
1206			var infoContent = "<div style='position:absolute;top:5px;right:10px;'><a href='javascript:closePoductInfo();'>Close [x]</a></div>" ;  // "<a href='javascript:closePoductInfo();'>Close [X]</a></p>"; 
1207			infoContent += "<h2>" + responseArray1[2] + ": " + responseArray1[6] + "</h2>";
1208			infoContent += responseArray1[17];			
1209			document.getElementById("productInfoContent").innerHTML = infoContent;
1210			document.getElementById("productInfoContent").style.top =  currentInfoY - 50 + "px"; 
1211			document.getElementById("productInfoContent").style.left = currentInfoX - 50 + "px"; 
1212			document.getElementById("productInfoContent").style.display = "block";			
1213		}
1214	}	
1215}
1216
1217//****************Get the year to use when checking dates for grouping the returned product layers (get start date where range specified)
1218function getCheckDate(theDataString){
1219	//Get rid of "s" eg in 1970s
1220	if(theDataString.indexOf("s") == (theDataString.length-1)){
1221		theDataString = theDataString.substring(0,(theDataString.length-1));
1222	}
1223	//Swap date string to dd/mm/yyyy format if necessary
1224	theDataString = theDataString.replace(/ January/g,"/01/");
1225	theDataString = theDataString.replace(/ February/g,"/02/");
1226	theDataString = theDataString.replace(/ March/g,"/03/");
1227	theDataString = theDataString.replace(/ April/g,"/04/");
1228	theDataString = theDataString.replace(/ May/g,"/05/");
1229	theDataString = theDataString.replace(/ June/g,"/06/");
1230	theDataString = theDataString.replace(/ July/g,"/07/");
1231	theDataString = theDataString.replace(/ August/g,"/08/");
1232	theDataString = theDataString.replace(/ September/g,"/09/");
1233	theDataString = theDataString.replace(/ October/g,"/10/");
1234	theDataString = theDataString.replace(/ November/g,"/11/");
1235	theDataString = theDataString.replace(/ December/g,"/12");
1236	theDataString = theDataString.replace(/st/g,"");
1237	theDataString = theDataString.replace(/nd/g,"");
1238	theDataString = theDataString.replace(/rd/g,"");
1239	theDataString = theDataString.replace(/th/g,"");	
1240	var sep = theDataString.indexOf("-");
1241	var sep1 = theDataString.indexOf("to");
1242	var sep2 = theDataString.indexOf(",");
1243	if(sep != -1){
1244		var toCheckDate1 = theDataString.substring((sep+1),theDataString.length);
1245	}else if(sep1 != -1){	
1246		var toCheckDate1 = theDataString.substring((sep1+2),theDataString.length);
1247	}else if(sep2 != -1){
1248		var toCheckDate1 = theDataString.substring((sep2+1),theDataString.length);		
1249	}else{
1250		var toCheckDate1 = theDataString;
1251	}
1252	toCheckDateAsDate = null;				
1253	//Remove specific dates to get the year only
1254	var sep3 = toCheckDate1.indexOf("/");
1255	if(sep3 != -1){
1256		tempArray = toCheckDate1.split("/");
1257		if(tempArray.length == 3){								//Full date defined
1258		   	usFormatCheckDate = tempArray[1] + "/" + tempArray[0] + "/" + tempArray[2];
1259			toCheckDateAsDate = new Date(usFormatCheckDate);
1260		}else{													//Only year defined create a date object for 1st jan
1261			for(s=0;s < toCheckDate1.length;s++){
1262				if(toCheckDate1.substring(s,s+1) == "/"){
1263					splitAt = s;
1264				}
1265			}
1266			toCheckDate1 = toCheckDate1.substring((splitAt+1),toCheckDate1.length);
1267			usFormatCheckDate = "01/01/" + toCheckDate1;
1268			toCheckDateAsDate = new Date(usFormatCheckDate);
1269		}
1270		
1271		/*for(s=0;s < toCheckDate1.length;s++){
1272			if(toCheckDate1.substring(s,s+1) == "/"){
1273				splitAt = s;
1274			}
1275		}
1276		toCheckDate1 = toCheckDate1.substring((splitAt+1),toCheckDate1.length);
1277		*/
1278		
1279		
1280	}else{																//Only year defined create a date object for 1st jan
1281		usFormatCheckDate = "01/01/" +toCheckDate1;
1282		toCheckDateAsDate = new Date(usFormatCheckDate);
1283	}
1284	
1285	return(toCheckDateAsDate);
1286	//return(Number(toCheckDate1));
1287}
1288
1289//****************Display the example of the data in new window
1290function showSupplierEg(passedQstring){
1291	if(passedQstring != ""){
1292		winName =  "suppliereg";  
1293		features = "menubar=no,toolbar=no,scrollbars=yes,resizable=no,width=290,height=290";		
1294		theURL = "supplier_sample.htm?" + passedQstring;
1295		window.open(theURL,winName,features);
1296	}
1297}
1298
1299//****************Display the % coverage of height data in new window
1300function showHeightCoverage(passedCode,passedCoords){
1301	if((passedCode != "") && (passedCoords != "")){
1302		winName =  "previewcov";  
1303		features = "menubar=no,toolbar=no,scrollbars=yes,resizable=no,width=250,height=250";
1304		theURL = "heightCoverage.php?code=" + passedCode + "&coords=" + passedCoords;		
1305		window.open(theURL,winName,features);
1306	}
1307}
1308
1309//****************Store the choosen supplier (or choose this product if the supplier choosen does not relate to the selected product)
1310function setSupplier(theCheckBox,theLayerCode,thePriceToAdd,theCovPercent,supplierType,royaltyPrice){
1311	if((document.varform.suppliers.value != "no") && (document.varform.suppliers.value != "")){				//Check it allows suppliers
1312		//Get the selected product
1313		var theSelectedProductIndex = getSelectedProductIndex();
1314		if(theSelectedProductIndex == -1){																	//No product selected - add as new product
1315			addAsNewProduct();
1316		}else{
1317			if(((document.getElementById("data" + theSelectedProductIndex).value == "OSMM") || (document.getElementById("data" + theSelectedProductIndex).value == "OSNI_MM")) && (document.getElementById("extent" + theSelectedProductIndex).value == "")){
1318				//Do nothing
1319			}else if((document.getElementById("data" + theSelectedProductIndex).value != document.varform.data.value) && (document.getElementById("data" + theSelectedProductIndex).value != "OSMM") && (document.getElementById("data" + theSelectedProductIndex).value != "OSNI_MM")){			//Supplier not for the seelcted product - add as new product
1320				addAsNewProduct();
1321			}else{
1322				if(document.getElementById("extent" + theSelectedProductIndex).value == ""){							//Extent not for the seelcted product - add as new product
1323					addAsNewProduct();
1324				}else{																									//The choosen supplier layer is the same as the product - supplier to the product order
1325					//Replace comma in passed layer code (commas are used for seperating each choosen product layer)
1326					theLayerCode = theLayerCode.replace(/,/g,"-com-");	
1327					if(theLayerCode.indexOf("*") == 0){			//Strip off * to indicate 1 extra day to supply
1328						theLayerCode = theLayerCode.substring(1,theLayerCode.length);
1329					}
1330					var currentLayers = document.getElementById("productLayers" + theSelectedProductIndex).value;
1331					var currentLayersPrice =  Number(document.getElementById("layersPrice" + theSelectedProductIndex).value);
1332					var currentOverlays = document.getElementById("layeroverlays" + theSelectedProductIndex).value;
1333					var currentPrices = document.getElementById("layersPrices" + theSelectedProductIndex).value;					
1334					newLayersPrice = 0;	
1335					//Add product code to currently selected data layers and price to add
1336					if(theCheckBox.checked){
1337						//Store layers and type of overlay (aerial or height)
1338						if(currentLayers == ""){
1339							document.getElementById("productLayers" + theSelectedProductIndex).value = theLayerCode + "|" + theCovPercent;							
1340						}else{
1341							document.getElementById("productLayers" + theSelectedProductIndex).value = currentLayers + "," + theLayerCode + "|" + theCovPercent;				
1342						}
1343						newLayersPrice = currentLayersPrice + Number(thePriceToAdd);
1344						if(currentOverlays == ""){
1345							document.getElementById("layeroverlays" + theSelectedProductIndex).value = supplierType;							
1346						}else{
1347							document.getElementById("layeroverlays" + theSelectedProductIndex).value = currentOverlays + "," + supplierType;				
1348						}
1349						if(currentPrices == ""){
1350							document.getElementById("layersPrices" + theSelectedProductIndex).value = thePriceToAdd + "|" + royaltyPrice;							
1351						}else{
1352							document.getElementById("layersPrices" + theSelectedProductIndex).value = currentPrices + "," + thePriceToAdd + "|" + royaltyPrice;				
1353						}
1354											
1355						//Show breakdown of selected in user selcted area
1356						var overlaysToTest = document.getElementById("layeroverlays" + theSelectedProductIndex).value;
1357						var overlaysToTestArray = overlaysToTest.split(",");
1358						var selectedHeightCnt = 0;
1359						var selectedAerialCnt = 0;
1360						for(c=0;c < overlaysToTestArray.length;c++){
1361							if(overlaysToTestArray[c] == "height"){
1362								selectedHeightCnt++;
1363							}else if(overlaysToTestArray[c] == "aerial"){
1364								selectedAerialCnt++;
1365							}
1366						}
1367						if((selectedAerialCnt == 0) && (selectedHeightCnt == 0)){
1368							if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_AERIAL") || (document.varform.data.value == "OSNI_HEIGHT")){
1369								var outputBreakdown = "<a href='javascript:showFurtherInfo(\"suppliers\"," + theSelectedProductIndex + ");'>Click to show data suppliers</a>";	
1370							}else{
1371								//var outputBreakdown = "<a href='javascript:showFurtherInfo(\"mastermap\"," + theSelectedProductIndex + ");'>Add Aerial/Height?</a>";
1372								var outputBreakdown = "";
1373								document.getElementById("aeriallayerlabel_" + selectedProductIndex).innerHTML = " Aerial";
1374								document.getElementById("aeriallayer_" + selectedProductIndex).checked = false;
1375								document.getElementById("heightlayerlabel_" + selectedProductIndex).innerHTML = " Height";
1376								document.getElementById("heightlayer_" + selectedProductIndex).checked = false;
1377							}
1378						}else{
1379							if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_AERIAL") || (document.varform.data.value == "OSNI_HEIGHT")){
1380								var infoType = "suppliers";
1381							}else{
1382								var infoType = "mastermap";
1383							}
1384							if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "OSNI_AERIAL")){			//Aerial product
1385								var outputBreakdown = "<p style='color:#3E3E3E;'>+Aerial (" + String(selectedAerialCnt) + ")   <a href='javascript:showFurtherInfo(\"" + infoType + "\"," + theSelectedProductIndex + ");'>&nbsp;&nbsp;&nbsp;&nbsp;Add/Edit</a></p>";	
1386							}else if((document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_HEIGHT")){		//Height product
1387								var outputBreakdown = "<p style='color:#3E3E3E;'>+Height (" + String(selectedHeightCnt) + ")   <a href='javascript:showFurtherInfo(\"" + infoType + "\"," + theSelectedProductIndex + ");'>&nbsp;&nbsp;&nbsp;&nbsp;Add/Edit</a></p>";		
1388							}else{    																										//MasterMap product
1389								var outputBreakdown = "";
1390								if(selectedAerialCnt > 0){
1391									document.getElementById("aeriallayer_" + theSelectedProductIndex).checked = true;
1392									document.getElementById("aeriallayerlabel_" + theSelectedProductIndex).innerHTML = " Aerial (" + String(selectedAerialCnt) + ")";
1393								}else{
1394									document.getElementById("aeriallayer_" + theSelectedProductIndex).checked = false;
1395									document.getElementById("aeriallayerlabel_" + theSelectedProductIndex).innerHTML = " Aerial";
1396								}
1397								if(selectedHeightCnt > 0){
1398									document.getElementById("heightlayer_" + theSelectedProductIndex).checked = true;
1399									document.getElementById("heightlayerlabel_" + theSelectedProductIndex).innerHTML = " Height (" + String(selectedHeightCnt) + ")";
1400								}else{
1401									document.getElementById("heightlayer_" + theSelectedProductIndex).checked = false;
1402									document.getElementById("heightlayerlabel_" + theSelectedProductIndex).innerHTML =" Height";
1403								}
1404							}
1405						}
1406						document.getElementById("furtherInfo" + theSelectedProductIndex).innerHTML = outputBreakdown;
1407						document.getElementById("furtherInfo" + theSelectedProductIndex).style.display = "block";				
1408					}else{				//Remove product code to currently selected data layers
1409						var newLayers = "";
1410						var newCoverage = "";
1411						var newOverlays = "";
1412						var newPrices = "";
1413						if(currentLayers.indexOf(",") == -1){			
1414						}else{
1415							var tempArray = new Array();
1416							tempArray = currentLayers.split(",");
1417							var tempArray2 = new Array();
1418							tempArray2 = currentOverlays.split(",");
1419							var tempArray3 = new Array();
1420							tempArray3 = currentPrices.split(",");
1421							for(t=0;t<tempArray.length;t++){
1422								if((theLayerCode + "|" + theCovPercent) == tempArray[t]){
1423									//ignore
1424									newLayersPrice = currentLayersPrice - Number(thePriceToAdd);
1425								}else{
1426									newLayers = newLayers + "," + tempArray[t];
1427									newOverlays = newOverlays + "," + tempArray2[t];
1428									newPrices = newPrices + "," + tempArray3[t];
1429								}
1430							}
1431							newLayers = newLayers.substring(1,newLayers.length);
1432							newOverlays = newOverlays.substring(1,newOverlays.length);
1433							newPrices = newPrices.substring(1,newPrices.length);
1434						}
1435						document.getElementById("productLayers" + theSelectedProductIndex).value = newLayers;
1436						document.getElementById("layeroverlays" + theSelectedProductIndex).value = newOverlays;
1437						document.getElementById("layersPrices" + theSelectedProductIndex).value = newPrices;
1438						
1439						//Update the product description that displays to the user
1440						var currentDisplay = document.getElementById("product" + theSelectedProductIndex + "content").innerHTML;
1441						if(currentDisplay.indexOf("<p>+") != -1){
1442							currentDisplay = currentDisplay.substring(0,(currentDisplay.indexOf("<p>+") - 1));
1443						}
1444		
1445						var overlaysToTest = document.getElementById("layeroverlays" + theSelectedProductIndex).value;
1446						var overlaysToTestArray = overlaysToTest.split(",");
1447						var selectedHeightCnt = 0;
1448						var selectedAerialCnt = 0;
1449						for(c=0;c < overlaysToTestArray.length;c++){
1450							if(overlaysToTestArray[c] == "height"){
1451								selectedHeightCnt++;
1452							}else if(overlaysToTestArray[c] == "aerial"){
1453								selectedAerialCnt++;
1454							}
1455						}
1456						if((selectedAerialCnt == 0) && (selectedHeightCnt == 0)){
1457							if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_AERIAL") || (document.varform.data.value == "OSNI_HEIGHT")){
1458								var outputBreakdown = "<a href='javascript:showFurtherInfo(\"suppliers\"," + theSelectedProductIndex + ");'>Click to show data suppliers</a>";	
1459							}else{
1460								//var outputBreakdown = "<a href='javascript:showFurtherInfo(\"mastermap\"," + theSelectedProductIndex + ");'>Add Aerial/Height?</a>";
1461								var outputBreakdown = "";
1462								document.getElementById("aeriallayer_" + theSelectedProductIndex).checked = false;
1463								document.getElementById("heightlayer_" + theSelectedProductIndex).checked = false;
1464								document.getElementById("aeriallayerlabel_" + theSelectedProductIndex).innerHTML = " Aerial";
1465								document.getElementById("heightlayerlabel_" + theSelectedProductIndex).innerHTML = " Height";
1466							}
1467						}else{
1468							if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_AERIAL") || (document.varform.data.value == "OSNI_HEIGHT")){
1469								var infoType = "suppliers";
1470							}else{
1471								var infoType = "mastermap";
1472							}
1473
1474							if((document.varform.data.value == "NULL_AERIAL") || (document.varform.data.value == "OSNI_AERIAL")){					//Aerial product
1475								var outputBreakdown = "<p style='color:#3E3E3E;'>+Aerial (" + String(selectedAerialCnt) + ")   <a href='javascript:showFurtherInfo(\"" + infoType + "\"," + theSelectedProductIndex + ");'>&nbsp;&nbsp;&nbsp;&nbsp;Add/Edit</a></p>";	
1476							}else if((document.varform.data.value == "NULL_HEIGHT") || (document.varform.data.value == "OSNI_HEIGHT")){			 //Height product
1477								var outputBreakdown = "<p style='color:#3E3E3E;'>+Height (" + String(selectedHeightCnt) + ")   <a href='javascript:showFurtherInfo(\"" + infoType + "\"," + theSelectedProductIndex + ");'>&nbsp;&nbsp;&nbsp;&nbsp;Add/Edit</a></p>";		
1478							}else{  																											 //MasterMap product
1479								var outputBreakdown = "";
1480								if(selectedAerialCnt > 0){
1481									document.getElementById("aeriallayer_" + theSelectedProductIndex).checked = true;
1482									document.getElementById("aeriallayerlabel_" + theSelectedProductIndex).innerHTML = " Aerial (" + String(selectedAerialCnt) + ")";
1483								}else{
1484									document.getElementById("aeriallayer_" + theSelectedProductIndex).checked = false;
1485									document.getElementById("aeriallayerlabel_" + theSelectedProductIndex).innerHTML = " Aerial";
1486								}
1487								if(selectedHeightCnt > 0){
1488									document.getElementById("heightlayer_" + theSelectedProductIndex).checked = true;
1489									document.getElementById("heightlayerlabel_" + theSelectedProductIndex).innerHTML = " Height (" + String(selectedHeightCnt) + ")";
1490								}else{
1491									document.getElementById("heightlayer_" + theSelectedProductIndex).checked = false;
1492									document.getElementById("heightlayerlabel_" + theSelectedProductIndex).innerHTML = " Height";
1493								}
1494							}
1495						}
1496						document.getElementById("furtherInfo" + theSelectedProductIndex).innerHTML = outputBreakdown;
1497						document.getElementById("furtherInfo" + selectedIndex).style.display = "block";	
1498					}	
1499					//Update the price
1500					document.getElementById("layersPrice" + theSelectedProductIndex).value = newLayersPrice;		//Store layers price	
1501					
1502					updatePrice(theSelectedProductIndex);
1503				}
1504			}
1505		}		
1506	}
1507}
1508
1509//****************Selects a product (Aerial or Height) - called when set supplier called but no approproate selected product to add the supplier to
1510function addAsNewProduct(){			
1511	var totalProducts = Number(document.getElementById("nofProducts").value);
1512	var selectedIndex = -1;
1513	var addingNew = false;
1514	if(totalProducts > 0){					//Check if a product is currently selected							
1515		selectedIndex = getSelectedProductIndex();
1516		if(selectedIndex != -1){			
1517			var answer = confirm("Do you want to replace the currently selected product with this one?");			
1518			if(answer == false){								
1519				selectedIndex = getNextEmptyIndex();							//Add as new product
1520				addingNew = true;
1521			}
1522		}else{
1523			selectedIndex = getNextEmptyIndex();								//Add as new product
1524			addingNew = true;
1525		}
1526	}else{																	//Define the selected index as the next available 
1527		selectedIndex = getNextEmptyIndex();
1528		addingNew = true;
1529	}					
1530	var tooManyProducts = false;				
1531	if((addingNew) && ((totalProducts+1) > maxProducts)){					//Is a new product added to the selected list - Ensure it does not exceed the max no. (5)
1532		showDialog('Warning','Maximum number of selected products has been reached.<br/><br/><input type="button" value="Close" id="closeButton" onclick="hideDialog();" >','warning');	
1533		tooManyProducts = true;
1534	}		
1535	if(tooManyProducts == false){												//Add a new product or replace an existing one		
1536		//Adding a new product - update the total number selected
1537		if(addingNew){		
1538			document.getElementById("nofProducts").value = Number(document.getElementById("nofProducts").value) + 1;
1539			hideShowProductMessage();
1540			var theAction = "new";											//Is a new product added to the list
1541		}else{
1542			var theAction = "change";										//Is a change to an existing selected product
1543		}
1544		//If changing the product check if the extent is valid for the new product
1545		if(theAction == "change"){
1546			var theExtentType = "";
1547			var theCurrentExtentID = document.getElementById("extent" + String(selectedIndex)).value;
1548			for(p=0; p < extentLayer.features.length;p++){
1549				if(extentLayer.features[p].attributes.id == theCurrentExtentID){
1550					if(String(extentLayer.features[p].geometry).indexOf("POINT") == 0){
1551						theExtentType = "point";
1552					}else{
1553						theExtentType = "poly";
1554					}
1555				}	
1556			}
1557			if(theExtentType != ""){
1558				var isOK = checkProductExtentAgree(document.varform.data.value,"no",theExtentType,theCurrentExtentID);
1559			}else{
1560				var isOK = true;
1561			}
1562			if(isOK == false){													//Cannot replace - add as a new item if possible
1563				if((totalProducts+1) > maxProducts){			
1564					showDialog('Warning','Cannot replace the current selected product as current extent type is incompatible.<br/><br/><input type="button" value="Close" id="closeButton" onclick="hideDialog();" >','warning');	
1565				}else{
1566					showDialog('Warning','Cannot replace the current selected product as current extent type is incompatible. This product will be added as a new item.<br/><br/><input type="button" value="Close" id="closeButton" onclick="hideDialog();" >','warning');	
1567					selectedIndex = getNextEmptyIndex();
1568					document.getElementById("nofProducts").value = Number(document.getElementById("nofProducts").value) + 1; //Update the total number of products accordingly.
1569					hideShowProductMessage();
1570					var theAction = "new";
1571				}		
1572			}
1573		}
1574	}		
1575	if(tooManyProducts == false){					
1576		//Add a new product or replace an existing one
1577		//Show the selected product in list of selcted products
1578		document.getElementById("Product " + selectedIndex + "container").style.display = "block";		//Show layer to display selected product info
1579		if(document.varform.dataDescript.value != document.varform.fullDataName.value){
1580			var descToPrint = document.varform.dataDescript.value + ": " + document.varform.fullDataName.value;
1581		}else{
1582			var descToPrint = document.varform.dataDescript.value;
1583		}	
1584		document.getElementById("furtherInfo" + selectedIndex).innerHTML = "<a href='javascript:getSupplierInfo(true);'><img src='images/info.jpg' alt='further info' /></a>";											
1585		document.getElementById("product" + selectedIndex + "content").innerHTML = "<h5>" + descToPrint + "</h5>";
1586		document.getElementById("data" + selectedIndex).value = document.varform.data.value;
1587		document.getElementById("datadesc" + selectedIndex).value = document.varform.dataDescript.value;
1588		document.getElementById("scale" + selectedIndex).value = document.varform.scale.value;
1589		document.getElementById("maxsize" + selectedIndex).value = document.varform.maxsize.value;
1590		document.getElementById("fulldataname" + selectedIndex).value = descToPrint;
1591		document.getElementById("hassuppliers" + selectedIndex).value = "yes";
1592		//Ensure this radio button is selected
1593		for (var i=0; i < document.frmSelected.selectedproducts.length; i++){	
1594			if(Number(document.frmSelected.selectedproducts[i].value) == selectedIndex){
1595				document.frmSelected.selectedproducts[i].checked = true;		
1596				break;	
1597			}
1598		}	
1599		//If selected product is changed need to update the price (providing an extent is associated)
1600		if(theAction == "change"){
1601			if(document.getElementById("extent" + selectedIndex).value != ""){
1602				updatePrice(selectedIndex);
1603			}
1604		}		
1605	}
1606	//Show the define extent area and hide product options
1607	jQuery('#zchmContent').animate({width:'0px'},800);
1608	
1609	displayTools("Define");
1610	showTools("Define");
1611	jQuery("#toolsArea").slideDown("slow",showState);		
1612}
1613
1614//****************Define the extent of the order area and minxy-maxxy
1615function getHeightExtent(){
1616	var geomString = "";
1617	var theSelectedProductIndex = getSelectedProductIndex();
1618	var theExtentID = document.getElementById("extent" + theSelectedProductIndex).value;	
1619	if(theExtentID != ""){	
1620		var extentGeom = getExtentGeomByID(theExtentID);
1621		var geomString = String(extentGeom).substring(9,(String(extentGeom).length -2));
1622		var newGeomString = "";
1623		tempArray = geomString.split(",");
1624		for(c=0;c < tempArray.length; c++){
1625			var tempArray2 = tempArray[c].split(" ");
1626			if(c==0){
1627				newGeomString = String(Math.round(Number(tempArray2[0]))) + "," + String(Math.round(Number(tempArray2[1])))
1628			}else{
1629				newGeomString += "," + String(Math.round(Number(tempArray2[0]))) + "," + String(Math.round(Number(tempArray2[1])));
1630			}
1631		}
1632	}			
1633	return newGeomString;
1634}
1635
1636//****************Cancels a supplier request
1637function cancelSupplierReq(theType){
1638	if(theType == "height"){	
1639		if(getOverviewHeightSuppliersReq != null){
1640			getOverviewHeightSuppliersReq.abort();
1641		}
1642		if(getHeightSuppliersReq != null){
1643			getHeightSuppliersReq.abort();
1644		}
1645	}else if(theType == "aerial"){
1646		if(getOverviewAerialSuppliersReq != null){
1647			getOverviewAerialSuppliersReq.abort();
1648		}
1649		if(getAerialSuppliersReq != null){
1650			getAerialSuppliersReq.abort();
1651		}
1652	}
1653}
1654
1655//****************Cancels a supplier request and closes the slide out
1656function cancelSupplierReq2(theType){
1657	if(theType == "height"){	
1658		if(getOverviewHeightSuppliersReq != null){
1659			getOverviewHeightSuppliersReq.abort();
1660			jQuery('#zchmContent').animate({width:'0px'},800);
1661		}
1662		if(getHeightSuppliersReq != null){
1663			getHeightSuppliersReq.abort();
1664			jQuery('#zchmContent').animate({width:'0px'},800);
1665		}
1666	}else if(theType == "aerial"){
1667		if(getOverviewAerialSuppliersReq != null){
1668			getOverviewAerialSuppliersReq.abort();
1669			jQuery('#zchmContent').animate({width:'0px'},800);
1670		}
1671		if(getAerialSuppliersReq != null){
1672			getAerialSuppliersReq.abort();
1673			jQuery('#zchmContent').animate({width:'0px'},800);
1674		}
1675	}
1676}
1677
1678//****************Closes supplier listing (when pressing "ok"/"close")
1679function closeSupplierListing(theType){
1680	//if(document.getElementById('dialog-mask2') != null){
1681	//	document.getElementById('dialog-mask2').style.visibility = "hidden";
1682	//}
1683	if((theType == "full") || (theType == "overlay")){				//full listing hide layer	
1684		if(document.getElementById("bestHeightAerialSuppliers").style.display == "block"){   //Showing bes supplier pre going to basket
1685			//document.getElementById("bestHeightAerialSuppliers").style.display = "none";	
1686			//check if any overlays checked and if so run pre basket check to get the prices.
1687			//if((document.getElementById("chkBestAerialItem").checked) || (document.getElementById("chkBestHeightItem").checked)){				
1688				preBasketCheck(0);		
1689			//}else{							//Nothing selected go straight to basket
1690			//	if(){
1691			//	
1692			//	}else{
1693			//		addToBasket();  
1694			//	}
1695			//}
1696		}else{					
1697			document.getElementById("heightAerialSuppliers").style.display = "none";
1698		}	
1699	}else{								//Overview listing slide content out									
1700		jQuery('#zchmContent').animate({width:'0px'},800);
1701	}
1702	//Kill any height-aerial lookups
1703	cancelSupplierReq("aerial");
1704	cancelSupplierReq("height");
1705	//Remove any coverage extent shapes
1706	aerialHeightExtentLayer.destroyFeatures();
1707}
1708
1709//****************Reformats supplier date/ date range for display	
1710function formatSupplierDate(passedDate){
1711	var theDateToPrint = "";
1712	var tempDateArray = passedDate.split("-");
1713	if(tempDateArray.length == 3){			//Single date
1714		theDateToPrint = tempDateArray[2] + "/" + tempDateArray[1] + "/" +tempDateArray[0];
1715	}else{									//Range
1716		theDateToPrint = tempDateArray[2] + "/" + tempDateArray[1] + "/" +tempDateArray[0] + "-" + tempDateArray[5] + "/" + tempDateArray[4] + "/" +tempDateArray[3];
1717	}
1718	return theDateToPrint;
1719}
1720
1721//****************Show the coveage extent over the user's defined extent
1722function showSupplierExtent(passedCoverageCoords){
1723	//Destroy any coverage extents
1724	aerialHeightExtentLayer.destroyFeatures();
1725	var tempPointList = [];
1726	var pointList = [];
1727	var linearRing = [];						
1728	//var thePartArray = passedCoverageCoords.split(")) ((");
1729	var thePartArray = passedCoverageCoords.split(") (");
1730	for(p=0;p < thePartArray.length;p++){
1731		var tempPointList = [];
1732		thePartArray[p] = thePartArray[p].replace(/\(/g,"").replace(/\)/g,"");
1733		var theCoordArray = thePartArray[p].split(" ");
1734		var ccnt = 0;		
1735		for (c=0; c< theCoordArray.length ;c++){
1736			ccnt++;
1737			if(ccnt == 2){
1738				var newPoint = new OpenLayers.Geometry.Point(theCoordArray[c-1],theCoordArray[c]);
1739				tempPointList.push(newPoint);
1740				ccnt = 0;
1741			}
1742		}		
1743
1744		pointList.push(tempPointList);
1745		linearRing.push(new OpenLayers.Geometry.LinearRing(pointList[p]));
1746	}
1747		
1748	var theCoverageFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon(linearRing),null);
1749	aerialHeightExtentLayer.addFeatures(theCoverageFeature);
1750
1751	//OLD
1752	/*	
1753	var pointList = [];			
1754	var theCoordArray = passedCoverageCoords.split(" ");
1755	var ccnt = 0;		
1756	for (c=0; c< theCoordArray.length ;c++){
1757		ccnt++;
1758		if(ccnt == 2){
1759			var newPoint = new OpenLayers.Geometry.Point(theCoordArray[c-1],theCoordArray[c]);
1760			pointList.push(newPoint);
1761			ccnt = 0;
1762		}
1763	}					
1764	var linearRing = new OpenLayers.Geometry.LinearRing(pointList);
1765	theCoverageFeature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Polygon([linearRing]),null);
1766
1767	aerialHeightExtentLayer.addFeatures(theCoverageFeature);*/
1768
1769}
1770
1771
1772//****************Cancels the add Aerial/Height message
1773function aerialHeightRemindAgain(selObj){
1774	if(selObj.checked){
1775		var promptValue = "no";
1776	}else{
1777		var promptValue = "yes";
1778	}
1779	//Store that the user wishes not to be reminded again
1780	if(document.varform.cid.value != ""){
1781		qstring = "cid=" + document.varform.cid.value + "&theval=" + promptValue;		
1782		ukMapWarningReq = new ajaxObject('updateHeightAerialPrompt.php', handleAerialHeightExtraResponse);
1783		ukMapWarningReq.update(qstring,'POST')
1784	}
1785}
1786
1787//****************Handles the response from setting UKMap prompt state
1788function handleAerialHeightExtraResponse(responseText, responseStatus){
1789	if(responseStatus == 200){		 
1790		var tempArray = responseText.split("|");			
1791		var theOutputType = tempArray[1];
1792		document.varform.userAerialHeightPrompt.value = tempArray[1];
1793	}
1794}
1795
1796
1797//****************Handles the response from getting product info in order to show layers available for a product
1798function handleGetProductInfoLayersResponse(responseText, responseStatus){
1799	if(responseStatus === 200){
1800		if(responseText !== ""){
1801			responseText = unescape(responseText);
1802			let tempArray1 = responseText.split("~");
1803			let tempArray = tempArray1[1].split("|");
1804			let extraLayersArray = tempArray[15].split(",");
1805			let extraLayersInfoArray = tempArray[16].split(",");
1806			let extraLayersCodeArray = tempArray[18].split(",");
1807			let selectedIndex = tempArray[19];
1808			let extraLayersinfoHtml = "";
1809			let extentAreaKM = 0;
1810			let productCodeArray = [];
1811			let layerCodeArray = [];
1812
1813			//Content for extra layers that can be added
1814			let outputElementCnt = -1;
1815			let extentGeom;
1816			for (let c = 0; c < extraLayersArray.length; c++) {
1817				//Show add-on only not already selected
1818				if(document.getElementById("xtralayerscode" + theSelectedProductIndex).value.indexOf(extraLayersCodeArray[c]) === -1) {
1819					outputElementCnt++;
1820					if(extraLayersinfoHtml === ""){
1821						extraLayersinfoHtml = "<table style='width:670px;'>";
1822						//extraLayersinfoHtml += "<tr><td colspan='6'>&nbsp;</td><td>&nbsp;</td><td><p style='font-weight:bold;font-style:oblique;text-align: center;'>Add?</p></td></tr>";
1823					}
1824
1825					extraLayersinfoHtml += "<tr><td style='width:150px;'><span style='color:#3E3E3E;font-size:14px;font-weight:bold;'>" + extraLayersArray[c] + "</span></td>";
1826					extraLayersinfoHtml += "<td colspan='4' style='width:220px;'><p style'color:#3E3E3E;font-size:14px;font-weight:normal;'>&nbsp;</p></td>";
1827					extraLayersinfoHtml += "<td style='width:20px;'><img src='images/info.jpg' width='16' height='16' alt='info' onclick='getExtraLayerInfo(\"" + extraLayersInfoArray[c] + "\");' class='clickable'/></td>";
1828					extraLayersinfoHtml += "<td style='width:90px;'><div id='addonextralayerprice" + String(outputElementCnt) + "'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;text-align:right;padding-right:10px;'>&pound: **.**</p></div></td>";
1829					extraLayersinfoHtml += "<td style='width:20px;'><p style='color:#3E3E3E;font-size:14px;font-weight:normal;text-align: center;'><input id='addonxlayer_" + selectedIndex + "_" + String(outputElementCnt) + "' name='addonxlayer_" + selectedIndex + "_" + String(outputElementCnt) + "' value='" + extraLayersArray[c] + "' type='checkbox' onclick='addExtraLayer(this,\"" + selectedIndex + "\",\"" + extraLayersCodeArray[c] + "\",\"" + String(c) + "\");'/> </p></td></tr>";
1830					extraLayersinfoHtml += "<tr><td colspan=8'>&nbsp;</td></tr>";
1831
1832					//Get the extra price for any data layers
1833					let theSelectedProductIndex = 1;  //will this always be 1
1834					let extentID = document.getElementById("extent" + theSelectedProductIndex).value;
1835					if (extentID !== "") {
1836						extentGeom = getExtentGeomByID(extentID);
1837						extentAreaKM = extentGeom.getArea() / 1000000;
1838					}
1839					productCodeArray.push(document.getElementById("data" + theSelectedProductIndex).value);
1840					layerCodeArray.push(extraLayersCodeArray[c]);
1841				}
1842			}
1843			if(extraLayersinfoHtml !== "") {
1844				extraLayersinfoHtml += "</table>";
1845			}
1846			document.getElementById("otherProductsAvailable").innerHTML  = extraLayersinfoHtml;
1847			document.getElementById("otherProductsAvailable").style.display = "block";
1848
1849			//Need to get the extra price
1850			retrieveLayerPriceForAddon(layerCodeArray.join("|"), extentAreaKM, productCodeArray.join("|"),"","",extentGeom,"");
1851
1852		}
1853	}
1854}
1855
1856
1857
1858//---------------------------------------End of file

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.