//noRightButton();

    function noRightButton(){
		document.oncontextmenu=function(){   
		    return false;   
		}   
		  
		//ctrl+c   
		document.onkeydown=function(){   
		    if(event.keyCode==67){   
		        return false;   
		    }   
		}  
    }

    function convertLatLng(v_str){
    	var str = ""+v_str;
    	var str = str.substr(1, str.length-2);
		var idxCom = str.indexOf(",");
		var tmpLat = convertDegreeToValue( trim(str.substring(0, idxCom)) );
		var tmpLng = convertDegreeToValue( trim(str.substring(idxCom + 1)));
		return (tmpLat+","+tmpLng);
		return (str);
    }
    
    function convertDegreeToValue(v_str){
    	try
		{
			if (v_str == null)
			{
				return ("");
			}
			var idxCom = v_str.indexOf(".");
			var str = v_str.substring(0, idxCom);
			var tmp = v_str.substring(idxCom + 1);
			var db = parseFloat("0."+tmp);
			db = db * 60;
			var tmpVal = "" + db;
			idxCom = tmpVal.indexOf(".");
			tmp = tmpVal.substring(0, idxCom);
			if (tmp.length==1)
			{
				tmp = "0" + tmp;
			}
			return (str + tmp + "."+tmpVal.substring(idxCom+1 , idxCom + 5));
		}
		catch (e){ }
		return ("");
    }
    
    function trim( v_str ) {
		return (v_str.replace(/^\s+|\s+$/g, ''));
	}	
	
	function createMarker(latlng, v_color, v_strCap) {
		var marker = null;
		if (v_color=="draggable"){
			marker = new GMarker(latlng, {draggable:true}) ;
		}else{
			var myIcon = new GIcon();
			myIcon.iconSize = new GSize(12, 20);
			myIcon.shadowSize = new GSize(22, 20);
			//myIcon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
			myIcon.iconAnchor = new GPoint(6, 20);
			myIcon.image = "http://labs.google.com/ridefinder/images/mm_20_"+v_color+".png";
			markerOptions = { icon:myIcon };
			marker = new GMarker(latlng, markerOptions);
			//var myHtml = "The GLatLng value is: ["+convertLatLng(marker.getLatLng())+"]<BR>";
			//myHtml += v_strCap;
			//map.openInfoWindowHtml(latlng, v_strCap);
		}
		//marker.title = v_strCap;
		
		
		GEvent.addListener(marker, "click", function() {
			var myHtml = "The GLatLng value is: ["+convertLatLng(marker.getLatLng())+"]<BR>";
			myHtml += v_strCap;
			map.openInfoWindowHtml(marker.getLatLng(), myHtml);
		});
		
		/*
		GEvent.addListener(marker, "dblclick", function() {
			var myHtml = "The GLatLng value is: ["+convertLatLng(marker.getLatLng())+"]";
			map.openInfoWindowHtml(marker.getLatLng(), myHtml);
		});
		
		
		GEvent.addListener(marker, "dragstart", function() {
          map.closeInfoWindow();
        });

        GEvent.addListener(marker, "dragend", function() {
        	clickedLatLng=convertLatLng(marker.getLatLng()); 
        	var myHtml = "The GLatLng value is: ["+convertLatLng(marker.getLatLng())+"]";
			//map.openInfoWindowHtml(marker.getLatLng(), myHtml);
          	marker.openInfoWindowHtml(myHtml);
        });
        */
        
		return marker;
	}
	
	var STAY_SEC_LEVEL_1=600;
	var STAY_SEC_LEVEL_2=1200;
	function getCircle(lat, lng, v_stay_sec, v_strCap) {
		if ((v_stay_sec==null)||(v_stay_sec==0)){
			return (null);
		}
		//var radius = parseFloat(""+(v_stay_sec/1200));
		//var radius = (v_stay_sec/(60*100));
		var radius = (120/(90*100));
		var strokeColor = "#FF0000";
		var strokeWidth = 1;
		var strokeOpacity = 0.75;
		var fillColor = "";
		if (v_stay_sec<=STAY_SEC_LEVEL_1){
			fillColor="#2222ff";
		}else if((v_stay_sec>STAY_SEC_LEVEL_1)&&(v_stay_sec<=STAY_SEC_LEVEL_2)){
			fillColor="#aa22aa";
		}else{
			fillColor="#FF2222";
		}
		var fillOpacity =.5;
		var d2r = Math.PI/180;
		var r2d = 180/Math.PI;
	    var Clat = radius * 0.014483;  // Convert statute miles into degrees latitude
		var Clng = Clat/Math.cos(lat*d2r); 
		var Cpoints = []; 
		for (var i=0; i < 33; i++) { 
	        var theta = Math.PI * (i/16); 
	        Cy = lat + (Clat * Math.sin(theta)); 
	        Cx = lng + (Clng * Math.cos(theta)); 
	        var P = new GPoint(Cx,Cy); 
	        Cpoints.push(P); 
		}

		var tmpPolyg = new GPolygon(Cpoints, strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity);
		
		GEvent.addListener(tmpPolyg, "click", function() {
			map.openInfoWindowHtml(new GLatLng(lat, lng), v_strCap);
		});
		return (tmpPolyg);
    }