function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function ocultar_grupo(id) {
    cual="grupo_"+id
    document.getElementById(cual).style.display="none";
}

function mostrar_grupo(id,cuantos) {
   for (var i=1; i<=cuantos; i++)  {
     cual="grupo_"+i
     if (i!=id) document.getElementById(cual).style.display="none";
  }
    cual="grupo_"+id
    if (document.getElementById(cual).style.display=="block") {
		document.getElementById(cual).style.display="none";
	}
	else  {
    		document.getElementById(cual).style.display="block";
	}
}

function fCalle_r(){
	p=MM_findObj('localizar');
	if (p!=null) p.value='0';
	p=MM_findObj('form1');
	p.calle_sel.value=1;
	if (p!=null) p.submit();
}

function carga_mapa(tipo,combo,shape) {
var calle_r=""
var edificio_r=""
var portal_r=""
var ficha_r=""
var accion_r=""
var ximg
var yimg
var val_txek="";
var ficha="";
var xmin, xmax,ymin,ymax
var shape_r=""
var idioma_r=""

for (var i = 0; i<document.form1.elements.length; i++) {
  if (document.form1.elements[i].type == 'checkbox' && document.form1.elements[i].checked==true) {
	val_txek=val_txek + document.form1.elements[i].value + ",";
 }
}
sInfo = val_txek.substring(0,val_txek.length-1);
	
	
ximg=document.form1.ximg.value
yimg=document.form1.yimg.value

xmin=document.form1.XMin.value
ymin=document.form1.YMin.value
xmax=document.form1.XMax.value
ymax=document.form1.YMax.value

idioma_r=document.form1.idioma.value

if (tipo=="calle_r") {
	calle_r=document.form1.calle_r.value
	portal_r=document.form1.portal_r.value
}	
if (tipo=="edificio_r") edificio_r=document.form1.edificio_r.value

if (combo!='' && combo!="panorami") {
    var inicial= eval("document.form1."+combo)
    ficha_r=inicial.options[inicial.selectedIndex].value
    accion_r="info"
    inicial.options[0].selected="true"
}

if (combo=="panorami") {
    var inicial= eval("document.form1."+combo)
    var array_ficha;
    array_ficha=inicial.options[inicial.selectedIndex].value.split("#");
    
    ficha_r=array_ficha[0];
    accion_r="info"
    inicial.options[0].selected="true"
}

if (!document.form1.orto.checked) orto_r=0
if (document.form1.orto.checked) orto_r=1

calidad_r=document.form1.calidad.options[document.form1.calidad.selectedIndex].value
ano_r=document.form1.ano.options[document.form1.ano.selectedIndex].value


if (shape!='') shape_r=shape


top.frames['rightFrame'].location.href="mapa.aspx?subgrupo=poi_vr," + sInfo + "&edificio_r=" + edificio_r + "&calle_r=" + calle_r + "&portal_r=" + portal_r + "&ficha_r=" + ficha_r + "&localizar=1&ximg="+ ximg + "&yimg=" + yimg + "&xmin="+ xmin + "&ymin=" + ymin + "&xmax="+ xmax + "&ymax=" + ymax + "&shape=" + shape_r + "&accion=" + accion_r + "&idioma=" + idioma_r + "&orto=" + orto_r + "&calidad=" + calidad_r + "&ano=" + ano_r
}	


function desplazar(direccion){
	//Desplazar el mapa en una direccin concreta.
	if (direccion=='alejar' || direccion=='acercar' ) document.MapForm.accion.value =""
	document.MapForm.Direccion.value = direccion;
	document.MapForm.submit();
}
  
function activa_checkbox(este) {
  for (var i = 0; i<document.form1.elements.length; i++) {
     if (document.form1.elements[i].type == 'checkbox' && document.form1.elements[i].value==este) {
	document.form1.elements[i].checked=true
     }
  }
	
}

function PopupCentrada(mypage, myname, w, h, scroll) {
var winl = (screen.availWidth - w - 10) / 2;
var wint = (screen.availHeight - h - 22) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
//if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function carga_pano() {
var mytool_array=document.form1.panorami.options[document.form1.panorami.selectedIndex].value.split("#");
	
var cual="http://www.irun.org/panorami/" + mytool_array[1]

MM_openBrWindow(cual,'Pano','width=400,height=500,left=250, top=10')
  
}	
