﻿


//
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
// PLEASE DO NOT USE THESE METHODS IN NEW FUNCTIONALITY :: MOVE TO 'CLASS BASED APPROACH'
//











		
		
		/*
		 *************************************************************************************************
		 MOVED TO:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js 
		 
		 - DELETE & TEST
		 *************************************************************************************************
		 */
		
					//prototype a beginsWith function
					String.prototype.startsWith = function(t, i) {
						if (i == false) {
							return (t == this.substring(0, t.length));
						} else {
							return (t.toLowerCase() == this.substring(0, t.length).toLowerCase());
						}
					}

					//prototype an endsWith function
					String.prototype.endsWith = function(t, i) {
						if (i == false) {
							return (t == this.substring(this.length - t.length));
						} else {
							return (t.toLowerCase() == this.substring(this.length - t.length).toLowerCase());
						}
					}

		
		/*
		 *************************************************************************************************
		 USED BY:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\Range.js
		 
		 SHOULD BE USING:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js ::: [ mergeDataListsIntoUniqueList(); ] 
		 *************************************************************************************************
		 */
			
				//function used to return a unique list of vals from two lists, reads in two delimited lists
				//and returns a single delimited list 
				function GetUniqueLists(valA, valB, separator) {
					//split the two lists into arrays
					var listA = valA.split(separator);
					var listB = valB.split(separator);
					var returnString = '';

					//cycle the first list and add the values to the return string if they aren't already present
					for (var i = 0; i < listA.length - 1; i++) {
						if (returnString.indexOf(separator + listA[i] + separator) == -1 && listA[i] != '') {
							returnString += listA[i] + separator;
						}
					}

					//now cycle the second list and if any values aren't present then add them to the return list
					for (var j = 0; j <= listB.length - 1; j++) {
						if (returnString.indexOf(separator + listB[j] + separator) == -1 && listB[j] != '') {
							returnString += listB[j] + separator;
						}
					}

					//trim any leading and trailing separators
					if (returnString.startsWith(separator, true) == true) {
						returnString = returnString.substring(1);
					}

					//return the finished value list
					return returnString;
				}
				
				
		/*
		 *************************************************************************************************
		 USED BY:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\Range.js
		 
		 SHOULD BE USING:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js ::: [ removeValuesFromDataList(); ] 
		 *************************************************************************************************
		 */
				//function used to remove a series of values from a list of delimited values
				function RemoveValuesFromList(list, values, separator) {
					//split both lists into arrays
					var listArray = list.split(separator);
					var valuesArray = values.split(separator);

					//the string of values to be returned   
					var returnString = '';

					//cycle the main list of values
					for (var i = 0; i < listArray.length; i++) {
						var listItem = listArray[i];
						//check we have a valid listItem to be processed
						if (listItem != '') {
							var add = true;
							//cycle the values array to see if this item should be added
							for (var j = 0; j < valuesArray.length; j++) {
								if (listItem == valuesArray[j]) {
									add = false;
								}
							}

							//if add is still set to true then we can add it
							if (add) {
								returnString += listItem + separator;
							}
						}
					}

					//return the list of accepted values
					if (returnString.endsWith(separator, true) == true) {
						returnString = returnString.substring(0, returnString.length - 1);
					}

					return returnString;
				}


		/*
		 *************************************************************************************************
		 USED BY:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\Range.js
		 
		 SHOULD BE USING:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js ::: [ getQSParameter(); ] 
		 *************************************************************************************************
		 */

				//function used to give easy access to querystring parameters
				function getQSParameter(name) { 
					name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 
					var regexS = "[\\?&]" + name + "=([^&#]*)"; 
					var regex = new RegExp(regexS); 
					var results = regex.exec(window.location.href); 
					if (results == null) 
						return ""; 
					else 
						return results[1]; 
				}



		/*
		 *************************************************************************************************
		 USED BY:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\display\AjaxConditionalLinkManager.js(481)
		 
		 SHOULD BE USING:
		 - Manheim.Portfolio.Uvl.Web.Lexus\Manheim.Portfolio.Uvl.Web.Lexus\assets\js\manheim\portfolio\common\global\Utilities.js ::: [ removeValuesFromDataList(); ] 
		 *************************************************************************************************
		 */
				//function used to unescape the .NET encoding for an Ajax callback
				function UnEncodeResponse(response) {
					response = unescape(response);
					response = response.replace(/Â/g, '');
					response = response.replace(/\+/g, ' ');
					return response;
				}
