
<!--

/* MISC Javascript Controls */
/*                          */
/* General Javascript that might be needed in more than one place   */
/* can be included here and it should become available to all pages */




/* Controls the display of stuff during printing */
/*                                               */
/* To make something disappear, give it the ID noprintX     */
/* where X is a number from 1 to 14 (must be unique on page */
/*                                                          */
/* To make something appear only during printing, use the   */
/* ID doprintX although you'll also need to add a style tag */
/* style="display:none" to the item to stop it appearing    */
/* before printing begins                                   */
/*                                                          */
/* Unfortunately this only works in IE, can't find a MZ fix */
/* as .onbeforeprint and .onafterprint don't exist in that  */



function pre_printer_process() {

	for (a = 0; a < 15; a++) {

		if (document.getElementById("noprint" + (a+1))) {
			document.getElementById("noprint" + (a+1)).style.display = 'none';
		}

		if (document.getElementById("doprint" + (a+1))) {
			document.getElementById("doprint" + (a+1)).style.display = '';
		}

	}

}




function post_printer_process() {

	for (a = 0; a < 15; a++) {

		if (document.getElementById("noprint" + (a+1))) {
			document.getElementById("noprint" + (a+1)).style.display = '';
		}

		if (document.getElementById("doprint" + (a+1))) {
			document.getElementById("doprint" + (a+1)).style.display = 'none';
		}

	}

}

window.onbeforeprint = pre_printer_process;
window.onafterprint  = post_printer_process;







/* Opens the phone booking link */


function phone_booking_popup(url, townname) {

	if (typeof url=="undefined") { return false; }

	url = url + 'town/' + townname;

	window.open(url,'phonepopup',"height=160,width=500,left=200,top=190");

	return true;

}






/* Opens any URL in a basic popup */
/*                                */
/* If we specify 0 for the width then it becomes 400px wide      */
/* If we specify 0 for the height it sets total available height */
/*                                                               */
/* Example call: onClick="make_a_popup('http..', 600, 0, 1);"    */


function make_a_popup(url, width, height, scrollbars) {


	if (typeof url=="undefined") { return false; }


	var screenheight = screen.height - 30;

	width  = (width < 1)  ? 400 : width;
	height = (height < 1) ? screenheight : height;
	scrollbars = (scrollbars < 1) ? 0 : 1;


//	window.open(url,'myownpopup','"height=' + height + ',width=' + width + ',left=200,top=190, scrollbars=' + scrollbars + '"');
	window.open(url,'myownpopup','height=' + height + ',width=' + width + ',left=200,top=190,resizable=1,menubar=0,location=0, scrollbars=' + scrollbars);


	return true;


}






function closeit() {

	window.opener.location.reload();

	window.self.close();

}





// Quick trim function
//
// Useful for removing whitespace etc. from around inputs
// which is basically exactly the same as the trim() in PHP

function trimcontent(stringToTrim) {
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}





/* Complicated way to create a bookmark */

function CreateBookmarkLink(pagetitle,url) {

	if (window.sidebar) {
		window.sidebar.addPanel(pagetitle, url,""); // FF
	}
	else if (window.external) {
		window.external.AddFavorite(url, pagetitle); // IE
	}
	else if(window.opera && window.print) {
		return true; // Opera
	}

}





/* Get the current query string */
/*                              */
/* If no query string exists then indexOf will be -1 */
/* and we return a blank string (safer than false)   */

function getTheQueryString() {

//	if (parent.document.URL) {
	if (document.URL) {

//		var tmp_url = parent.document.URL;
		var tmp_url = document.URL;

		if (tmp_url.indexOf('?') >= 0) {
			return tmp_url.substring(tmp_url.indexOf('?')+1, tmp_url.length);
		}
		else {
			return '';
		}

	}

}




/* Bolt QS onto URL */
/*                  */
/* A handy function using the above which receives a URL */
/* and simply bolts the above query string onto it.      */
/*                                                       */
/* If no URL is passed as first argument then we exit.   */
/*                                                       */
/* If customQS is set, we add this onto the end of the   */
/* URL passed else addon the std. page QS.               */

function addQStoURL(url,customQS) {


	if (url.indexOf('http://') == -1) {
		return false;
	}


	if (url.indexOf('?') < 0) {
		url = url + '?'; // Addon a '?'
	}




	if (customQS) {
		url = url + customQS;
	}
	else {
		url = url + getTheQueryString();
	}


	return url;

}




/* Add to onLoad() without overwriting */
/*                                     */
/* A very handy little function that allows adding of functions to onLoad  */
/* without actually having to physically add them to the page code. It can */
/* add other stuff, but not worrying about that here...                    */
/*                                                                         */
/* To add to onload, use the syntax "addToOnload(window, 'load', foo);"    */
/* Set "foo" to be the function we want to add to the onload event.        */
/*                                                                         */
/* http://onlinetools.org/articles/unobtrusivejavascript/chapter4.html     */

function addToOnload(obj, evType, fn){
 if (obj.addEventListener){
   obj.addEventListener(evType, fn, false);
   return true;
 } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
 } else {
   return false;
 }
}





/* Copy to clipboard (IE only) */

function CopyToClipboard()
{
   CopiedTxt = document.selection.createRange();
   CopiedTxt.execCommand("Copy");
}





// Simple scroll to without anchors (v1.0.1)
//
// Ex. <a href="" onClick="scrollToElement(document.getElementById('topofpagediv')); return false;">
//     where <div id="topofpagediv"></div> is where we want to scroll to.
//
// http://stackoverflow.com/questions/68165/javascript-to-scroll-long-page-to-div (bottom comment)
//
//
// scrollToElementSmooth: An alternative to scrollToElement() but written by Trev which will try
//                        to smoothly scroll to the point in question instead of direct jump. Req.
//                        the absoluteOffset() function however.
//
//                        Scroll back to top:-
//                        - Can also be made to scroll to the top of the page by passing 1 as the 2nd argument.
//                        - Doesn't require the 1st element, so just set as ''
//
//                        NOTE: There must be a "return false;" on any calling link or this will jump, not scroll.
//
//
// History: v1.0.1 - Fixed a bug which meant it didn't always scroll correctly if the page had been moved
//                   and now always scrolls correctly back up the page which it would sometimes fail to do.
//

function absoluteOffset(elem) {
    return elem.offsetParent && elem.offsetTop + absoluteOffset(elem.offsetParent);
}

function scrollToElement(elem) {
     window.scroll(0,absoluteOffset(elem));
}




function scrollToElementSmooth(elem, backToTop) {



	var timeout_delay  		= 7; // Total ms before next scroll
	var pixels_to_scroll 	= 3; // Pixels to scroll each time

	var final_location		= 0;
	var total_scrolls		= 0;
	var tmp_timeout    		= 0;

	var backToTop 			= (backToTop != 1) ? 0 : 1;

	final_location 			= (!elem) ? 0 : absoluteOffset(elem);		// Check we have an element to go to
	final_location			= (backToTop == 1) ? 0 : final_location;  	// Back to top override



	if (parseInt(final_location) < parseInt(document.body.scrollTop)) {

		// We need to scroll back up the page to reach the final_location (DIV)
		var tmp_pixels_to_scroll = pixels_to_scroll * 2;
		pixels_to_scroll = parseInt(pixels_to_scroll - tmp_pixels_to_scroll);

	}


	final_location	= final_location - parseInt(document.body.scrollTop);
	total_scrolls  	= parseInt(final_location / pixels_to_scroll) + 1;


	for (var z=0; z < total_scrolls; z++) {
		tmp_timeout = timeout_delay * (z + 1);
	   	var scrolldelay = setTimeout("window.scrollBy(0," + pixels_to_scroll + ")",tmp_timeout);
	}

	return true;

}






/* -----------------------------------------------
   Floating layer - v.1
   (c) 2006 www.haan.net
   contact: jeroen@haan.net
   You may use this script but please leave the credits on top intact.

   http://javascript.internet.com/miscellaneous/popup-div.html

  ------------------------------------------------ */

/* -----------------------------------------------

   Trev Mods:

   v1.0.1: Removed the timer and now trigger the placeIt()
           at the same time as the setVisible() in the link
		   otherwise it'll only work with one popup at a time.

		   Added some code to setVisible() to track whether we'd
		   opened up a new preview DIV and thus needed to clear
		   the previous one, otherwise they stack under each other.

		   Changed a few variable names to prevent clashes with
		   other scripts, eg: having a global x or y isn't good.

  ------------------------------------------------ */


/* -----------------------------------------------

Note: The height of the box if set by the container element (eg: span)
      so if using this for towns page previews, look in Towns SubTPL

	  See set_content_centred() below as this might be a replacement
	  for this code since it's newer and causes fewer problems.

	  For centring a DIV and an Iframe on a page, there's also the new
	  uks_create_div_iframe_popup() function which does a good job.

  ------------------------------------------------ */


var uks_preview_co_x = 150;
var uks_preview_co_y = -250;

var uks_preview_window_prev_id = ''; // Trev addition for tracking prev preview

function PreviewSetVisible(obj)
{

	var objorig = obj;

	// Hide previous window if not the same as the new one
	if ((objorig != uks_preview_window_prev_id) && (uks_preview_window_prev_id != '')) {
		if (document.getElementById(uks_preview_window_prev_id)) {
			document.getElementById(uks_preview_window_prev_id).style.visibility = 'hidden';
		}
	}

	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';

	uks_preview_window_prev_id = objorig;

}


function PreviewPlaceIt(objtofind,objtomove)
{

	var theTop  = absoluteOffset(document.getElementById(objtofind));
	var theLeft = 0;


 	theLeft += uks_preview_co_x;
 	theTop += uks_preview_co_y;

	document.getElementById(objtomove).style.left = theLeft + 'px';
	document.getElementById(objtomove).style.top = theTop + 'px';

}



function PreviewSetIframeSrc(iframename, iframesrc) {


	if (!iframesrc.match(/^http:\/\//)) {
		return false;
	}

	if (iframename == '') {
		return false;
	}


	if (frames[iframename]) {
		frames[iframename].location.href = iframesrc;
	}


}




/* *** END FLOATING LAYER *** */








/* *** BEGIN CENTRE DIV MIDDLE OF PAGE *** */
/*                                         */
/* A series of functions used to create the DIV centrally in the page */
/* for the linkback on UKSeries. However this can be used elsewhere   */
/* and the functions are independently useful too.                    */
/*                                                                    */
/* It actually does a similar job to the PreviewPlaceIt etc. funcs    */
/* and might one day replace them for a lot of things.                */


function getWindowWidth() {

  var myWidth = 0;

  if ( typeof( window.innerWidth ) == 'number' ) {

	myWidth = window.innerWidth - 20; // Non IE

  }
  else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {

    myWidth = document.documentElement.clientWidth; // IE6

  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {

    myWidth = document.body.clientWidth; // IE4 & IE7

  }

  return parseInt(myWidth);

}



function getWindowHeight() {

	var windowHeight = 0;

	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {

		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {

			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}

		}

	}

	return windowHeight;

}



function set_content_centred(id_to_centre) {


	if (document.getElementById) {

		var windowHeight = getWindowHeight();
		var windowWidth  = getWindowWidth();

		if (windowHeight > 0) {

			var contentElement = document.getElementById(id_to_centre);
			var contentHeight  = contentElement.offsetHeight;
			var contentWidth   = contentElement.offsetWidth;

			if (windowHeight - contentHeight > 0) {

				var contentTopOnScreen 		= ((windowHeight / 2) - (contentHeight / 2));
				var windowScrolledBy  		= parseInt(document.body.scrollTop);
				var contentNewTopLocation 	= contentTopOnScreen + windowScrolledBy;

				var contentNewLeftLocation  = ((windowWidth / 2) - (contentWidth / 2));


				contentElement.style.position 	= 'absolute';
				contentElement.style.top  		= contentNewTopLocation + 'px';
				contentElement.style.left 		= contentNewLeftLocation + 'px';

				return true;

			}
			else {

				contentElement.style.position = 'static';
				return true;

			}

		}

	}
	else {

		// The DIV ID passed doesn't exist
		return false;

	}


	// Keeps Firefox happy!
	return true;

}





//
// Creates the linkback message box
//
// A specialist function to add a popup DIV box onto the page
// containing the instructions for linking back to the page.
//
// In theory this can be modified for other purposes as it just receives a chunk
// of HTML from a variable 'uks_plb_linkback_html_json', but in this case it's
// JSON encoded (probably wouldn't need to be in all cases).
//
//  - There are problems however when it comes to including J/script in the output, esp
//    with ' quotes. Whatever we do seems to run into problems and usually manifests as
//    "missing ; before statement". Backslashing doesn't seem to work so we gave up there
//    and in this case used a function for the close window link.
//
//
//
// Usage Notes:-
//
//  - The divIDName is optional and if missing the name will be created automatically.
//    - If there's more than one popup per page, it's a good idea to set this
//    - It can also be set in the uks_linkback_popup_content_div_name='' global var
//
//  - If the DIV mentioned in divIDName or uks_linkback_popup_content_div_name doesn't
//    exist it'll be auto generated by the function which makes this very self-contained
//    and allows for multiple popups on the page without worrying about creating DIVs.
//
//  - The actual centring of the content is done by set_content_centred() which is passed the
//    DIV id mentioned above. It doesn't have to be a DIV, as anything with the ID will move.
//
//  - Note: The divHeight must be larger than the actual content size or it'll start to show the
//          content too low down on the page, but only in Firefox. In FF a value of 0 doesn't work
//          either as this causes it to drop half way off the page. For the std. linkback, 500 is good.
//
//
//
// divIDName 	 : Name given to the DIV tag (optional)
// divWidth 	 : Width of the DIV tag
// divHeight	 : Height of the DIV tag (set to 0 to auto set this [see note above])
// urlToUse		 : Allows use of a custom URL instead of the page URL
// customQSToUse : Allows us to use a custom query string instead of the page one*
//
//
// * In some cases (eg: tariffs) we can't collect this in the call, so we also look in
//   a global variable 'uks_general_linkback_custom_qs' if the call is empty.
//

function uks_set_linkback_message(divIDName,divWidth,divHeight,urlToUse,customQSToUse,testData) {



	if (!divIDName) {

		if (uks_linkback_popup_content_div_name) {
			divIDName = uks_linkback_popup_content_div_name;
		}
		else {
			divIDName = 'xyzyzyzyz'; // Random DIV name
		}

	}



	// Copy the data into a single var
	var uks_plb_linkback_html_data = testData;



	// Various replacements to fix bizare problems

	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/:plbqts:/g, "'");
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/:plbqtd:/g, '"');
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/:plbbk1:/g, '<');
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/:plbbk2:/g, '>');
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/:plbtbk1:/g, '&lt;');
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/:plbtbk2:/g, '&gt;');
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/:plbqt:/g, '&quot;');




	// Dynamically create the DIV with the correct ID

	if (!document.getElementById(divIDName)) {

		var new_div = document.createElement("div");
		new_div.id = divIDName;
		document.body.appendChild(new_div);
		document.getElementById(divIDName).style.display='none';

	}




	// See if we've got a custom QS
	//
	// To allow the tariff system to use this, we can collect the custom QS
	// from either the arguments list or from a pre-defined global variable

	if (!customQSToUse) {

		if (typeof uks_general_linkback_custom_qs !== 'undefined') {

			customQSToUse = uks_general_linkback_custom_qs;

		}

	}





	//
	// Process the URL
	//
	// If no URL passed (pretty common), we get the one from the page
	//

	if (urlToUse.indexOf('http://') == -1) {

		if (parent.document.URL) {
//			var urlToUse = parent.document.URL;
			urlToUse = parent.document.URL;
		}
		else {
			return false; // Old browser
		}
	}




	// Create URL without any query strings option

	var urlToUseNoQS = urlToUse;

	if (urlToUse.indexOf('?') >= 0) {
		urlToUseNoQS = urlToUse.substring(0, urlToUse.indexOf('?'));
	}




	// Addon any custom QS

	if (customQSToUse) {
		var urlToUseCustomQS = addQStoURL(urlToUseNoQS,customQSToUse);
	}
	else {
		var urlToUseCustomQS = urlToUseNoQS;
	}




	// Trim the URLs

	urlToUseNoQS		= trimcontent(urlToUseNoQS);
	urlToUse	 		= trimcontent(urlToUse);
	urlToUseCustomQS 	= trimcontent(urlToUseCustomQS);



	// Encode URLs

	var urlToUseNoQS_Enc 		= encodeURIComponent(urlToUseNoQS);
	var urlToUse_Enc	 		= encodeURIComponent(urlToUse);
	var urlToUseCustomQS_Enc 	= encodeURIComponent(urlToUseCustomQS);




	// Do replacements
	//
	// JS_LINKBACK_NOQS_LINK 		: No query string on the URL
	// JS_LINKBACK_QS_LINK			: Query string as appears on the page
	// JS_LINKBACK_CUSTOM_QS_LINK	: Query string as passed in the arguments list
	//
	// The versions with _ENC on the end are exactly the same, except they're URL encoded.

	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/JS_LINKBACK_NO_QS_LINK_ENC/g, urlToUseNoQS_Enc);
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/JS_LINKBACK_PAGE_QS_LINK_ENC/g, urlToUse_Enc);
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/JS_LINKBACK_CUSTOM_QS_LINK_ENC/g, urlToUseCustomQS_Enc);

	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/JS_LINKBACK_NO_QS_LINK/g, urlToUseNoQS);
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/JS_LINKBACK_PAGE_QS_LINK/g, urlToUse);
	uks_plb_linkback_html_data = uks_plb_linkback_html_data.replace(/JS_LINKBACK_CUSTOM_QS_LINK/g, urlToUseCustomQS);






	// More generic stuff to make message appear

	if (divWidth > 0)  { document.getElementById(divIDName).style.width  = divWidth; }
	if (divHeight > 0) { document.getElementById(divIDName).style.height = divHeight; }

	document.getElementById(divIDName).style.display = '';
	document.getElementById(divIDName).innerHTML = uks_plb_linkback_html_data;
	set_content_centred(divIDName);

	return true;


}




function uks_close_linkback_message(divIDname) {


	if (document.getElementById(divIDname)) {

		document.getElementById(divIDname).style.display='none';

	}


}






/* Create IFrame Popup in DIV */
/*                            */
/*  Code to create a popup DIV box containing an iFrame to show external content.    */
/*  First use of this is for the new preview popups although it should be universal. */
/*                                                                                   */
/*  The main advantage is it's dead easy to use, just requiring a link and a URL in  */
/*  essence to tell it what iFramed content to display. Much simpler than previous.  */
/*                                                                                   */
/*                                                                                   */
/*  Create an onClick in the HTML link such as:                                      */
/*  <a href="#" onClick="uks_create_div_iframe_popup('http://www.x.com', 450, 500, 'MyDivClass'); return false;">LINK</a> */
/*                                                                                   */
/*  Argument1 - URL of page for use in the iframe                                    */
/*  Argument2 - WIDTH of the DIV and the Iframe                                      */
/*  Argument3 - HEIGHT of the DIV and the Iframe                                     */
/*  Argument4 - Classname for DIV and the Iframe                                     */
/*                                                                                   */
/*  The width & height can be set as 0 in which case we'll use the defaults set here */
/*  which might be a simpler way to do things for large scale outputs.               */
/*                                                                                   */
/*  The centring aspect is done by the set_content_centred() function as usual.      */
/*                                                                                   */
/*                                                                                   */
/*  Notes:                                                                           */
/*                                                                                   */
/*  - Don't forget to add the "return false;" to the end of the link or it'll bounce */
/*    around the page and won't centre properly.                                     */
/*                                                                                   */
/*   - To close this popup, create a link calling uks_close_div_iframe_popup() as it */
/*     will take care of removing the DIV (hiding it) and parent / frames issues and */
/*     place this within the iFrame content.                                         */
/*                                                                                   */
/*     Eg: <a href="#" onClick="parent.uks_close_div_iframe_popup();">Close</a>      */
/*                                                                                   */

function uks_create_div_iframe_popup(url,divWidth,divHeight,divClass,closeLinkText,closeLinkClass) {



	if (url == '') {
		return false;
	}

	if (divWidth < 1) {
		divWidth = 620;
	}

	if (divHeight < 1) {
		divHeight = 450;
	}

	if (divClass == '') {
		divClass = 'xxxxnoclass';
	}



	if (typeof(closeLinkText) == 'undefined') {
		var add_close_link = 0;
	}
	else if (closeLinkText == '') {
		var add_close_link = 0;
	}
	else {
		var add_close_link = 1;
	}





	// Set the vars
	var divIDName 	 	= 'uks_create_popup_preview_div'; 	// If changed, also change in uks_close_div_iframe_popup()

	var iFrameWidth  = divWidth  - 10;
	var iFrameHeight = divHeight - 30;

	var closeLinkMarginTop    = 10;
	var closeLinkMarginBottom = 20;



	if (add_close_link==1) {

		divHeight += (closeLinkMarginTop + closeLinkMarginBottom); // Increase DIV size if closelink on

	}





	//
	// Dynamically create the main DIV with the correct ID
	//

	if (!document.getElementById(divIDName)) {

		var new_div = document.createElement("div");
		new_div.id = divIDName;
		document.body.appendChild(new_div);
		document.getElementById(divIDName).style.display='none';
		document.getElementById(divIDName).setAttribute("class", divClass);
		document.getElementById(divIDName).setAttribute("className", divClass);

	}



	//
	// Incase main DIV not auto created
	//

	if (!document.getElementById(divIDName)) {
		return false;
	}




	//
	// Make the main DIV appear centred
	//
	//  Very important that we set a width and height to the DIV or it won't centre
	//  oh and remember to make it visible before we try to add content to it.
	//

	document.getElementById(divIDName).style.width    = divWidth;
	document.getElementById(divIDName).style.height   = divHeight;
	document.getElementById(divIDName).style.overflow = "auto";
	document.getElementById(divIDName).style.display  = '';




	//
	// Make sure the DIV container is empty
	//

	document.getElementById(divIDName).innerHTML = '';




	//
	// Create the optional close link for outer DIV
	//

	if (add_close_link==1) {

		document.getElementById(divIDName).innerHTML += '<div class="uks_trans_gif_alt" style="width:100px;height:'+closeLinkMarginTop+'px;">&nbsp;</div>';
		document.getElementById(divIDName).innerHTML += '<a href="#" onClick="parent.uks_close_div_iframe_popup(); return false;" class="'+closeLinkClass+'">'+closeLinkText+'</a>';
		document.getElementById(divIDName).innerHTML += '<div class="uks_trans_gif_alt" style="width:100px;height:'+closeLinkMarginBottom+'px;">&nbsp;</div>';

	}




	//
	// Create the iFrame
	//
	//  This goes within the DIV created above
	//

	document.getElementById(divIDName).innerHTML += '<iframe src="' + url + '" width="' + iFrameWidth + '" ' + 'height="' + iFrameHeight + '" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" class="' + divClass + '">&nbsp;</iframe>';




	//
	// Call the AJAX function
	//
/*
	poststr  = 'stripbody=1';
	poststr += '&u=' + url;

	var popup_processor_script = 'http://' + window.location.hostname + '/' + 'misc_popup_prx/';

	var popup_ajax_object = '';
	popup_ajax_object 	  = new uks_generic_ajaxObject(popup_processor_script,uks_create_div_iframe_popup_ajax_callback);
	popup_ajax_object.update(poststr,'GET',divIDName);
*/



	// Centre the content
	set_content_centred(divIDName);



	return true;



}




/* Close a DIV window */
/*                    */
/*  Related to the above, but this closes the DIV iFrame window above */

function uks_close_div_iframe_popup() {

	if (parent.document.getElementById('uks_create_popup_preview_div')) {

		parent.document.getElementById('uks_create_popup_preview_div').style.display='none';

	}

}




/* Part 2 of the popup code */

function uks_create_div_iframe_popup_ajax_callback(responseText, responseStatus, responseXML, div_id_manual_value) {



	if (responseStatus==200) {



		var internal_htmldata_div_id = 'uks_create_popup_preview_htmldata_div';

		if (typeof(div_id_manual_value) != 'undefined') {

			if (div_id_manual_value.length > 3) {
				var internal_htmldata_div_id = div_id_manual_value;
			}

		}



		var ajax_response 	= responseText;
		var ajax_error_code	= 0;


		var json_ajax_outer_regex = /.*<!--JSON_DATA_START-->(.+)<!--JSON_DATA_END-->.*/;
		var tmp_response_data = ajax_response.match(json_ajax_outer_regex);
		var ajax_response = tmp_response_data[1];


		var json_code_array = eval( "(" + ajax_response + ")" );


		var popup_data_array = new Array();

			popup_data_array['html_data']	= json_code_array.html_data;
			popup_data_array['status'] 		= parseInt(json_code_array.status);


		if (popup_data_array['status'] == 1) {

			if (document.getElementById(internal_htmldata_div_id)) {

				document.getElementById(internal_htmldata_div_id).innerHTML += popup_data_array['html_data'];

			}

		}




		x = document.getElementById('uks_create_popup_preview_div');
		y = document.getElementById(internal_htmldata_div_id);
//		alert('POST OUTER: ' + 'Offset: ' + x.offsetHeight + ' : ScrollHeight: ' + x.scrollHeight);



	}


	return true;


}





/* *** END CENTRE DIV MIDDLE OF PAGE TYPE FUNCTIONS *** */








// Universal sort settings
//
// Save_reset global variables

var uks_eqs_entries_default_local  	 	= '';
var uks_eqs_entries_default_nonlocal 	= '';
var uks_eqs_entries_default_run  	 	= 0;

var uks_entries_container_local_div	 	= 'uks_all_entries_local_container';
var uks_entries_container_nonlocal_div	= 'uks_all_entries_nonlocal_container';

var uks_all_local_section_div	 		= 'uks_all_local_section'; 		// Goes outside the table rows
var uks_all_nonlocal_section_div	 	= 'uks_all_nonlocal_section'; 	// Switches to display:none if not applic.



// Universal sort function
//
// The function is designed to sort the content of the page assuming
// each entry has the correct DIV IDs around it (all should now).
//
// It also requires the array main_sort_array[] and similar to be included
// at the top of the pages (again should all now be there from server side).
//
//
// Call it either with the argument equiv to the sortType which will call on
// the appropriate array of EQS's, or blank to reset back to the default list.

function uks_sort_entry_lists(sortType) {


	var new_output_list_local 	 = '';
	var new_output_list_nonlocal = '';

	var main_sort_array = new Array();

	var tmp_count_output_local 		= 0;
	var tmp_count_output_nonlocal 	= 0;




	if (!document.getElementById(uks_entries_container_local_div)) {
		return false;
	}



	switch (sortType) {

		case 'bestprice':
		var main_sort_array = uks_eqs_sortby_array['bestprice'];
		break;

		case 'starrating':
		var main_sort_array = uks_eqs_sortby_array['starrating'];
		break;

		case 'distance':
		var main_sort_array = uks_eqs_sortby_array['distance'];
		break;

		default:
		return false;

	}



	if (main_sort_array.length < 1) {
		return false;
	}



	// Make sure the original is saved
	uks_save_reset_entry_lists();



	// Once saved, we can loop through every entry in the main_sort_array[] and assuming
	// a corresponding DIV ID exists (usually surrounding an entry), we try to work out if
	// it's a local or non local entry so we know which DIV to drop the entry into.
	//
	// Eg: If sorting by price then we'll use the array uks_eqs_sortby_array['bestprice']
	//     to find the applicable entries and the order in which they come, and redraw the
	//     page output based on that.

	for (var z=0; z < main_sort_array.length; z++) {


		if (document.getElementById('uks_eqs_entry_container:' + main_sort_array[z])) {


			if (uks_sort_entry_lists_entrytype(main_sort_array[z]) == 1) {

				new_output_list_local += '<div id="uks_eqs_entry_container:' + main_sort_array[z] + '">';
				new_output_list_local += document.getElementById('uks_eqs_entry_container:' + main_sort_array[z]).innerHTML;
				new_output_list_local += "</div>\n\n";

				tmp_count_output_local = 1;

			}
			else if (uks_sort_entry_lists_entrytype(main_sort_array[z]) == 2) {

				new_output_list_nonlocal += '<div id="uks_eqs_entry_container:' + main_sort_array[z] + '">';
				new_output_list_nonlocal += document.getElementById('uks_eqs_entry_container:' + main_sort_array[z]).innerHTML;
				new_output_list_nonlocal += "</div>\n\n";

				tmp_count_output_nonlocal = 1;

			}
			else {
			}

		}


	}




	//
	// Fill the contents of the local and non-local DIVs with sorted data
	//

	if (document.getElementById(uks_entries_container_local_div)) {
		document.getElementById(uks_entries_container_local_div).innerHTML = '';
		document.getElementById(uks_entries_container_local_div).innerHTML = new_output_list_local;
	}

	if (document.getElementById(uks_entries_container_nonlocal_div)) {
		document.getElementById(uks_entries_container_nonlocal_div).innerHTML = '';
		document.getElementById(uks_entries_container_nonlocal_div).innerHTML = new_output_list_nonlocal;
	}




	//
	// Hide a section if it's not used
	//

	if (document.getElementById(uks_all_local_section_div)) {

		if (tmp_count_output_local != 1) {
			document.getElementById(uks_all_local_section_div).style.display = 'none';
		}
		else {
			document.getElementById(uks_all_local_section_div).style.display = '';
		}

	}


	if (document.getElementById(uks_all_nonlocal_section_div)) {

		if (tmp_count_output_nonlocal != 1) {
			document.getElementById(uks_all_nonlocal_section_div).style.display = 'none';
		}
		else {
			document.getElementById(uks_all_nonlocal_section_div).style.display = '';
		}

	}



	// Save memory
	new_output_list_local 	 = '';
	new_output_list_nonlocal = '';



	return true;


}



//
// Run the RC code in the page
//
//  If we change the QS, also add it into _format_qs_private() in scripts

function uksrch() {

	if (location.href == '') {
		return false;
	}

	if (genericReadCookie('rcache') != 1) {
		return false;
	}

	if (location.href.match('rcache')) {
		return false;
	}

	if (location.href.match('\\?')) {
		var addon='&';
	}
	else {
		var addon='?';
	}

	document.write('<table width="25%" border="0" cellspacing="0" cellpadding="0" align="center" height="15"><tr valign="middle" align="center" height="7"><td><a href="'+location.href+addon+'rcache" class="ukseries_small_grey_text">Reset Page</a></center><img src="/shared-images/trans.gif" width="5" height="7"></td></tr></table>');


}




// Find location of EQS
//
// Assistance function for the above to work out whether the entry
// is in the local or non-local array. Essentially a in_array() type
// of function except J/script doesn't seem to have one.
//
// Returns 1 if local, 2 if non-local or 0 if not found (shouldn't happen)

function uks_sort_entry_lists_entrytype(eqs) {


	for (var z=0; z < uks_eqs_list_local.length; z++) {

		if (eqs == uks_eqs_list_local[z]) {
			return 1;
		}

	}


	for (var x=0; x < uks_eqs_list_nonlocal.length; x++) {

		if (eqs == uks_eqs_list_nonlocal[x]) {
			return 2;
		}

	}


	return 0;


}




//
// Save & reset entry list contents
//
// A universal function allowing the saving of the contents of the local & non-local
// list contents so that we can reset the page later to it's original state. Originally
// designed for the uks_sort_entry_lists() function, but could be useful in various places.
//
// Call with no arguments to save the contents of the page (eg: after page load)
//
// Call with argument 'RESET' to make sure the contents are saved and then reset them.
// If the contents are to be changed (eg: removed during sort) then call without argument first
//


function uks_save_reset_entry_lists(command) {


	var run_reset = 0;



	// Only really applicable to towns listing type pages
	// since we don't need to bother saving the contents for anything else

	if (uks_eqs_entries_default_run != 1) {

		if (document.getElementById(uks_entries_container_local_div)) {
			uks_eqs_entries_default_local = document.getElementById(uks_entries_container_local_div).innerHTML;
		}

		if (document.getElementById(uks_entries_container_nonlocal_div)) {
			uks_eqs_entries_default_nonlocal = document.getElementById(uks_entries_container_nonlocal_div).innerHTML;
		}

	}




	if (command == 'RESET') {

		if (document.getElementById(uks_all_local_section_div)) {
			document.getElementById(uks_entries_container_local_div).innerHTML = '';
			document.getElementById(uks_entries_container_local_div).innerHTML = uks_eqs_entries_default_local;
		}

		if (document.getElementById(uks_all_nonlocal_section_div)) {
			document.getElementById(uks_entries_container_nonlocal_div).innerHTML = '';
			document.getElementById(uks_entries_container_nonlocal_div).innerHTML = uks_eqs_entries_default_nonlocal;
		}

	}



	uks_eqs_entries_default_run = 1;


	return true;


}







// -------------- COOKIE READ / WRITE FUNCS -------------- //
//                                                         //
// Quick and simple cookie functions for general usages    //
// pinched from the live tariff system and renamed.        //
//                                                         //
// http://www.quirksmode.org/js/cookies.html#script        //


function genericCreateCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function genericReadCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function genericEraseCookie(name) {
	genericCreateCookie(name,"",-1);
}





//
// Change CSS function
//
//  A very handy function that can change the CSS values inside existing CSS stylesheets
//  Renamed from original changecss() to prevent clashes with any future code.
//
//  Usage ex: uks_changecss('uks_myclass_name, 'display', 'none');
//
//  Note: The script changes display='inline' to display='' as the first one breaks badly
//        in Firefox 3 (works fine in IE8 and Chrome) especially in tables. The add bit in
//        this script fixes the problem of 'display' being removed as a property.
//

function uks_changecss(theClass,element,value,read_write) {



	// Last Updated on June 23, 2009
	// Documentation for this script at
	// http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html

	var cssRules;

	var added = false;

	read_write = (read_write == 1) ? 1 : 0;

	if ((element == 'display') && (value == 'inline')) {
		value = ''; // Fixes FF glitch
	}



	for (var S = 0; S < document.styleSheets.length; S++) {


		if (document.styleSheets[S]['rules']) {
			cssRules = 'rules';
		} else if (document.styleSheets[S]['cssRules']) {
			cssRules = 'cssRules';
		} else {
			//no rules found... browser unknown
			break;
		}


		for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {

			if (document.styleSheets[S][cssRules][R].selectorText == theClass) {

				if(document.styleSheets[S][cssRules][R].style[element]) {

					if (read_write != 1) {

					 	// Read and return the value
						return document.styleSheets[S][cssRules][R].style[element];

					}
					else {

						// If value not same as set, then set it (if property exists)
						if (document.styleSheets[S][cssRules][R].style[element] != value) {
							document.styleSheets[S][cssRules][R].style[element] = value;
						}

					}

					added=true;
					break;

				}

			}

		}


		if(!added) {

			if(document.styleSheets[S].insertRule) {

				document.styleSheets[S].insertRule(theClass+' { '+element+': '+value+'; }',document.styleSheets[S][cssRules].length);

			} else if (document.styleSheets[S].addRule) {

				document.styleSheets[S].addRule(theClass,element+': '+value+';');

			}
			else {

			}

		}

	}

}





//
// Reverse a string
//
//  http://www.bytemycode.com/snippets/snippet/400/
//
//  Usage:
//
//  x = new String('This is a test.');
//  document.write(x.reverseString());
//

String.prototype.reverseString = function(){

	splitext = this.split("");
	revertext = splitext.reverse();
	reversed = revertext.join("");
	return reversed;

}






//
// MD5 Generator
//

/**
*
*  MD5 (Message-Digest Algorithm)
*  http://www.webtoolkit.info/
*
**/

var uks_MD5_calc = function (string) {

	function RotateLeft(lValue, iShiftBits) {
		return (lValue<<iShiftBits) | (lValue>>>(32-iShiftBits));
	}

	function AddUnsigned(lX,lY) {
		var lX4,lY4,lX8,lY8,lResult;
		lX8 = (lX & 0x80000000);
		lY8 = (lY & 0x80000000);
		lX4 = (lX & 0x40000000);
		lY4 = (lY & 0x40000000);
		lResult = (lX & 0x3FFFFFFF)+(lY & 0x3FFFFFFF);
		if (lX4 & lY4) {
			return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
		}
		if (lX4 | lY4) {
			if (lResult & 0x40000000) {
				return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
			} else {
				return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
			}
		} else {
			return (lResult ^ lX8 ^ lY8);
		}
 	}

 	function F(x,y,z) { return (x & y) | ((~x) & z); }
 	function G(x,y,z) { return (x & z) | (y & (~z)); }
 	function H(x,y,z) { return (x ^ y ^ z); }
	function I(x,y,z) { return (y ^ (x | (~z))); }

	function FF(a,b,c,d,x,s,ac) {
		a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
		return AddUnsigned(RotateLeft(a, s), b);
	};

	function GG(a,b,c,d,x,s,ac) {
		a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
		return AddUnsigned(RotateLeft(a, s), b);
	};

	function HH(a,b,c,d,x,s,ac) {
		a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
		return AddUnsigned(RotateLeft(a, s), b);
	};

	function II(a,b,c,d,x,s,ac) {
		a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
		return AddUnsigned(RotateLeft(a, s), b);
	};

	function ConvertToWordArray(string) {
		var lWordCount;
		var lMessageLength = string.length;
		var lNumberOfWords_temp1=lMessageLength + 8;
		var lNumberOfWords_temp2=(lNumberOfWords_temp1-(lNumberOfWords_temp1 % 64))/64;
		var lNumberOfWords = (lNumberOfWords_temp2+1)*16;
		var lWordArray=Array(lNumberOfWords-1);
		var lBytePosition = 0;
		var lByteCount = 0;
		while ( lByteCount < lMessageLength ) {
			lWordCount = (lByteCount-(lByteCount % 4))/4;
			lBytePosition = (lByteCount % 4)*8;
			lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount)<<lBytePosition));
			lByteCount++;
		}
		lWordCount = (lByteCount-(lByteCount % 4))/4;
		lBytePosition = (lByteCount % 4)*8;
		lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80<<lBytePosition);
		lWordArray[lNumberOfWords-2] = lMessageLength<<3;
		lWordArray[lNumberOfWords-1] = lMessageLength>>>29;
		return lWordArray;
	};

	function WordToHex(lValue) {
		var WordToHexValue="",WordToHexValue_temp="",lByte,lCount;
		for (lCount = 0;lCount<=3;lCount++) {
			lByte = (lValue>>>(lCount*8)) & 255;
			WordToHexValue_temp = "0" + lByte.toString(16);
			WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length-2,2);
		}
		return WordToHexValue;
	};

	function Utf8Encode(string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";

		for (var n = 0; n < string.length; n++) {

			var c = string.charCodeAt(n);

			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}

		}

		return utftext;
	};

	var x=Array();
	var k,AA,BB,CC,DD,a,b,c,d;
	var S11=7, S12=12, S13=17, S14=22;
	var S21=5, S22=9 , S23=14, S24=20;
	var S31=4, S32=11, S33=16, S34=23;
	var S41=6, S42=10, S43=15, S44=21;

	string = Utf8Encode(string);

	x = ConvertToWordArray(string);

	a = 0x67452301; b = 0xEFCDAB89; c = 0x98BADCFE; d = 0x10325476;

	for (k=0;k<x.length;k+=16) {
		AA=a; BB=b; CC=c; DD=d;
		a=FF(a,b,c,d,x[k+0], S11,0xD76AA478);
		d=FF(d,a,b,c,x[k+1], S12,0xE8C7B756);
		c=FF(c,d,a,b,x[k+2], S13,0x242070DB);
		b=FF(b,c,d,a,x[k+3], S14,0xC1BDCEEE);
		a=FF(a,b,c,d,x[k+4], S11,0xF57C0FAF);
		d=FF(d,a,b,c,x[k+5], S12,0x4787C62A);
		c=FF(c,d,a,b,x[k+6], S13,0xA8304613);
		b=FF(b,c,d,a,x[k+7], S14,0xFD469501);
		a=FF(a,b,c,d,x[k+8], S11,0x698098D8);
		d=FF(d,a,b,c,x[k+9], S12,0x8B44F7AF);
		c=FF(c,d,a,b,x[k+10],S13,0xFFFF5BB1);
		b=FF(b,c,d,a,x[k+11],S14,0x895CD7BE);
		a=FF(a,b,c,d,x[k+12],S11,0x6B901122);
		d=FF(d,a,b,c,x[k+13],S12,0xFD987193);
		c=FF(c,d,a,b,x[k+14],S13,0xA679438E);
		b=FF(b,c,d,a,x[k+15],S14,0x49B40821);
		a=GG(a,b,c,d,x[k+1], S21,0xF61E2562);
		d=GG(d,a,b,c,x[k+6], S22,0xC040B340);
		c=GG(c,d,a,b,x[k+11],S23,0x265E5A51);
		b=GG(b,c,d,a,x[k+0], S24,0xE9B6C7AA);
		a=GG(a,b,c,d,x[k+5], S21,0xD62F105D);
		d=GG(d,a,b,c,x[k+10],S22,0x2441453);
		c=GG(c,d,a,b,x[k+15],S23,0xD8A1E681);
		b=GG(b,c,d,a,x[k+4], S24,0xE7D3FBC8);
		a=GG(a,b,c,d,x[k+9], S21,0x21E1CDE6);
		d=GG(d,a,b,c,x[k+14],S22,0xC33707D6);
		c=GG(c,d,a,b,x[k+3], S23,0xF4D50D87);
		b=GG(b,c,d,a,x[k+8], S24,0x455A14ED);
		a=GG(a,b,c,d,x[k+13],S21,0xA9E3E905);
		d=GG(d,a,b,c,x[k+2], S22,0xFCEFA3F8);
		c=GG(c,d,a,b,x[k+7], S23,0x676F02D9);
		b=GG(b,c,d,a,x[k+12],S24,0x8D2A4C8A);
		a=HH(a,b,c,d,x[k+5], S31,0xFFFA3942);
		d=HH(d,a,b,c,x[k+8], S32,0x8771F681);
		c=HH(c,d,a,b,x[k+11],S33,0x6D9D6122);
		b=HH(b,c,d,a,x[k+14],S34,0xFDE5380C);
		a=HH(a,b,c,d,x[k+1], S31,0xA4BEEA44);
		d=HH(d,a,b,c,x[k+4], S32,0x4BDECFA9);
		c=HH(c,d,a,b,x[k+7], S33,0xF6BB4B60);
		b=HH(b,c,d,a,x[k+10],S34,0xBEBFBC70);
		a=HH(a,b,c,d,x[k+13],S31,0x289B7EC6);
		d=HH(d,a,b,c,x[k+0], S32,0xEAA127FA);
		c=HH(c,d,a,b,x[k+3], S33,0xD4EF3085);
		b=HH(b,c,d,a,x[k+6], S34,0x4881D05);
		a=HH(a,b,c,d,x[k+9], S31,0xD9D4D039);
		d=HH(d,a,b,c,x[k+12],S32,0xE6DB99E5);
		c=HH(c,d,a,b,x[k+15],S33,0x1FA27CF8);
		b=HH(b,c,d,a,x[k+2], S34,0xC4AC5665);
		a=II(a,b,c,d,x[k+0], S41,0xF4292244);
		d=II(d,a,b,c,x[k+7], S42,0x432AFF97);
		c=II(c,d,a,b,x[k+14],S43,0xAB9423A7);
		b=II(b,c,d,a,x[k+5], S44,0xFC93A039);
		a=II(a,b,c,d,x[k+12],S41,0x655B59C3);
		d=II(d,a,b,c,x[k+3], S42,0x8F0CCC92);
		c=II(c,d,a,b,x[k+10],S43,0xFFEFF47D);
		b=II(b,c,d,a,x[k+1], S44,0x85845DD1);
		a=II(a,b,c,d,x[k+8], S41,0x6FA87E4F);
		d=II(d,a,b,c,x[k+15],S42,0xFE2CE6E0);
		c=II(c,d,a,b,x[k+6], S43,0xA3014314);
		b=II(b,c,d,a,x[k+13],S44,0x4E0811A1);
		a=II(a,b,c,d,x[k+4], S41,0xF7537E82);
		d=II(d,a,b,c,x[k+11],S42,0xBD3AF235);
		c=II(c,d,a,b,x[k+2], S43,0x2AD7D2BB);
		b=II(b,c,d,a,x[k+9], S44,0xEB86D391);
		a=AddUnsigned(a,AA);
		b=AddUnsigned(b,BB);
		c=AddUnsigned(c,CC);
		d=AddUnsigned(d,DD);
	}

	var temp = WordToHex(a)+WordToHex(b)+WordToHex(c)+WordToHex(d);

	return temp.toLowerCase();
}









// ------------ GENERIC AJAX CODE ------------ //
//                                             //
// This is pretty standalone AJAX code which accepts the usual URL to lookup from the call
// but also accepts a second parameter which can be any data we want to send to the callback()
// function (normally not possible with AJAX).
//
//
// Credits:
//
// Original script by: http://www.hunlock.com/blogs/The_Ultimate_Ajax_Object
// (recommended reading as it also has other useful bits inc. how to use the timeout).
//
//
//  Trev Tweaks:
//
//  - The .update function now accepts another parameter
//
//  - Added a link to the Firebug console so we can more easily debug using Firefox with the
//    Firebug addon. Handy for seeing exactly what the script is doing without lots of alerts.
//
//    - If using elsewhere, remember to include the console code at the top of any script to enable
//      this to work when Firebug isn't active or isn't installed (ie: most systems).
//
//  - This one is based on the version in the live_search system but a little more generic.
//

function uks_generic_ajaxObject(url, callbackFunction) {


	var that=this;
	this.updating = false;

	this.abort = function() {

		if (that.updating) {

			that.updating=false;
			that.AJAX.abort();
			that.AJAX=null;

		}

	}


	this.update = function(passData,postMethod,miscDataCallbackReturn) {



		if (that.updating) {
			return false;
		}


		that.AJAX = null;


		if (window.XMLHttpRequest) {
			that.AJAX=new XMLHttpRequest();
		} else {
			that.AJAX=new ActiveXObject("Microsoft.XMLHTTP");
		}


		if (that.AJAX==null) {

			console.error("FUNC: uks_ajaxObject_live_search_mod :: Attempt to start AJAX object failed suggesting serious browser problems or no J/script");
			return false;

		} else {

			that.AJAX.onreadystatechange = function() {

				if (that.AJAX.readyState==4) {

					that.updating=false;
					that.callback(that.AJAX.responseText,that.AJAX.status,that.AJAX.responseXML,miscDataCallbackReturn);
					that.AJAX=null;

				}

			}



			that.updating = new Date();

			if (/post/i.test(postMethod)) {

				var uri=urlCall+'?'+that.updating.getTime();
				that.AJAX.open("POST", uri, true);
				that.AJAX.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
				that.AJAX.setRequestHeader("Content-Length", passData.length);
				that.AJAX.send(passData);

			} else {

				var uri=urlCall+'?'+passData+'&timestamp='+(that.updating.getTime());
		        that.AJAX.open("GET", uri, true);
				that.AJAX.send(null);

			}

			return true;

		}


	}


	var urlCall = url;
	this.callback = callbackFunction || function () { };

}





// -->









