	var xmlHttp;
	
	function createXMLHttpRequest() {
		if ( window.ActiveXObject ) {
			xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
		} else if ( window.XMLHttpRequest ) {
			xmlHttp = new XMLHttpRequest();
		}
	}

	/* **********************************
	
		City Noise Ajax Functions.
		
	********************************** */

	//City Noise New Addition
	function check_noise() {
		document.getElementById("indicator_search").style.visibility = "visible";
		var get_title = document.frm_add_noise.frm_title.value;
		var get_text = document.frm_add_noise.frm_text.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCheckNoise;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_check_noise.php?title=" + get_title + "&text=" + get_text, true);
		xmlHttp.send(null);
	}

	function outputCheckNoise() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("indicator_search").style.visibility = "hidden";
				if ( xmlHttp.responseText == 'true' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Please fill out all fields.</div>';
				} else {
					document.frm_add_noise.action = "cn_list.php";
					document.frm_add_noise.submit();
				}

			}
		}
	}

	//City Noise Top part - Message System...
	function ChangeCityNoise(noise_ID) {
		document.getElementById("indicator_search").style.visibility = "visible";
		var get_city = document.getElementById("frm_city").value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_citynoise.php?city=" + get_city + "&noise=" + noise_ID, true);
		xmlHttp.send(null);
	}
	
	function ChangeCityNoise_all() {
		document.getElementById("indicator_search").style.visibility = "visible";
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_citynoise.php?noise=undefined", true);
		xmlHttp.send(null);
	}
	
	function outputCityNoise() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("citynoise").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	//City Noise Change Message...

	//From External Link
	function ChangeCityNoise_custom(noise_ID) {
		document.getElementById("indicator_search").style.visibility = "visible";
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise_Single_link;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_citynoise_single_link.php?noise=" + noise_ID, true);
		xmlHttp.send(null);
	}

	function outputCityNoise_Single_link() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("citynoise").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	//City Noise Reply...

	//From within page
	function ChangeCityNoise_one(noise_ID) {
		document.getElementById("indicator_search").style.visibility = "visible";
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise_Single;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_citynoise_single.php?noise=" + noise_ID, true);
		xmlHttp.send(null);
	}
	
	function CityNoise_Reply(noise_ID) {
		document.getElementById("indicator_search").style.visibility = "visible";
		var get_text = document.frm_citynoise.frm_reply.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise_Single;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_citynoise_reply.php?noise=" + noise_ID + "&text=" + get_text, true);
		xmlHttp.send(null);
	}
	
	function outputCityNoise_Single() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("city_noise_message").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	//City Noise Page Number Part...
	
	function ChangeCityNoisePages(page, city) {
		document.getElementById("indicator_search").style.visibility = "visible";
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoisePages;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_citynoise_pages.php?page=" + page + '&city=' + city, true);
		xmlHttp.send(null);
	}
	
	function outputCityNoisePages() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("resultbox").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}
	
	//City Noise Send To Friend routine...
	
	function CityNoise_send_to_friend() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_from = document.frm_cn_sendtofriend.frm_send_from.value;
		var get_to = document.frm_cn_sendtofriend.frm_send_to.value;
		var get_ID = document.frm_cn_sendtofriend.frm_send_noise_ID.value;
		var get_user = document.frm_cn_sendtofriend.frm_send_user_ID.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise_SentToFriend;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_citynoise_sendtofriend.php?from=" + get_from + "&to=" + get_to + "&noise=" + get_ID + "&user=" + get_user, true);
		xmlHttp.send(null);		
	}

	function outputCityNoise_SentToFriend() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'From' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Your address seems to be incorrect.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				} else if ( xmlHttp.responseText == 'To' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Your friends address seems to be incorrect.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				} else {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("send_button").style.visibility = "hidden";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #66cc00; background: #ccff99 url(images/alert_green.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #66cc00;">Your mail was sent.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				}
			}
		}
	}

	function CityNoise_send_venue_to_friend() {

		var get_from = document.frm_cn_sendtofriend.frm_send_from.value;
		var get_to = document.frm_cn_sendtofriend.frm_send_to.value;

		var get_venue_ID = document.frm_cn_sendtofriend.frm_venue_id.value;
		var get_kind = document.frm_cn_sendtofriend.frm_venue_kind.value

		var get_user = document.frm_cn_sendtofriend.frm_send_user_ID.value;
		var get_user_name = document.frm_cn_sendtofriend.frm_sender_name.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise_SentToFriend;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_sendvenuetofriend.php?from=" + get_from + "&to=" + get_to + "&venue=" + get_venue_ID + "&kind=" + get_kind + "&user=" + get_user + "&user_name=" + get_user_name, true);
		xmlHttp.send(null);		
	}

	function outputCityNoise_SentToFriend() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'From' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Your address seems to be incorrect.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				} else if ( xmlHttp.responseText == 'To' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Your friends address seems to be incorrect.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				} else {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("send_button").style.visibility = "hidden";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #66cc00; background: #ccff99 url(images/alert_green.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #66cc00;">Your mail was sent.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				}
			}
		}
	}

	function CityNoise_send_trip_to_friend() {

		var get_from = document.frm_cn_sendtofriend.frm_send_from.value;
		var get_to = document.frm_cn_sendtofriend.frm_send_to.value;

		var get_venue_ID = document.frm_cn_sendtofriend.frm_venue_id.value;
		var get_kind = document.frm_cn_sendtofriend.frm_venue_kind.value

		var get_user = document.frm_cn_sendtofriend.frm_send_user_ID.value;
		var get_user_name = document.frm_cn_sendtofriend.frm_sender_name.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise_SentToFriend;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_sendtriptofriend.php?from=" + get_from + "&to=" + get_to + "&venue=" + get_venue_ID + "&kind=" + get_kind + "&user=" + get_user + "&user_name=" + get_user_name, true);
		xmlHttp.send(null);		
	}

	function CityNoise_send_event_to_friend() {
		var get_from = document.frm_cn_sendtofriend.frm_send_from.value;
		var get_to = document.frm_cn_sendtofriend.frm_send_to.value;

		var get_event_ID = document.frm_cn_sendtofriend.frm_event_id.value;

		var get_user = document.frm_cn_sendtofriend.frm_send_user_ID.value;
		var get_user_name = document.frm_cn_sendtofriend.frm_sender_name.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputCityNoise_SentToFriend;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_sendeventtofriend.php?from=" + get_from + "&to=" + get_to + "&event=" + get_event_ID + "&user=" + get_user + "&user_name=" + get_user_name, true);
		xmlHttp.send(null);		
	}

	function outputCityNoise_SentToFriend() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'From' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Your address seems to be incorrect.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				} else if ( xmlHttp.responseText == 'To' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Your friends address seems to be incorrect.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				} else {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("send_button").style.visibility = "hidden";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #66cc00; background: #ccff99 url(images/alert_green.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #66cc00;">Your mail was sent.</div>';
					document.getElementById("indicator_search").style.visibility = "hidden";
				}
			}
		}
	}


	/* **********************************
	
		Classifieds Ajax Functions
		
	********************************** */
	
	function selectClassifiedsSubMenu() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_category = document.frm_classified.frm_classcat.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputClassifieds_SubMenu;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_classifieds_submenu.php?cat=" + get_category, true);
		xmlHttp.send(null);
	}

	function outputClassifieds_SubMenu() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("pageholder").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	//Show hidden formfield for custom city	
	
	function ShowOtherCity() {
		var get_city = document.frm_classified.frm_city.value;

		if ( get_city == 'none' ) {
			document.getElementById("CustomCity").style.display = "block";
		} else {
			document.getElementById("CustomCity").style.display = "none";
		}
	}
	
	function ShowOtherCityProps() {
		document.getElementById("indicator_search").style.visibility = "visible";
		var get_city = document.frm_classified.frm_city.value;

		if ( get_city == 'none' ) {
			document.getElementById("CustomCity").style.display = "block";
			document.getElementById("Country").style.display = "block";
			document.getElementById("CityArea").style.display = "block";
			document.getElementById("known_city").style.display = "none";
			document.getElementById("known_city").value = "";
			document.getElementById("indicator_search").style.visibility = "hidden";
		} 
		
		if ( get_city != 'none' && get_city != '' ) {
			createXMLHttpRequest();
			xmlHttp.onreadystatechange = outputClassifieds_SubProps;
			xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_classifieds_sub_props.php?city_id=" + get_city, true);
			xmlHttp.send(null);
		}

	}
	
	function outputClassifieds_SubProps() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("CustomCity").style.display = "none";
				document.getElementById("Country").style.display = "none";
				document.getElementById("CityArea").style.display = "none";
				document.getElementById("known_city").style.display = "block";
				document.getElementById("known_city").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function ShowOtherCityProps_profile(city_area) {
		document.getElementById("indicator_search").style.visibility = "visible";
		var get_city = document.frm_register.frm_city.value;
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputClassifieds_SubProps_profile;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_classifieds_sub_props_profile.php?city_id=" + get_city + "&area=" + city_area, true);
		xmlHttp.send(null);
	}
	
	function outputClassifieds_SubProps_profile() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("known_city").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}
	
	//Show Catgories on class_list page - search form.
	
	function ClassListType() {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		var get_type = document.frm_class_search.f_type.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputClassifieds_ClassListType;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_classifieds_getType.php?type=" + get_type, true);
		xmlHttp.send(null);	
	}

	function outputClassifieds_ClassListType() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("class_list_cat").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function ClassSearchCity() {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		var get_city = document.frm_class_search.frm_city.value;
		var get_type = document.frm_class_search.frm_type.value;
		var get_class = document.frm_class_search.frm_category.value;
		var get_searchword = document.frm_class_search.frm_searchword.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputClassifieds_ClassSearch;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_classifieds_search.php?searchword=" + get_searchword + "&type=" + get_type + "&city=" + get_city + "&class=" + get_class, true);
		xmlHttp.send(null);	
	}
	
	function outputClassifieds_ClassSearch() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("main_classifieds").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function classifieds_all(id) {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = outputClassifieds_Part;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_classifieds_show_part.php?part=" + id, true);
		xmlHttp.send(null);	
	}
	
	function outputClassifieds_Part() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("main_classifieds").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}


	/* **********************************
	
		PUBLIC VENUE FUNCTIONS !!!
		
	********************************** */
	
	/* **********************************
	
		Venue Review Ajax Functions
		
	********************************** */
	

	function ReviewEnter() {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		var get_user_id = document.frm_review.frm_user_id.value;
		var get_venue_id = document.frm_review.frm_venue_id.value;
		var get_venue_kind = document.frm_review.frm_venue_kind.value;
		var get_review_text = document.frm_review.frm_review_text.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ReviewOutput;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_review_add.php?review=" + get_review_text + "&user=" + get_user_id + "&venue=" + get_venue_id + "&kind=" + get_venue_kind, true);
		xmlHttp.send(null);	
	}
	
	function ReviewOutput() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("review_box").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function ReviewEnterTrip() {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		var get_user_id = document.frm_review.frm_user_id.value;
		var get_venue_id = document.frm_review.frm_venue_id.value;
		var get_review_text = document.frm_review.frm_review_text.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ReviewOutputTrip;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_review_add_trip.php?review=" + get_review_text + "&user=" + get_user_id + "&venue=" + get_venue_id, true);
		xmlHttp.send(null);	
	}
	
	function ReviewOutputTrip() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("review_box").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	/* **********************************
	
		Venue Review Ajax Functions
		
	********************************** */
	

	function ReviewEventEnter() {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		var get_user_id = document.frm_review.frm_user_id.value;
		var get_event_id = document.frm_review.frm_event_id.value;
		var get_review_text = document.frm_review.frm_review_text.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ReviewEventOutput;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_review_enter_add.php?review=" + get_review_text + "&user=" + get_user_id + "&event=" + get_event_id, true);
		xmlHttp.send(null);	
	}
	
	function ReviewEventOutput() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("review_box").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	/* **********************************
	
		Add To Favourites 
		
	********************************** */

	function AddToFavourites(user, venue, kind) {
		document.getElementById("indicator_search").style.visibility = "visible";
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = AddToFavouritesOutput;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_favourites_add.php?user=" + user + "&venue=" + venue + "&kind=" + kind + "&like=yes", true);
		xmlHttp.send(null);
	}
	
	function AddToFavouritesOutput() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("addtofavourites").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function AddToFavouritesNeg(user, venue, kind, like) {
		document.getElementById("indicator_search").style.visibility = "visible";
		createXMLHttpRequest();
		
		xmlHttp.onreadystatechange = AddToFavouritesOutputNeg;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_favourites_add_myct.php?user=" + user + "&venue=" + venue + "&kind=" + kind + "&like=" + like, true);
		xmlHttp.send(null);
	}
	
	function AddToFavouritesOutputNeg() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("addedstuff").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function attend_event(user, event) {
		document.getElementById("indicator_search").style.visibility = "visible";

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = AttendEventOutput;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_favourites_event.php?user=" + user + "&event=" + event, true);
		xmlHttp.send(null);
	}
	
	function AttendEventOutput() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("going_event").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function attend_event_myct(user, event) {
		document.getElementById("indicator_search").style.visibility = "visible";

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = AttendEventOutputMyCT;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_favourites_event_myct.php?user=" + user + "&event=" + event, true);
		xmlHttp.send(null);
	}
	
	function AttendEventOutputMyCT() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("addedstuff").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}


	/* **********************************
	
		Show Functions VENUES
		
	********************************** */
	
	function show_stuff(venue, kind, what, user) {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ShowVenueSomething;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_show_stuff.php?what=" + what + "&venue=" + venue + "&kind=" + kind + "&user=" + user, true);
		xmlHttp.send(null);
	}
	
	function ShowVenueSomething() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("review_box").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function show_stuff_events(event, what) {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ShowVenueSomething;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_show_stuff_event.php?what=" + what + "&event=" + event, true);
		xmlHttp.send(null);
	}
	
	function ShowVenueSomething() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("review_box").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	/* **********************************
	
		Show Functions PEOPLE
		
	********************************** */
	
	function show_stuff_people(person, what) {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ShowPeopleSomething;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_show_stuff_people.php?what=" + what + "&person=" + person, true);
		xmlHttp.send(null);
	}
	
	function ShowPeopleSomething() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("review_box").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	/* **********************************
	
		Show Functions TRIPS
		
	********************************** */
	
	function show_stuff_trip(trip, what) {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ShowTripSomething;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_show_stuff_trip.php?what=" + what + "&trip=" + trip, true);
		xmlHttp.send(null);
	}
	
	function ShowTripSomething() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("review_box").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	/* **********************************
	
		SEND MAIL
		
	********************************** */
	
	function send_mail() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_target = document.mail_form.frm_to.value;
		var get_subject = document.mail_form.frm_subject.value;
		var get_text = document.mail_form.frm_text.value;

		if (document.mail_form.frm_sendtoself.value == 'on') {
			var get_self = 'on';
		} else {
			var get_self = 'off';
		}

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = SendMailResult;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_send_mail.php?target=" + get_target + "&subject=" + get_subject + "&text=" + get_text + "&sendtoself=" + get_self, true);
		xmlHttp.send(null);
	}
	
	function SendMailResult() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("mail_part").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function send_mail_reply() {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		var get_target = document.mail_reply.frm_to.value;
		var get_subject = document.mail_reply.frm_subject.value;
		var get_text = document.mail_reply.frm_text.value;
		var get_orig = document.mail_reply.frm_orig.value;
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = SendMailReplyResult;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_send_mail_reply.php?target=" + get_target + "&subject=" + get_subject + "&text=" + get_text + "&orig=" + get_orig, true);
		xmlHttp.send(null);
	}
	
	function SendMailReplyResult() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("mail_part_reply").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	/* **********************************
	
		INVITE FRIENDS
		
	********************************** */
	
	function send_invites(page) {
	
		document.getElementById("indicator_search").style.visibility = "visible";
		
		if ( document.invite_friends.email_1.value != '' ) {
			var get_address_1 = document.invite_friends.email_1.value;
			var get_name_1 = document.invite_friends.first_name_1.value;
			var get_lastname_1 = document.invite_friends.last_name_1.value;
			var user_1 = get_address_1 + "@@@" + get_name_1 + "@@@" + get_lastname_1;
		}
		if ( document.invite_friends.email_2.value != '' ) {
			var get_address_2 = document.invite_friends.email_2.value;
			var get_name_2 = document.invite_friends.first_name_2.value;
			var get_lastname_2 = document.invite_friends.last_name_2.value;
			var user_2 = get_address_2 + "@@@" + get_name_2 + "@@@" + get_lastname_2;
		}
		if ( document.invite_friends.email_3.value != '' ) {
			var get_address_3 = document.invite_friends.email_3.value;
			var get_name_3 = document.invite_friends.first_name_3.value;
			var get_lastname_3 = document.invite_friends.last_name_3.value;
			var user_3 = get_address_3 + "@@@" + get_name_3 + "@@@" + get_lastname_3;
		}
		if ( document.invite_friends.email_4.value != '' ) {
			var get_address_4 = document.invite_friends.email_4.value;
			var get_name_4 = document.invite_friends.first_name_4.value;
			var get_lastname_4 = document.invite_friends.last_name_4.value;
			var user_4 = get_address_4 + "@@@" + get_name_4 + "@@@" + get_lastname_4;
		}
		if ( document.invite_friends.email_5.value != '' ) {
			var get_address_5 = document.invite_friends.email_5.value;
			var get_name_5 = document.invite_friends.first_name_5.value;
			var get_lastname_5 = document.invite_friends.last_name_5.value;
			var user_5 = get_address_5 + "@@@" + get_name_5 + "@@@" + get_lastname_5;
		}

		if ( page == 'normal' ) {
			var get_body_text = document.invite_friends.frm_mail_body.value;

			if (document.invite_friends.frm_remind.value == 'on') {
				var get_reminder = 'on';
			} else {
				var get_reminder = 'off';
			}

			createXMLHttpRequest();
			xmlHttp.onreadystatechange = SendInvites;
			xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_send_invites.php?body=" + escape(get_body_text) + "&reminder=" + get_reminder + "&user_1=" + user_1 + "&user_2=" + user_2 + "&user_3=" + user_3 + "&user_4=" + user_4 + "&user_5=" + user_5 + "&page=" + page, true);
			xmlHttp.send(null);
		} else {
			createXMLHttpRequest();
			xmlHttp.onreadystatechange = SendInvites;
			xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_send_invites.php?user_1=" + user_1 + "&user_2=" + user_2 + "&user_3=" + user_3 + "&user_4=" + user_4 + "&user_5=" + user_5 + "&page=" + page, true);
			xmlHttp.send(null);		
		}
	}
	
	function SendInvites() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("invite_box").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function invite_friends_button() {
		document.form_import.action = "invite_list.php";
		document.form_import.submit();
	}

	/* **********************************
	
		PUBLIC PROFILE FUNCTIONS !!!
		
	********************************** */
	
	/* **********************************
	
		Person Comment Ajax Functions
		
	********************************** */

	function CommentEnter() {
		document.getElementById("indicator_search").style.visibility = "visible";
	
		var get_source_id = document.frm_comment.frm_source_id.value;
		var get_target_id = document.frm_comment.frm_target_id.value;
		var get_comment_text = document.frm_comment.frm_comment_text.value;
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = CommentOutput;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_comment_add.php?comment=" + get_comment_text + "&source=" + get_source_id + "&target=" + get_target_id + "&what=comments", true);
		xmlHttp.send(null);	
	}
	
	function CommentOutput() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("profile_main").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}
	
	/* **********************************
	
		ADD TO FRIEND
		
	********************************** */

	function add_to_friends(user_id) {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = AddFriend;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_add_friend.php?friend=" + user_id, true);
		xmlHttp.send(null);
	}
	
	function AddFriend() {
		document.getElementById("friend_addition").innerHTML = 'Pending friend request';
		document.getElementById("indicator_search").style.visibility = "hidden";
	}

	function add_to_friends_myct(user_id) {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = AddFriendMyct;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_add_friend_myct.php?friend=" + user_id, true);
		xmlHttp.send(null);
	}
	
	function AddFriendMyct() {
		document.getElementById("addedstuff").innerHTML = xmlHttp.responseText;
		document.getElementById("indicator_search").style.visibility = "hidden";
	}
	

	/* **********************************
	
		ADD VENUE / EVENT
		
	********************************** */

	//City Area stuff
	function check_city() {
		var get_city = document.enter_venue.frm_city.value;
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showCityArea;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_city.php?city=" + get_city, true);
		xmlHttp.send(null);
	}

	function showCityArea() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'no_country' ) {
					document.getElementById("city_area").innerHTML = '<select name="frm_city_area"><option value="none">-- Select City Area --</option></select>';
				} else {
					document.getElementById("city_area").innerHTML = xmlHttp.responseText;
				}
			}
		}
	}
	
	function show_stuff_enter_venue(param) {
		document.getElementById("indicator_search").style.visibility = "visible";

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ShowVenueEnterSomething;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_show_stuff_enter_venue.php?what=" + param, true);
		xmlHttp.send(null);
	}
	
	function ShowVenueEnterSomething() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("main_space").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function add_main_tag(param) {
		var get_main_tags = document.enter_venue.check_main.value;
		if ( get_main_tags.match('-' + param + '-') == '-' + param + '-' ) {
			document.enter_venue.check_main.value = get_main_tags.replace('-' + param + '-', '-');
		} else {
			document.enter_venue.check_main.value = get_main_tags + param + '-';
		}
	}

	function add_loc_tag(param) {
		var get_loc_tags = document.enter_venue.check_loc.value;
		if ( get_loc_tags.match('-' + param + '-') == '-' + param + '-' ) {
			document.enter_venue.check_loc.value = get_loc_tags.replace('-' + param + '-', '-');
		} else {
			document.enter_venue.check_loc.value = get_loc_tags + param + '-';
		}
	}

	function check_venue_entry() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_venue_name = document.enter_venue.frm_venue_name.value;
		var get_city = document.enter_venue.frm_city.value;
		var get_city_area = document.enter_venue.frm_city_area.value;
		var get_main_tags = document.enter_venue.check_main.value;
		var get_loc_tags = document.enter_venue.check_loc.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ShowVenueEnterCheck;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_check_enter_venue.php?main=" + get_main_tags + "&loc=" + get_loc_tags + "&venue=" + get_venue_name + "&city=" + get_city + "&city_area=" + get_city_area, true);
		xmlHttp.send(null);
	}
	
	function ShowVenueEnterCheck() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'true' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Please fill out all mandatory fields.</div>';
				} else {
					document.enter_venue.action = "add_venue_step2.php";
					document.enter_venue.submit();
				}
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function check_venue_entry2() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_venue_name = document.enter_venue.frm_venue_name.value;
		var get_city = document.enter_venue.frm_city.value;
		var get_city_area = document.enter_venue.frm_city_area.value;
		var get_main_tags = document.enter_venue.check_main.value;
		var get_loc_tags = document.enter_venue.check_loc.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ShowVenueEnterCheck2;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_check_enter_venue.php?main=" + get_main_tags + "&loc=" + get_loc_tags + "&venue=" + get_venue_name + "&city=" + get_city + "&city_area=" + get_city_area, true);
		xmlHttp.send(null);
	}
	
	function ShowVenueEnterCheck2() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'true' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Please fill out all mandatory fields.</div>';
					document.getElementById("name").innerHTML = '<font color="red"><b>Name of Place</b></font>';
					document.getElementById("city_area_name").innerHTML = '<font color="red"><b>City Area</b></font>';
					document.getElementById("city_name").innerHTML = '<font color="red"><b>City</b></font>';
					document.getElementById("main_tags_name").innerHTML = '<font color="red"><b>Main Tags</b></font>';
					document.getElementById("loc_tags_name").innerHTML = '<font color="red"><b>Location Tags</b></font>';
				} else {
					document.enter_venue.action = "add_event_step3b.php";
					document.enter_venue.submit();
				}
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	function check_event_entry() {

		document.getElementById("indicator_search").style.visibility = "visible";

		var get_event_name = document.enter_venue.frm_event_name.value;
		var get_main_tags = document.enter_venue.check_main.value;
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ShowEventEnterCheck;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_check_enter_event.php?main=" + get_main_tags + "&event=" + get_event_name, true);
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.send(null);
	}
	
	function ShowEventEnterCheck() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'FALSE' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Please fill out all mandatory fields.</div>';
				} else {
					document.enter_venue.action = "add_event_step2.php";
					document.enter_venue.submit	();
				}
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}

	//Return Venues ...
	function return_venues() {
	
		var get_string = document.searchVenues.frm_string.value;
		var get_event = document.searchVenues.frm_event.value;

		createXMLHttpRequest();

		xmlHttp.onreadystatechange = showVenues;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_search_venues.php?string=" + get_string + "&event=" + get_event, true);
		xmlHttp.send(null);
	}

	function showVenues() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("Return_field").style.visibility = "visible";
				document.getElementById("Return_field").innerHTML = xmlHttp.responseText;
			}
		}
	}	

	function AttachVenue(venue, event) {
		createXMLHttpRequest();

		xmlHttp.onreadystatechange = AttachVenueReturn;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_attach_venues.php?venue=" + venue + "&event=" + event, true);
		xmlHttp.send(null);
	}

	function AttachVenueReturn() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("Return_field").style.visibility = "visible";
				document.getElementById("Return_field").innerHTML = xmlHttp.responseText;
			}
		}
	}
	
	function change_trip_city() {
		var get_city = document.frm_create_trip.frm_trip_city.value;

		if ( get_city == "none" ) {
			document.getElementById("trip_otherCity").style.visibility = "visible";
		} else {
			document.getElementById("trip_otherCity").style.visibility = "hidden";
		}
	}
	
	/* **********************************
	
		Create Trip.
		
	********************************** */

	function add_main_tag_trip(param) {
		var get_main_tags = document.frm_create_trip.check_main.value;
		if ( get_main_tags.match('-' + param + '-') == '-' + param + '-' ) {
			document.frm_create_trip.check_main.value = get_main_tags.replace('-' + param + '-', '-');
		} else {
			document.frm_create_trip.check_main.value = get_main_tags + param + '-';
		}
	}

	function create_trip() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_name = document.frm_create_trip.frm_trip_name.value;
		var get_tags = document.frm_create_trip.check_main.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showEntertrip;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_enter_trips.php?tags=" + get_tags + "&name=" + get_name, true);
		xmlHttp.send(null);
	}

	function showEntertrip() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("indicator_search").style.visibility = "hidden";
				if ( xmlHttp.responseText == 'FALSE' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Please fill out all mandatory fields.</div>';
					document.getElementById("trip_name").innerHTML = '<label for="p-tripname"><font color="red"><b>Name your trip</b></font></label>';
					document.getElementById("trip_going").innerHTML = '<font color="red"><b><label for="p-direction">Where are you going?</label></b></font>';
					document.getElementById("trip_reason").innerHTML = '<font color="red"><b><label>Reason for trip</label></b></font>';
				} else {
					document.frm_create_trip.action = "trip_create_invite.php";
					document.frm_create_trip.submit();
				}

			}
		}
	}

	function edit_trip() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_name = document.frm_create_trip.frm_trip_name.value;
		var get_tags = document.frm_create_trip.check_main.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showEdittrip;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_enter_trips.php?tags=" + get_tags + "&name=" + get_name, true);
		xmlHttp.send(null);
	}

	function showEdittrip() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("indicator_search").style.visibility = "hidden";
				if ( xmlHttp.responseText == 'true' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Please fill out all mandatory fields.</div>';
				} else {
					document.frm_create_trip.action = "trip_overview.php";
					document.frm_create_trip.submit();
				}

			}
		}
	}
	
	function create_trip_edit() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_name = document.frm_create_trip.frm_trip_name.value;
		var get_tags = document.frm_create_trip.check_main.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showEntertrip_edit;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_enter_trips.php?tags=" + get_tags + "&name=" + get_name, true);
		xmlHttp.send(null);
	}

	function showEntertrip_edit() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("indicator_search").style.visibility = "hidden";
				if ( xmlHttp.responseText == 'true' ) {
					document.getElementById("errorbox").style.visibility = "visible";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Please fill out all mandatory fields.</div>';
					document.getElementById("trip_name").innerHTML = '<label for="p-tripname"><font color="red"><b>Name your trip</b></font></label>';
					document.getElementById("trip_going").innerHTML = '<font color="red"><b><label for="p-direction">Where are you going?</label></b></font>';
					document.getElementById("trip_reason").innerHTML = '<font color="red"><b><label>Reason for trip</label></b></font>';
				} else {
					document.frm_create_trip.action = "trip_create_invite.php";
					document.frm_create_trip.submit();
				}
			}
		}
	}
	
	/* **********************************
	
		INDEX PAGE STUFF
		
	********************************** */
	
	function show_tag_line_city() {

		var get_city = document.frm_index.frm_city.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showIndexTag;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_index_tag.php?city=" + get_city, true);
		xmlHttp.send(null);
	}

	function showIndexTag() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("tag_line_city").innerHTML = xmlHttp.responseText;
			}
		}
	}

	/* **********************************
	
		ADD SUB TAGS EVENT PAGE
		
	********************************** */
	
	function add_sub_tag_event() {

		var get_tag = document.frm_tags.frm_sub_tag_name.value;
		var get_event = document.frm_tags.frm_sub_tag_event_ID.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showPublicEventSubTag;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_add_sub_tag_event.php?tag=" + get_tag + "&event=" + get_event, true);
		xmlHttp.send(null);
	}

	function showPublicEventSubTag() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("sub_tags_venue").innerHTML = xmlHttp.responseText;
			}
		}
	}

	/* **********************************
	
		ADD SUB TAGS TRIP PAGE
		
	********************************** */

	function add_sub_tag_trips() {
		var get_tag = document.frm_tags.frm_sub_tag_name.value;
		var get_trip = document.frm_tags.frm_sub_tag_trip_ID.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showPublicTripSubTag;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_add_sub_tag_trip.php?tag=" + get_tag + "&trip=" + get_trip, true);
		xmlHttp.send(null);
	}

	function showPublicTripSubTag() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("sub_tags_trip").innerHTML = xmlHttp.responseText;
			}
		}
	}

	/* **********************************
	
		ADD SUB TAGS VENUE PAGE
		
	********************************** */
	
	function add_sub_tag() {

		var get_tag = document.frm_tags.frm_sub_tag_name.value;
		var get_venue = document.frm_tags.frm_sub_tag_venue_ID.value;
		var get_kind = document.frm_tags.frm_sub_tag_venue_kind.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showPublicVenueSubTag;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_add_sub_tag.php?tag=" + get_tag + "&venue=" + get_venue + "&kind=" + get_kind, true);
		xmlHttp.send(null);
	}

	function showPublicVenueSubTag() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("sub_tags_venue").innerHTML = xmlHttp.responseText;
			}
		}
	}

	/* **********************************
	
		ADVANCED SEARCHES
		
	********************************** */
		
	function places_adv_search() {
	
		document.getElementById("indicator_search").style.visibility = "visible";
	
		var output = "-";
		
		for (i=0; i < document.getElementById("multiple").length; i++) {
			if (document.getElementById("multiple").options[i].selected == true) {
				output += document.getElementById("multiple").options[i].value + "-";
			}
		}

		len = document.frm_search_places_advanced.frm_sex.length;

		for (i = 0; i < len; i++) {
			if (document.frm_search_places_advanced.frm_sex[i].checked) {
				get_sex = document.frm_search_places_advanced.frm_sex[i].value
			}
		}

		get_start_age = document.frm_search_places_advanced.age_from.value;
		get_stop_age = document.frm_search_places_advanced.age_to.value;
		get_city_area_id = document.frm_search_places_advanced.frm_city_area.value;

		get_city_id = document.frm_global_search.frm_city_id.value;
		get_free_text = document.frm_global_search.frm_free_text.value;

		if ( document.getElementById("frm_hotels").checked ) {
			get_hotels = 'on';
		} else {
			get_hotels = 'off';
		}
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showAdvSearchPlaces;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_adv_search.php?hotels=" + get_hotels + "&area=" + get_city_area_id + "&sex=" + get_sex + "&free_text=" + get_free_text + "&city=" + get_city_id + "&start_age=" + get_start_age + "&stop_age=" + get_stop_age + "&main_tags=" + output, true);
		xmlHttp.send(null);
	}

	function showAdvSearchPlaces() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("search_result").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
				document.frm_global_search.frm_free_text.focus();
			}
		}
	}

	function people_adv_search() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var output = "-";

		for (i=0; i < document.getElementById("multiple").length; i++) {
			if (document.getElementById("multiple").options[i].selected == true) {
				output += document.getElementById("multiple").options[i].value + "-";
			}
		}

		len = document.frm_search_people_advanced.frm_sex.length;

		for (i = 0; i < len; i++) {
			if (document.frm_search_people_advanced.frm_sex[i].checked) {
				get_sex = document.frm_search_people_advanced.frm_sex[i].value
			}
		}

		len = document.frm_search_people_advanced.what_people.length;

		for (j = 0; j < len; j++) {
			if (document.frm_search_people_advanced.what_people[j].checked) {
				get_what = document.frm_search_people_advanced.what_people[j].value
			}
		}

		get_start_age = document.frm_search_people_advanced.age_from.value;
		get_stop_age = document.frm_search_people_advanced.age_to.value;

		get_city_id = document.frm_global_search.frm_city_id.value;
		get_free_text = document.frm_global_search.frm_free_text.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showAdvSearchPeople;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_adv_search_people.php?get_what=" + get_what + "&sex=" + get_sex + "&free_text=" + get_free_text + "&city=" + get_city_id + "&start_age=" + get_start_age + "&stop_age=" + get_stop_age + "&main_tags=" + output, true);
		xmlHttp.send(null);
	}

	function showAdvSearchPeople() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("search_result").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
				document.frm_global_search.frm_free_text.focus();
			}
		}
	}

	function event_adv_search() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var output = "-";

		for (i=0; i < document.getElementById("multiple").length; i++) {
			if (document.getElementById("multiple").options[i].selected == true) {
				output += document.getElementById("multiple").options[i].value + "-";
			}
		}


		len = document.frm_search_events_advanced.frm_sex.length;

		for (i = 0; i < len; i++) {
			if (document.frm_search_events_advanced.frm_sex[i].checked) {
				get_sex = document.frm_search_events_advanced.frm_sex[i].value
			}
		}

		get_start_age = document.frm_search_events_advanced.age_from.value;
		get_stop_age = document.frm_search_events_advanced.age_to.value;

		get_start_month = document.frm_search_events_advanced.month_start.value;
		get_start_day = document.frm_search_events_advanced.day_start.value;
		get_start_year = document.frm_search_events_advanced.year_start.value;
		get_stop_month = document.frm_search_events_advanced.month_stop.value;
		get_stop_day = document.frm_search_events_advanced.day_stop.value;
		get_stop_year = document.frm_search_events_advanced.year_stop.value;

		get_added = document.frm_search_events_advanced.frm_added.value;

		get_city_id = document.frm_global_search.frm_city_id.value;
		get_free_text = document.frm_global_search.frm_free_text.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showAdvSearchEvent;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_adv_search_event.php?main_tags=" + output + "&sex=" + get_sex + "&start_age=" + get_start_age + "&stop_age=" + get_stop_age + "&start_month=" + get_start_month + "&start_day=" + get_start_day + "&start_year=" + get_start_year + "&stop_month=" + get_stop_month + "&stop_day=" + get_stop_day + "&stop_year=" + get_stop_year + "&added=" + get_added + "&city_id=" + get_city_id + "&free_text=" + get_free_text, true);
		xmlHttp.send(null);
	}

	function showAdvSearchEvent() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("search_result").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
				document.frm_global_search.frm_free_text.focus();
			}
		}
	}

	function trip_adv_search() {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		var output = "-";

		for (i=0; i < document.getElementById("multiple").length; i++) {
			if (document.getElementById("multiple").options[i].selected == true) {
				output += document.getElementById("multiple").options[i].value + "-";
			}
		}

		len = document.frm_search_trip_advanced.frm_sex.length;

		for (i = 0; i < len; i++) {
			if (document.frm_search_trip_advanced.frm_sex[i].checked) {
				get_sex = document.frm_search_trip_advanced.frm_sex[i].value
			}
		}

		get_start_age = document.frm_search_trip_advanced.age_from.value;
		get_stop_age = document.frm_search_trip_advanced.age_to.value;

		get_city_id = document.frm_global_search.frm_city_id.value;
		get_free_text = document.frm_global_search.frm_free_text.value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showAdvSearchTrip;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_adv_search_trip.php?sex=" + get_sex + "&free_text=" + get_free_text + "&city=" + get_city_id + "&start_age=" + get_start_age + "&stop_age=" + get_stop_age + "&main_tags=" + output, true);
		xmlHttp.send(null);

	}

	function showAdvSearchTrip() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("search_result").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
				document.frm_global_search.frm_free_text.focus();
			}
		}
	}


	function check_city_search() {
		var get_city = document.frm_global_search.frm_city_id.value;
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showCityArea_search;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_city_search.php?city=" + get_city, true);
		xmlHttp.send(null);
	}

	function showCityArea_search() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'no_country' ) {
					document.getElementById("city_area").innerHTML = '<select id="frm_city_area" name="frm_city_area"><option value="none">-- Select City Area --</option></select>';
				} else {
					document.getElementById("city_area").innerHTML = xmlHttp.responseText;
				}
				places_adv_search();
			}
		}
	}
	
	function check_city_search_events() {
		var get_city = document.frm_global_search.frm_city_id.value;
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = showCityArea_search_events;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_city_search_events.php?city=" + get_city, true);
		xmlHttp.send(null);
	}

	function showCityArea_search_events() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'no_country' ) {
					document.getElementById("city_area").innerHTML = '<select id="frm_city_area" name="frm_city_area"><option value="none">-- Select City Area --</option></select>';
				} else {
					document.getElementById("city_area").innerHTML = xmlHttp.responseText;
				}
				event_adv_search();
			}
		}
	}
	
	/* **********************************
	
		My CT functions
		
	********************************** */
	
	function accept_friend(id, kind) {
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = MyCT_accept_friends;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_accept_friend.php?id=" + id + "&kind=" + kind, true);
		xmlHttp.send(null);	
	}
	
	function MyCT_accept_friends() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("myct_invite").innerHTML = xmlHttp.responseText;
			}
		}
	}

	function accept_trip(id, kind) {
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = MyCT_accept_trip;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_accept_trip.php?id=" + id + "&kind=" + kind, true);
		xmlHttp.send(null);	
	}
	
	function MyCT_accept_trip() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("myct_trip_invite").innerHTML = xmlHttp.responseText;
			}
		}
	}


	function change_recommend(kind) {
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ChangeRecommend;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_change_recommend.php?kind=" + kind, true);
		xmlHttp.send(null);	
	}

	function ChangeRecommend() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("recommend").innerHTML = xmlHttp.responseText;
			}
		}
	}


	/* **********************************
	
		My CT functions
		
	********************************** */

	function check_nickname() {
		var get_nick = document.getElementById("p-nickname").value;
	
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = ChangeCheckNickname;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_check_nickname.php?nick=" + get_nick, true);
		xmlHttp.send(null);	
	}

	function ChangeCheckNickname() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'False' ) {
					document.getElementById("nickname_check").innerHTML = '&nbsp;&nbsp;<font color="#00dd00">Free</font>';
				} else if ( xmlHttp.responseText == 'Nothing' ) {
					document.getElementById("nickname_check").innerHTML = '&nbsp;&nbsp;';				
				} else {
					document.getElementById("nickname_check").innerHTML = '&nbsp;&nbsp;<font color="#dd0000">Taken</font>';	
				}
			}
		}
	}
	
	function header_search() {
		var output = "-";

		for (i=0; i < document.getElementById("multiple").length; i++) {
			if (document.getElementById("multiple").options[i].selected == true) {
				output += document.getElementById("multiple").options[i].value + "-";
			}
		}
		document.getElementById("frm_tags_hidden").value = output;
		
	}

	function AddBlogComment() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_user_ID = document.getElementById("frm_user_id").value;
		var get_blog_ID = document.getElementById("frm_blog_id").value;
		var get_comment = document.getElementById("frm_comment").value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = OutputBlogComment;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_add_blog_comment.php?user=" + get_user_ID + "&blog=" + get_blog_ID + "&comment=" + get_comment, true);
		xmlHttp.send(null);	
	}
	
	function OutputBlogComment() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("blog_comments").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}
	
	function reset_field(form_field) {
		document.getElementById(form_field).value = '';
	}
	
	function send_message() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_sender = document.getElementById("mail_sender").value;
		var get_receiver = document.getElementById("mail_receiver").value;
		var get_title = document.getElementById("mail_title").value;
		var get_text = document.getElementById("mail_text").value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = OutputSendMessage;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_send_message.php?sender=" + get_sender + "&receiver=" + get_receiver + "&title=" + get_title + "&message=" + get_text, true);
		xmlHttp.send(null);	
	}
	
	function OutputSendMessage() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'ok' ) {
					document.getElementById("indicator_search").style.visibility = "hidden";
					document.getElementById("mail_button").style.display = "none";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #66cc00; background: #ccff99 url(images/alert_green.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #66cc00;">Your mail was sent.</div>';
				} else {
					document.getElementById("indicator_search").style.visibility = "hidden";
					document.getElementById("errorbox").innerHTML = '<div style="font-size: 0.9em; color: #cc0000; background: #ffcccc url(images/alert_red.gif) no-repeat left center; width: 250px; margin: 10px 0 10px 0; padding: 5px 0 5px 30px; border: 1px solid #cc0000;">Please fill out all fields.</div>';
				}
			}
		}
	}
	
	function save_trip() {
		document.getElementById("indicator_search").style.visibility = "visible";

		var get_trip = document.getElementById("frm_trip_id").value;
		var get_kind = document.getElementById("frm_trip_kind").value;
		var get_id = document.getElementById("frm_trip_place_id").value;
				
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = OutputSavetrip;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_attach_trip.php?trip=" + get_trip + "&kind=" + get_kind + "&id=" + get_id, true);
		xmlHttp.send(null);	
	}
	
	function OutputSavetrip() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("trip_stuff").innerHTML = xmlHttp.responseText;
				document.getElementById("indicator_search").style.visibility = "hidden";
			}
		}
	}
	
	function check_name_venue() {
		document.getElementById("indicator_search").style.visibility = "visible";
		
		var get_name = document.getElementById("a-placename").value;
		
		createXMLHttpRequest();
		xmlHttp.onreadystatechange = OutputCheckNameVenue;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_check_name_venue.php?name=" + get_name, true);
		xmlHttp.send(null);	
	}

	function OutputCheckNameVenue() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText != 'none' ) {
					document.getElementById("selfcheck").style.visibility = "visible";
					document.getElementById("selfcheck").innerHTML = xmlHttp.responseText;
					document.getElementById("indicator_search").style.visibility = "hidden";
				} else {
					document.getElementById("selfcheck").style.visibility = "hidden";
					document.getElementById("indicator_search").style.visibility = "hidden";
				}
			}
		}
	}
	
	function check_name_event() {
	
		var get_name = document.getElementById("frm_event_name_id").value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = OutputCheckNameEvent;
		xmlHttp.open("GET","http://www.citytherapy.com/back/ajax/ajax_check_name_event.php?name=" + get_name, true);
		xmlHttp.send(null);	
	}

	function OutputCheckNameEvent() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				if ( xmlHttp.responseText == 'empty' ) {
					document.getElementById("selfcheck_event").style.visibility = "hidden";
				} else {
					document.getElementById("selfcheck_event").style.visibility = "visible";
					document.getElementById("selfcheck_event").innerHTML = xmlHttp.responseText;				
				}
			}
		}
	}
	
	function reload_upload() {
		var get_venue = document.getElementById("frm_venue").value;
		var get_event = document.getElementById("frm_event").value;
		var get_trip = document.getElementById("frm_trip").value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = OutputReloadUpload;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_reload_upload.php?event=" + get_event + "&venue=" + get_venue + "&trip=" + get_trip, true);
		xmlHttp.send(null);	
	}

	function OutputReloadUpload() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				var test = 'ok';
			}
		}
	}
	
	function change_calendar(month, year, user, kind) {
		var get_month = month;
		var get_year = year;
		var get_user = user;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = OutputProfileCalendar;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_profile_calendar_month.php?month=" + get_month + "&year=" + get_year + "&user=" + get_user + "&kind=" + kind, true);
		xmlHttp.send(null);	
	}
	
	function OutputProfileCalendar() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("calendar").innerHTML = xmlHttp.responseText;
			}
		}
	}

	function going_there(venueID, kind) {
		var get_date = document.getElementById("orderdate").value;

		createXMLHttpRequest();
		xmlHttp.onreadystatechange = OutputGoingThere;
		xmlHttp.open("GET","http://www.citytherapy.com/ajax/ajax_going_there.php?date=" + get_date + "&venue=" + venueID + "&kind=" + kind, true);
		xmlHttp.send(null);	
	}
	
	function OutputGoingThere() {
		if ( xmlHttp.readyState == 4 ) {
			if ( xmlHttp.status == 200 ) {
				document.getElementById("going_there_result").innerHTML = xmlHttp.responseText;
			}
		}
	}