	var sessionId = null;
	var countyId = null;
 
	function setSessionId(sessId) {
		sessionId = sessId;
	
	}
	
	function setCountyId(cntyId) {
		countyId = cntyId;
	}
	
	function onLoad() {
   		oadMapClientInit();
   	}    
    
     //clientPointInfo
    //generates the text for the information window for a simple point
    //label, category, id are DOM nodeCollections
    function clientPointInfo(label,category,id) {
		//alert(label[0].firstChild.nodeValue);
    	var info = '<div>';
    	if(label.length) {
    		if(label[0].firstChild) {
			var idVal = id[0].firstChild.nodeValue;
 
                        var index = idVal.indexOf("#");

                        if(index > 0) {
                                idVal = idVal.substring(0,index);
                        }    			

			info = getItemBubble(idVal);
    			if(info == null) {
    			info = '<p>'
    					/*+ '<strong>' 
    					+ label[0].firstChild.nodeValue 
						+ '</strong><br/><br/>' 
						+ '<a href="/webdav/harmonise?Page/@id=63&amp;Section[@stateId_eq_County]/@id='
						+ countyId
						+ '&amp;Session/@id=' + sessionId
						+ '&amp;Document[@stateId_eq_Main]/@id=' 
						+  id[0].firstChild.nodeValue 
						+ '&amp;Section[@stateId_eq_Item]/@id=' 
						+ id[0].firstChild.nodeValue 
						+ '">'*/
						+ '<a href="/itemRedirector?item='
						+ id[0].firstChild.nodeValue
						+ '&amp;sessionId=' + sessionId
						+ '">'
						+ label[0].firstChild.nodeValue
						+ '</a></p>';
			}
			}
    	}
    	
	info = info + '</div>';
	
	return info;
    }
    
    function getItemBubble(id) {
		var result = ""; 
		
		var url = '/googlebubble?itemid=' + id;
	
		var xmlhttp = new XMLHttpRequest();
		xmlhttp.open("GET",url , false);
	
		xmlhttp.send('');
		var oDomDoc = xmlhttp.responseXML;
		
		if(Sarissa.getParseErrorText(oDomDoc) != Sarissa.PARSED_OK){
		 // construct a human readable
		 // error description
		 alert(Sarissa.getParseErrorText(oDomDoc));
		alert("item id - " + id);
		} else {
		 //alert(Sarissa.serialize(oDomDoc));
		 var rootEl   = oDomDoc.documentElement;
		 	if(rootEl.getAttribute("class") != "noitem") { 
				result = new XMLSerializer().serializeToString(rootEl); 
			} else {
				result = null;
			}
		}
    	return result;
    }
    
    //clientMultipointInfo
    //generates the text for the information window for a multipoint object (ie multiple items at a single point)
    //label, category, id are DOM nodeCollections
    function clientMultipointInfo(label,category,id,count) {
    	var info = '<p>' + count + " items<br/><br/>";
    	for(i = 0; i < label.length; i++) {
    		info = info 
			/*+ '<a href="/webdav/harmonise?Page/@id=63&amp;Section[@stateId_eq_County]/@id='
						+ countyId
						+ '&amp;Session/@id=' + sessionId
						+'&amp;Document[@stateId_eq_Main]/@id=' 
						+  id[i].firstChild.nodeValue 
						+ '&amp;Section[@stateId_eq_Item]/@id=' 
						+ id[i].firstChild.nodeValue 
						+ '">'*/
			+ '<a href="/itemRedirector?item='
			+ id[i].firstChild.nodeValue
			+ '&amp;sessionId='
			+ sessionId
			+ '">'
						+ label[i].firstChild.nodeValue + "</a><br/>";
    	}
    	info = info + "</p>";
		//alert(info);
    	return info;
    }
 
    function clientClusterIcon() {
    	var icon = new GIcon();
		icon.image = "/resources/images/cluster_iconEPE.gif";
		icon.iconSize = new GSize(20, 32);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
    }
	
	function clientMultipointIcon() {
		var icon = new GIcon();
		icon.image = "/resources/images/cluster_iconEPE.gif";
		icon.iconSize = new GSize(20, 32);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
	}


	function clientPointIcon(categoryNodes) {
		category = '';
		if(categoryNodes.length) {
			if(categoryNodes[0].firstChild) {
				category = categoryNodes[0].firstChild.nodeValue;
			}
		}
	
	    var icon = new GIcon();
		if(category.length > 0) {
			icon.image = "/resources/categoryimg/" + category.toLowerCase() + ".png";
			icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
		} else 
		{
			icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
			icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
		}
		
		icon.iconSize = new GSize(24, 32);
		icon.shadowSize = new GSize(22, 20);
		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1);
		return icon;
    }
   	  

