//------------------------------------------------------------------------------function EstablecerAlturaFrame(){ //Esta funcion se tiene que utilizar en la pagina donde se encuentra el iframe, normalmente el onload del body//El nombre y el id del iframe tienen que ser iguales//calcula la altura de la p?ina principal del frame y ajusta la altura del mismo	for(i=0;i<window.frames.length;i++){		var id=window.frames[i].name;		//var the_height=window.document.body.scrollHeight+25;		var the_height=window.frames[id].document.body.scrollHeight+25;//		var the_width=window.frames[id].document.body.scrollWidth+25;		//var the_height=document.getElementById(id).contentWindow.document.body.scrollHeight + 25;		//cambia la altura del iframe 		document.getElementById(id).style.height=the_height;//		document.getElementById(id).style.width=the_width;	}	for(i=0;i<parent.window.frames.length;i++){		var id=parent.window.frames[i].name;		var the_height=parent.window.frames[id].document.body.scrollHeight+25;//		var the_width=parent.window.frames[id].document.body.scrollWidth+25;		//var the_height=parent.document.getElementById(id).contentWindow.document.body.scrollHeight + 25;		//var the_height=parent.document.body.scrollHeight + 25;		//cambia la altura del iframe 		parent.document.getElementById(id).style.height=the_height;//		parent.document.getElementById(id).style.width=the_width;	}}//------------------------------------------------------------------------------function OverLinea(oObj,mycolor)// colorea una tabla o celda con el color mycolor en el mouseOver{	oObj.style.cursor='pointer';	//if(!(myTD==oObj)){		oObj.style.backgroundColor = mycolor;	//}}function OutLinea(oObj,mycolor)// colorea una tabla o celda con el color mycolor en el mouseOut{	oObj.style.cursor='auto';	//if(!(myTD==oObj)){		oObj.style.backgroundColor = mycolor;	//}	}//------------------------------------------------------------------------------function MM_setTextOfLayer(objName,x,newText) { //v3.0if ((obj=MM_findObj(objName))!=null) with (obj)    if (navigator.appName=='Netscape') {document.write(unescape(newText)); document.close();}    else innerHTML = unescape(newText);}//------------------------------------------------------------------------------function MM_preloadImages() { //v3.0 // carga imagen	// Macromedia	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_swapImgRestore() { //v3.0//  restaura imagen	// Macromedia 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_findObj(n, d) { //v4.0	//n: , d:	// devuelve un objeto	// Macromedia	if (isNS()){		if (parseInt(navigator.appVersion) > 4){					obj = document.getElementById(n);			if (obj!=null) return obj;		}	}  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); return x;}//------------------------------------------------------------------------------function MM_swapImage() { //v3.0 // cambia imagen	// Macromedia 	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 MM_validateForm() { //v4.0  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;  for (i=0; i<(args.length-2); i+=3) {   	test=args[i+2];	val=MM_findObj(args[i]);    if (val){ 				nm=val.name;		if ((val=val.value)!=""){		  if (test.indexOf('isEmail')!=-1) { 			p=val.indexOf('@');			if (p<1 || p==(val.length-1)) errors+='- '+nm+' Debe ser un correo.\n';		  }else if (test!='R') { 			num = parseFloat(val);			if (isNaN(val)) errors+='- '+nm+' Debe ser un valor numerico.\n';			if (test.indexOf('inRange') != -1) { 				p=test.indexOf(':');				min=test.substring(8,p); max=test.substring(p+1);				if (num<min || max<num) errors+='- '+nm+' Debe ser un valor numerico entre '+min+' y '+max+'.\n';			}		 }		}else if (test.charAt(0) == 'R') errors += '- '+nm+' es obligatorio.\n'; 	}  }  if (errors) alert('Han ocurrido los siguientes errores:\n'+errors);  document.MM_returnValue = (errors == '');}//------------------------------------------------------------------------------function isNS(){	// detecta si el browser es Netscape	// devuelve TRUE si es netscape y FALSE si no	// escrita por ec, 28/02/02					     if (navigator.appName.substring(0,8) == "Netscape"){			return true;}	 else{		return false;	}}//------------------------------------------------------------------------------function isIE(){	// detecta si el browser es explorer	// devuelve TRUE si es explorer y FALSE si no	// modificada por ec, 28/02/02				     if (navigator.appName.substring(0,9) == "Microsoft"){    			return true;}					else{					return false;				}}//------------------------------------------------------------------------------function isFirefox (){	if ((navigator.userAgent).indexOf("Firefox") !=-1){ return true }else{return false};}//------------------------------------------------------------------------------function isMac(){		// detecta si la plataforma es mac  		// devuelve TRUE si es mac y FALSE si no		// escrita por ec, 28/02/02			if (navigator.appVersion.indexOf("Mac") > 0) {					return true;}					else{					return false;					}			}//------------------------------------------------------------------------------function isWin(){		// detecta si la plataforma es win  		// devuelve TRUE si es win y FALSE si no		// escrita por ec, 28/02/02					if (navigator.appVersion.indexOf("Win") > 0){				return true;}					else{					return false;					}}//------------------------------------------------------------------------------function getBrowserVersion() {		// detecta la version del browser  // devuelve una cadena con le numero de version si es entre 3 y 6, si no devuelve "unknown"		// escrita por ec, 28/02/02			bVer = "unknown";			if (parseInt(navigator.appVersion) >= 3) bVer="3x";      if (parseInt(navigator.appVersion) >= 4) bVer="4x";      if (parseInt(navigator.appVersion) >= 5) bVer="5x";			if (parseInt(navigator.appVersion) >= 5) bVer="6x";					return bVer;}//------------------------------------------------------------------------------function putFileInLayerConProblemas (whichFile,whichLayer,isImg){	// mete un fichero html o img en un layer determinado	// whichFile: src del fichero	//isImg: 1 si es una imagen, vacio en caso contrario	// whichlayer: name del layer o del objeto (tambien img por ejemplo)	// atencion: para whichLayer es el name del objeto	/* hay problemas en netscape,  ya que al usar el src del layer y en una segunda invocacion			el document.write se cuelga*/  	var docu="";  if (isNS()){		if (isImg){			myImg = "<img src='" + whichFile + "'>";			docu=MM_findObj(whichLayer);								//alert (docu);			docu.document.open();		  	docu.document.write(myImg);		  	docu.document.close();		}		else{			docu=MM_findObj(whichLayer);			docu.src=whichFile;		}	}  else{		if (isImg){					myImg = "<img src='" + whichFile + "'>";					docu=document.getElementById(whichLayer);					docu.innerHTML=myImg;		}		else{			docu=document.getElementById(whichLayer);			docu.src=whichFile;		}	}}//------------------------------------------------------------------------------function putFileInLayer (whichFile,whichLayer){	// mete un fichero html o img en un layer determinado	// whichFile: src del fichero	// whichlayer: name del layer o del objeto (tambien img por ejemplo)	// atencion: para whichLayer es el name del objeto	/* para que funcione bien en netscape si se cambia el fichero de una img,			la nueva imagen debe tener el mismo tamao que la anterior*/	var docu="";  if (isNS()){		docu=MM_findObj(whichLayer);		docu.src=whichFile;		docu.visibility="show";		}  else{		docu=document.getElementById(whichLayer);		docu.src=whichFile;		docu.style.visibility="visible";	}}//------------------------------------------------------------------------------function hideBadLayers (){		// oculta todos los layers que no corresponde al navegador	if (isIE()){		myLayers=handleAllTags("layer");	}	else{		myLayers=handleAllTags("div");	}	for(i=0; i<myLayers.length; i++){		alert(myLayers[i].id);		MM_showHideLayers(myLayers[i].id,"","hide");	}}//------------------------------------------------------------------------------function MM_showHideLayers() { //v3.0 var i,p,v,obj,args=MM_showHideLayers.arguments;  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2]; 	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }    obj.visibility=v; } }//------------------------------------------------------------------------------function handleAllTags(str) {	// str es el tag que vamos a buscar	// devuelve un array con los elementos encontrados		var arrayOfTags;  if (document.all || document.getElementById) {    arrayOfTags = document.getElementsByTagName(str);  }  else {    document.write("Unrecognized Browser Detected");  }  return(arrayOfTags);}//------------------------------------------------------------------------------//---------------------------SCROLLES----------------------------function verifyCompatibleBrowser(){     this.ver=navigator.appVersion     this.dom=document.getElementById?1:0     this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;     this.ie4=(document.all && !this.dom)?1:0;     this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;     this.ns4=(document.layers && !this.dom)?1:0;     this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)     return this } bw=new verifyCompatibleBrowser()   var speed=50 var loop, timer  function ConstructObject(obj,nest){     nest=(!nest) ? '':'document.'+nest+'.';	this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0; 	this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;	this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight     this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight     this.up=MoveAreaUp;this.down=MoveAreaDown;     this.MoveArea=MoveArea; this.x; this.y;     this.obj = obj + "Object"     eval(this.obj + "=this")     return this } function MoveArea(x,y){     this.x=x;this.y=y     this.css.left=this.x     this.css.top=this.y } function MoveAreaDown(move){ 	if(this.y>-this.scrollHeight+objContainer.clipHeight){     this.MoveArea(0,this.y-move)     if(loop) setTimeout(this.obj+".down("+move+")",speed) 	} } function MoveAreaUp(move){ 	if(this.y<0){   this.MoveArea(0,this.y-move)     if(loop) setTimeout(this.obj+".up("+move+")",speed) 	} } function PerformScroll(speed){ 	if(initialised){ 		loop=true; 		if(speed>0) objScroller.down(speed) 		else objScroller.up(speed)	}  	} function CeaseScroll(){     loop=false     if(timer) clearTimeout(timer) } var initialised;/*function InitialiseScrollableArea(divContainer,divContent,divContenido){     objContainer=new ConstructObject(divContainer,'',divContenido)     objScroller=new ConstructObject(divContent,divContainer,divContenido)     objScroller.MoveArea(0,0)     objContainer.css.visibility='visible'     initialised=true;}  */function InitialiseScrollableArea(divContainer,divContent){     objContainer=new ConstructObject(divContainer)     objScroller=new ConstructObject(divContent,divContainer)     objScroller.MoveArea(0,0)     objContainer.css.visibility='visible'     initialised=true; }function displayStatusMsg(msgStr) {   status=msgStr;  document.returnValue = true;}//------------------------------------------------------------------------------function hidealllayers(myLayer){	 	if (isIE()) {		myLayers=handleAllTags("div");		for(i=0; i<myLayers.length; i++){			MM_showHideLayers(myLayers[i].id,"","hide");		}	} 		else{	 	n = 1;		tmpLayer = "Layer" + n;		tmpLayerObj = MM_findObj(tmpLayer);			while (true) {			tmpLayer = "Layer" + n;			tmpLayerObj = MM_findObj(tmpLayer);			MM_showHideLayers(tmpLayer,"","hide");			n++;			if (tmpLayerObj == undefined){				break;			}					}	}if (myLayer!=""){		MM_showHideLayers(myLayer,"","show");	}}//------------------------------------------------------------------------------function strReplaceAll(str,strFind,strReplace){  var returnStr = str;  var start = returnStr.indexOf(strFind);  while (start>=0)  {    returnStr = returnStr.substring(0,start) + strReplace + returnStr.substring(start+strFind.length,returnStr.length);    start = returnStr.indexOf(strFind,start+strReplace.length);  }  return returnStr;} //------------------------------------------------------------------------------function MM_openBrWindow(theURL,winName,features) { //v2.0  window.open(theURL,winName,features);}//------------------------------------------------------------------------------function openWindow(myFile,w,h){	//myObj = MM_findObj("imagenEnLayer");	//myFile = extractFile(myObj.href);		h=h+20;		w=w+20;	myWin=window.open("","IMAGEN","resizable=no,width="+w+",height="+h);	txt="<html> <head> <title>'IMAGEN'</title><script type='text/javascript' src='js/prototype.js'></script><script type='text/javascript' src='js/scripts.js'></script></head> <body bgcolor='#FFFFFF'><img id='dummyImg' src='../shared/imagenes/" + myFile + "' ><body></html>";	myWin.document.write(txt);	window.close();}//------------------------------------------------------------------------------//----------------------------------------------------------------------------function ocultarMenus(myLayer){// oculta todos los menus desplegables y luego muestra el que se pasa como argumento// si no se pasa el argumento, los oculta todos			MM_showHideLayers("Layer1","","hide");			MM_showHideLayers("Layer2","","hide");			MM_showHideLayers("Layer3","","hide");			MM_showHideLayers("Layer4","","hide");			if (!myLayer==""){				MM_showHideLayers(myLayer,"","show");			}	}//--------------------------------------function showtip(current,e,text){if (document.getElementById){/*	thetitle=text.split('<br>')	if (thetitle.length>1){	thetitles=''	for (i=0;i<thetitle.length;i++)	thetitles+=thetitle[i]	current.title=thetitles*/var lon=text.length;var inicio=0;var primer;if (lon>150){	thetitles=''	for (i=0;i<=Math.floor(lon/150);i++){		parte=text.substr(i*150,150)		thetitles=thetitles+parte+'\n';	}current.title=thetitles.substr(0,thetitles.length-1);}elsecurrent.title=text}else if (document.layers){document.tooltip.document.write('<layer bgColor="white" style="border:1px solid black;font-size:12px;">'+text+'</layer>')document.tooltip.document.close()document.tooltip.left=e.pageX+5document.tooltip.top=e.pageY+5document.tooltip.visibility="show"}}//--------------------------------------function hidetip(){if (document.layers)document.tooltip.visibility="hidden"}//--------------------------------------// para reposicionamiento correcto de layers con respecto a un elemnto de la pagina. Funciona con tablasns4 = (document.layers)? true:falseie4 = (document.all)&&(!document.getElementById)? true:falseie5 = (document.all)&&(document.getElementById)? true:falsens6=  (document.getElementById) && (!document.all)? true:false  function reposicionar(capa,refN,refE,netX,netY,expX,expY,N6X,N6Y) {	//alert("entro");	//str = eval("document.all."+refE).offsetLeft+expX+"px";	//alert(capa + str);	if (document.layers){		if(!(eval("document."+capa))){		}else{				eval("document."+capa).left=eval("document."+refN).x+netX;		eval("document."+capa).top=eval("document."+refN).y+netY;	}							}	if(document.getElementById && !document.all){				eval("document.getElementById ('"+ capa +"')").style.left=eval("document."+refN).x+N6X;		eval("document.getElementById ('"+ capa +"')").style.top=eval("document."+refN).y+N6Y;			}	if (((document.all)&&(!document.getElementById))||((document.all)&&(document.getElementById))) {					eval("document.all."+capa).style.left=eval("document.all."+refE).offsetLeft+expX+"px";		eval("document.all."+capa).style.top=eval("document.all."+refE).offsetTop+expY+"px";			}}function buscarGeneral(str){	var str=document.getElementById("strbusqueda").value;	if (! str == ""){		document.location = "listado_busqueda_gen.jsp?strbusqueda=" + str;	}}function replace(string,text,by) {// Replaces text with by in string    var strLength = string.length, txtLength = text.length;    if ((strLength == 0) || (txtLength == 0)) return string;    var i = string.indexOf(text);    if ((!i) && (text != string.substring(0,txtLength))) return string;    if (i == -1) return string;    var newstr = string.substring(0,i) + by;    if (i+txtLength < strLength)        newstr += replace(string.substring(i+txtLength,strLength),text,by);    return newstr;}function QTVR(id, ancho, alto){	// nos escribe un objeto qtvr con el id dinamico	moviename="elVR";	//alert("id="+id+" moviename="+moviename);	document.write("<object classid='clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B' codebase='http://www.apple.com/qtactivex/qtplugin.cab' name='QTVRmedio' width='"+ancho+"' height='"+alto+"'>");	document.write("<param name='src' value='"+id+"'>");	document.write("<param name='autoplay' value='false'>");	document.write("<param name='controller' value='false'>");	document.write("<param name='kioskmode' value='true'>");	document.write("<param name='scale' value='tofit'>");	document.write("<param name='moviename' value='panoramica'>");	document.write("<embed alt='virtual' src='"+id+"' width='"+ancho+"' height='"+alto+"' kioskmode='true' autoplay='false' controller='false' pluginspage='http://www.apple.com/quicktime/download/' scale='tofit' name='QTVRmedio' moviename='panoramica'></embed>");	document.write("</object>");	document.close();}function JAVA(id, ancho, alto){	document.write("<applet code='ptviewer.class' name='tviewer' width='"+ancho+"' height='"+alto+"' mayscript='true' archive='qtvr/ptviewer.jar' class='objects' title=''>");	document.write("<param name='file' value='qtvr/"+id+".jpg'>");	document.write("<param name='pan' value='0'>");	document.write(" <param name='fov' value='65'>");	document.write("<param name='fovmax' value='95'>");	document.write("<param name='fovmin' value='45'>");	document.write("<param name='bar_x' value='70'>");	document.write("<param name='bar_xy' value='200'>");	document.write("<param name='bar_width' value='250'>");	document.write("<param name='bar_height' value='10'>");	document.write("<param name='wait' value='imagenes/portada.gif'>");	document.write("</applet>");}function parametro(name){// recuperacion de parametros	var query=location.search;	query= replace(query,'%20',' ');	var pos=query.indexOf(name);	if (pos!=-1){		query=query.substring(pos+name.length+1,query.length);		pos=query.indexOf("&");		if (pos!=-1)return query.substring(0,pos);		return query;	}	return "";}function AbrirCentrada(theURL,winName,width,height) {var obj;  var posx=(screen.Width-width)/2;  var posy=(screen.Height-height)/2;  parametros='width=' + width + ',left='+ posx + ',height=' + height + ',top='+ posy + ',toolbar=no,location=no,status=no,directories=no,menubar=no,scrollbars=no,resizable=no,titlebar=no';  obj=window.open("",winName,parametros);  obj.document.write("<body leftmargin=\"0\" topmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">");  obj.document.write("<img src="+theURL+"></body>");  obj.document.close();}function zoomImg (img,pie,autor,enlace,imprimir){	//permite aumentar una imagen	var alto=30;	if (pie!="" && pie!=null){		alto=alto+30;				if (enlace!="" && enlace!=null)	alto=alto+30;			}else if (enlace!="" && enlace!=null) alto=alto+30;					var superior=(screen.height/2)-300;	var izquierdo=(screen.width/2)-400;		w=window.open("","IMAGEN","titlebar=no,toolbar=no,top="+superior+",left="+izquierdo+",status=no,scrollbars=no,resizable=yes,width=400,height=300");	w.document.write("<html><head><title>IMAGEN</title>");	w.document.write("<style>"+					 "img {margin:10px;padding:10px;border-color:#fff;border-width:2px} "+					 "span {margin:10px;padding:10px;color:#fff} "+					 ".img-shadow {float:left;background: url(../images/shadow.gif) no-repeat bottom right;margin: 10px 0 0 5px;} "+					 ".img-shadow img {  display: block; position: relative; background-color:#fff;  border: 1px solid #eee; margin: -6px 6px 6px -6px; padding: 4px; }");	w.document.write("</style>");	w.document.write("<link href='shared/default.css' rel='stylesheet' type='text/css'>");;	w.document.write("<style>body {background-color:#000; background-image:none} </style>");	w.document.write("<script>function checksize(){");	w.document.write("if (document.images[0].complete){");	w.document.write("		window.resizeTo(document.images[0].width+20,document.images[0].height+180);");	w.document.write("		window.focus();");	w.document.write("	}else{");	w.document.write("		setTimeout('checksize()',250)");	w.document.write("	}}</script>");	w.document.write("<script type='text/javascript' src='js/prototype.js'></script><script type='text/javascript' src='js/scripts.js'></script></head>");	w.document.write("<body onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0>");	if(isIE()){		w.document.write("<div class='img-shadow' style='margin-left:6px'>");		}else{		w.document.write("<div class='img-shadow' style='margin-left:15px'>");		}	w.document.write("<img src='"+img+"'/ ><span>"+pie+autor+"</span>");	//if (pie!="" && pie!=null) w.document.write("<br/ ><br/><br/>");	w.document.write("<p style='float:right;display:block; font-size:10px;'> <a href='javascript:window.close()' style='color:#a8b6ad; margin-right:20px'>[Cerrar]</a></p></div>");	w.document.write("</body></html>");	w.document.close();	//if (!imprimir) w.print();}function checksize(){	if (document.images[0].complete){		window.resizeTo(document.images[0].width+30,document.images[0].height+170);		window.focus();	}else{		setTimeout('checksize()',250)	}}function SoloNumeros(code){// var code = event.keyCode  var habilitado = false  // teclas para decimales  if (code == 188 || code == 190 || code == 110 ) {  var habilitado = false  }  // teclas de edicion  if (code == 27 || code == 8 || code == 37 || code == 39 || code == 46 || code==9) {  var habilitado = true  }  window.status = code  return ( ((code >= 48) && (code <= 57) ||(code >= 94) && (code <= 105)  )|| habilitado   )  }// para susin ----------------------------------------// asignacion de clic a las imagenesdocument.observe("dom:loaded", function() { 	$$("div.story img:not([rel=noclick])").each(function(s){		//s.onmouseover=alert(s.src);/*mostrarSubmenus.bind(this,s)*/		var src = s.src.substr(s.src.lastIndexOf("/")+1);		s.onmouseover=function(){s.style.cursor='pointer' }		s.onclick=mostrarImg.bind(this,s);			});});function mostrarImg(event){	var data = $A(arguments);	var src = data[0].src.substr(data[0].src.lastIndexOf("/")+1);	zoomImg ("images/bg/"+src,data[0].title,"","no");}