
	/****
	 *	Javascript Predictive Search - LondonTown.com
	 *	June 2007 - Seb inpired from James Holden's (james_holden at londonmarketing dot com)
	 */

	 function processProgressBarUp(nothing) {
	 }
	 function processProgressBarDown(nothing) {
	 }

	/*****
	 * SEARCH
	 */

	var AjaxSearches = {

		__handler 	: null,		// Handler for ajax
		__ref 		: null,		// Reference ID
		__loc 		: '',		// Location
		__tim : null,


		/**
		 * LogIn
		 * @param
		 * @desc
		 */
		LogIn : function( username, password, formName, runFunction ) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				//AjaxSearches.Ajax("/Objects/AjaxSearches.php?action=logIn&username="+username+"&password="+password+"&formName="+formName+"&runFunction="+runFunction,'','postAjaxLogin(response)');
				var rememberMe = document.getElementById('submitRememberMe').value;
				AjaxSearches.Ajax("/Objects/SaveVenueMap.php?pageAction=logIn&submitRememberMe="+rememberMe+"&username="+username+"&password="+password+"&formName="+formName+"&runFunction="+runFunction,'','postAjaxLogin(response)');
			//}

		},

		/**
		 * AdminLogIn
		 * @param
		 * @desc
		 */
		AdminLogIn : function( username, password, formName, runFunction ) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=adminLogIn&username="+username+"&password="+password+"&formName="+formName+"&runFunction="+runFunction,'','postAjaxLogin(response)');
			//}

		},


		/**
		 * CreateAccount
		 * @param
		 * @desc
		 */
		CreateAccount : function( firstName, lastName, username, password, formName, runFunction ) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=createAccount&firstName="+firstName+"&lastName="+lastName+"&username="+username+"&password="+password+"&formName="+formName+"&runFunction="+runFunction,'','postAjaxLogin(response)');
			//}

		},

		/**
		 * SaveProDetails
		 * @param
		 * @desc
		 */
		SaveProDetails : function( proId,username,name,address,address2,city,postcode,telephone,fax,email ) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=saveProDetails&proId="+proId+"&username="+username+"&name="+name+"&address="+address+"&address2="+address2+"&city="+city+"&postcode="+postcode+"&telephone="+telephone+"&fax="+fax+"&email="+email);
			//}

		},

		/**
		 * CheckDetails
		 * @param
		 * @desc
		 */
		CheckDetails : function( username, currentPassword, newPassword ) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=checkDetails&username="+username+"&currentPassword="+currentPassword+"&newPassword="+newPassword);
			//}

		},

		/**
		 * SendPassword
		 * @param
		 * @desc
		 */
		SendPassword : function( emailAddress ) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=sendPassword&emailAddress="+emailAddress,'','postAjaxLogin(response)');
			//}

		},

		/**
		 * SendPassword
		 * @param
		 * @desc
		 */
		SendAdminPassword : function( emailAddress ) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=sendAdminPassword&emailAddress="+emailAddress,'','postAjaxLogin(response)');
			//}

		},

		/**
		 * SendMessage
		 * @param
		 * @desc
		 */
		SendMessage : function( senderName, senderEmailAddress, messageTitle, messageBody) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=sendMessage&senderName="+senderName+"&senderEmailAddress="+senderEmailAddress+"&messageTitle="+messageTitle+"&messageBody="+messageBody,'','postAjaxLogin(response)');
			//}

		},

		/**
		 * SaveMapDetails
		 * @param
		 * @desc
		 */
		SaveMapDetails : function( mapId, eventId, venueName, eventName, venueAddress, venueAddress2, venueCity, venuePostcode, startDate, endDate, venueX, venueY) {
			//if ( keyword && keyword != ' ' && keyword.length > 2) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=saveMapDetails&mapId="+mapId+"&eventId="+eventId+"&venueName="+venueName+"&eventName="+eventName+"&venueAddress="+venueAddress+"&venueAddress2="+venueAddress2+"&venueCity="+venueCity+"&venuePostcode="+venuePostcode+"&startDate="+startDate+"&endDate="+endDate+"&venueX="+venueX+"&venueY="+venueY);
			//}

		},

		/**
		 * GetMapsList
		 * @param
		 * @desc
		 */
		GetMapsList : function( mapKeyword) {
			if ( mapKeyword && mapKeyword != ' ' && mapKeyword.length > 3) {
				AjaxSearches.Ajax("/londonpro/AjaxSearches.php?action=getMapsList&keyword="+mapKeyword);
			}

		},


		/**
		 * Ajax
		 * @param URL
		 * @param POST
		 * @desc process a request to a remote search and run the internal parsejax function post readystate
		 *
		Ajax : function( URL, POST ) {
			AjaxSearches.Ajax(URL, POST, 'postAjax(response)');
		},*/


		/**
		 * Ajax
		 * @param URL
		 * @param POST
		 * @desc process a request to a remote search and run the internal parsejax function post readystate
		 */
		Ajax : function( URL, POST, postAjaxFunction ) {
			if ( typeof postAjaxFunction == 'undefined' || postAjaxFunction == '' ) {
				postAjaxFunction = 'postAjax(response)';
			}
			try {
			if ( AjaxSearches.__handler ) AjaxSearches.__handler.abort() ;
			AjaxSearches.__handler = ( window.XMLHttpRequest ) ? new XMLHttpRequest() : ( window.ActiveXObject ) ? new ActiveXObject("Microsoft.XMLHTTP") : null ;
			if ( AjaxSearches.__handler ) {
				AjaxSearches.__handler.onreadystatechange = function() { AjaxSearches.ParseJax( AjaxSearches.__handler, postAjaxFunction ) ; }
				if ( POST != '' && POST !=null && POST != "undefined" ) {
					AjaxSearches.__handler.open("POST", URL, true);
					AjaxSearches.__handler.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
					AjaxSearches.__handler.setRequestHeader("Content-length", POST.length);
					AjaxSearches.__handler.setRequestHeader("Connection", "close");
					AjaxSearches.__handler.send(POST);
				} else {
					AjaxSearches.__handler.open("GET", URL, true);
					AjaxSearches.__handler.send(null);
				}
			}
			} catch (ee ){}
		},


		GetNodeValue : function( element, name ) {
			try {
				return (element.getElementsByTagName(name)[0]).firstChild.nodeValue;
			} catch ( Exception ) {}
		},


		/**
		 * ParseJax
		 * @param handler (ajax handler)
		 * @desc Process the results coming through the system
		 */
		ParseJax : function( handler, postAjaxFunction ) {
			try {
			if ( handler ) {
				if ( handler.readyState == 4 && handler.status == 200 ) {
					if ( handler.responseText != '' ) {
						eval(handler.responseText);
					}
				}
			}
			} catch (ee ){}
		}



	}

