function comapcontrol(comap){
this.map = comap;

this.citysearch = document.createElement("input");
this.citysearch.type="text";
this.citysearch.value="Boulder, CO";

this.btnSearch = document.createElement('input');
this.btnSearch.type = "button";
this.btnSearch.id = "btnSearch";
this.btnSearch.value = "Lookup Location";
this.btnSearch.title = "Search Colorado";
this.btnSearch.name = "btnSearch";	
this.lastsearched;

this.resultsdiv = document.createElement('div');


this.show = function(div){
		this.div = div;
		this.table = document.createElement('table');
		this.table.border = "0";
		this.table.width = "250";
		//this.table.style.backgroundColor = "#999999";
		
		this.tbody = document.createElement('tbody');
		
		this.tr1 = document.createElement('tr');
		this.td1 = document.createElement('td');
		//this.td1.style.backgroundColor = "#003366";
		//this.td1.style.fontSize = "10px";
		//this.td1.style.color = "#FFFFFF";
		//this.td1.height="10px";
		//this.td1.width = "118px";
		//this.td1.align="left";
		
		//this.spanlabel = document.createElement('span');
	//	this.spanlabel.class="style7";
	//	this.spanlabel.id="comapctrl";
		this.textstring = document.createElement('input');
		this.textstring.type = "text";
		this.textstring.size = 25;
		this.textstring.maxlength = 50;
		this.td1.innerHTML = "step 1: point us to your file";//<input name=\"\" type=\"text\" size=\"25\" maxlength=\"50\" />";
		this.td1.appendChild(this.textstring);
	
		
		this.tr2 = document.createElement('tr');
		this.td2 = document.createElement('td');

		this.btnPreview = document.createElement('input');
		this.btnPreview.name = "btnPreview";
		this.btnPreview.type = "button";
		this.btnPreview.value = "Step 2: Preview Map!";
		//this.td2.innerHTML = "<input name=\"btnPreview\" type=\"button\" value=\"Preview Map!\" /></td>";
		this.td2.appendChild(this.btnPreview);
		
		this.tr3 = document.createElement('tr');
		this.td3 = document.createElement('td');
		this.textarea = document.createElement('textarea');
		this.textarea.id = "txtarea";
		this.textarea.rows = 25;
		this.textarea.cols = 25;
		this.td3.appendChild(this.textarea);
		
		this.tr1.appendChild(this.td1);
		this.tr2.appendChild(this.td2);
		this.tr3.appendChild(this.td3);
		this.tbody.appendChild(this.tr1);
		this.tbody.appendChild(this.tr2);
			this.tbody.appendChild(this.tr3);
		this.table.appendChild(this.tbody);
		
		//this.table.appendChild(this.tr2);
		this.div.appendChild(this.table);

		Event.observe($(this.btnPreview), 'click', function(event){
			 //$(this.resultsdiv).innerHTML = "Trails:";					
			 this.map.OpenTrail(this.textstring.value);
			 this.map.createlink();
		}.bindAsEventListener(this));
}

	this.showAddress = function () 
		{
		lat.length=0;
		var search = document.getElementById("CitySearch").value;
			map.clearOverlays();
		geo.getLocations(search, function (result)
			{
				if (result.Status.code == G_GEO_SUCCESS) 
					{
					// Loop through the results, placing markers
						for (var i=0; i<result.Placemark.length; i++) 
						{
						//alert();
						document.getElementById("maplist").innerHTML = result.Placemark[i].address;	
						map.setCenter(new GLatLng(result.Placemark[i].Point.coordinates[1],result.Placemark[i].Point.coordinates[0]), 14);
						}
					} 
			});
		}
		
//end of comapcontrol
}

