var objMapView = document.getElementById("objMapView");

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadstatustext="<img src='Estilos/loading.gif' /> Cargando..."

////NO NEED TO EDIT BELOW////////////////////////
var loadedobjects=""
var defaultcontentarray=new Object()
var bustcacheparameter=""

//==========================================================
function startajaxtabs()
{
	for (var i=0; i<arguments.length; i++)
	{ //loop through passed UL ids
		var ulobj=document.getElementById(arguments[i])
		var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
		for (var x=0; x<ulist.length; x++)
		{ //loop through each LI element
			var ulistlink=ulist[x].getElementsByTagName("a")[0]
			if (ulistlink.getAttribute("rel"))
			{
				var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+"/")
				//var modifiedurl=ulistlink.getAttribute("href").replace(/^http:\/\/[^\/]+\//i, "http://"+window.location.hostname+":8000/")
				ulistlink.setAttribute("href", modifiedurl) //replace URL's root domain with dynamic root domain, for ajax security sake
				savedefaultcontent("ajaxcontentarea") //save default ajax tab content
				ulistlink.onclick=function()
				{
					ajaxpage(this.getAttribute("href"), this.getAttribute("rel"), this,"")					
					loadobjs(this.getAttribute("rev"))
					return false
				}
				if (ulist[x].className=="selected")
				{			
					ajaxpage(ulistlink.getAttribute("href"), ulistlink.getAttribute("rel"), ulistlink,"ayto") //auto load currenly selected tab content
					loadobjs(ulistlink.getAttribute("rev")) //auto load any accompanying .js and .css files
				}		
			}
		}
	}
}
//==========================================================
function savedefaultcontent(contentid)
{// save default ajax tab content
	if (typeof defaultcontentarray[contentid]=="undefined") //if default content hasn't already been saved
	defaultcontentarray[contentid]=document.getElementById(contentid).innerHTML
}
//==========================================================
function ajaxpage(url, containerid, targetobj, seactivapor)
{
	var page_request = false
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject)
	{ // if IE
		try {
				page_request = new ActiveXObject("Msxml2.XMLHTTP")
			} 
		catch (e)
			{
			try
				{
					page_request = new ActiveXObject("Microsoft.XMLHTTP")
				}
			catch (e){}
			}
	}
	else
		return false
		
	var ullist=targetobj.parentNode.parentNode.getElementsByTagName("li")
	for (var i=0; i<ullist.length; i++)
		{
		ullist[i].className=""  //deselect all tabs
		}
	targetobj.parentNode.className="selected"  //highlight currently clicked on tab

	document.getElementById("ajaxcontentarea").innerHTML=loadstatustext
	page_request.onreadystatechange=function()
	{
		loadpage(page_request, containerid, seactivapor)		
	}
	if (bustcachevar) //if bust caching of external page
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	url=estado(url);
	page_request.open("GET", url+bustcacheparameter, false)
	page_request.send(null)
}
//==========================================================
function loadpage(page_request, containerid, seactivapor)
{	
	//if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
	if (page_request.readyState == 4 && page_request.status==200)
	{
		document.getElementById("ajaxcontentarea").innerHTML=page_request.responseText;
		if (seactivapor == ""){actdescheckbox(containerid);}
	}
}
//==========================================================
function loadobjs(revattribute)
{		
	if (revattribute!=null && revattribute!="")
	{ //if "rev" attribute is defined (load external .js or .css files)			
		var objectlist=revattribute.split(/\s*,\s*/) //split the files and store as array
		for (var i=0; i<objectlist.length; i++)
		{
			var file=objectlist[i]
			var fileref=""
			if (loadedobjects.indexOf(file)==-1)
			{ //Check to see if this object has not already been added to page before proceeding
				if (file.indexOf(".js")!=-1)
				{ //If object is a js file						
					fileref=document.createElement('script')
					fileref.setAttribute("type","text/javascript");
					fileref.setAttribute("src", file);						
				}
				else if (file.indexOf(".css")!=-1)
				{ //If object is a css file
					fileref=document.createElement("link")
					fileref.setAttribute("rel", "stylesheet");
					fileref.setAttribute("type", "text/css");
					fileref.setAttribute("href", file);
				}
			}
			if (fileref!="")
			{				
				document.getElementsByTagName("head").item(0).appendChild(fileref)
				loadedobjects+=file+" " //Remember this object as being already added to page
			}
		}
	}
}
//==========================================================
function expandtab(tabcontentid, tabnumber)
{ //interface for selecting a tab (plus expand corresponding content)
	var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
	if (thetab.getAttribute("rel"))
	{
		ajaxpage(thetab.getAttribute("href"), thetab.getAttribute("rel"), thetab)
		loadobjs(thetab.getAttribute("rev"))
	}
}
//==========================================================
function cambiarGlobalflag(elemento,capa)
{		
	if(elemento.checked == true)	
		capa.value="C";	
	else
	{
		capa.value="U";
	}	
}
//==========================================================
function estado(url)
{
	url+="&Idioma=" + globals.flagIdioma.value;
	url+="&Color=" + globals.flagColor.value;
	url+="&Orografia=" + globals.flagOrografia.value;
	url+= "&Calles=" + globals.flagCalles.value;
	url+= "&Trafico=" + globals.flagTrafico.value;
	url+= "&Camaras=" + globals.flagCamaras.value;
	url+= "&ObrasIncidencias=" + globals.flagObrasIncidencias.value;
	url+= "&Paneles=" + globals.flagPaneles.value;
	url+= "&CinturonPeriferico=" + globals.flagCinturonPeriferico.value;
	url+= "&Parking=" + globals.flagParking.value;
	url+= "&ZonasOTA=" + globals.flagZonasOTA.value;
	url+= "&TramosOTA=" + globals.flagTramosOTA.value;
	url+= "&ReservadoPMR=" + globals.flagReservadoPMR.value;
	url+= "&ReservadoBicis=" + globals.flagReservadoBicis.value;
	url+= "&ReservadoMotos=" + globals.flagReservadoMotos.value;
	url+= "&CargaDescarga=" + globals.flagCargaDescarga.value;
	url+= "&Taxi=" + globals.flagTaxi.value;
	url+= "&Lineas=" + globals.flagLineas.value;
	url+= "&Paradas=" + globals.flagParadas.value;
	url+= "&OtrosMedios=" + globals.flagOtrosMedios.value;
	url+= "&Sentidos=" + globals.flagSentidos.value;
	url+= "&LineasBilbobus=;"
	var divlinbilb = document.getElementById("LeyLineasBilbobus");
	var ulist = divlinbilb.getElementsByTagName("input");
	if (ulist.length > -1){
		for (var x=0; x<ulist.length; x++){
			if(ulist[x].checked == true){
				url+= ulist[x].name.substr(3) + ";";
			}
		}
	}
	//url+= "&MSS=" + globals.MSS.value;
	url+="&rnd=" + Math.random();
	return url;
}
//==========================================================
function leyenda(elemento,leyenda)
{
	if(elemento.checked == true && elemento.disabled == false)
	{				
		var ld=document.getElementById(leyenda).style;
		ld.display="inline";	
	}
	else
	{				
		var ld=document.getElementById(leyenda).style;
		ld.display="none";		
	}
}
//==========================================================
function fncIniMapa()
{	
	//var objMapView = document.getElementById("objMapView");
	if (globals.flagCalles.value=="U"){for (var y=1; y<4; y++){objMapView.setLayerVisible("Calles"+y,false);}}		
	if (globals.flagTrafico.value=="U" ){objMapView.setLayerVisible("Trafico",false)}
	if (globals.flagCamaras.value=="U" ){objMapView.setLayerVisible("Camaras",false)}
	if (globals.flagObrasIncidencias.value=="U" ){objMapView.setLayerVisible("ObrasIncidencias",false)}	
	if (globals.flagPaneles.value=="U" ){objMapView.setLayerVisible("Paneles",false)}	
	if (globals.flagCinturonPeriferico.value=="U" ){objMapView.setLayerVisible("CinturonPeriferico",false)}	
	if (globals.flagParking.value=="U" ){objMapView.setLayerVisible("Parking",false)}	
	if (globals.flagZonasOTA.value=="U" ){objMapView.setLayerVisible("ZonasOTA",false)}	
	if (globals.flagTramosOTA.value=="U" ){objMapView.setLayerVisible("TramosOTA",false);}	
	if (globals.flagReservadoPMR.value=="U" ){objMapView.setLayerVisible("ReservadoPMR",false)}	
	if (globals.flagReservadoBicis.value=="U" ){objMapView.setLayerVisible("ReservadoBicis",false)}	
	if (globals.flagReservadoMotos.value=="U" ){objMapView.setLayerVisible("ReservadoMotos",false)}	
	if (globals.flagCargaDescarga.value=="U" ){objMapView.setLayerVisible("CargaDescarga",false)}		
	if (globals.flagTaxi.value=="U" ){objMapView.setLayerVisible("Taxi",false)}	
	if (globals.flagLineas.value=="U" )
	{
		var divlinbilb = document.getElementById("LeyLineasBilbobus");
		var ulist = divlinbilb.getElementsByTagName("input");
		for (var x=1; x<ulist.length; x++)
			{objMapView.setLayerVisible(ulist[x].name,false);}
	}
	else{fncMostrarLeyLineas(document.getElementById("cb32"));}
	if (globals.flagParadas.value=="U" ){objMapView.setLayerVisible("Paradas",false)}	
	if (globals.flagOtrosMedios.value=="U" ){objMapView.setLayerVisible("OtrosMedios",false)}	
	if (globals.flagSentidos.value=="U" ){objMapView.setLayerVisible("Sentidos",false)}	
	if (globals.flagOrografia.value=="U" ){objMapView.setLayerVisible("_GWMImage",false)}	
	
	objMapView.refreshView();
	
/*	return;
/*}

function actdescheckbox2()
{*/
	
	var capas = objMapView.getLayerNames(1);
	var obj_capa;
	
	var existe_activa = false;
	for (var y=1; y<4; y++){
		if (capas.indexOf("Calles"+y) > 0){existe_activa = true;break;}
	}
	if(existe_activa == false){obj_capa = document.getElementById("cb11");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	
	//if (capas.indexOf("Calles") < 0){obj_capa = document.getElementById("cb11");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("Trafico") < 0){obj_capa = document.getElementById("cb12");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z-";}
	if (capas.indexOf("Camaras") < 0){obj_capa = document.getElementById("cb13");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("ObrasIncidencias") < 0){obj_capa = document.getElementById("cb14");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("Paneles") < 0){obj_capa = document.getElementById("cb15");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("CinturonPeriferico") < 0){obj_capa = document.getElementById("cb16");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z-";}
	if (capas.indexOf("Sentidos") < 0){obj_capa = document.getElementById("cb17");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	
	if (capas.indexOf("Parking") < 0){obj_capa = document.getElementById("cb21");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("ZonasOTA") < 0){obj_capa = document.getElementById("cb22");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z-";}
	if (capas.indexOf("TramosOTA") < 0){obj_capa = document.getElementById("cb23");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("ReservadoPMR") < 0){obj_capa = document.getElementById("cb24");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("ReservadoBicis") < 0){obj_capa = document.getElementById("cb25");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("ReservadoMotos") < 0){obj_capa = document.getElementById("cb26");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("CargaDescarga") < 0){obj_capa = document.getElementById("cb27");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
				
	if (capas.indexOf("Taxi") < 0){obj_capa = document.getElementById("cb31");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	
	existe_activa = false;
	var divlinbilb = document.getElementById("LeyLineasBilbobus");
	var ulist = divlinbilb.getElementsByTagName("input");
	for (var x=1; x<ulist.length; x++){
		if (capas.indexOf(ulist[x].name) < 0){ulist[x].disabled="disabled";ulist[x].style.cursor="no-drop";}
		else{existe_activa = true;}
	}
	if(existe_activa == false){obj_capa = document.getElementById("cb32");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	
	if (capas.indexOf("Paradas") < 0){obj_capa = document.getElementById("cb33");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	if (capas.indexOf("OtrosMedios") < 0){obj_capa = document.getElementById("cb34");obj_capa.disabled="disabled";obj_capa.style.cursor="no-drop";obj_capa.title="Z+";}
	fncActualizaTodas();		
	//if (objMapView.getLayerNames(8) == ""){document.getElementById("cb48").disabled="disabled";}
	
	//activo el portal localizado
	if (capas.indexOf("Portal") > 0){objMapView.setLayerVisible("Portal",true)}

	//if (globals.xport.value!="0" && globals.yport.value!="0"){posicionportal();}	
}
//==========================================================
function fncMostrarCapa(strSheetName, id, raster)
{		
	if (raster == 1)
	{
		if (objMapView.getLayerVisible(strSheetName))
			{			
			objMapView.setLayerVisible("_GWMImage",false);
			}
		else
			{			
			objMapView.setLayerVisible("_GWMImage", true);
			}
	}
	else
	{
	if (objMapView.getLayerVisible(strSheetName))
		{		
		objMapView.setLayerVisible(strSheetName,false);				
		}
	else
		{		
		objMapView.setLayerVisible(strSheetName, true);					
		}
	}
	objMapView.refreshView();
	return;
}
//==========================================================
function fncMostrarCalles(strSheetName)
{		
	for (var y=1; y<4; y++){
		if (objMapView.getLayerVisible(strSheetName + y))
			{		
			objMapView.setLayerVisible(strSheetName + y,false);				
			}
		else
			{		
			objMapView.setLayerVisible(strSheetName + y, true);					
			}
	}
	objMapView.refreshView();
	return;
}
//==========================================================
function fncMostrarLeyLineas(id)
{
	var divlinbilb = document.getElementById("LeyLineasBilbobus");
	var ulist = divlinbilb.getElementsByTagName("input");
	for (var x=1; x<ulist.length; x++){
		if(id.checked == true)
		{
			if(ulist[x].checked == true)
				{objMapView.setLayerVisible(ulist[x].name, true);}
			else{objMapView.setLayerVisible(ulist[x].name, false);}
		}
		else
		{
			objMapView.setLayerVisible(ulist[x].name, false);
		}
	}
	objMapView.refreshView();
	return;
}
//==========================================================
function fncMostrarLineasTodas(id)
{
	var chec_;
	if(id.checked == true){chec_ = true;}else{chec_ = false;}

	var divlinbilb = document.getElementById("LeyLineasBilbobus");
	var ulist = divlinbilb.getElementsByTagName("input");
	for (var x=1; x<ulist.length; x++){
		ulist[x].checked = chec_;
		if (ulist[x].disabled!="disabled"){objMapView.setLayerVisible(ulist[x].name, chec_);}
	}	
	
	objMapView.refreshView();
	return;
}
//==========================================================
function fncActualizaTodas()
{
	var chec_ = true;
	var divlinbilb = document.getElementById("LeyLineasBilbobus");
	var ulist = divlinbilb.getElementsByTagName("input");
	for (var x=1; x<ulist.length; x++){
		if (ulist[x].disabled!="disabled" && ulist[x].checked==false){chec_=false;break;}
	}	
	ulist[0].checked = chec_;
}
//==========================================================
function ActivarClickHandler()
{
	var ret = 0;
	var sResultText = "";

 		// Nothing currently set; set event handler
    ret = objMapView.setEventHandler(0, DisplayRule,"DisplayRule");
    if (ret < 0)
    {
      sResultText = "setEventHandler devuleve error " + ret + " en ajaxtabs.js";
      sResultText += ".\n" + GetErrorString(ret);
    }
    else
	{
      sResultText = "Activado Evento SetEventHandler al hacer click en el mapa";
 	}
	//return;
}
//==========================================================
function DisplayRule()
//function DisplayRule(capa,propiedad)
{		
	
	if (DisplayRule.arguments[0] != null && DisplayRule.arguments[1] != null)
	{
	  //var sBuf = sBuf + "\nArgumentos:";
	  //for(var i = 0; i < DisplayRule.arguments.length;)
	  //{
	  //  sBuf = sBuf + "\n" + DisplayRule.arguments[i++];
	  //}
	  //alert(sBuf);

		var capa = DisplayRule.arguments[0];
		
		if (capa.length >= 3){
			if (capa.substr(0,3) == "lin"){
				capa = "Lineas"
			}
		}
		
		if(capa == "Lineas" || capa == "ZonasOTA" || capa == "Paradas" || capa == "Paneles" || capa == "Camaras" || capa == "ObrasIncidencias" || capa == "TramosOTA" || capa == "Parking" || capa == "Trafico")
		{
			var h_eight = 200;
			var w_idth = 400;		

			if(capa == "Parking"){h_eight=350;w_idth=400 }			
			if(capa == "Camaras"){h_eight=350;w_idth=400 }
			if(capa == "ZonasOTA"){h_eight=600;w_idth=450}
			if(capa == "Trafico"){h_eight=370;w_idth=450}

			var idioma = globals.flagIdioma.value;
			window.open("/circuweb/Asp/" + capa + "Emergente.asp?identificador=" + DisplayRule.arguments[1] + "&idioma=" + idioma + "&rnd=" + Math.random(),capa + DisplayRule.arguments[1],'left=20,top=20,width=' + w_idth + ',height=' + h_eight+ ',toolbar=0,location=0, directories=0,status=0,menubar=0,scrollbars=1,resizable=0','true');	
					
			/*
			método anterior que abre ventana de información en un div dentro de la ventana actual
			win = new Window({className: "dialog", title: "Informacion de " + capa, width:w_idth, height:h_eight, destroyOnClose: true, recenterAuto:false});				
			var idioma = globals.flagIdioma.value;
			win.getContent().update(emergente(idioma,capa,DisplayRule.arguments[1]));			
			win.showCenter();
			if(capa == "Camaras"){			
				win.initCamaras(DisplayRule.arguments[1]);						
			}	
			if(capa == "ZonasOTA"){						
				win.initZonasOTAChart(DisplayRule.arguments[1]);						
			}*/	
		}
	}	
}
//==========================================================
//==========================================================
function marcoMapaGuiaFernando()
{
	//coloco el marco o punto en mapa guia el area activa del mapa detalle
	var vcoord = objMapView.getViewRange();
	vcoord = vcoord.split("|");	
	var deltaX = Math.abs((vcoord[0] - vcoord[2]));
	var objMapView1 = document.getElementById("objMapView1");
	objMapView1.setCoordinateUnits(1);
	var valopac;
	var valstrw;
	if (deltaX > 6000){valopac = "0.5";valstrw="20";}
	if (deltaX <= 6000 && deltaX > 4000){valopac = "0.7";valstrw="30";}
	if (deltaX <= 4000){valopac = "0.9";valstrw="40";}
	if(deltaX > 1000)	//marco
	{
		
		objMapView1.setRLStyle("rectangle","fill:rgb(255,255,255);fill-opacity:" + 0 + ";stroke:rgb(244,4,4);stroke-width:"+ valstrw + ";opacity:" + 1 + ";display:none;");
		var scoord = "2|" + objMapView.getViewRange();
		var ret1 = objMapView1.addRLRectangle("AreaVisible",scoord);
	}
	else			//punto
	{
		
		objMapView1.setRLStyle("line","stroke:rgb(255,255,255);stroke-width:"+ valstrw + ";opacity:" + 1 + ";display:none;");
		objMapView1.setRLStyle("circle","fill:rgb(255,255,255);fill-opacity:" + 0 + ";stroke:rgb(244,4,4);stroke-width:"+ valstrw + ";opacity:" + 1 + ";display:none;");
		var cenx = parseFloat((parseFloat(vcoord[0]) + (deltaX / 2)));
		var ceny = parseFloat((parseFloat(vcoord[1]) - (deltaX / 2)));
		var scoord = "2|" + (cenx - 800) + "|" + ceny + "|" + (cenx + 800) + "|" + ceny;
		var ret1 = objMapView1.addRLLine("AreaVisible1",scoord);
		scoord = "2|" + cenx + "|" + (ceny - 800) + "|" + cenx + "|" + (ceny + 800);
		ret1 = objMapView1.addRLLine("AreaVisible2",scoord);
		scoord = "2|" + cenx + "|" + ceny + "|" + (cenx + 400) + "|" + ceny ;
		ret1 = objMapView1.addRLCircle("AreaVisible3",scoord);
	}
}


function marcoMapaGuia()
{
	//coloco el marco o punto en mapa guia el area activa del mapa detalle
	var vcoord = objMapView.getViewRange();
	vcoord = vcoord.split("|");	
	var deltaX = Math.abs((vcoord[0] - vcoord[2]));
	var objMapView1 = document.getElementById("objMapView1");
	objMapView1.setCoordinateUnits(1);
	var valopac;
	var valstrw;
	if (deltaX > 6000){valopac = "0.5";valstrw="20";}
	if (deltaX <= 6000 && deltaX > 4000){valopac = "0.7";valstrw="30";}
	if (deltaX <= 4000){valopac = "0.9";valstrw="40";}
	if(deltaX > 1000)	//marco
	{
		
		objMapView1.setRLStyle("rectangle","fill:rgb(255,255,255);fill-opacity:" + 0 + ";stroke:rgb(244,4,4);stroke-width:"+ valstrw + ";opacity:" + 1 + ";display:none;");
		var scoord = "2|" + objMapView.getViewRange();
		var ret1 = objMapView1.addRLRectangle("AreaVisible",scoord);
	}
	else			//punto
	{
		
		objMapView1.setRLStyle("line","stroke:rgb(255,255,255);stroke-width:"+ valstrw + ";opacity:" + 1 + ";display:none;");
		objMapView1.setRLStyle("circle","fill:rgb(255,255,255);fill-opacity:" + 0 + ";stroke:rgb(244,4,4);stroke-width:"+ valstrw + ";opacity:" + 1 + ";display:none;");
		var cenx = parseFloat((parseFloat(vcoord[0]) + (deltaX / 2)));
		var ceny = parseFloat((parseFloat(vcoord[1]) - (deltaX / 2)));
		var scoord = "2|" + (cenx - 800) + "|" + ceny + "|" + (cenx + 800) + "|" + ceny;
		var ret1 = objMapView1.addRLLine("AreaVisible1",scoord);
		scoord = "2|" + cenx + "|" + (ceny - 800) + "|" + cenx + "|" + (ceny + 800);
		ret1 = objMapView1.addRLLine("AreaVisible2",scoord);
		scoord = "2|" + cenx + "|" + ceny + "|" + (cenx + 400) + "|" + ceny ;
		ret1 = objMapView1.addRLCircle("AreaVisible3",scoord);
	}
}

//No utilizado actualmente
//Dibuja un punto en la posición indicada
function posicionportal()
{
	var coorx = parseFloat(globals.xport.value);
	var coory = parseFloat(globals.yport.value); 
	var scoord = "1|" + coorx + "|" + coory;
	objMapView.setRLStyle("point","fill:rgb(255,255,255);fill-opacity:0.5;stroke:rgb(244,4,4);stroke-width:200;opacity:0.5;display:none;");
	var ret1 =objMapView.addRLPoint("Portal1", scoord);
}

//==========================================================
//No se usa, solo para comprobar los argumentos pasados por seteventhandler
//(para activar incluir la función en ActivarClickHandler)
function CallbackElemento()
{
	  var sBuf = "Llamada a CallbackElemento:";
	  sBuf = sBuf + "\ntotal argumentos=" + 
         String(CallbackElemento.arguments.length);

	  sBuf = sBuf + "\nArgumentos:";
	  for(var i = 0; i < CallbackElemento.arguments.length;)
	  {
	    sBuf = sBuf + "\n" + CallbackElemento.arguments[i++];
	  }
	  alert(sBuf);
return;
}
//==========================================================
function vercoordenadas()
{
	var sBuf = "Llamada a vercoordenadas:";
	sBuf = sBuf + "\nSistema de Coordenadas=" +
		objMapView.getCoordinateUnits();
	  sBuf = sBuf + "\nArgumentos:";
	  for(var i = 0; i < vercoordenadas.arguments.length;)
	  {
	    sBuf = sBuf + "\n" + vercoordenadas.arguments[i++];
	  }
	  alert(sBuf);
return;
}
//==========================================================
function calcHeight()
{	
	if( typeof( window.innerHeight ) == 'number' ) 
	{	
		status = window.innerHeight;		
	}
	else if( document.documentElement && document.documentElement.clientHeight) 
	{			
		status = document.getElementById("bloquecirculacion").clientHeight;
	} 
	else if( document.body && document.body.clientHeight ) 
	{
		status = document.body.clientHeight;		
	}
	
}

function mostrarcoord()
{
}
function pepe(evt)
{
//var x = objMapView.Clientx;
alert("hola");
}
