/* 
This library allows modification of HTML code that already has been send to the browser
and displayed on the screen of the end-user.  By using these functions it is possible to show complete
forms BEFORE all the data on these forms is available.  This gives the impression of a quicker response.

NOTE: The code to be modified must be marked 
      with an ANCHOR like this <a name="myName"><code to be modified...></a>
	  or with an ID like this <td id="myName"><code to be modified...></td>

Copyright 2003 by TRAVELSTREET NV, All rights reserved.
*/

var cacheGetObj = {};

function GetObj(name){
	var obj = cacheGetObj[name];
	if (typeof(obj)=="undefined") obj = cacheGetObj[name] = GetObjNow(name);
	return obj;
}

function GetObjNow(name){
	var obj = document.anchors[name];
	if (obj==null || typeof(obj)=="undefined"){
		if (document.getElementById){ //NS6+
			obj = document.getElementById(name);
		}else{ //IE4+
			obj = document.all[name];
			if ((obj==null || typeof(obj)=="undefined") && typeof(document.body)!="undefined"){
				obj = document.body.document.all[name];
			}
		}
	}
	if ((obj!=null) && (typeof(obj)!="undefined")){
		return obj;
	}else{
		//alert("GetObj('"+name+"'): Object not found!");
		return null;
	}
}

function SetFgColor(names,color){
	// Change the foreground color of an object
	names = names.split(",");
	for (var i = 0; i < names.length; i++){
		var obj = GetObj(names[i]);
		if (obj != null){
			obj.style.color = color;
		}
	}
}

function SetBgColor(names,color){
	// Change the background color of an object
	names = names.split(",");
	for (var i = 0; i < names.length; i++){
		var obj = GetObj(names[i]);
		if (obj != null){
			obj.style.backgroundColor = color;
		}
	}
}

function GetHTML(name){
	// Search and return the content of an anchor object (or empty string if the object doesn't exist)
	var obj = GetObj(name);
	if (obj!=null){
		return obj.innerHTML;
	}else{
		return "";
	}
}

function LoadHTML(names,urlname){
	var xmlhttp;
	if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}else if (window.ActiveXObject){ // code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}else{
		alert("Your browser does not support XMLHTTP!");
	}
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4 || xmlhttp.readyState == "complete"){
			SetHTML(names,xmlhttp.responseText);
		}
	}
	xmlhttp.open("GET",urlname,true);
	xmlhttp.send(null);
}

function SetHTML(names, newValue){
	// Change the text of an anchor object
	names = names.split(",");
	for (var i = 0; i < names.length; i++){
		var obj = GetObjNow(names[i]);
		if (obj != null){
			obj.innerHTML = newValue;
		}
	}
	return true;
}

function ReplaceHTML(names, oldValue, newValue){
	// Change the text of an anchor object if and only if it already contains a certain text
	names = names.split(",");
	for (var i = 0; i < names.length; i++){
		var obj = GetObj(names[i]);
		if (obj != null && obj.innerHTML.indexOf(oldValue) >= 0){
			obj.innerHTML = newValue;
		}
	}
	return true;
}

function AddHTML(names, extraValue){
	// Add extra HTML code to an anchor object
	names = names.split(",");
	for (var i = 0; i < names.length; i++){
		var obj = GetObj(names[i]);
		if (obj != null){
			obj.innerHTML = obj.innerHTML.concat(extraValue);
		}
	}
	return true;
}

function IsVisible(name){
	// returns true/false if an object is visible/invisible
	var obj = GetObj(name);
	if (obj == null || obj.style.display == "none" || obj.style.visibility == "hidden"){
		return false;
	}else{
		return true;
	}
}

function SetVisible(names, visible){
	// Hide or Show multiple object
	names = names.split(",");
	for (var i=0; i<names.length; i++){
		SetObjectVisible(GetObjNow(names[i]), visible);
	}
}

function SetObjectVisible(obj, visible){
	// Hide or Show object by direct reference (use result returned by GetObj() for this)
	if (obj != null){
		if (visible){
			obj.style.display = "";
			obj.style.visibility = "visible";
		}else{
			obj.style.display = "none";
			obj.style.visibility = "hidden";
		}
	}
}

function ToggleVisible(names){
	names = names.split(",");
	for (var i=0; i<names.length; i++){
		SetVisible(names[i], !IsVisible(names[i]));
	}
}

function TogglePanelVisible(name){
	var panelImage = GetObj(name + "_panelImage");
	if (IsVisible(name)){
		if(panelImage != undefined && panelImage != null){
			panelImage.src = panelImage.src.replace("opened", "closed");
		}
		SetVisible(name, false);
	}else{
		if(panelImage != undefined && panelImage != null){
			panelImage.src = panelImage.src.replace("closed", "opened");
		}
		SetVisible(name, true);
	}
}

function PreloadImages(names){
	// Load images upfront (HTML allows showing images before they are loaded by the browser)
	names = names.split(",");
	for (i=0; i<names.length; i++){
		var tmpimg = new Image; 
		tmpimg.src = names[i];
	}
}

function ListOr(list1, list2){ // add items of list2 to list1 (unless they are already in list1)
	var i1, i2, found;
	if (list1==""){list1 = new Array(0);}else{list1 = list1.split(',');}
	if (list2==""){list2 = new Array(0);}else{list2 = list2.split(',');}
	for (i2=0; i2<list2.length; i2++){
		for (found = false, i1=0; !found && i1<list1.length; i1++) found = (list1[i1] == list2[i2]);
		if (!found) list1[list1.length] = list2[i2];
	}
	return list1.join(',');
}

function ListExcluding(list1, list2){ // reconstruct list1 without the items that occur in list2
	var i1, i2, found, result = new Array(0);
	if (list1==""){list1 = new Array(0);}else{list1 = list1.split(',');}
	if (list2==""){list2 = new Array(0);}else{list2 = list2.split(',');}
	for (i1=0; i1<list1.length; i1++){
		for (found = false, i2=0; !found && i2<list2.length; i2++) found = (list1[i1] == list2[i2]);
		if (!found) result[result.length] = list1[i1];
	}
	return result.join(',');
}

function ListSet(list1, list2, set){
	if (set){return ListOr(list1, list2);}else{return ListExcluding(list1, list2);}
}

//Function that returns the correct top of a specific object, works cross browsers
function findPosY(obj)
{
    var nTopPos = obj.offsetTop;          		// initialize var to store calculations
    var eParElement = obj.offsetParent;     	// identify first offset parent element  
    while (eParElement != null)
    {											// move up through element hierarchy
        nTopPos += eParElement.offsetTop;		// appending top offset of each parent
        eParElement = eParElement.offsetParent;	// until no more offset parents exist
    }
    return nTopPos;								// return the number calculated
}

//Function that returns the correct top of a specific object, works cross browsers
function findPosX(obj)
{
    var nLeftPos = obj.offsetLeft;          	// initialize var to store calculations
    var eParElement = obj.offsetParent;     	// identify first offset parent element  
    while (eParElement != null)
    {											// move up through element hierarchy
        nLeftPos += eParElement.offsetLeft;		// appending left offset of each parent
        eParElement = eParElement.offsetParent;	// until no more offset parents exist
    }
    return nLeftPos;							// return the number calculated
}

// Initialize an Iframe to be used as tab-area, the Iframe must exist BEFORE calling this function
function DeclareGoTab(name, link){
	var f = GetObj(name);
	f.style.position = "absolute"; // make the iframes overlap in the place where they are created
	f.style.zIndex = 1; // make all frames "low", one of them will become "high" later to select it
	if (typeof(link) != "undefined"){ // if there was an URL for this frame
		f.src2 = link; // then remember it but don't activate it yet 
	}
}

// Bring one of the previously declared tab-frames to the surface and hide the other onces
function GoTab(name, link){
	var f = GetObj(name);
	if (typeof(f) == "undefined"){ // if no iframe exists with that name (then we are in trouble) 
		alert("frame("+name+") not found");
		return;
	}
	if (typeof(link) != "undefined"){ // if an URL was provided then (re)load this URL
		if (typeof(GoTab_loading) != "undefined"){ // if a waitmessage was defined to display during the URL-load then display it now
			if ((typeof(f.contentWindow.document.body) != "undefined") && (f.contentWindow.document.body != null)){
				f.contentWindow.document.body.innerHTML = GoTab_loading;
			}
		}
		f.src = link;
	}else if (typeof(f.src2) != "undefined"){ // if we already had an URL then activate it if this is the first time that the tab-frame is selected
		if (typeof(GoTab_loading) != "undefined"){ // if a waitmessage was defined to display during the URL-load then display it now
			if ((typeof(f.contentWindow.document.body) != "undefined") && (f.contentWindow.document.body != null)){
				f.contentWindow.document.body.innerHTML = GoTab_loading;
			}
		}
		f.src = f.src2; // goto the URL that we have stored during DeclareGoTab()
		f.src2 = undefined; // once the original URL is activated it remains active inside the frame if we goback to it later
	}
	if (typeof(activeGoTab) != "undefined"){ // if previously another tab was activate then we have to deactivate that first
		if (activeGoTab.id==name) return; // if the active tab is the one we need then there is nothing todo
		activeGoTab.style.zIndex = 1; // lower the tab-frame to make it disapear after the other tab
		if (activeGoTab.contentWindow.GoTab_OnBlur){ 
			activeGoTab.contentWindow.GoTab_OnBlur();
		}
	}
	activeGoTab = f;
	activeGoTab.style.zIndex = 2;
	// if the tab being loaded has the UpdateButtonText function (multiple search)
	// call it for the window being selected to update the texts on the button.
	// Calling this function from here avoids setting up a timer function which puts a lot of load on the CPU.
	if (activeGoTab.contentWindow.UpdateButtonText){ 
		activeGoTab.contentWindow.UpdateButtonText();
	}
	if (activeGoTab.contentWindow.GoTab_OnFocus){ 
		activeGoTab.contentWindow.GoTab_OnFocus();
	}
	activeGoTab.focus();
	//alert("GoTab "+f.id+" "+f.src);
}

// This functions makes visual elements automaticly move and resize when the browserwindow is resized
// Positive coördinates are relative to the top or left, negative coördinates are relative to right or bottom  
function AutoResize(name,top,left,bottom,right){
	var f = {};
	f.item = GetObj(name);
	f.top    = (top   ==0 ? f.item.offsetTop                     : top);
	f.left   = (left  ==0 ? f.item.offsetLeft                    : left);
	f.bottom = (bottom==0 ? f.item.offsetTop +f.item.offsetHeight: bottom);
	f.right  = (right ==0 ? f.item.offsetLeft+f.item.offsetWidth : right);
	if (typeof(AutoResize_objects) == "undefined"){ // if an URL was provided then (re)load this URL
		AutoResize_objects = [];
		AutoResize_width  = 0; // used by timer to see if browserwindow width has changed
		AutoResize_height = 0; // used by timer to see if browserwindow height has changed
		AutoResize_items = 0;
		setInterval("AutoResizeTimer()", 500);
	}
	AutoResize_objects.push(f);
}

function AutoResizeTimer(){
	var i,f,top,left,bottom,right;
	if (AutoResize_items != AutoResize_objects.length
	||  AutoResize_height!= document.body.clientHeight
	||  AutoResize_width != document.body.clientWidth){

		AutoResize_items  = AutoResize_objects.length;
		AutoResize_height = document.body.clientHeight;
		AutoResize_width  = document.body.clientWidth;

		for (i=0; i<AutoResize_objects.length; i++){
			f = AutoResize_objects[i];
			// calculate the new position
			top    = (f.top    <0 ? AutoResize_height + f.top     : f.top   ); 
			left   = (f.left   <0 ? AutoResize_width  + f.left    : f.left  );
			bottom = (f.bottom <0 ? AutoResize_height + f.bottom  : f.bottom); 
			right  = (f.right  <0 ? AutoResize_width  + f.right   : f.right );
			// move+resize the item to the new location
			f.item.style.top    = top;
			f.item.style.left   = left;
			f.item.style.height = bottom - top;
			f.item.style.width  = right  - left;
		}
	}
}

/* Function to copy a specific code returned by Ajax to another field. The code should be placed within brackets.
 * The first parameter is the field to which the Ajax is added, the second parameter is the field to where to copy the code.
 * The third parameter is optional and can contain a javascript function which will be executed if specified when the function is called
 */
function getAjaxCode(Name, Code, trigger){
	var AirportCode  = "";
	var AirportName  = "";
	var Start 		 = 0;
	var End 		 = 0;
	Name			 = GetObj(Name);
	Code			 = GetObj(Code);
	Start 	  		 = Name.value.indexOf('[');
	if (Start != -1){
		End 	  		 = Name.value.indexOf(']');
		AirportCode 	 = Name.value.substring(Start+1,End);
		AirportName		 = Name.value.substring(0,Start-1);
		Name.value 		 = AirportName;
		Code.value 		 = AirportCode;
		if (typeof(trigger) != 'undefined'){
			eval(trigger);
		}
	}
}

/*Function to set the z-index of multiple fields so that there will be no overlapping in for 
 *example Ajax Div's. The field that should be shown on top should be specified first in the field list.
 */
function setZindex(field){
	var fields  = field.split(",");
	var i 		= 0;
	var j		= fields.length * 100 + 100;
	
	for (i=0; i<fields.length; i++){
		field = GetObj(fields[i]);
		field.style.zIndex = j;
		j = j - 100;
	}
}

function DumpObject(obj, title){
	var result = "  " + title + "  =  {\n\n";
	for (fld in obj){
		if (obj[fld] == null){
			result += typeof(obj[fld]) + "  " + fld + " = NULL\n";
		}else if ((typeof(obj[fld]) == "string" && obj[fld].length < 100) || typeof(obj[fld]) == "number"){
			result += typeof(obj[fld]) + "  " + fld + " = " + obj[fld] + "\n";
		}else{
			result += typeof(obj[fld]) + "  " + fld + "\n";
		}
	}
	result += "\n}";
	alert(result);
}

// General logic to work with sorted headers in HTML tables
function TabSort_OnClick(th, thColor){
	th.sortImage = GetObj(th.id + "_sortImage");
	if (typeof(TabSort_obj) == "undefined") TabSort_obj = {};
	if (th.sortImage == null) alert(th.id + "_sortImage NOT FOUND!")
	if (th.sortDirection == "Ascending"){
		th.sortDirection = "Descending";
		th.sortImage.src = th.sortImage.src.replace("Ascending", th.sortDirection); 
	}else{
		for (var id in TabSort_obj){
			var th2 = TabSort_obj[id];
			if (th2.sortDirection != "Random"){ 
				th2.sortDirection = "Random";
				th2.sortImage.src = th2.sortImage.src.replace("Ascending", th2.sortDirection).replace("Descending", th2.sortDirection);
				th2.style.color = th2.sortOriginalColor;
			}
		}
		th.sortOriginalColor = th.style.color;
		th.sortDirection = "Ascending";
		th.sortImage.src = th.sortImage.src.replace("Random", th.sortDirection); 
		if (typeof(thColor) != "undefined") th.style.color = thColor;
	}
	TabSort_obj[th.id] = th;
	return th.sortDirection;
}

function getPageHeight(){
    var yScroll;
	var windowHeight;
	
	if (window.innerHeight && window.scrollMaxY){	
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		yScroll = document.body.offsetHeight;
	}
	
	if (self.innerHeight){	// all except Explorer
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight){ // Explorer 6 Strict Mode
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body){ // other Explorers
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if (yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	return pageHeight;
}

function GetTopScreen(){
	var waitY;
	if (typeof(window.pageYOffset) != 'undefined'){
		waitY = window.pageYOffset;
	}else if (document.documentElement.scrollTop != 0){
		waitY = document.documentElement.scrollTop;
	}else{
		waitY = document.body.scrollTop;
	}
	return waitY;
}

/* CONSTANTS */

/* services */
var GOOGLE_MAPS = '1';
var YAHOO_MAPS = '2';
var LIVESEARCH_MAPS = '3';

/* zoom levels */
var COUNTRY_ZOOM = 1;
var STATE_ZOOM = 2;
var CITY_ZOOM = 3;
var STREET_ZOOM = 4;

var centerPointCallbackFunction = null;

/* ******************************** GEOMAPPING **************************************/

// Constructs new geomapping object
function Geomapping(serviceName, mapContainerId) {
    if (document.getElementById(mapContainerId) == null)
        return null;

    this._serviceName = serviceName;
    this._mapContainerId = mapContainerId;
    this._map = null;
    this._centerPointCallbackFunction = null;
}

// loads map into a map container
Geomapping.prototype.LoadMap = function (onLoadCallbackFunction) {
    this.UnloadMap();
    switch (this._serviceName) {
        case GOOGLE_MAPS:
            //this._map = new GMap2(document.getElementById(this._mapContainerId));
            this._map = new google.maps.Map(document.getElementById(this._mapContainerId)); //v3
            break;
        case YAHOO_MAPS:
            this._map = new YMap(document.getElementById(this._mapContainerId), YAHOO_MAP_REG);
            break;
        case LIVESEARCH_MAPS:
            this._map = new VEMap(this._mapContainerId);
            this._map.LoadMap();
            break;
    }
}

// unloads the map
Geomapping.prototype.UnloadMap = function () {
    this._map = null;
    var ctrl = document.getElementById(this._mapContainerId);
    if (ctrl != null) {
        while (ctrl.childNodes[0]) {
            ctrl.removeChild(ctrl.childNodes[0]);
        }
    }
}

// shows map in a designated container
Geomapping.prototype.ShowMap = function (geoPoint, zoom, showLocationPin, allowDragging) {
    if (zoom == null) {
        zoom = STREET_ZOOM;
    }
    if (showLocationPin == null) {
        showLocationPin = true;
    }
    if (allowDragging == null) {
        allowDragging = false;
    }

    this.LoadMap();
    this.ShowMapInternal(this._serviceName, geoPoint.Lat, geoPoint.Lon, zoom, showLocationPin, allowDragging);
}

// acquires geo longitude and geo latitude of the center point of the map
Geomapping.prototype.AcquireCenterPoint = function (street, city, country, state, callbackFunction) {
    centerPointCallbackFunction = callbackFunction;
    var query = GetPlaceQuery(this._serviceName, street, city, country, state);

    this.LoadMap();
    this.AcquireCenterPointInternal(this._serviceName, "'" + query + "'");
}

/* ******************************** INTERNAL FUNCTIONS ************************** */
Geomapping.prototype.ShowMapInternal = function (_serviceName, lat, lon, zoom, showLocationPin, allowDragging) {
    var geoPoint = new GeoPoint(lon, lat);

    switch (_serviceName) {
        case GOOGLE_MAPS:
            //this._map.setCenter(new GLatLng(geoPoint.Lat, geoPoint.Lon), GetZoomValue(zoom, _serviceName));
            var gLatlng = new google.maps.LatLng(geoPoint.Lat, geoPoint.Lon);
            var gOptions = {
                zoom: GetZoomValue(zoom, _serviceName),
                center: gLatlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            }
            this._map.setOptions(gOptions); //v3
            if (showLocationPin) {
                //this._map.addOverlay(new GMarker(new GLatLng(geoPoint.Lat, geoPoint.Lon)));
                var marker = new google.maps.Marker({
                    position: gLatlng,
                    map: this._map
                }); //v3
            }
            //if(!allowDragging)
            //  this._map.disableDragging();
            this._map.draggable = allowDragging //v3
            break;
        case YAHOO_MAPS:
            this._map.drawZoomAndCenter(new YGeoPoint(geoPoint.Lat, geoPoint.Lon), GetZoomValue(zoom, _serviceName));
            if (showLocationPin)
                this._map.addMarker(new YGeoPoint(geoPoint.Lat, geoPoint.Lon));
            if (allowDragging)
                this._map.enableDragMap();
            else
                this._map.disableDragMap();
            break;
        case LIVESEARCH_MAPS:
            this._map.LoadMap(new VELatLong(geoPoint.Lat, geoPoint.Lon), GetZoomValue(zoom, _serviceName), 'r', !allowDragging);
            this._map.HideDashboard();
            if (showLocationPin) {
                var shape = new VEShape(VEShapeType.Pushpin, this._map.GetCenter());
                this._map.AddShape(shape);
            }
            this._map.Resize();
            break;
    }
}

Geomapping.prototype.AcquireCenterPointInternal = function (_serviceName, query) {
    switch (_serviceName) {
        case GOOGLE_MAPS:
            geocoder = new google.maps.Geocoder();
            geocoder.geocode({ 'address': query }, this.AcquireCenterPointGoogle_Callback);
            break;
        case YAHOO_MAPS:
            this._map.drawZoomAndCenter(query, 12); // the zome value here is not important
            YEvent.Capture(this._map, EventsList.endMapDraw, this.AcquireCenterPointYahoo_Callback);
            break;
        case LIVESEARCH_MAPS:
            this._map.Find(null, query, null, null, 0, 1, true, true, false, true, this.AcquireCenterPointLiveSearch_Callback);
            break;
    }
}

Geomapping.prototype.AcquireCenterPointGoogle_Callback = function (results, status) {
    if (status == google.maps.GeocoderStatus.OK) {
        var latitude = results[0].geometry.location.Ba;
        var longitude = results[0].geometry.location.za;
        centerPointCallbackFunction(new GeoPoint(latitude, longitude));
    } else {
        alert("Geocode was not successful for the following reason: " + status);
    }
}

Geomapping.prototype.AcquireCenterPointYahoo_Callback = function (_e) {
    centerPointCallbackFunction(new GeoPoint(_e.YGeoPoint.Lon, _e.YGeoPoint.Lat));
}

Geomapping.prototype.AcquireCenterPointLiveSearch_Callback = function (layer, resultsArray, places, hasMore, veErrorMessage) {
    if (veErrorMessage != null) {
        alert(veErrorMessage);
    }
    else {
        centerPointCallbackFunction(new GeoPoint(places[0].LatLong.Longitude, places[0].LatLong.Latitude));
    }
}

/* ******************************** HELPER FUNCTION ***************************** */

// this function takes sitefinity zoom value and return appropriate zoom value for given service
function GetZoomValue(zoom, _serviceName) {
    var zoomValue = '';
    switch (_serviceName) {
        case GOOGLE_MAPS:
            switch (zoom) {
                case COUNTRY_ZOOM:
                    zoomValue = 5;
                    break;
                case STATE_ZOOM:
                    zoomValue = 10;
                    break;
                case CITY_ZOOM:
                    zoomValue = 14;
                    break;
                case STREET_ZOOM:
                    zoomValue = 15;
                    break;
            }
            break;
        case YAHOO_MAPS:
            switch (zoom) {
                case COUNTRY_ZOOM:
                    zoomValue = 14;
                    break;
                case STATE_ZOOM:
                    zoomValue = 11;
                    break;
                case CITY_ZOOM:
                    zoomValue = 5;
                    break;
                case STREET_ZOOM:
                    zoomValue = 3;
                    break;
            }
            break;
        case LIVESEARCH_MAPS:
            switch (zoom) {
                case COUNTRY_ZOOM:
                    zoomValue = 5;
                    break;
                case STATE_ZOOM:
                    zoomValue = 8;
                    break;
                case CITY_ZOOM:
                    zoomValue = 12;
                    break;
                case STREET_ZOOM:
                    zoomValue = 15;
                    break;
            }
            break;
    }
    return zoomValue;
}

// this function takes location info from sitefinity and returns 
// a proper location query for given service
function GetPlaceQuery(_serviceName, street, city, country, state) {
    var query = '';
    switch (_serviceName) {
        case GOOGLE_MAPS:
            query = street + ', ' + city + ', ' + country + ', ' + state;
            break;
        case YAHOO_MAPS:
            if (country.toUpperCase() == "UNITED STATES") {
                query = street + ', ' + city + ', ' + state;
            }
            else {
                query = street + ', ' + city + ', ' + country;
            }
            break;
        case LIVESEARCH_MAPS:
            query = street + ', ' + city + ', ' + country + ', ' + state;
            break;
    }
    return query;
}

/* ******************************** OBJECTS ************************************* */

/* Geomapping point object */
function GeoPoint(longitude, latitude) {
    this.Lon = longitude;
    this.Lat = latitude;
}  
