String.prototype.replaceAll = function( 
	strTarget, // The substring you want to replace
	strSubString // The string you want to replace in.
	){
var strText = this;
var intIndexOfMatch = strText.indexOf( strTarget );
 

// Keep looping while an instance of the target string
// still exists in the string.
while (intIndexOfMatch != -1){
	// Relace out the current instance.
	strText = strText.replace( strTarget, strSubString )

	// Get the index of any next matching substring.
	intIndexOfMatch = strText.indexOf( strTarget );
}

// Return the updated string with ALL the target strings
// replaced out with the new substring.
return( strText );
}

function setCF(data) {
  if(!document.getElementById("cf")) return;
  document.getElementById("cf").innerHTML = data;
}

function chkCF() {
  if(point_id && parent && parent.frames["afr"+point_id]) {
    GDownloadUrl("get_cf.php?id="+point_id, endCF);
    return true;
  }
  return false;
}

function endCF(data) {
  eval(data);
}

function ajax(url, vars, callbackFunction) {
  if( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
    try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
    try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
    try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
    try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
    throw new Error( "This browser does not support XMLHttpRequest." )
  };

  var request =  new XMLHttpRequest();
  request.open("POST", url, true);
  request.setRequestHeader("Content-Type",
                           "application/x-www-form-urlencoded");

  request.onreadystatechange = function() {
    if (request.readyState == 4 && request.status == 200) {
      if (request.responseText) {
        callbackFunction(request);
      }
    }
  };
  request.send(vars);
}

function getChkCatNum(){
	var cnt = 0;
	if(document.forms['myform'] && document.forms['myform'].chkMarkerTypes){
		var chkMarkerTypes = document.forms['myform'].chkMarkerTypes;
		for(var i=0;i<chkMarkerTypes.length;i++){
			if(chkMarkerTypes[i].checked) cnt++;
		}
	}
	return cnt;
}