

function clearSelectOptions(selectElementId)
{
	var selectObj = $(selectElementId);
	while (selectObj.options.length > 0) 
	{
		if(Prototype.Browser.IE) 
		{
	       		selectObj.options.remove(0);
	        }
	        else
	        {
	        	selectObj.remove(0);
	        	// selectObj.remove(selectObj.options[0], null);  DOESNT WORK
	        }
	}	
}


function addOptionToEndOfSelect(selectElementId, strOptionText, strOptionValue)
{
	var selectObj = $(selectElementId);
	
	var optn = document.createElement("OPTION");
	optn.text = strOptionText;
	optn.value = strOptionValue;

	
	/*
	if(Prototype.Browser.IE) {
	    selectObj.options.add(optn, selectObj.options.length+1);
	}
	*/
	
	
	  try {
	    selectObj.add(optn, null); // standards compliant; doesn't work in IE
	  }
	  catch(ex) {
	    selectObj.add(optn); // IE only
  	}
	
	
	//else new Insertion.After(selectObj.options[0], '<option value="' + strOptionValue + '">' + strOptionText + '</option>');
}

function hightlightPolyline(line)
{

	line.color='#CC3300';
	line.weight  = parseInt("4");
	line.opacity = parseFloat("0.7");
	line.redraw(true);
}


/* GENERAL HELPER FUNCTIONS */

			
showCustomTooltip=function(_marker, htmlString)
{

	if (!(tooltip))   
	{
	      // ====== set up marker mouseover tooltip div ======
	      tooltip = document.createElement("div");
	      tooltip.className="tooltip";
	      map.getPane(G_MAP_FLOAT_PANE).appendChild(tooltip);
	      tooltip.style.visibility="visible";   
	}


	tooltip.innerHTML = htmlString; //this.getToolTipHtml(_marker.stopId);

	var marker = _marker;
	var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.fromDivPixelToLatLng(new GPoint(0,0),true),map.getZoom());
	var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
	var anchor=marker.getIcon().iconAnchor;
	var width=marker.getIcon().iconSize.width;
	var height=tooltip.clientHeight;
	var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(offset.x - point.x - anchor.x + width, offset.y - point.y -anchor.y -height)); 
	pos.apply(tooltip);

	tooltip.style.visibility="visible";
}



