	var b = navigator.appName

	if (b=="Netscape")
		b = "ns"
	else if (b=="Microsoft Internet Explorer")
		b = "ie"

	var v = parseInt(navigator.appVersion)
	var ns = (b=="ns" && v>=4)
	var ns4 = (b=="ns" && v==4)
	var ns5 = (b=="ns" && v==5)
	var ie = (b=="ie" && v>=4)
	var ie4 = (navigator.userAgent.indexOf('MSIE 4')>0)
	var ie5 = (navigator.userAgent.indexOf('MSIE 5')>0)
	if (ie5) v = 5


function loadSource(url,form)
{
 	if (url.indexOf("nh=00&")>0)
 		return;
	if (ns4)
	{
		//var lyr =  document.layers[id];
		//lyr.load(url,lyr.clip.width)
	}
	else if(ns5)
	{
    		//var nodeList = this.document.getElementsByTagName('select');
		//nodeList[2].options.selectedIndex=0;
		this.bufferFrame.document.location = url;
	}
	else if (ie)
	{
			//divloc.document.formloc.loc.options.selectedIndex=0;
		//prompt("",url)
		bufferFrame.document.location = url

	}
}
function ClearOptions(OptionList) {

// Always clear an option list from the last entry to the first
for (x = OptionList.length; x >= 0; x--) {
OptionList[x] = null;
}
}


function AddToOptionList(OptionList, OptionValue, OptionText) {
// Add option to the bottom of the list
OptionList[OptionList.length] = new Option(OptionText, OptionValue);
}
function inicializaCombo(sel,noele){
  var forma=sel.form;
  var noelem=forma.elements.length
  var edo=false;
  var ctaele=0;
  for(i=0;i<noelem;i++){
    if (sel.name==forma.elements[i].name && !edo) edo=true
    if (edo && forma.elements[i].type.indexOf("select")>-1){
    	forma.elements[i].selectedIndex=0;
        ctaele++
        if (ctaele>=noele) return;
    }
  }
}
function loadSourceFinish(id,nomform,noele)
{
        var i=0;
	var lim;
	var opcion=null;
	var selForm=eval(nomform+".elements['"+id+"']");
        inicializaCombo(selForm,noele)
	var insel=null;
	if (ie){
		insel=bufferFrame.document.forma.seleccion;
		ClearOptions(selForm);
		lim=insel.length;
		while (i<lim){
			opcion=insel[i];
			AddToOptionList(selForm,opcion.value,opcion.text);
			i++;
		}
	}else if (ns5)
	{
		insel=bufferFrame.document.forma.seleccion;
		ClearOptions(selForm);
		lim=insel.length;
		while (i<lim){
			opcion=insel[i];
			AddToOptionList(selForm,opcion.value,opcion.text);
			i++;
		}
	}
}

function ubica(ent,mpo){
var cedo,cmpo,cloc;
var layact;
var texmpo;
var texent;
  

    cedo=ent.options[ent.options.selectedIndex].value;
    cmpo=mpo.options[mpo.options.selectedIndex].value;
    cloc="00";
    texent=ent.options[ent.options.selectedIndex].text;
    texmpo=mpo.options[mpo.options.selectedIndex].text

   if (cedo=="00") {
   	alert("Seleccione una entidad y/o municipio a ubicar");
   	return false;
   }	
  //texent=texent.substring(texent.indexOf(" ")+1);
  var re= new RegExp(" ","g");
  texent=texent.replace(re,"%20");
  texmpo=texmpo.replace(re,"%20");
  if (cmpo=="00000"){
   		if (mest=="na") layact="00,"+cedo;
   		else layact="99";
   		CambiarMAP(layact,"es",cedo, texent); 
   	}
   else{
   		if (mest=="na" || mest=="es")
      		layact=cedo+","+cedo+"a"+",00";
   		else layact="99";//.substring(texmpo.indexOf("%20")+3)
   		CambiarMAP(layact,"ag",cmpo,texmpo+", "+texent);
   	}	
}

