function init(){
	wW = (is.ns)? window.innerWidth-15 : document.body.offsetWidth-20
	wH = (is.ns)? window.innerHeight : document.body.offsetHeight-4

	if(is.ns){
	origWidth=innerWidth;
	origHeight=innerHeight;
	onresize=function(){
		if(innerWidth!=origWidth||innerHeight!=origHeight)
		location.reload()
		}
	}
	Lnada = new DynLayer("LnadaDiv");
	Lnada.moveTo(0,0)
	Lnada.clipTo(0,wW,wH,0);
	Lcontenido = new DynLayer("LcontenidoDiv");
	Lcontenido.moveTo(wW/2-380,10)
	Lbusca = new DynLayer("LbuscaDiv");
	Lbusca.moveTo(wW/2-244,210);
if (is.ns) {
    	if(location.reload)
		Lnada.hide();
	}
    if (is.ie) {
    	if(document.all)
		Lnada.hide();
	}
}

function IP_swapImgRestore() {  
  var i,x,a=document.IP_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function IP_findObj(n, d) {  
  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=IP_findObj(n,d.layers[i].document); return x;
}

function IP_swapImage() {  
  var i,j=0,x,a=IP_swapImage.arguments; document.IP_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=IP_findObj(a[i]))!=null){document.IP_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function IP_preloadImages() {  
  var d=document; if(d.images){ if(!d.IP_p) d.IP_p=new Array();
    var i,j=d.IP_p.length,a=IP_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.IP_p[j]=new Image; d.IP_p[j++].src=a[i];}}
}

function openVentana(P_pagina) {
		KulturWeb = window.open(P_pagina, 'dy', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=50,height=50,left=200,top=40,screenLeft=200,screenTop=40,resizable=1');
}

function openVentana1(P_pagina) {
		KulturWeb = window.open(P_pagina, 'dy', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,width=400,height=500,left=200,top=40,screenLeft=200,screenTop=40,resizable=0');
}

function openVentana2(P_pagina) {
		mapaweb = window.open(P_pagina, 'dy', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width=780,height=450,left=0,top=40,screenLeft=0,screenTop=40,resizable=0');
}

function ahora(){
  fecha=new Date();
  ms =fecha.getTime();
  return ms;
}	

function ventanaImagen(urlImagen) {
	nueva = window.open('http://www.facilnet.es/generic/ventanaimagen.asp?imagen=' +urlImagen, '_blank', 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width=50,height=50');
	nueva.focus();
}

/*
 Hace que el iframe tome la altura de su contenido
 p_frame: id del iframe (opcional)
 p_div: id del div que abarca el body del iframe
 Para mantener la compatibilidad con mozilla (especialmente si omitimos el 1er parámetro)
 conviene que el iframe tenga el mismo name e id
*/
function cambiar_altura(p_frame, p_div){
//	alert(p_frame);
//	alert(this.frames.name);
	if(p_frame==null) p_frame = this.frames.name;
	var lbackdiv = parent.document.getElementById(p_frame);//frame obj
	var contentdiv = document.getElementById(p_div);//tallest div on iframe's parent
	var contentht = contentdiv.clientHeight? contentdiv.clientHeight : contentdiv.offsetHeight;//find height of tallest div

	var winht = document.body.clientHeight? document.body.clientHeight : document.body.offsetHeight;//find height of browser window
	
	if(winht < 1)
	{winht = window.innerHeight;}//in case browser uses neither clientHeight nor offsetHeight
	
//	Bourch: Comento esta linea para que pueda adaptase a mayor y también menor
//	var ht = contentht > winht? contentht : winht;//set height to whichever is greater, window or tallest div height
	var ht = contentht ;

	lbackdiv.style.height = ht + "px";//change height of iframe
} 
