var BrowserDetect={init:function(){this.browser=this.searchString(this.dataBrowser)||"An unknown browser";this.version=this.searchVersion(navigator.userAgent)||this.searchVersion(navigator.appVersion)||"an unknown version";this.OS=this.searchString(this.dataOS)||"an unknown OS"},searchString:function(D){for(var A=0;A<D.length;A++){var B=D[A].string;var C=D[A].prop;this.versionSearchString=D[A].versionSearch||D[A].identity;if(B){if(B.indexOf(D[A].subString)!=-1){return D[A].identity}}else{if(C){return D[A].identity}}}},searchVersion:function(B){var A=B.indexOf(this.versionSearchString);if(A==-1){return }return parseFloat(B.substring(A+this.versionSearchString.length+1))},dataBrowser:[{string:navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:navigator.vendor,subString:"Apple",identity:"Safari"},{prop:window.opera,identity:"Opera"},{string:navigator.vendor,subString:"iCab",identity:"iCab"},{string:navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:navigator.vendor,subString:"Camino",identity:"Camino"},{string:navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],dataOS:[{string:navigator.platform,subString:"Win",identity:"Windows"},{string:navigator.platform,subString:"Mac",identity:"Mac"},{string:navigator.platform,subString:"Linux",identity:"Linux"}]};BrowserDetect.init();var menu_object="menu04";Ajax.Responders.register({onCreate:showLoader,onComplete:hideLoader});document.volver=new Array();document.avanzar=new Array();function showLoader(){if($("loader")!=undefined){document.loader_effect=new Effect.Appear("loader",{duration:0.3})}}function hideLoader(){if($("loader")!=undefined){document.loader_effect=new Effect.Fade("loader")}}function showMsg(a){$("error_msg").innerHTML=a;$("error_msg").show();new Effect.Highlight($("error_msg"))}Init=function(f){if(f==undefined||f==null||f!=1){document.body.ondrag=document.body.onselectstart=document.onmousedown=function(h){if(!h){var h=event}var g=null;if(h.srcElement){g=h.srcElement}else{if(h.target){g=h.target}}if(g.nodeType==3){g=g.parentNode}if(g==null||(hasClassName(g,"no_sel"))){return false}return true};document.habilita_seleccion=false}else{document.habilita_seleccion=true}if(document.id_lengua==undefined||$("len_"+document.id_lengua)==undefined){document.id_lengua="es"}var d=1;document.id_home=1;var c;var b;var e;var a=ParseaURL(c,b,e);c=a[0];b=a[1];e=a[2];document.id_lengua=b;document.var_apartado=c;document.sub_apartado=e;$("len_"+document.id_lengua).style.display="none";document.oscroll=new OScroll("cuerpo","desplazador","handle","track",316);if(document.xml_lista_sec&&document.xml_lista_var){GetApartadoList(document.id_lengua,"GetVarApartado(null,true);",document.xml_lista_sec,document.xml_lista_var)}GetNoticiaList("noticias_cabeceras",1);LanzaCheckURL();$("outer").style.visibility="visible";if(Prototype.Browser.Chrome){$("encabezado_general").setOpacity(0.9999)}$("derecha_div").setOpacity(0);$("derecha_div").style.visibility="visible";new Effect.Appear("derecha_div",{from:0,to:1.1,duration:1.5});if(Prototype.Browser.IE){setTimeout(function(){Dialog.info($("noIE").innerHTML,{className:"ventana_nota",width:386,height:164,effectOptions:{duration:0.4},id:"No_IE",closable:true})},100)}};function makeNewHash(c,a){if(c&&location.hash!=c){if(a){window.location.replace(c)}else{window.location.hash=c}}var b=document.getElementById("historyFrame").contentWindow.document;b.open("javascript:'<html></html>'");b.write('<html><head><script type="text/javascript">parent.onFrameLoaded(\''+c+"');<\/script></head><body></body></html>");b.close()}function onFrameLoaded(a){if(a&&location.hash!=a){location.hash=a}}function GetVarApartado(a,b,d){var c=document.id_home;if(a){document.var_apartado=a}if(document.var_apartado&&document.lista_secciones.length>0&&document.var_apartado.length>0){if(document.lista_secciones[document.var_apartado]){c=parseInt(document.lista_secciones[document.var_apartado]);if(isNaN(c)){c=1}}}GetApartado(c,b);if($(menu_object)&&$("menu_div").style.display!="none"&&document.var_apartado&&(document.habilita_seleccion==false)){if(d){}else{if($(menu_object)&&$(menu_object).ClickEnApartado){$(menu_object).ClickEnApartado(document.var_apartado)}}}}function GeneraSUB(c){var a=c[0];var b;for(b=1;b<c.length;b++){a+="/"+c[b]}return a}function ParseaSUB(c,d){if(c==null||c==undefined){c=document.sub_apartado}if(c==null||c==undefined){var b=ParseaURL();if(b[2]){c=b[2]}}var a=new Array();if(c==null||c==undefined){return a}if(!isNaN(c)){c=c.toString()}a=c.split("/");return a}function ParseaURL(){var d=window.location.hash;var f=1;var c=document.var_apartado;var h=null;var e=document.id_lengua;if(d.indexOf("#")>-1){if(d.substr(d.indexOf("#")+2).indexOf("/")>-1){var g=d.indexOf("#")+2;c=d.substr(g,d.substr(g).indexOf("/"));var b=d.substr(g+c.length+1).indexOf("/");var a;if(b>-1){a=d.substr(g+c.length+1,b)}else{a=d.substr(g+c.length+1)}if(a=="ca"||a=="es"||a=="en"){e=a;if((d.length-(g+c.length+4))>0){h=d.substr(g+c.length+4)}}else{if((d.length-(g+c.length+1))>0){h=d.substr(g+c.length+1)}}}else{c=d.substr(d.indexOf("#")+2);h=null}}return new Array(c,e,h)}function CambiaURL(c,f,h,a,d){var b=window.location.href;var e="";var g=ParseaURL();var i=false;if(c){e+="#/"+document.lista_secciones[c];if(c!=g[0]){i=true}}else{if(f){e+="#/"+f;if(f!=g[0]){i=true}}}if(document.id_lengua){e+="/"+document.id_lengua}if(a){e+="/"+a;if(a!=g[2]){i=true}}document.sub_apartado=a;document.custom_hash=e;if(location.hash==e){return}if(Prototype.Browser.IE){makeNewHash(e,d)}else{if(d||!i){window.location.replace(e)}else{window.location.hash=e}}}function LanzaCheckURL(){document.intervalo_url=setInterval("CheckURL()",333)}function CheckURL(){if(document.custom_hash&&document.custom_hash!=window.location.hash){var a=ParseaURL();var b=false;if(a[1]!=undefined&&a[1]!=document.id_lengua){CambiaLengua(a[1])}if(a[2]!=document.sub_apartado){if(a[2]){document.sub_apartado=a[2]}else{document.sub_apartado=null}b=true}if(a[0]!=undefined&&a[0]!=document.var_apartado){GetVarApartado(a[0],true)}else{if(b){if(document.lista_secciones[document.var_apartado].func){document.lista_secciones[document.var_apartado].func(document.sub_apartado)}}else{CambiaURL(null,a[0],a[1],a[2],true)}}}}function GetBack(){volver=document.volver;if(volver.length>1){volver.pop();eval(volver.pop())}}function CambiaLengua(len){var volver=document.volver;GetApartadoList(len,null);if(volver.length){eval(volver[volver.length-1])}GetNoticiaList("noticias_cabeceras",1)}function ParseText(a,b){if(b){a=a.replace(/<span class=\"tab\"><\/span>/g,"\t");a=a.replace(/<br>/g,"\n");a=a.replace(/&amp;/g,"&")}else{a=a.replace(/\\t/g,'<span class="tab"></span>');a=a.replace(/\t/g,'<span class="tab"></span>');a=a.replace(/\n/g,"<br />");a=a.replace(/&#x22;/g,'"')}return a}function getElementWidth(b){var c=$(b);if(c.style.pixelWidth){xPos=c.style.pixelWidth}else{if(c.offsetWidth==0&&c.style.width){var a=c.style.width;alert("("+b+").width:"+c.style.width);xPos=parseInt(a.substring(0,a.indexOf("px")))}else{xPos=c.offsetWidth}}return xPos}function fireEvent(c,b){if(document.createEventObject){var a=document.createEventObject();return c.fireEvent("on"+b,a)}else{var a=document.createEvent("HTMLEvents");a.initEvent(b,true,true);return !c.dispatchEvent(a)}}if(typeof DOMParser=="undefined"){DOMParser=function(){};DOMParser.prototype.parseFromString=function(c,e){if(typeof ActiveXObject!="undefined"){var b=new ActiveXObject("MSXML2.DomDocument");b.loadXML(c);return b}else{if(typeof XMLHttpRequest!="undefined"){var a=new XMLHttpRequest;a.open("GET","data:"+(e||"application/xml")+";charset=utf-8,"+encodeURIComponent(c),false);if(a.overrideMimeType){a.overrideMimeType(e)}a.send(null);return a.responseXML}}}}if(Prototype.Browser.IE){}else{Node.prototype.transformNode=function(c){var d=new XSLTProcessor();d.importStylesheet(c);var b=d.transformToFragment(this,document);var a=new XMLSerializer().serializeToString(b);return a}}function getChild(c,b){if(c.hasChildNodes()){for(var a=0;a<c.childNodes.length;a++){if(c.childNodes[a]!=undefined&&c.childNodes[a].tagName==b){return c.childNodes[a]}}}return false}function getNextChild(c,b,a){if(c.hasChildNodes()){if(this.i==undefined||this.i>c.childNodes.length){this.i=0}for(;this.i<c.childNodes.length;this.i++){if(c.childNodes[this.i]!=undefined&&c.childNodes[this.i].tagName==b){if(a==undefined||this.n==a){this.n++;return c.childNodes[this.i++]}else{this.n++}}}}return false}function NextChild(){this.i=0;this.n=0;this.getNextChild=getNextChild}function getText(a){if(a.firstChild){return a.firstChild.nodeValue}if(a.nodeValue){return a.nodeValue}return(a.text?a.text:a.textContent)}function setText(b,a){alert("objeto.nodeValue:"+b.textContent);if(b.text){b.text=a}else{b.textContent=a}alert("After .nodeValue:"+b.textContent)}function debug(a){if(!document.alf_debug){document.alf_debug=new Array()}document.alf_debug.push(a)}function show_debug(){var c=document.alf_debug;var a="";if(c){for(var b=0;b<c.length;b++){a+=b+"."+c[b]+"\n"}alert(a)}else{alert("empty debug.")}}function decode_utf8(b){try{var a=decodeURIComponent(escape(b))}catch(c){}return a}function SetMenuActivo(a){document.menu_activo=a}function GetApartadoList(len,after,xmlsec,xmlvar,n){var sel=document.habilita_seleccion;var error_accediendo_menu="ERROR: Accediendo al menu Flash";var tanz="Tanz du mit mir?";if($(menu_object).style.display=="block"){if(document.menu_activo!=1||$(menu_object).SetApartado==undefined||$(menu_object).MenuLoaded(tanz)!="NatÃ¼rlich!"){debug("warning("+n+"): "+error_accediendo_menu);if(n==undefined){n=0}else{if(n<120){return setTimeout(function(){GetApartadoList(len,after,xmlsec,xmlvar,++n)},220)}else{alert("extra waiting");$("menu_div").show();return setTimeout(function(){GetApartadoList(len,after,xmlsec,xmlvar,++n)},350)}}}}if(n>=120){$("menu_div").style.visibility="hidden"}var success=function(t){var xml;if(xmlsec&&t==null){xml=xmlsec}else{xml=t.responseXML}if(!xml.hasChildNodes()||!getChild(xml,"secciones")){alert(document.mensajes.error_cargadatos)}else{document.id_lengua=len;var secs=getChild(xml,"secciones");var num=parseInt(secs.getAttribute("num").toString());var g=new NextChild;$("menu_texto_div").innerHTML="";document.lista_secciones=new Array();for(var i=0;i<num;i++){var sec=g.getNextChild(secs,"seccion");var secHTML="";var id_sec=sec.getAttribute("id");var nombre=sec.getAttribute("nombre");var variable=sec.getAttribute("variable");var seccion=sec.getAttribute("seccion");document.lista_secciones[variable]=id_sec;document.lista_secciones[id_sec]=variable;if(seccion){if($(menu_object)){$(menu_object).SetVariable(variable,nombre)}else{alert(error_accediendo_menu)}if(sel){secHTML='<ul><li><input type="radio" name="ap_sel" value="'+id_sec+'" /><a href="javascript:GetApartado('+id_sec+')">'+nombre+"</a></li></ul>"}else{secHTML='<ul><li><a href="'+variable+"/"+document.id_lengua+'">'+nombre+"</a></li></ul>"}new Insertion.Bottom("sec_"+seccion,secHTML)}else{var m=$(menu_object);if(m&&m.SetApartado!=undefined){m.SetApartado(variable,decode_utf8(nombre))}else{debug(i+"-"+error_accediendo_menu+". "+variable+"=>"+nombre)}secHTML='<li><div id="sec_'+id_sec+'"><a href="#/'+variable+'">'+decode_utf8(nombre)+"</a></div></li>";new Insertion.Bottom("menu_texto_div",secHTML)}}$("menu_texto_div").innerHTML="<ul>"+$("menu_texto_div").innerHTML+"</ul>";if(after){eval(after)}}};var success_var=function(t){var xml;if(xmlvar&&t==null){xml=xmlvar}else{xml=t.responseXML}if(!xml.hasChildNodes()||!getChild(xml,"variables")){alert(document.mensajes.error_cargadatos)}else{var vars=getChild(xml,"variables");var num=parseInt(vars.getAttribute("num").toString());var g=new NextChild;document.lista_variables=new Array();for(var i=0;i<num;i++){var vari=g.getNextChild(vars,"variable");var nombre=vari.getAttribute("nombre");var valor=unescape(vari.getAttribute("valor"));document.lista_variables[nombre]=valor;var m=$(menu_object);if(xmlvar==undefined){var e=$("var_"+nombre);var ee=$$(".var_"+nombre);if(e){e.innerHTML=valor}if(ee&&ee.length){ee.each(function(el){el.innerHTML=valor})}}if(m&&m.SetApartado!=undefined){m.SetApartado(nombre,valor)}else{if(!document.habilita_seleccion){debug(i+"-VARS-"+error_accediendo_menu+". "+nombre+"=>"+valor)}}}}};var error=function(){alert(document.mensajes.error_desconocido)};if(xmlsec&&xmlvar&&len==document.php_detected_len){success(null);success_var(null);return}if(len){$("len_"+(document.id_lengua)).style.display="inline";document.id_lengua=len;$("len_"+len).style.display="none"}var lang="&lang="+len;new Ajax.Request("xml.php?lst_sec"+(len?lang:""),{asynchronous:true,onSuccess:success,onFailure:error});new Ajax.Request("xml.php?lst_var"+(len?lang:""),{asynchronous:true,onSuccess:success_var,onFailure:error})}function GetApartado(b,a){if($("cuerpo").style.display=="none"){alert("Por favor, aplique los cambios al texto principal antes de cambiar de seccion.");return}var n=document.volver;var i="GetApartado("+b+","+a+")";if(!n.length||n[n.length-1]!=i){n.push(i)}if(a){}else{document.sub_apartado=null}CambiaURL(b,null,document.id_lengua,document.sub_apartado,a);$("central_div").hide();$("central_div").setOpacity(0.01);var l=$("bloque_interno");l.style.marginTop="0px";l.style.width="auto";if(l.style.styleFloat!=undefined){l.style.styleFloat=""}else{l.style.cssFloat=""}$("imagenes").style.height="280px";$("cuerpo").style.height="316px";$("cuerpo").style.left="0px";$("bloque").style.width="463px";var j=$("banner");j.style.position="";j.style.width="";j.style.height="93px";j.style.margin="";j.style.cssFloat="";j.style.letterSpacing="";j.show();var h=$("encabezado");h.style.position="static";h.style.paddingTop="19px";h.style.height="26px";h.style.display="block";h.style.visibility="visible";var c=$("imagenes");c.style.display="block";c.style.visibility="visible";c.style.left="0px";c.style.paddingTop="0px";c.style.paddingRight="0px";if(b==6||b==37||b==39){$("cuerpo").style.width="276px";if(c.style.styleFloat!=undefined){c.style.styleFloat="left"}else{c.style.cssFloat="left"}}else{$("cuerpo").style.width="309px";if(c.style.styleFloat){c.style.styleFloat="right"}else{c.style.cssFloat="right"}}var e=$("desplazador");e.style.left="0px";e.style.height="350px";e.style.display="block";e.style.cssFloat="left";$("track").style.height="314px";document.oscroll.slider.options.maximum=314;if($("bloque").original_width!=undefined){$("bloque").style.width=$("bloque").original_width}if($("bloque_interno").original_width!=undefined){$("bloque_interno").style.width=$("bloque_interno").original_width}if($("proyectos")){var k=$("proyectos").parentNode;k.removeChild($("proyectos"))}document.apartado=b;if(ScrollObj().SetSlider){ScrollObj().SetSlider.bind(ScrollObj())}var m=function(E){var w=E.responseXML;if(!w.hasChildNodes()||getChild(w,"error")){alert(document.mensajes.error_cargadatos)}else{document.cargando=1;var z=getChild(w,"seccion");var A=getChild(z,"script");document.nombre_seccion=getText(getChild(z,"nombre"));$("imagenes").innerHTML="";$("banner").innerHTML="";if(!A||A.firstChild==undefined){if(document.habilita_seleccion&&$("boton_edita_cuerpo")){$("boton_edita_cuerpo").disabled=false}var v=getChild(z,"texto");Element.update($("cuerpo"),ParseText(getText(v)));GetImagenesAp(b,null,null,z);var q=GeneraEnlacesLaterales($("cuerpo"),$("imagenes"));var x=getChild(z,"id_encabezado");var o=getChild(z,"encabezado");var D=getChild(z,"id_banner");if(getText(x)){GetEncabezado(parseInt(getText(x)))}else{if(getText(o)){SetEncabezado(getText(o))}else{SetEncabezado(document.nombre_seccion)}}if(getText(D)){GetBanner(parseInt(getText(D)),D)}else{$("banner").style.height="22px";if(b!=40){if(b==6||b==37||b==39){c.style.paddingTop="94px"}else{c.style.paddingTop="139px"}c.style.height=211+"px"}else{c.style.paddingRight="30px"}$("cuerpo").style.height="350px";$("track").style.height="350px";document.oscroll.slider.options.maximum=350}var u=$("cuerpo").style.height;$("cuerpo").style.height="auto";$("central_div").style.visibility="hidden";$("central_div").show();var r=$("cuerpo").offsetHeight;$("central_div").hide();$("central_div").style.visibility="visible";$("cuerpo").style.height=u;if(r<250){c.style.height=208+"px"}else{if(r<=316){c.style.height=r-14+"px"}}VentanaManager.init("ventana",{url:"ventana.php",options:{method:"get"}},{});LanzaIntervalos("central_div");document.cargando--}else{if(document.apartado!=9&&document.habilita_seleccion&&$("boton_edita_cuerpo")){$("boton_edita_cuerpo").disabled=true}else{if($("boton_edita_cuerpo")&&$("boton_edita_cuerpo").disabled){$("boton_edita_cuerpo").disabled=false}}document.cargando=1;if(b==1||b==9||b==18||b==19){document.cargando=2}GetImagenesAp(b,null,null,z);var B=getText(A);var x=getChild(z,"id_encabezado");var o=getChild(z,"encabezado");var D=getChild(z,"id_banner");if(getText(x)){GetEncabezado(parseInt(getText(x)))}else{if(getText(o)){SetEncabezado(getText(o))}else{SetEncabezado(document.nombre_seccion)}}if(getText(D)){GetBanner(parseInt(getText(D)),D)}else{$("banner").style.height="22px";c.style.paddingTop="139px";c.style.height=211+"px";$("cuerpo").style.height="350px";$("track").style.height="350px";document.oscroll.slider.options.maximum=350;ScrollObj().rebuild()}LanzaIntervalos("central_div");var s="";if(a&&document.sub_apartado){s="&sub="+document.sub_apartado}var z="?sec=";if(B.indexOf("?")>-1){z="&sec="}if(B.indexOf("ventana_")==0){$("cuerpo").update("");$("encabezado").update("");var C=B.split(" ").detect(function(t){return t.indexOf("ventana_")==0});var p=B.split(" ").detect(function(t){return t.indexOf("ajax_")==0});if(p){p="?sec="+p.substr(p.indexOf("_")+1,p.length)}else{p="?sec="+b}var y=B.split(" ").detect(function(t){return t.indexOf("tpl_")==0});if(y){y="&tpl="+y.substr(y.indexOf("_")+1,y.length)}else{y=""}VentanaManager.init(C,{url:"ventana.php"+p+y,options:{method:"get"}},{})}else{new Ajax.Updater("cuerpo",B+z+b+s,{method:"get",asynchronous:true,evalScripts:true,onFailure:d,onSuccess:g})}}}};var g=function(){VentanaManager.init("ventana",{url:"ventana.php",options:{method:"get"}},{});var o=GeneraEnlacesLaterales($("cuerpo"),$("imagenes"));document.cargando--};var d=function(){alert(document.mensajes.error_desconocido);document.cargando--};var f=function(){alert(document.mensajes.error_desconocido)};new Effect.Appear("loader",{duration:0.3});new Ajax.Request("xml.php?sec="+b+(document.id_lengua?("&lang="+document.id_lengua):""),{asynchronous:true,onSuccess:m,onFailure:f})}function GetProyectoInt(e,m,b,g,q){if(document.cargando>0){return}document.cargando=0;var k=Array(null,m);if(document.var_apartado=="muebles"&&g==undefined){g=true}else{if(document.var_apartado=="exposiciones"&&q==undefined){q=true}}if(e==undefined||e==null){e="proyectos"}else{k=ParseaSUB(e);if(isArray(k)&&isInteger(k[0])){m=k[0]}else{if(isInteger(e)){m=parseInt(e)}}e="proyectos"}var f=$(e);if(!f){return}if(ScrollObj().SetSlider){ScrollObj().SetSlider(0)}var j=0;var p;var c=0;while(p=f.childNodes[j]){if(p.tagName=="DIV"){var d;if(p.id&&p.id.length>0){d=p.id.substr(3)}else{if(p.childNodes.length&&p.childNodes[1].id&&p.childNodes[1].id.length>0){p=p.childNodes[1];d=p.id.substr(3)}}if(p.className.indexOf("_sel")>0){c=d;break}}j++}if(m==c){if(document.sub_apartado){CambiaImagenInt(k[1],k[0])}return}if(q==undefined){$("banner").style.height="261px";$("cuerpo").style.width="392px";$("bloque").style.width="443px"}var h=document.lista_secciones[document.var_apartado];document.lista_secciones[document.var_apartado]=new Array();document.lista_secciones[document.var_apartado][0]=h;document.lista_secciones[document.var_apartado].func=GetProyectoInt;var n=function(s){var o=s.responseXML;if(!o.hasChildNodes()||getChild(o,"error")){alert(document.mensajes.error_cargadatos)}else{document.cargando++;var i=getChild(o,"proyecto");if(q){var v=getText(getChild(i,"nombre"));var x=getText(getChild(i,"fecha_inicio"));var w=getText(getChild(i,"fecha_fin"));var u=getText(getChild(i,"descripcion"));u+='<div class="grisaceo10px espacio_arriba">'+x;if(w&&w.length>0){u+=" - "+w}u+="</div>";$("texto_expo").hide();Element.update($("texto_expo"),u);LanzaIntervalos("texto_expo","txt_exp")}else{$("imagenes").innerHTML="";$("banner").innerHTML="";var v=getChild(i,"nombre");var r=getChild(i,"anyo_ejec");var u=getChild(i,"descripcion")}document.cargando--}};var l=function(){alert(document.mensajes.error_desconocido)};if(m){$("banner").innerHTML="";$("numeros").innerHTML="";$("numeros").setOpacity(0);$("banner").setOpacity(0);if(q){if($("texto_expo")){$("texto_expo").innerHTML=""}if($("banner").alt_height){$("banner").style.height=$("banner").alt_height}if($("cuerpo").alt_height){redim_cuerpo($("cuerpo").alt_height)}GetImagenesAp(m,3)}else{if(g){GetImagenesAp(m,2)}else{GetImagenesAp(m,1)}}if(c&&$("prj"+c)){$("prj"+c).className="proyecto_int"}if($("prj"+m)){$("prj"+m).className="proyecto_int_sel"}else{return}document.cargando++;LanzaIntervalos("banner","inter");new Effect.Appear("numeros");var a=ParseaSUB();a[0]=m;if(a.length>2){a=a.slice(0,2)}a=GeneraSUB(a);if(b){a=m}CambiaURL(null,document.var_apartado,document.id_lengua,a);document.cargando--}else{if(q==undefined){$("banner").innerHTML="";$("numeros").innerHTML="";j=0;if(c&&$("prj"+c)){$("prj"+c).className="proyecto_int"}c=0;while(!c&&(p=f.childNodes[j])){if(p.tagName=="DIV"){c=p.id.substr(3)}j++}if(c){document.sub_apartado=null;CambiaURL(null,document.var_apartado,document.id_lengua,document.sub_apartado);$("banner").setOpacity(0);if(q){GetImagenesAp(c,3)}else{if(g){GetImagenesAp(c,2)}else{GetImagenesAp(c,1)}}$("prj"+c).className="proyecto_int_sel";LanzaIntervalos("banner","inter")}}}if(q&&m){new Ajax.Request("xml.php?expo_estudio="+m,{asynchronous:true,onSuccess:n,onFailure:l})}else{if(q){if(c&&$("prj"+c)){$("prj"+c).className="proyecto_int"}$("texto_expo").hide();$("banner").setOpacity(0);if($("banner").intro_height){$("banner").style.height=$("banner").intro_height}if($("cuerpo").intro_height){redim_cuerpo($("cuerpo").intro_height)}$("texto_expo").update($("bloq").innerHTML);$("banner").update($("bloq").img);new Effect.Appear("banner");new Effect.Appear("texto_expo")}}}function CambiaImagenInt(e,c){if(document.intervalo_interiorismo){return}var a=true;if(e==null||e==undefined){var d=ParseaSUB(document.sub_apartado);if(d.length>1){e=d[1]}else{var b=getChild($("numeros"),"SPAN");if(!b){return}e=parseInt(b.id.substr(7));a=false}}$("num_img"+$("numeros").sel).className="num_img";new Effect.Fade($("banner").firstChild,{duration:1.2});if(document.proyecto_int&&document.proyecto_int[c]&&document.proyecto_int[c][e]){new Insertion.Bottom("banner",document.proyecto_int[c][e])}else{getImagen(e,"banner")}$("numeros").sel=e;$("num_img"+e).className="num_img_sel";if(a){var d=ParseaSUB(document.sub_apartado);d[0]=c;d[1]=e;d=GeneraSUB(d);CambiaURL(null,document.var_apartado,document.id_lengua,d)}document.intervalo_interiorismo=setInterval('substituye("banner")',900)}function substituye(b){clearInterval(document.intervalo_interiorismo);document.intervalo_interiorismo=0;var a=$(b).childNodes;if(a.length>1){a[a.length-1].style.display="none";new Effect.Appear(a[a.length-1]);while(a.length>1){$(b).removeChild($(b).firstChild)}}}function GetImagenesAp(g,b,d,c){var f=function(w){var n;if(c){n=c}else{n=w.responseXML}if(!n.hasChildNodes()||!getChild(n,"imagenes")){alert(document.mensajes.error_cargadatos)}else{var y=getChild(n,"imagenes");var r=parseInt(y.getAttribute("num").toString());var D=new NextChild;$("imagenes").innerHTML="";document.cargando++;var z;if(d){z=$(d);while(z.hasChildNodes()){z.removeChild(z.firstChild)}}var x=0;if(b){$("numeros").innerHTML="";$("image_cache_prj").innerHTML="";document.proyecto_int=new Array();var s=ParseaSUB();if(s.length>1){x=parseInt(s[1]);if(!isFinite(x)){x=0}}}var v=new String();for(var B=0;B<r;B++){var F=D.getNextChild(y,"imagen");var u="";var q=F.getAttribute("id");var k=F.getAttribute("nombre");var m=F.getAttribute("fichero");var h=F.getAttribute("ancho");var p=F.getAttribute("alto");var l=F.getAttribute("tipo");var C=F.getAttribute("desc").toString();if(d){var E=Builder.node("option",{value:q});E.innerHTML=q+" - "+k;z.appendChild(E)}else{if(b){if(B==x||q==x){document.cargando++;if(b==3){u='<img src="'+m+'" alt="'+k+'" onload="updateLoading()" onerror="updateLoading()"/>';u='<div style="height:100%;position:relative;"><div style="position:absolute;bottom:0;left:0">'+u+"</div></div>"}else{u='<img src="'+m+'" alt="'+k+'" width="'+h+'" height="'+p+'" onload="updateLoading()" onerror="updateLoading()"/>';$("banner").style.height=p+"px"}$("numeros").sel=q;$("banner").innerHTML=u;if(document.proyecto_int[g]==undefined||!isArray(document.proyecto_int[g])){document.proyecto_int[g]=new Array()}document.proyecto_int[g][q]=u;var A='<span id="num_img'+q+'" class="num_img_sel" onclick="CambiaImagenInt('+q+","+g+')">'+(B+1)+"</span> ";$("numeros").innerHTML+=A}else{u='<img src="'+m+'" alt="'+k+'" width="'+h+'" height="'+p+'" />';new Insertion.Bottom("image_cache_prj",u);if(document.proyecto_int[g]==undefined||!isArray(document.proyecto_int[g])){document.proyecto_int[g]=new Array()}document.proyecto_int[g][q]=u;$("numeros").innerHTML+='<span id="num_img'+q+'" class="num_img" onclick="CambiaImagenInt('+q+","+g+')">'+(B+1)+"</span> "}if(r<2){$("numeros").innerHTML="";if(C.length>0){$("numeros").className="pie_compacto";$("numeros").innerHTML=C}else{$("numeros").className=""}}}if(l=="IMG"){if(b||r<3){document.cargando++;u='<img src="'+m+'" alt="'+k+'" width="'+h+'" height="'+p+'" onerror="updateLoading()" onload="updateLoading()" />'}else{u='<img src="'+m+'" alt="'+k+'" width="'+h+'" height="'+p+'" />'}}else{if(b||r<3){document.cargando++}u='<object type="application/x-shockwave-flash" title="imagen'+B+'" data="'+m+'" width="'+h+'" height="'+p+'" onload="updateLoading()" onerror="updateLoading()"><param name="movie" value="'+m+'" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><img src="imgs/flash.png" width="'+h+'" height="'+p+'" alt="Imagen en reemplazo de flash" /></object>'}if(C&&C.length>0){u=u+'<br /><div class="enlaces_lat">'+C+"</div>"}if(r>1&&b==null){v+=m+(B<(r-1)?":":"");u='<div style="display:none">'+u+"</div>"}new Insertion.Bottom("imagenes",u)}}if(v.length>0){var j='<object type="application/x-shockwave-flash" title="flashSlide" data="imgs/slideshow01.swf" width="93" height="139" onload="updateLoading()" onerror="updateLoading()"><param name="movie" value="imgs/slideshow01.swf" /><param name="quality" value="high" /><param name="wmode" value="opaque" /><param name="bgcolor" value="#E6E6D1" /><param name="FlashVars" value="Timagenes='+v+'" /><img src="imgs/flash.png" width="93" height="139" alt="Imagen en reemplazo de flash" /></object>';new Insertion.Bottom("imagenes",j)}document.cargando--}};var a=function(){alert(document.mensajes.error_desconocido)};var e;if(b==1){e="lst_img&int="}else{if(b==2){e="lst_img&dis="}else{if(b==3){e="lst_img&expo="}else{e="lst_img&ap="}}}if(c){f(null)}else{new Ajax.Request("xml.php?"+e+g,{asynchronous:true,onSuccess:f,onFailure:a})}}function GetNoticia(id,o,after){if(o==null||o==undefined){o="noticias"}if(id&&isString(id)&&id.indexOf("/")>-1){id=id.split("/")}if(id){var from;var to;if(isArray(id)){if(isFinite(id)){id=parseInt(id[0])}else{if(isString(id[0])){var compact=2;if(id.length<3||id[1]==id[2]){compact=0}if($("archivo")){$("archivo").onclick()}return GetNoticiaList(null,compact,id[0],id[1],id[2],id[3])}}}else{if(isFinite(id)){id=parseInt(id)}else{if(id.indexOf("-")>1){from=id;if($("archivo")){$("archivo").onclick()}return GetNoticiaList(null,2,null,from)}else{return GetNoticiaList(null,0,id)}}}}else{return GetNoticiaList(null,0)}var success=function(t){var xml=t.responseXML;if(!xml.hasChildNodes()||getChild(xml,"error")!=false){alert(document.mensajes.error_cargadatos)}else{var not=getChild(xml,"noticia");var nx=new NextChild;var elem;var el1;var obj=$(o);while(obj.hasChildNodes()){obj.removeChild(obj.firstChild)}var id_not=getText(getChild(not,"id"));$(o).innerHTML=xml.transformNode(document.xsl_noticia);if(Prototype.Browser.IE||Prototype.Browser.WebKit||Prototype.Browser.Gecko){var n=$("not"+id_not);elem=getChild(n,"TABLE");elem=getChild(elem,"TBODY");elem=getChild(elem,"TR");var par=nx.getNextChild(elem,"TD",1);elem=getChild(par,"DIV");var val=(elem.textContent?elem.textContent:elem.innerText);elem.innerHTML=val;elem=getChild(par,"TEXTO");if(Prototype.Browser.IE){elem=par.childNodes[2]}el1=Builder.node("p");el1.innerHTML=(Prototype.Browser.IE?elem.data:(elem.textContent?elem.textContent:elem.innerText));par.replaceChild(el1,elem)}new Effect.Appear("noticias",{duration:0.5});CambiaURL(null,document.var_apartado,document.id_lengua,id);setTimeout("ScrollObj().rebuild()",document.cuerposlider_timeout);if(after){eval(after)}}};var error=function(){alert("ERROR ACCEDIENDO A DATOS!")};$(o).hide();resalta_este("tipos_noticias",null);$("busca_not").hide();new Ajax.Request("xml.php?not="+id,{asynchronous:true,onSuccess:success,onFailure:error})}function GetNoticiaList(o,compacto,entidad,subsec,tipo,from,to,after){if(o==null||o==undefined){o="noticias"}var en=entidad;var ss=subsec;var tt=tipo;var tf=from;var t_o=to;var success=function(t){var xml=t.responseXML;if(!xml.hasChildNodes()||getChild(xml,"error")){alert(document.mensajes.error_cargadatos);alert("ERROR:"+t.responseText)}else{var nots=getChild(xml,"noticias");var num=parseInt(nots.getAttribute("num").toString());var nx=new NextChild;var elem,el2;var obj=$(o);while(obj.hasChildNodes()){obj.removeChild(obj.firstChild)}if(compacto==0||compacto==2){if(compacto==0){$(o).innerHTML=xml.transformNode(document.xsl_noticia_extensa)}else{if(compacto==2){$(o).innerHTML=xml.transformNode(document.xsl_noticia_compacta)}}if(Prototype.Browser.IE||Prototype.Browser.WebKit||Prototype.Browser.Gecko){nx=new NextChild;for(var i=0;i<num;i++){var not=nx.getNextChild(nots,"noticia");var id_not=getText(getChild(not,"id"));var nx2=new NextChild;var n=$("not"+id_not);if(n==null){var n=$("doc"+id_not)}if(n==null){break}elem=getChild(n,"TABLE");elem=getChild(elem,"TBODY");elem=getChild(elem,"TR");var par=nx2.getNextChild(elem,"TD",1);elem=getChild(par,"DIV");var val=(elem.textContent?elem.textContent:elem.innerText);elem.innerHTML=val;elem=getChild(par,"TEXTO");if(Prototype.Browser.IE){elem=par.childNodes[2]}var val=(Prototype.Browser.IE?elem.data:(elem.textContent?elem.textContent:elem.innerText));el2=Builder.node("p");el2.innerHTML=val;par.replaceChild(el2,elem)}}new Effect.Appear("noticias",{duration:0.8});var sub="";if(en){sub=en}if(ss){sub+="/"+ss}if(tt&&tt!=ss){sub+="/"+tt}if(tf){sub+=((sub.length>0)?("/"):"")+tf;$("archivo_anyo").value=tf}if(t_o){sub+="/"+t_o}CambiaURL(null,document.var_apartado,document.id_lengua,sub);setTimeout("ScrollObj().rebuild()",document.cuerposlider_timeout)}else{for(var i=0;i<num;i++){var not=nx.getNextChild(nots,"noticia");var id_not=not.getAttribute("id");var titulo=not.getAttribute("titulo");var tipo=not.getAttribute("tipo");var fecha=not.getAttribute("fecha");var id_img=not.getAttribute("id_img");var tit_img=not.getAttribute("tit_img");var tipo_img=not.getAttribute("timg");var url_img=not.getAttribute("url_img");var texto_corto=getText(not);titulo=titulo+((titulo.charAt(titulo.length-1)==".")?"":".");elem=Builder.node("div",{"class":"noticias_cabecera"});elem.innerHTML='<a href="#/prensa/'+document.id_lengua+"/"+id_not+'">'+titulo+"</a>";$(o).appendChild(elem)}$(o).scrollTop=0;if(document.scroller){document.scroller.stop();document.scroller.rebuild();document.scroller.start()}else{setTimeout("document.scroller=new Scroller('noticias_cabeceras',12,2500);",2500)}}if(after){eval(after)}}};var error=function(){alert("ERROR ACCEDIENDO A DATOS!")};if($("noticias")){$("noticias").hide()}var ent="",tip="",from_="",to_="",ent="",act;if(compacto==1){act="lst_not"}else{act="lst_not_ext"}switch(entidad){case"col":en="col";ent=2;break;case"est":en="est";ent=1;break;default:}if(ent){ent="&ent="+ent}if(subsec){var tipoOk=false;switch(subsec){case"archivo":($("archivo").onclick());compacto=2;tipoOk="todos";break;case"notas":($("notas").onclick());tipoOk="notas";tipo="notas";break;case"dossiers":$("dossiers").onclick();tipo="dossiers";tipoOk="dossiers";break;case"visto":($("visto").onclick());tipoOk="visto";tipo="visto";break;case"leido":($("leido").onclick());tipoOk="leido";tipo="leido";break;default:ss="notas";tipoOk="notas";tipo="notas"}}else{ss="notas";tipo="notas";if($("notas")){$("notas").onclick()}tipoOk=true}if(tipo==undefined||tipo==null||!tipo){tipo=tipoOk}else{switch(tipo){case"todos":break;case"notas":break;case"dossiers":break;case"visto":break;case"leido":break;default:tipo="notas"}}tt=tipo;tip="&tipo="+escape(tipo);var sub_sec="&sub=";if(ss){sub_sec+=ss}else{sub_sec+=subsec}if(from){from_="&from="+escape(from)}if(to){to_="&to="+escape(to)}new Ajax.Request("xml.php?"+act+ent+tip+from_+to_+sub_sec,{asynchronous:true,onSuccess:success,onFailure:error})}function RefrescaNoticia(j,g){if(j==undefined){return}var a=false;if(g==undefined){a=true;g=$("tipos_noticias")}if(g){var b=g.getElementsByTagName("A");var f=j.options[j.selectedIndex].value;for(var c=0;c<b.length;c++){var e=b[c].href;if(b[c].o_href==undefined){b[c].o_href=e}else{e=b[c].o_href}b[c].href=e.replace(/\$ent/,f)}}if(a){var d=ParseaSUB();d[0]=j.value;d=GeneraSUB(d);document.lista_secciones[document.var_apartado].func(d)}}function GetExpo(id,o,after){if(o==null||o==undefined){o="expos"}if(id&&id.indexOf&&id.indexOf("/")>-1){id=id.split("/")}if(id){var from;var to;if(isArray(id)){if(isFinite(id)){id=parseInt(id[0])}else{if(isString(id[0])){if(id.length<2){id[1]=undefined}$("archivo").onclick();return GetExpoList(null,id[0],id[1])}}}else{if(isFinite(id)){id=parseInt(id)}else{if(id.indexOf("-")>1){from=id;$("archivo").onclick();return GetExpoList("expos","archivo",from)}else{return GetExpoList("expos",id)}}}}else{return GetExpoList("expos",(document.var_apartado=="exposicionestemporales"?"actuales":"condiciones"))}var success=function(t){var xml=t.responseXML;if(!xml.hasChildNodes()||getChild(xml,"error")!=false){alert(document.mensajes.error_cargadatos)}else{var exp=getChild(xml,"exposicion");var nx=new NextChild;var elem;var el1;var el2;var obj=$(o);while(obj.hasChildNodes()){obj.removeChild(obj.firstChild)}var id_exp=getText(getChild(exp,"id"));$(o).innerHTML=xml.transformNode(document.xsl_exposicion);var ex=$("exp"+id_exp);elem=getChild(ex,"TABLE");elem=getChild(elem,"TBODY");elem=getChild(elem,"TR");var par=nx.getNextChild(elem,"TD",1);var listica=par.getElementsByTagName("div");elem=listica[2];el1=Builder.node("div");var kk=elem.firstChild.data;el1.innerHTML=elem.firstChild.data;par.replaceChild(el1,elem);$("cuerpo").style.width="400px";oculta("cont","cond","imagenes");redim_cuerpo(410);document.cargando++;LanzaIntervalos("expos");CambiaURL(null,document.var_apartado,document.id_lengua,id);setTimeout("ScrollObj().rebuild()",document.cuerposlider_timeout);if(after){eval(after)}}};var error=function(){alert("ERROR ACCEDIENDO A DATOS!")};resalta_este("clas_expo",null);$("expos").hide();oculta("busca_not");new Ajax.Request("xml.php?exp="+id,{asynchronous:true,onSuccess:success,onFailure:error});return 0}function GetExpoList(o,tipo,from,to,after){if(o==null||o==undefined){o="expos"}var tt=tipo;var tf=from;var t_o=to;var success=function(t){var xml=t.responseXML;if(!xml.hasChildNodes()||getChild(xml,"error")){alert(document.mensajes.error_cargadatos);alert("ERROR:"+t.responseText)}else{var exps=getChild(xml,"exposiciones");var num=parseInt(exps.getAttribute("num").toString());var nx=new NextChild;var elem,el2;var obj=$(o);while(obj.hasChildNodes()){obj.removeChild(obj.firstChild)}if(num>0){$(o).innerHTML=xml.transformNode(document.xsl_expo_lista);document.cargando=num;$("bloque_interno").style.visibility="hidden";$(o).show();LanzaIntervalos("bloque_interno",null,{duration:0.8})}var sub="";if(tt){sub=tt}if(tf){sub=((sub.length>0)?(sub+"/"):"")+tf}if(t_o){sub+="/"+t_o}CambiaURL(null,document.var_apartado,document.id_lengua,sub);if(num==0&&$("texto_noExpo")){new Effect.Appear("texto_noExpo")}if(after){eval(after)}}};if($(o)){$(o).hide()}if($("exposicion")){$("exposicion").hide()}var error=function(){alert("ERROR ACCEDIENDO A DATOS!")};var tip="";var from_="";var to_="";var act;act="lst_exp";if(tipo){var tipoOk=false;switch(tipo){case"archivo":($("archivo").onclick());tipoOk=true;break;case"actuales":($("actuales").onclick());tipoOk=true;break;case"proximas":($("proximas").onclick());tipoOk=true;break;case"disponibles":($("disponibles").onclick());tipoOk=true;break;case"colaboraciones":return($("colaboraciones").onclick());tipoOk=true;break;case"condiciones":return($("condiciones").onclick());tipoOk=true;break;case"contacto":return($("contacto").onclick());tipoOk=true;break}tip="&tipo="+escape(tipo)}oculta("exposicion");if(from){from_="&from="+escape(from)}if(to){to_="&to="+escape(to)}new Ajax.Request("xml.php?"+act+tip+from_+to_,{asynchronous:true,onSuccess:success,onFailure:error})}function GetEnlaces(a,g){if(a==null||a==undefined){a="enlaces"}else{if(a.tagName&&a.tagName=="SELECT"){g=a.value}}var j=function(i){LanzaIntervalos("enlaces",null,{duration:0.8});var k="";if(g){k=g}CambiaURL(null,document.var_apartado,document.id_lengua,k)};oculta("enlaces");var f=function(){alert("ERROR ACCEDIENDO A DATOS!")};var h="";var e="lst_enl";if(g){var c="";var b=$("sel_tipo");for(var d=0;d<b.options.length;d++){if(b.options[d].value==g){break}}if(d==b.options.length){d=0}b.selectedIndex=d;c=b.options[d].innerHTML;$("enlace_tipo").value=c;h="tipo="+escape(g)}new Ajax.Updater("enlaces","enlaces.php?"+h,{asynchronous:true,onSuccess:j,onFailure:f})}function updateLoading(){if(document.cargando>0){document.cargando--}}function getImagen(d,e,c,a){var f=function(o){var k=o.responseXML;var l="";if(!k.hasChildNodes()||getChild(k,"error")){alert(document.mensajes.error_cargadatos);return}else{var j=getChild(k,"imagen");var n=getText(getChild(j,"nombre"));var g=getText(getChild(j,"fichero"));var h=getText(getChild(j,"descripcion"));var i=getText(getChild(j,"ancho"));var p=getText(getChild(j,"alto"));var m=getText(getChild(j,"tipo"));if(e!="encabezado"&&$(e).clientHeight<p){$(e).style.height=p+"px"}if(m=="IMG"){document.cargando++;l='<img src="'+g+'" alt="'+n+'" width="'+i+'" height="'+p+'" onload="updateLoading()" onerror="updateLoading()"/>'}else{l='<object type="application/x-shockwave-flash" data="'+g+'" width="'+i+'" height="'+p+'"><param name="movie" value="'+g+'" /><param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="scale" value="exactfit" /><img src="imgs/flash.png" width="'+i+'" height="'+p+'" alt="Imagen en reemplazo de flash" /></object>'}new Insertion.Bottom(e,l);if(a){a(n,h,i,p,m)}}};var b=function(){alert(document.mensajes.error_desconocido);return null};new Ajax.Request("xml.php?img="+d,{asynchronous:true,onSuccess:f,onFailure:b})}function GetBanner(e,b){var d="banner";$(d).update("");if(b){if(document.cargando!=undefined){document.cargando++}var a=b.getAttribute("alto");if($(d).clientHeight<a){$(d).style.height=a+"px"}var c='<img src="'+b.getAttribute("url")+'" alt="'+b.getAttribute("nombre")+'" width="'+b.getAttribute("ancho")+'" height="'+a+'" onerror="updateLoading()" onload="updateLoading()" />';$(d).update(c)}else{getImagen(e,d)}}function SetEncabezado(a){$("encabezado").innerHTML=a}function GetEncabezado(a){$("encabezado").innerHTML="";getImagen(a,"encabezado")}function LanzaIntervalos(b,c,a){if(c){document["aparecer_"+c]=b;if(a){document["aparecer_"+c+"_opt"]=a}else{document["aparecer_"+c+"_opt"]={duration:1.4}}}else{if(b){document.aparecer=b;if(a){document.aparecer_opt=Object.extend(a,{to:(Prototype.Browser.Chrome?0.9999:1)})}else{document.aparecer_opt={duration:1.4,to:(Prototype.Browser.Chrome?0.9999:1)}}}}setTimeout("ScrollObj().Scroll.bind(ScrollObj())",40);if(c){if(document["intervalo_aparecer_"+c]){clearInterval(document["intervalo_aparecer_"+c])}document["intervalo_aparecer_"+c]=setInterval("Aparecer('"+c+"')",200)}else{if(document.intervalo_aparecer){clearInterval(document.intervalo_aparecer)}document.intervalo_aparecer=setInterval("Aparecer()",200)}}function Aparecer(b){if(document.cargando<=0&&(document.aparecer||b)){if(b){clearInterval(document["intervalo_aparecer_"+b]);document["intervalo_aparecer_"+b]=null;if(document[b+"_effect"]){document[b+"_effect"].cancel()}document[b+"_effect"]=new Effect.Appear(document["aparecer_"+b],document["aparecer_"+b+"_opt"]);if($(document["aparecer_"+b]).style.visibility=="hidden"){$(document["aparecer_"+b]).style.visibility="visible"}}else{clearInterval(document.intervalo_aparecer);document.intervalo_aparecer=null;if(document.central_effect){document.central_effect.cancel()}$(document.aparecer).setOpacity(0);document.central_effect=new Effect.Appear(document.aparecer,document.aparecer_opt);if($(document.aparecer).style.visibility=="hidden"){$(document.aparecer).style.visibility="visible"}if($(menu_object)&&$(menu_object).FundidoEntrada){$(menu_object).FundidoEntrada(9)}else{try{$(menu_object).FundidoEntrada(9)}catch(a){}}}if(ScrollObj().desp.visible()){setTimeout("ScrollObj().rebuild();",100)}}}function buscaCosasRaras(){if(!$(menu_object)){alert("NO ESTA??");return}$(menu_object).hide();$(menu_object).show()}function SaveUser(g,a){var b=$(g);if(!b){alert("error de acceso al formulario");return}var h=function(n){var l=n.responseXML;var m=((getChild(l,"ok"))?true:false);if(!l.hasChildNodes()||!m){var k=getChild(l,"error");if(k){var i=k.getAttribute("num");if(i.charAt(0)=="#"){return alert("ERROR:"+i)}}alert("Error al crear usuario:"+n.responseText)}else{VentanaManager.close();alert("Registro completado.")}};var f=function(){alert(mensajes.error_desconocido)};if(b.acepto_usr.checked==false){alert("ATENCIÃ“N: No ha aceptado las polÃtica de privacidad y sus condiciones");return}if(b.nombre_usr.value.length<3||b.apellidos_usr.value.length<3||b.email_usr.value.length<5||b.profesion_usr.value.length<3||b.pais_sel_usr.selectedIndex==-1||(b.pais_sel_usr.selectedIndex==73&&b.prov_sel_usr.selectedIndex==-1)||b.anyo_usr.value.length<3||b.usuario_usr.value.length<4){alert(mensajes.mensaje_faltan_datos);return}if(b.nombre_usr.value.length<3||b.apellidos_usr.value.length<3||b.direccion_usr.value.length<4||b.codigo_postal_usr.value.length<3||b.localidad_usr.value.length<3||b.email_usr.value.length<5||b.profesion_usr.value.length<3||b.pais_sel_usr.selectedIndex==-1||(b.pais_sel_usr.selectedIndex==73&&b.prov_sel_usr.selectedIndex==-1)||b.anyo_usr.value.length<3||b.usuario_usr.value.length<4){alert(mensajes.mensaje_faltan_datos);return}if(!mail_check($F(b.email_usr))){alert(mensajes.email_invalido);return}if(b.pass1_usr.value.length<6){alert(mensajes.mensaje_contrasenya_corta);return}if(b.pass1_usr.value==b.usuario_usr.value){alert(mensajes.mensaje_contrasenya_igual_usuario);return}if(b.pass1_usr.value!=b.pass2_usr.value){alert(mensajes.mensaje_contrasenya);return}if(entropy_check(b.pass1_usr.value)<45){alert(mensajes.mensaje_contrasenya_simple);return}var j="";var c=0;for(var d=0;d<b.areas_usr.length;d++){if(b.areas_usr[d].checked){j=j+b.areas_usr[d].value+(d+1<b.areas_usr.length?", ":"");c++}}if(c==0){alert(mensajes.mensaje_faltan_datos);return}var e="nombre_usr="+escape(b.nombre_usr.value);e+="&apellidos_usr="+escape(b.apellidos_usr.value);e+="&direccion_usr="+escape(b.direccion_usr.value);e+="&codigo_postal_usr="+escape(b.codigo_postal_usr.value);e+="&localidad_usr="+escape(b.localidad_usr.value);e+="&email_usr="+escape(b.email_usr.value);e+="&usuario_usr="+escape(b.usuario_usr.value);e+="&pass1_usr="+escape(b.pass1_usr.value);e+="&areas_usr="+escape(j);e+="&anyo_usr="+escape(b.anyo_usr.value);e+="&profesion_usr="+escape(b.profesion_usr.value);e+="&pais_usr="+escape(b.pais_sel_usr.value);e+="&prov_usr="+((b.pais_sel_usr.value==73)?escape(b.prov_sel_usr.value):"0");new Ajax.Request("xml.php?act=new_usuario",{asynchronous:true,method:"post",postBody:e,onSuccess:h,onFailure:f});return}function Login(e,c){var g=document;g.okidoki=false;var h=(e?e.usuario:$("usuario"));var b=(e?e.contrasenya:$("contrasenya"));var f=function(i){var d=i.responseXML;if(!d.hasChildNodes()||!getChild(d,"ok")){alert(getText(getChild(d,"error")));if(c&&c.onError){c.onError()}return false}else{level=getChild(d,"ok").getAttribute("nivel");alert("Â¡Bienvenido "+getChild(d,"ok").getAttribute("nombre")+" !");g.okidoki=true;$("loguin_derecha")["usuario"].value=h.value;$("loguin_derecha")["contrasenya"].value="";b.value="";if(c&&c.onLogin){c.onLogin()}return true}};var a=function(){alert(mensajes.error_desconocido);return false};new Ajax.Request("xml.php",{method:"post",postBody:"usr="+h.value+"&pass="+b.value,asynchronous:true,onSuccess:f,onFailure:a})}function SBMIT(a){if(a.keyCode==Event.KEY_RETURN){a.element().form.submit()}}Event.observe(window,"load",function(){$("usuario").observe("keyup",SBMIT);$("contrasenya").observe("keyup",SBMIT)});Catalogo={envia:function(i){var h=$("buscar_catalogo");var c=h.modelo.val||h.modelo.value;var m=h.disenyador.val||h.disenyador.value;var g=h.tipologia.val||h.tipologia.value;var n=h.familia.val||h.familia.value;var j=h.fabricante.val||h.fabricante.value;var b=h.pais_fab.val||h.pais_fab.value;var d=h.concepto.val||h.concepto.value;var l=h.fecha_ini.val||h.fecha_ini.value;var k=h.fecha_fin.val||h.fecha_fin.value;var a=""+(c?"&modelo="+c:"")+(m?"&disenyador="+m:"")+(g?"&tipologia="+g:"")+(n?"&familia="+n:"")+(j?"&fabricante="+j:"")+(b?"&pais_fab="+b:"")+(d?"&concepto="+d:"")+(l?"&from="+l:"")+(k?"&to="+k:"");CambiaURL(null,document.var_apartado,document.id_lengua,"busqueda"+(a.length?"/?"+a:""));var e=i?"sub":"ahah[0]";oculta("resultado");new Ajax.Updater("resultado","catalogo.php?"+e+"=busqueda"+a,{method:"get",asynchronous:true,evalScripts:true,onFailure:this.error,onSuccess:this.ok})},ok:function(){new Effect.Appear("resultado");setTimeout("document.oscroll.rebuild();Catalogo.asignaEventoResultado();",200)},error:function(){alert("Error cargando datos.\nPor favor intentelo mÃ¡s adelante.")}};function GeneraEnlacesLaterales(b,h){if(b.clientHeight==0||b.offsetHeight==0||b.scrollHeight==0){return setTimeout(function(){GeneraEnlacesLaterales(b,h)},250)}if(b&&h){var e;var c=b.getElementsByTagName("A");if(c.length>0){var f=h.getElementsByTagName("IMG");var d=(f.length>0?true:false);var j="enlaces_lat_top";var l=Builder.node("div",{style:"position:relative;height:"+(parseInt($("imagenes").style.height)-(d?139:0))+"px"});var a=Builder.node("div",{"class":j});for(e=0;e<c.length;e++){var g=c[e].cloneNode(true);if(g.className=="no_lateral"){continue}else{if(g.className=="oculto_sololateral"){g.className=""}else{if(b.offsetHeight>=b.scrollHeight){continue}}}if(e<c.length-1){var k=Builder.node("div",{"class":"espacio_abajo"});k.appendChild(g);a.appendChild(k)}else{a.appendChild(g)}}if(j=="enlaces_lat"){Insertion.Bottom(l,a);Insertion.Bottom(h,l)}else{Insertion.Bottom(h,a)}return a}}}function mail_check(a){var b=/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;if(a.match(b)){return true}return false}function entropy_check(b){var c;var a=b.length;var d=0;for(c=1;c<a;c++){d+=Math.abs(b.charCodeAt(c-1)-b.charCodeAt(c))*0.666}return d}function resalta_este(d,e,b,f){var c=new Array();if(b==undefined){b=new Array("SPAN","INPUT")}if(isArray(b)){c=collectionToArray($(d).getElementsByTagName(b[0]));for(var a=1;a<b.length;a++){c=c.concat(collectionToArray($(d).getElementsByTagName(b[a])))}}else{c=$(d).getElementsByTagName(b)}if(f==undefined){f="sel"}for(var a=0;a<c.length;a++){if(c[a]==e){e.className=f}else{c[a].className=""}}}function oculta(){if(arguments){for(var a=0;a<arguments.length;a++){if($(arguments[a])){$(arguments[a]).hide();if(arguments[a]=="imagenes"){$(arguments[a]).style.visibility="hidden"}}}}}function redim_cuerpo(i,h,f,b,d,g){if(isObject(i)){var e=i;var a=e.sync;i=e.alto;h=e.cuerpo;f=e.desplazador;b=e.track;d=e.imagenes;g=e.morph}if(i){if(h==undefined){h=$("cuerpo")}if(d==undefined){d=$("imagenes")}if(f==undefined){f=$("desplazador")}if(b==undefined){b=$("track")}if(g==undefined){if(h){h.style.height=i+"px"}if(d){d.style.height=(i-36-parseInt(d.style.paddingTop))+"px"}if(f){f.style.height=i+"px"}if(b){b.style.height=(i-1)+"px"}}else{var c=new Array();if(h){c.push(new Effect.Morph(h,{style:"height:"+i+"px",sync:true}))}if(d){c.push(new Effect.Morph(d,{style:"height:"+(i-36-parseInt(d.style.paddingTop))+"px",sync:true}))}if(f){c.push(new Effect.Morph(f,{style:"height:"+i+"px",sync:true}))}if(b){c.push(new Effect.Morph(b,{style:"height:"+(i-1)+"px",sync:true}))}if(a){return c}else{return new Effect.Parallel(c)}}}}function swapdivs(b,a){if($(b).style.display!="none"){$(b).hide()}else{$(b).show()}if($(a).style.display=="none"){$(a).show()}else{$(a).hide()}}function collectionToArray(d){var c=[];for(var b=0,a=d.length;b<a;b++){c.push(d[b])}return c}function isArray(a){if(a==undefined||a.constructor.toString().indexOf("Array")==-1){return false}else{return true}}isInteger=function(a){return !isNaN(parseInt(a))};function isObject(){if(arguments[0]==undefined){return false}if(typeof arguments[0]=="string"){return false}if(isInteger(arguments[0])){return false}if(typeof arguments[0]=="object"){var a=arguments[0].constructor.toString().match(/string/i);return(a==null)}return false}function isString(){if(typeof arguments[0]=="string"){return true}if(typeof arguments[0]=="object"){var a=arguments[0].constructor.toString().match(/string/i);return(a!=null)}return false}function open2(a,b){if(b==0){window.location=a}else{if(b==1){window.open(a)}else{if(b==2){window.open(a);self.focus()}else{window.open(a,b)}}}}function isFunction(a){return"function"==typeof a}function getClassNames(b){var a=new String();if(b==null||b==undefined){return a}do{a+=(b.className?" "+b.className:"");b=b.parentNode}while(b);return a}function hasClassName(c,a){var b=getClassNames(c);return(b.length?new RegExp("(^|\\s)"+a+"(\\s|$)").test(b):false)}if(this.mensajes==undefined){mensajes=new Array()}mensajes.ok_guardadatos="Datos actualizados correctamente.";mensajes.error_desconocido="Algun problema ha ocurrido, pongase en contacto con el desarrollador del sitio web";mensajes.error_cargadatos="ERROR: No se pudo cargar datos.";mensajes.volver="&lt; volver";mensajes.mensaje_faltan_datos="ATENCIÃ“N: Ha de introducir todos los datos.";mensajes.mensaje_contrasenya="ATENCIÃ“N: La contraseÃ±a de confirmaciÃ³n no coincide.";mensajes.mensaje_contrasenya_corta="ATENCIÃ“N: La contraseÃ±a ha de tener un mÃnimo de 6 carÃ¡cteres.";mensajes.mensaje_contrasenya_simple="ATENCIÃ“N: La contraseÃ±a es demasiado simple.";mensajes.mensaje_contrasenya_igual_usuario="ATENCIÃ“N: La contraseÃ±a no puede ser la misma que el nombre de usuario.";mensajes.email_invalido="ATENCIÃ“N: El correo electrÃ³nico introducido no es vÃ¡lido.";Prototype.Browser.Chrome=!!navigator.userAgent.match("Chrome");if(navigator.appVersion.indexOf("Win")!=-1){Prototype.Browser.Win=true}else{Prototype.Browser.Win=false}if(navigator.appVersion.indexOf("Mac")!=-1){Prototype.Browser.Mac=true}else{Prototype.Browser.Mac=false}if(navigator.appVersion.indexOf("X11")!=-1){Prototype.Browser.Linux=true}else{Prototype.Browser.Linux=false}if(navigator.appVersion.indexOf("Linux")!=-1){Prototype.Browser.Linux=true}else{Prototype.Browser.Linux=false};function OScroll(D,B,F,A,G){var E=$(B);var C=this;this.desp=E;this.handle=F;this.track=A;this.altura=G;this.objetivo=$(D);this.objetivo.desp=E;this.v_val=0;this.objetivo.scrollTop=0;Event.observe(this.objetivo,"DOMMouseScroll",this.wheel.bind(this));Event.observe(this.desp,"DOMMouseScroll",this.wheel.bind(this));Event.observe(this.objetivo,"mousewheel",this.wheel.bind(this));Event.observe(this.desp,"mousewheel",this.wheel.bind(this));this.init=function(){C.slider=new Control.Slider(C.handle,C.track,{axis:"vertical",maximum:C.altura,onSlide:function(H){C.Scrolea(H)},onChange:function(H){C.Scrolea(H)}})};this.init();this.rebuild=function(){if(C.slider){C.slider.dispose();C.slider=null}C.v_val=0;C.init();C.Scroll()};this.dispose=function(){alert("disposable heroes");ScrollSys.unregister(C)}}OScroll.prototype.Scrolea=function(A){var B=this.desp;var C=this.objetivo;this.v_val=(C.scrollHeight-C.clientHeight+6)*A;if(this.v_val%5){this.Scroll()}};OScroll.prototype.Scroll=function(){var B=this.desp;var D=this.objetivo;if(D.clientHeight>0&&(D.scrollHeight-D.clientHeight)<=0){if(this.intervalo_slider){clearInterval(this.intervalo_slider);this.intervalo_slider=null}B.style.visibility="hidden"}else{if(B.style.visibility=="hidden"||B.style.display=="none"){B.style.visibility="visible";if(this.intervalo_slider){clearInterval(this.intervalo_slider)}this.intervalo_slider=setInterval(this.Scroll.bind(this),40)}}var A=D.scrollTop;var C=this.v_val;var E;if(A<C){E=A+(C-A)/6}else{E=A-(A-C)/6}if(A!=E){D.scrollTop=E}};OScroll.prototype.setScrollTo=function(A){var B=this;B.set_scroll=1;var C=B.objetivo;if(A&&$(A)){B.v_val=$(A).offsetTop-C.offsetTop}else{if(!(C.offsetTop)){B.v_val=0}else{B.v_val=C.offsetTop}}B.slider.setValue(B.v_val/(C.scrollHeight-C.clientHeight+6))};OScroll.prototype.SetSlider=function(){this.setScrollTo()};document.cuerposlider_timeout=200;document.mensajes=new Array();document.mensajes.ok_guardadatos="Datos actualizados correctamente.";document.mensajes.error_desconocido="Algun problema ha ocurrido, pongase en contacto con el desarrollador del sitio web";document.mensajes.error_cargadatos="ERROR: No se pudo cargar datos.";document.mensajes.volver="&lt; volver";OScroll.prototype.wheel=function(A){var B=0;if(!A){A=window.event}if(A.wheelDelta){B=A.wheelDelta/1880;if(window.opera){B=-B}}else{if(A.detail){B=-A.detail/80}}if(B){this.slider.setValueBy(-B)}if(A.preventDefault){A.preventDefault()}A.returnValue=false};function ScrollObj(){if(Windows){if(Windows.focusedWindow&&Windows.focusedWindow.oscroll){return Windows.focusedWindow.oscroll}if(Windows.windows.length&&Windows.windows.last().visible&&Windows.windows.last().oscroll){return Windows.windows.last().oscroll}}return document.oscroll};function Scroller(C,D,F){this.o=$(C);this.objN=C;if(this.o==null||this.o==undefined||this.o==false){return alert("No se pudo acceder a '"+C+"'")}this.boxHeight=this.o.style.height.replace("px","");this.repeatHeight=this.o.scrollHeight;this.o.innerHTML=this.o.innerHTML+this.o.innerHTML;this.o.scrollTop=0;this.stopScroll=0;this.fps=D;this.nDelay=F;this.onchild=false;this.scrollMe=E;this.scrollIsOnChild=B;this.interval=null;var A=this;this.stop=function(){A.stopScroll=1};this.rebuild=function(){A.boxHeight=A.o.style.height.replace("px","");A.repeatHeight=A.o.scrollHeight;A.o.innerHTML=A.o.innerHTML+A.o.innerHTML};this.start=function(){A.stopScroll=0;if(A.onchild){return }if(A.interval==null){A.interval=setInterval(A.scrollMe,1000/A.fps)}};this.start();function E(){if(A.o==null||A.o==undefined||A.o==false){clearInterval(A.interval);A.interval=null;return alert("No se pudo acceder a '"+A.objN+"'\nthis:"+A)}A.onchild=false;if(A.stopScroll==1){clearInterval(A.interval);A.interval=null;return }A.o.scrollTop=A.o.scrollTop+1;if(A.o.scrollTop<=A.repeatHeight){if(A.interval==null){A.interval=setInterval(A.scrollMe,1000/A.fps)}}else{A.o.scrollTop=1;if(A.interval==null){A.interval=setInterval(A.scrollMe,1000/A.fps)}}if(A.scrollIsOnChild()){A.onchild=true;clearInterval(A.interval);A.interval=null;setTimeout(A.scrollMe,A.nDelay)}}function B(){var H=A.o.childNodes;var I=(Prototype.Browser.IE?A.o.offsetTop:0);for(var G=0;G<H.length;G++){if((H[G].offsetTop-A.o.offsetTop)==(A.o.scrollTop-I)){return true}}return false}};function ConstruyeContenedor(C,I,G){var D,F,B,A,H="div";B=$(C);if(B==undefined||B==false||B==null){return alert("No se pudo acceder a '"+C+"'")}D=Builder.node("div",{"class":I});if(G){H=G}if(B.options.length>9){D.style.height="142px";D.style.overflow="auto"}for(var E=0;E<B.options.length;E++){F=Builder.node(H,{value:B.options[E].value});F.appendChild(document.createTextNode(B.options[E].innerHTML));D.appendChild(F)}return D}function ControlSelect(A,B,H,G,D){var F;try{F=Position.cumulativeOffset($(B))}catch(E){}if(F==undefined||F[0]==0||F[1]==0){return setTimeout("new ControlSelect('"+A+"','"+B+"','"+H+"',"+G+",'"+D+"');",200)}this.select=$(A);this.clase=H;this.nodo=D;this.contenedor=ConstruyeContenedor(A,H,D);this.destino=$(B);this.contenedor.control=this;this.destino.control=this;this.callBack=G;var C=this;this.onblurIEfix=function(J){J=J||window.event;var I=J.target||J.srcElement;$$("input").each(function(L){L.stopObserving("click",C.onblurIEfix)});$$("select").each(function(L){L.stopObserving("click",C.onblurIEfix)});$$("table").each(function(L){L.stopObserving("click",C.onblurIEfix)});C.onblurIEfixSet=false;C.contenedor.style.visibility="hidden";try{document.body.removeChild(C.control.contenedor)}catch(K){}};this.destino.onblur=function(I){if(Prototype.Browser.IE){if(C.contenedor.style.visibility=="hidden"||C.onblurIEfixSet){return }$$("input").each(function(K){K.observe("click",C.onblurIEfix)});$$("select").each(function(K){K.observe("click",C.onblurIEfix)});$$("table").each(function(K){K.observe("click",C.onblurIEfix)});C.onblurIEfixSet=true;return }C.contenedor.style.visibility="hidden";try{document.body.removeChild(this.control.contenedor)}catch(J){}};this.destino.onkeyup=function(I){I=I||window.event;if(I.KEY_RETURN&&this.control.callBack){this.control.callBack(this.control.select)}};this.destino.readOnly=true;this.destino.onclick=function(){var I=Position.cumulativeOffset(this.control.destino);this.control.contenedor.style.width=this.control.destino.clientWidth+"px";this.control.contenedor.style.left=I[0]+2+"px";this.control.contenedor.style.top=I[1]+(Prototype.Browser.IE?0:this.control.destino.offsetHeight)+"px";this.control.contenedor.style.visibility="visible";document.body.appendChild(this.control.contenedor);this.control.contenedor.style.zIndex=1000};this.initContenedor=function(){this.contenedor.onmousedown=this.contenedor.onmouseup=this.contenedor.onmouseover=function(J){J=J||window.event;var I=J.target||J.srcElement;Event.stop(J);if(J.type=="mousedown"){for(var K=0;K<this.control.select.options.length;K++){if(this.control.select.options[K].innerHTML==I.firstChild.nodeValue){this.control.select.selectedIndex=K;break}}if(this.control.select.options.length!=K){this.control.destino.value=I.firstChild.nodeValue;this.style.visibility="hidden";try{document.body.removeChild(this.contenedor)}catch(L){}if(Prototype.Browser.IE){$$("input").each(function(M){M.stopObserving("click",C.onblurIEfix)});$$("select").each(function(M){M.stopObserving("click",C.onblurIEfix)});$$("table").each(function(M){M.stopObserving("click",C.onblurIEfix)});C.onblurIEfixSet=false}if(this.control.callBack){this.control.callBack(this.control.select)}}}else{if(J.type=="mouseover"){this.control.Highlight(I)}else{this.control.destino.focus()}}return false}};this.Highlight=function(J){for(var I=0;I<this.contenedor.childNodes.length;I++){if(this.contenedor.childNodes[I]==J){this.contenedor.childNodes[I].className="current"}else{if(this.contenedor.childNodes[I].className="current"){this.contenedor.childNodes[I].className=""}}}};this.rebuild=function(){document.body.removeChild(this.contenedor);delete this.contenedor;this.contenedor=ConstruyeContenedor(this.select,this.clase,this.nodo);this.initContenedor();this.posicionaContenedor()};this.posicionaContenedor=function(){this.contenedor.style.width=this.destino.clientWidth+"px";this.contenedor.style.left=F[0]+2+"px";this.contenedor.style.top=F[1]+(Prototype.Browser.IE?0:this.destino.offsetHeight)+"px";this.contenedor.style.visibility="hidden"};this.initContenedor();this.posicionaContenedor()};var Window=Class.create();Window.keepMultiModalWindow=true;Window.hasEffectLib=(typeof Effect!="undefined");Window.resizeEffectDuration=0.4;Window.prototype={initialize:function(){var C;var B=0;if(arguments.length>0){if(typeof arguments[0]=="string"){C=arguments[0];B=1}else{C=arguments[0]?arguments[0].id:null}}if(!C){C="window_"+new Date().getTime()}if($(C)){alert("Window "+C+" is already registered in the DOM! Make sure you use setDestroyOnClose() or destroyOnClose: true in the constructor")}this.options=Object.extend({className:"dialog",blurClassName:null,minWidth:100,minHeight:20,resizable:true,closable:true,minimizable:true,maximizable:true,draggable:true,userData:null,showEffect:(Window.hasEffectLib?Effect.Appear:Element.show),hideEffect:(Window.hasEffectLib?Effect.Fade:Element.hide),showEffectOptions:{},hideEffectOptions:{},effectOptions:null,parent:document.body,title:"&nbsp;",url:null,onload:Prototype.emptyFunction,width:200,height:300,opacity:1,recenterAuto:true,wiredDrag:false,closeCallback:null,destroyOnClose:true,gridX:1,gridY:1},arguments[B]||{});if(this.options.blurClassName){this.options.focusClassName=this.options.className}if(typeof this.options.top=="undefined"&&typeof this.options.bottom=="undefined"){this.options.top=this._round(Math.random()*500,this.options.gridY)}if(typeof this.options.left=="undefined"&&typeof this.options.right=="undefined"){this.options.left=this._round(Math.random()*500,this.options.gridX)}if(this.options.effectOptions){Object.extend(this.options.hideEffectOptions,this.options.effectOptions);Object.extend(this.options.showEffectOptions,this.options.effectOptions);if(this.options.showEffect==Element.Appear){this.options.showEffectOptions.to=this.options.opacity}}if(Window.hasEffectLib){if(this.options.showEffect==Effect.Appear){this.options.showEffectOptions.to=this.options.opacity}if(this.options.hideEffect==Effect.Fade){this.options.hideEffectOptions.from=this.options.opacity}}if(this.options.hideEffect==Element.hide){this.options.hideEffect=function(){Element.hide(this.element);if(this.options.destroyOnClose){this.destroy()}}.bind(this)}if(this.options.parent!=document.body){this.options.parent=$(this.options.parent)}this.element=this._createWindow(C);this.element.win=this;this.eventMouseDown=this._initDrag.bindAsEventListener(this);this.eventMouseUp=this._endDrag.bindAsEventListener(this);this.eventMouseMove=this._updateDrag.bindAsEventListener(this);this.eventOnLoad=this._getWindowBorderSize.bindAsEventListener(this);this.eventMouseDownContent=this.toFront.bindAsEventListener(this);this.eventResize=this._recenter.bindAsEventListener(this);this.topbar=$(this.element.id+"_top");this.bottombar=$(this.element.id+"_bottom");this.content=$(this.element.id+"_content");Event.observe(this.topbar,"mousedown",this.eventMouseDown);Event.observe(this.bottombar,"mousedown",this.eventMouseDown);Event.observe(this.content,"mousedown",this.eventMouseDownContent);Event.observe(window,"load",this.eventOnLoad);Event.observe(window,"resize",this.eventResize);Event.observe(window,"scroll",this.eventResize);Event.observe(this.options.parent,"scroll",this.eventResize);if(this.options.draggable){var A=this;[this.topbar,this.topbar.up().previous(),this.topbar.up().next()].each(function(D){D.observe("mousedown",A.eventMouseDown);D.addClassName("top_draggable")});[this.bottombar.up(),this.bottombar.up().previous(),this.bottombar.up().next()].each(function(D){D.observe("mousedown",A.eventMouseDown);D.addClassName("bottom_draggable")})}if(this.options.resizable){this.sizer=$(this.element.id+"_sizer");Event.observe(this.sizer,"mousedown",this.eventMouseDown)}this.useLeft=null;this.useTop=null;if(typeof this.options.left!="undefined"){this.element.setStyle({left:parseFloat(this.options.left)+"px"});this.useLeft=true}else{this.element.setStyle({right:parseFloat(this.options.right)+"px"});this.useLeft=false}if(typeof this.options.top!="undefined"){this.element.setStyle({top:parseFloat(this.options.top)+"px"});this.useTop=true}else{this.element.setStyle({bottom:parseFloat(this.options.bottom)+"px"});this.useTop=false}this.storedLocation=null;this.setOpacity(this.options.opacity);if(this.options.zIndex){this.setZIndex(this.options.zIndex)}if(this.options.destroyOnClose){this.setDestroyOnClose(true)}this._getWindowBorderSize();this.width=this.options.width;this.height=this.options.height;this.visible=false;this.constraint=false;this.constraintPad={top:0,left:0,bottom:0,right:0};if(this.width&&this.height){this.setSize(this.options.width,this.options.height)}this.setTitle(this.options.title);Windows.register(this)},destroy:function(){this._notify("onDestroy");Event.stopObserving(this.topbar,"mousedown",this.eventMouseDown);Event.stopObserving(this.bottombar,"mousedown",this.eventMouseDown);Event.stopObserving(this.content,"mousedown",this.eventMouseDownContent);Event.stopObserving(window,"load",this.eventOnLoad);Event.stopObserving(window,"resize",this.eventResize);Event.stopObserving(window,"scroll",this.eventResize);Event.stopObserving(this.content,"load",this.options.onload);if(this._oldParent){var C=this.getContent();var A=null;for(var B=0;B<C.childNodes.length;B++){A=C.childNodes[B];if(A.nodeType==1){break}A=null}if(A){this._oldParent.appendChild(A)}this._oldParent=null}if(this.sizer){Event.stopObserving(this.sizer,"mousedown",this.eventMouseDown)}if(this.options.url){this.content.src=null}if(this.iefix){Element.remove(this.iefix)}Element.remove(this.element);Windows.unregister(this)},setCloseCallback:function(A){this.options.closeCallback=A},getContent:function(){return this.content},setContent:function(G,F,B){var A=$(G);if(null==A){throw"Unable to find element '"+G+"' in DOM"}this._oldParent=A.parentNode;var E=null;var D=null;if(F){E=Element.getDimensions(A)}if(B){D=Position.cumulativeOffset(A)}var C=this.getContent();this.setHTMLContent("");C=this.getContent();C.appendChild(A);A.show();if(F){this.setSize(E.width,E.height)}if(B){this.setLocation(D[1]-this.heightN,D[0]-this.widthW)}},setHTMLContent:function(A){if(this.options.url){this.content.src=null;this.options.url=null;var B='<div id="'+this.getId()+'_content" class="'+this.options.className+'_content"> </div>';$(this.getId()+"_table_content").innerHTML=B;this.content=$(this.element.id+"_content")}this.getContent().innerHTML=A},setAjaxContent:function(B,A,D,C){this.showFunction=D?"showCenter":"show";this.showModal=C||false;A=A||{};this.setHTMLContent("");this.onComplete=A.onComplete;if(!this._onCompleteHandler){this._onCompleteHandler=this._setAjaxContent.bind(this)}A.onComplete=this._onCompleteHandler;new Ajax.Request(B,A);A.onComplete=this.onComplete},_setAjaxContent:function(A){Element.update(this.getContent(),A.responseText);if(this.onComplete){this.onComplete(A)}this.onComplete=null;this[this.showFunction](this.showModal)},setURL:function(A){if(this.options.url){this.content.src=null}this.options.url=A;var B="<iframe frameborder='0' name='"+this.getId()+"_content'  id='"+this.getId()+"_content' src='"+A+"' width='"+this.width+"' height='"+this.height+"'> </iframe>";$(this.getId()+"_table_content").innerHTML=B;this.content=$(this.element.id+"_content")},getURL:function(){return this.options.url?this.options.url:null},refresh:function(){if(this.options.url){$(this.element.getAttribute("id")+"_content").src=this.options.url}},setCookie:function(B,C,M,E,A){B=B||this.element.id;this.cookie=[B,C,M,E,A];var K=WindowUtilities.getCookie(B);if(K){var L=K.split(",");var I=L[0].split(":");var H=L[1].split(":");var J=parseFloat(L[2]),F=parseFloat(L[3]);var G=L[4];var D=L[5];this.setSize(J,F);if(G=="true"){this.doMinimize=true}else{if(D=="true"){this.doMaximize=true}}this.useLeft=I[0]=="l";this.useTop=H[0]=="t";this.element.setStyle(this.useLeft?{left:I[1]}:{right:I[1]});this.element.setStyle(this.useTop?{top:H[1]}:{bottom:H[1]})}},getId:function(){return this.element.id},setDestroyOnClose:function(){this.options.destroyOnClose=true},setConstraint:function(A,B){this.constraint=A;this.constraintPad=Object.extend(this.constraintPad,B||{});if(this.useTop&&this.useLeft){this.setLocation(parseFloat(this.element.style.top),parseFloat(this.element.style.left))}},_initDrag:function(B){if(Event.element(B)==this.sizer&&this.isMinimized()){return }if(Event.element(B)!=this.sizer&&this.isMaximized()){return }if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}this.pointer=[this._round(Event.pointerX(B),this.options.gridX),this._round(Event.pointerY(B),this.options.gridY)];if(this.options.wiredDrag){this.currentDrag=this._createWiredElement()}else{this.currentDrag=this.element}if(Event.element(B)==this.sizer){this.doResize=true;this.widthOrg=this.width;this.heightOrg=this.height;this.bottomOrg=parseFloat(this.element.getStyle("bottom"));this.rightOrg=parseFloat(this.element.getStyle("right"));this._notify("onStartResize")}else{this.doResize=false;var A=$(this.getId()+"_close");if(A&&Position.within(A,this.pointer[0],this.pointer[1])){this.currentDrag=null;return }this.toFront();if(!this.options.draggable){return }this._notify("onStartMove")}Event.observe(document,"mouseup",this.eventMouseUp,false);Event.observe(document,"mousemove",this.eventMouseMove,false);WindowUtilities.disableScreen("__invisible__","__invisible__",this.overlayOpacity);document.body.ondrag=function(){return false};document.body.onselectstart=function(){return false};this.currentDrag.show();Event.stop(B)},_round:function(B,A){return A==1?B:B=Math.floor(B/A)*A},_updateDrag:function(B){var A=[this._round(Event.pointerX(B),this.options.gridX),this._round(Event.pointerY(B),this.options.gridY)];var J=A[0]-this.pointer[0];var I=A[1]-this.pointer[1];if(this.doResize){var H=this.widthOrg+J;var D=this.heightOrg+I;J=this.width-this.widthOrg;I=this.height-this.heightOrg;if(this.useLeft){H=this._updateWidthConstraint(H)}else{this.currentDrag.setStyle({right:(this.rightOrg-J)+"px"})}if(this.useTop){D=this._updateHeightConstraint(D)}else{this.currentDrag.setStyle({bottom:(this.bottomOrg-I)+"px"})}this.setSize(H,D);this._notify("onResize")}else{this.pointer=A;if(this.useLeft){var C=parseFloat(this.currentDrag.getStyle("left"))+J;var G=this._updateLeftConstraint(C);this.pointer[0]+=G-C;this.currentDrag.setStyle({left:G+"px"})}else{this.currentDrag.setStyle({right:parseFloat(this.currentDrag.getStyle("right"))-J+"px"})}if(this.useTop){var F=parseFloat(this.currentDrag.getStyle("top"))+I;var E=this._updateTopConstraint(F);this.pointer[1]+=E-F;this.currentDrag.setStyle({top:E+"px"})}else{this.currentDrag.setStyle({bottom:parseFloat(this.currentDrag.getStyle("bottom"))-I+"px"})}this._notify("onMove")}if(this.iefix){this._fixIEOverlapping()}this._removeStoreLocation();Event.stop(B)},_endDrag:function(A){WindowUtilities.enableScreen("__invisible__");if(this.doResize){this._notify("onEndResize")}else{this._notify("onEndMove")}Event.stopObserving(document,"mouseup",this.eventMouseUp,false);Event.stopObserving(document,"mousemove",this.eventMouseMove,false);Event.stop(A);this._hideWiredElement();this._saveCookie();document.body.ondrag=null;document.body.onselectstart=null},_updateLeftConstraint:function(B){if(this.constraint&&this.useLeft&&this.useTop){var A=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;if(B<this.constraintPad.left){B=this.constraintPad.left}if(B+this.width+this.widthE+this.widthW>A-this.constraintPad.right){B=A-this.constraintPad.right-this.width-this.widthE-this.widthW}}return B},_updateTopConstraint:function(C){if(this.constraint&&this.useLeft&&this.useTop){var A=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var B=this.height+this.heightN+this.heightS;if(C<this.constraintPad.top){C=this.constraintPad.top}if(C+B>A-this.constraintPad.bottom){C=A-this.constraintPad.bottom-B}}return C},_updateWidthConstraint:function(A){if(this.constraint&&this.useLeft&&this.useTop){var B=this.options.parent==document.body?WindowUtilities.getPageSize().windowWidth:this.options.parent.getDimensions().width;var C=parseFloat(this.element.getStyle("left"));if(C+A+this.widthE+this.widthW>B-this.constraintPad.right){A=B-this.constraintPad.right-C-this.widthE-this.widthW}}return A},_updateHeightConstraint:function(B){if(this.constraint&&this.useLeft&&this.useTop){var A=this.options.parent==document.body?WindowUtilities.getPageSize().windowHeight:this.options.parent.getDimensions().height;var C=parseFloat(this.element.getStyle("top"));if(C+B+this.heightN+this.heightS>A-this.constraintPad.bottom){B=A-this.constraintPad.bottom-C-this.heightN-this.heightS}}return B},_createWindow:function(A){var F=this.options.className;var D=document.createElement("div");D.setAttribute("id",A);D.className="dialog";var E;if(this.options.url){E='<iframe frameborder="0" name="'+A+'_content"  id="'+A+'_content" src="'+this.options.url+'"> </iframe>'}else{E='<div id="'+A+'_content" class="'+F+'_content"> </div>'}var G=this.options.closable?"<div class='"+F+"_close' id='"+A+"_close' onclick='Windows.close(\""+A+"\", event)'> </div>":"";var H=this.options.minimizable?"<div class='"+F+"_minimize' id='"+A+"_minimize' onclick='Windows.minimize(\""+A+"\", event)'> </div>":"";var I=this.options.maximizable?"<div class='"+F+"_maximize' id='"+A+"_maximize' onclick='Windows.maximize(\""+A+"\", event)'> </div>":"";var C=this.options.resizable?"class='"+F+"_sizer' id='"+A+"_sizer'":"class='"+F+"_se'";var B="../themes/default/blank.gif";D.innerHTML=G+H+I+"      <table id='"+A+"_row1' class=\"top table_window\">        <tr>          <td class='"+F+"_nw'></td>          <td class='"+F+"_n'><div id='"+A+"_top' class='"+F+"_title title_window'>"+this.options.title+"</div></td>          <td class='"+F+"_ne'></td>        </tr>      </table>      <table id='"+A+"_row2' class=\"mid table_window\">        <tr>          <td class='"+F+"_w'></td>            <td id='"+A+"_table_content' class='"+F+"_content' valign='top'>"+E+"</td>          <td class='"+F+"_e'></td>        </tr>      </table>        <table id='"+A+"_row3' class=\"bot table_window\">        <tr>          <td class='"+F+"_sw'></td>            <td class='"+F+"_s'><div id='"+A+"_bottom' class='status_bar "+F+"_status_bar'><span style='float:left; width:1px; height:1px'></span></div></td>            <td "+C+"></td>        </tr>      </table>    ";Element.hide(D);this.options.parent.insertBefore(D,this.options.parent.firstChild);Event.observe($(A+"_content"),"load",this.options.onload);return D},changeClassName:function(A){var B=this.options.className;var C=this.getId();$A(["_close","_minimize","_maximize","_sizer","_content"]).each(function(D){this._toggleClassName($(C+D),B+D,A+D)}.bind(this));this._toggleClassName($(C+"_top"),B+"_title",A+"_title");$$("#"+C+" td").each(function(D){D.className=D.className.sub(B,A)});this.options.className=A},_toggleClassName:function(C,B,A){if(C){C.removeClassName(B);C.addClassName(A)}},setLocation:function(C,B){C=this._updateTopConstraint(C);B=this._updateLeftConstraint(B);var A=this.currentDrag||this.element;A.setStyle({top:C+"px"});A.setStyle({left:B+"px"});this.useLeft=true;this.useTop=true},getLocation:function(){var A={};if(this.useTop){A=Object.extend(A,{top:this.element.getStyle("top")})}else{A=Object.extend(A,{bottom:this.element.getStyle("bottom")})}if(this.useLeft){A=Object.extend(A,{left:this.element.getStyle("left")})}else{A=Object.extend(A,{right:this.element.getStyle("right")})}return A},getSize:function(){return{width:this.width,height:this.height}},setSize:function(C,B,A){C=parseFloat(C);B=parseFloat(B);if(!this.minimized&&C<this.options.minWidth){C=this.options.minWidth}if(!this.minimized&&B<this.options.minHeight){B=this.options.minHeight}if(this.options.maxHeight&&B>this.options.maxHeight){B=this.options.maxHeight}if(this.options.maxWidth&&C>this.options.maxWidth){C=this.options.maxWidth}if(this.useTop&&this.useLeft&&Window.hasEffectLib&&Effect.ResizeWindow&&A){new Effect.ResizeWindow(this,null,null,C,B,{duration:Window.resizeEffectDuration})}else{this.width=C;this.height=B;var E=this.currentDrag?this.currentDrag:this.element;E.setStyle({width:C+this.widthW+this.widthE+"px"});E.setStyle({height:B+this.heightN+this.heightS+"px"});if(!this.currentDrag||this.currentDrag==this.element){var D=$(this.element.id+"_content");D.setStyle({height:B+"px"});D.setStyle({width:C+"px"})}}},updateHeight:function(){this.setSize(this.width,this.content.scrollHeight,true)},updateWidth:function(){this.setSize(this.content.scrollWidth,this.height,true)},toFront:function(){if(this.element.style.zIndex<Windows.maxZIndex){this.setZIndex(Windows.maxZIndex+1)}if(this.iefix){this._fixIEOverlapping()}},getBounds:function(B){if(!this.width||!this.height||!this.visible){this.computeBounds()}var A=this.width;var C=this.height;if(!B){A+=this.widthW+this.widthE;C+=this.heightN+this.heightS}var D=Object.extend(this.getLocation(),{width:A+"px",height:C+"px"});return D},computeBounds:function(){if(!this.width||!this.height){var A=WindowUtilities._computeSize(this.content.innerHTML,this.content.id,this.width,this.height,0,this.options.className);if(this.height){this.width=A+5}else{this.height=A+5}}this.setSize(this.width,this.height);if(this.centered){this._center(this.centerTop,this.centerLeft)}},show:function(B){this.visible=true;if(B){if(typeof this.overlayOpacity=="undefined"){var A=this;setTimeout(function(){A.show(B)},10);return }Windows.addModalWindow(this);this.modal=true;this.setZIndex(Windows.maxZIndex+1);Windows.unsetOverflow(this)}else{if(!this.element.style.zIndex){this.setZIndex(Windows.maxZIndex+1)}}if(this.oldStyle){this.getContent().setStyle({overflow:this.oldStyle})}this.computeBounds();this._notify("onBeforeShow");if(this.options.showEffect!=Element.show&&this.options.showEffectOptions){this.options.showEffect(this.element,this.options.showEffectOptions)}else{this.options.showEffect(this.element)}this._checkIEOverlapping();WindowUtilities.focusedWindow=this;this._notify("onShow")},showCenter:function(A,C,B){this.centered=true;this.centerTop=C;this.centerLeft=B;this.show(A)},isVisible:function(){return this.visible},_center:function(C,B){var D=WindowUtilities.getWindowScroll(this.options.parent);var A=WindowUtilities.getPageSize(this.options.parent);if(typeof C=="undefined"){C=(A.windowHeight-(this.height+this.heightN+this.heightS))/2}C+=D.top;if(typeof B=="undefined"){B=(A.windowWidth-(this.width+this.widthW+this.widthE))/2}B+=D.left;this.setLocation(C,B);this.toFront()},_recenter:function(B){if(this.centered){var A=WindowUtilities.getPageSize(this.options.parent);var C=WindowUtilities.getWindowScroll(this.options.parent);if(this.pageSize&&this.pageSize.windowWidth==A.windowWidth&&this.pageSize.windowHeight==A.windowHeight&&this.windowScroll.left==C.left&&this.windowScroll.top==C.top){return }this.pageSize=A;this.windowScroll=C;if($("overlay_modal")){$("overlay_modal").setStyle({height:(A.pageHeight+"px")})}if(this.options.recenterAuto){this._center(this.centerTop,this.centerLeft)}}},hide:function(){this.visible=false;if(this.modal){Windows.removeModalWindow(this);Windows.resetOverflow()}this.oldStyle=this.getContent().getStyle("overflow")||"auto";this.getContent().setStyle({overflow:"hidden"});this.options.hideEffect(this.element,this.options.hideEffectOptions);if(this.iefix){this.iefix.hide()}if(!this.doNotNotifyHide){this._notify("onHide")}},close:function(){if(this.visible){if(this.options.closeCallback&&!this.options.closeCallback(this)){return }if(this.options.destroyOnClose){var A=this.destroy.bind(this);if(this.options.hideEffectOptions.afterFinish){var B=this.options.hideEffectOptions.afterFinish;this.options.hideEffectOptions.afterFinish=function(){B();A()}}else{this.options.hideEffectOptions.afterFinish=function(){A()}}}Windows.updateFocusedWindow();this.doNotNotifyHide=true;this.hide();this.doNotNotifyHide=false;this._notify("onClose")}},minimize:function(){if(this.resizing){return }var A=$(this.getId()+"_row2");if(!this.minimized){this.minimized=true;var D=A.getDimensions().height;this.r2Height=D;var C=this.element.getHeight()-D;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height-D,{duration:Window.resizeEffectDuration})}else{this.height-=D;this.element.setStyle({height:C+"px"});A.hide()}if(!this.useTop){var B=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(B+D)+"px"})}}else{this.minimized=false;var D=this.r2Height;this.r2Height=null;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,null,null,null,this.height+D,{duration:Window.resizeEffectDuration})}else{var C=this.element.getHeight()+D;this.height+=D;this.element.setStyle({height:C+"px"});A.show()}if(!this.useTop){var B=parseFloat(this.element.getStyle("bottom"));this.element.setStyle({bottom:(B-D)+"px"})}this.toFront()}this._notify("onMinimize");this._saveCookie()},maximize:function(){if(this.isMinimized()||this.resizing){return }if(Prototype.Browser.IE&&this.heightN==0){this._getWindowBorderSize()}if(this.storedLocation!=null){this._restoreLocation();if(this.iefix){this.iefix.hide()}}else{this._storeLocation();Windows.unsetOverflow(this);var G=WindowUtilities.getWindowScroll(this.options.parent);var B=WindowUtilities.getPageSize(this.options.parent);var F=G.left;var E=G.top;if(this.options.parent!=document.body){G={top:0,left:0,bottom:0,right:0};var D=this.options.parent.getDimensions();B.windowWidth=D.width;B.windowHeight=D.height;E=0;F=0}if(this.constraint){B.windowWidth-=Math.max(0,this.constraintPad.left)+Math.max(0,this.constraintPad.right);B.windowHeight-=Math.max(0,this.constraintPad.top)+Math.max(0,this.constraintPad.bottom);F+=Math.max(0,this.constraintPad.left);E+=Math.max(0,this.constraintPad.top)}var C=B.windowWidth-this.widthW-this.widthE;var A=B.windowHeight-this.heightN-this.heightS;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,E,F,C,A,{duration:Window.resizeEffectDuration})}else{this.setSize(C,A);this.element.setStyle(this.useLeft?{left:F}:{right:F});this.element.setStyle(this.useTop?{top:E}:{bottom:E})}this.toFront();if(this.iefix){this._fixIEOverlapping()}}this._notify("onMaximize");this._saveCookie()},isMinimized:function(){return this.minimized},isMaximized:function(){return(this.storedLocation!=null)},setOpacity:function(A){if(Element.setOpacity){Element.setOpacity(this.element,A)}},setZIndex:function(A){this.element.setStyle({zIndex:A});Windows.updateZindex(A,this)},setTitle:function(A){if(!A||A==""){A="&nbsp;"}Element.update(this.element.id+"_top",A)},getTitle:function(){return $(this.element.id+"_top").innerHTML},setStatusBar:function(B){var A=$(this.getId()+"_bottom");if(typeof (B)=="object"){if(this.bottombar.firstChild){this.bottombar.replaceChild(B,this.bottombar.firstChild)}else{this.bottombar.appendChild(B)}}else{this.bottombar.innerHTML=B}},_checkIEOverlapping:function(){if(!this.iefix&&(navigator.appVersion.indexOf("MSIE")>0)&&(navigator.userAgent.indexOf("Opera")<0)&&(this.element.getStyle("position")=="absolute")){new Insertion.After(this.element.id,'<iframe id="'+this.element.id+'_iefix" style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.element.id+"_iefix")}if(this.iefix){setTimeout(this._fixIEOverlapping.bind(this),50)}},_fixIEOverlapping:function(){Position.clone(this.element,this.iefix);this.iefix.style.zIndex=this.element.style.zIndex-1;this.iefix.show()},_getWindowBorderSize:function(B){var C=this._createHiddenDiv(this.options.className+"_n");this.heightN=Element.getDimensions(C).height;C.parentNode.removeChild(C);var C=this._createHiddenDiv(this.options.className+"_s");this.heightS=Element.getDimensions(C).height;C.parentNode.removeChild(C);var C=this._createHiddenDiv(this.options.className+"_e");this.widthE=Element.getDimensions(C).width;C.parentNode.removeChild(C);var C=this._createHiddenDiv(this.options.className+"_w");this.widthW=Element.getDimensions(C).width;C.parentNode.removeChild(C);var C=document.createElement("div");C.className="overlay_"+this.options.className;document.body.appendChild(C);var A=this;setTimeout(function(){A.overlayOpacity=($(C).getStyle("opacity"));C.parentNode.removeChild(C)},10);if(Prototype.Browser.IE){this.heightS=$(this.getId()+"_row3").getDimensions().height;this.heightN=$(this.getId()+"_row1").getDimensions().height}if(Prototype.Browser.WebKit&&Prototype.Browser.WebKitVersion<420){this.setSize(this.width,this.height)}if(this.doMaximize){this.maximize()}if(this.doMinimize){this.minimize()}},_createHiddenDiv:function(B){var A=document.body;var C=document.createElement("div");C.setAttribute("id",this.element.id+"_tmp");C.className=B;C.style.display="none";C.innerHTML="";A.insertBefore(C,A.firstChild);return C},_storeLocation:function(){if(this.storedLocation==null){this.storedLocation={useTop:this.useTop,useLeft:this.useLeft,top:this.element.getStyle("top"),bottom:this.element.getStyle("bottom"),left:this.element.getStyle("left"),right:this.element.getStyle("right"),width:this.width,height:this.height}}},_restoreLocation:function(){if(this.storedLocation!=null){this.useLeft=this.storedLocation.useLeft;this.useTop=this.storedLocation.useTop;if(this.useLeft&&this.useTop&&Window.hasEffectLib&&Effect.ResizeWindow){new Effect.ResizeWindow(this,this.storedLocation.top,this.storedLocation.left,this.storedLocation.width,this.storedLocation.height,{duration:Window.resizeEffectDuration})}else{this.element.setStyle(this.useLeft?{left:this.storedLocation.left}:{right:this.storedLocation.right});this.element.setStyle(this.useTop?{top:this.storedLocation.top}:{bottom:this.storedLocation.bottom});this.setSize(this.storedLocation.width,this.storedLocation.height)}Windows.resetOverflow();this._removeStoreLocation()}},_removeStoreLocation:function(){this.storedLocation=null},_saveCookie:function(){if(this.cookie){var A="";if(this.useLeft){A+="l:"+(this.storedLocation?this.storedLocation.left:this.element.getStyle("left"))}else{A+="r:"+(this.storedLocation?this.storedLocation.right:this.element.getStyle("right"))}if(this.useTop){A+=",t:"+(this.storedLocation?this.storedLocation.top:this.element.getStyle("top"))}else{A+=",b:"+(this.storedLocation?this.storedLocation.bottom:this.element.getStyle("bottom"))}A+=","+(this.storedLocation?this.storedLocation.width:this.width);A+=","+(this.storedLocation?this.storedLocation.height:this.height);A+=","+this.isMinimized();A+=","+this.isMaximized();WindowUtilities.setCookie(A,this.cookie)}},_createWiredElement:function(){if(!this.wiredElement){if(Prototype.Browser.IE){this._getWindowBorderSize()}var B=document.createElement("div");B.className="wired_frame "+this.options.className+"_wired_frame";B.style.position="absolute";this.options.parent.insertBefore(B,this.options.parent.firstChild);this.wiredElement=$(B)}if(this.useLeft){this.wiredElement.setStyle({left:this.element.getStyle("left")})}else{this.wiredElement.setStyle({right:this.element.getStyle("right")})}if(this.useTop){this.wiredElement.setStyle({top:this.element.getStyle("top")})}else{this.wiredElement.setStyle({bottom:this.element.getStyle("bottom")})}var A=this.element.getDimensions();this.wiredElement.setStyle({width:A.width+"px",height:A.height+"px"});this.wiredElement.setStyle({zIndex:Windows.maxZIndex+30});return this.wiredElement},_hideWiredElement:function(){if(!this.wiredElement||!this.currentDrag){return }if(this.currentDrag==this.element){this.currentDrag=null}else{if(this.useLeft){this.element.setStyle({left:this.currentDrag.getStyle("left")})}else{this.element.setStyle({right:this.currentDrag.getStyle("right")})}if(this.useTop){this.element.setStyle({top:this.currentDrag.getStyle("top")})}else{this.element.setStyle({bottom:this.currentDrag.getStyle("bottom")})}this.currentDrag.hide();this.currentDrag=null;if(this.doResize){this.setSize(this.width,this.height)}}},_notify:function(A){if(this.options[A]){this.options[A](this)}else{Windows.notify(A,this)}}};var Windows={windows:[],modalWindows:[],observers:[],focusedWindow:null,maxZIndex:0,overlayShowEffectOptions:{duration:0.5},overlayHideEffectOptions:{duration:0.5},addObserver:function(A){this.removeObserver(A);this.observers.push(A)},removeObserver:function(A){this.observers=this.observers.reject(function(B){return B==A})},notify:function(A,B){this.observers.each(function(C){if(C[A]){C[A](A,B)}})},getWindow:function(A){return this.windows.detect(function(B){return B.getId()==A})},getFocusedWindow:function(){return this.focusedWindow},updateFocusedWindow:function(){this.focusedWindow=this.windows.length>=2?this.windows[this.windows.length-2]:null},register:function(A){this.windows.push(A)},addModalWindow:function(A){if(this.modalWindows.length==0){WindowUtilities.disableScreen(A.options.className,"overlay_modal",A.overlayOpacity,A.getId(),A.options.parent)}else{if(Window.keepMultiModalWindow){$("overlay_modal").style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex+=1;WindowUtilities._hideSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.hide()}WindowUtilities._showSelect(A.getId())}this.modalWindows.push(A)},removeModalWindow:function(A){this.modalWindows.pop();if(this.modalWindows.length==0){WindowUtilities.enableScreen()}else{if(Window.keepMultiModalWindow){this.modalWindows.last().toFront();WindowUtilities._showSelect(this.modalWindows.last().getId())}else{this.modalWindows.last().element.show()}}},register:function(A){this.windows.push(A)},unregister:function(A){this.windows=this.windows.reject(function(B){return B==A})},closeAll:function(){this.windows.each(function(A){Windows.close(A.getId())})},closeAllModalWindows:function(){WindowUtilities.enableScreen();this.modalWindows.each(function(A){if(A){A.close()}})},minimize:function(C,A){var B=this.getWindow(C);if(B&&B.visible){B.minimize()}Event.stop(A)},maximize:function(C,A){var B=this.getWindow(C);if(B&&B.visible){B.maximize()}Event.stop(A)},close:function(C,A){var B=this.getWindow(C);if(B){B.close()}if(A){Event.stop(A)}},blur:function(B){var A=this.getWindow(B);if(!A){return }if(A.options.blurClassName){A.changeClassName(A.options.blurClassName)}if(this.focusedWindow==A){this.focusedWindow=null}A._notify("onBlur")},focus:function(B){var A=this.getWindow(B);if(!A){return }if(this.focusedWindow){this.blur(this.focusedWindow.getId())}if(A.options.focusClassName){A.changeClassName(A.options.focusClassName)}this.focusedWindow=A;A._notify("onFocus")},unsetOverflow:function(A){this.windows.each(function(B){B.oldOverflow=B.getContent().getStyle("overflow")||"auto";B.getContent().setStyle({overflow:"hidden"})});if(A&&A.oldOverflow){A.getContent().setStyle({overflow:A.oldOverflow})}},resetOverflow:function(){this.windows.each(function(A){if(A.oldOverflow){A.getContent().setStyle({overflow:A.oldOverflow})}})},updateZindex:function(A,B){if(A>this.maxZIndex){this.maxZIndex=A;if(this.focusedWindow){this.blur(this.focusedWindow.getId())}}this.focusedWindow=B;if(this.focusedWindow){this.focus(this.focusedWindow.getId())}}};var Dialog={dialogId:null,onCompleteFunc:null,callFunc:null,parameters:null,confirm:function(D,C){if(D&&typeof D!="string"){Dialog._runAjaxRequest(D,C,Dialog.confirm);return }D=D||"";C=C||{};var F=C.okLabel?C.okLabel:"Ok";var A=C.cancelLabel?C.cancelLabel:"Cancel";C=Object.extend(C,C.windowParameters||{});C.windowParameters=C.windowParameters||{};C.className=C.className||"alert";var B="class ='"+(C.buttonClass?C.buttonClass+" ":"")+" ok_button'";var E="class ='"+(C.buttonClass?C.buttonClass+" ":"")+" cancel_button'";var D="      <div class='"+C.className+"_message'>"+D+"</div>        <div class='"+C.className+"_buttons'>          <input type='button' value='"+F+"' onclick='Dialog.okCallback()' "+B+"/>          <input type='button' value='"+A+"' onclick='Dialog.cancelCallback()' "+E+"/>        </div>    ";return this._openDialog(D,C)},alert:function(C,B){if(C&&typeof C!="string"){Dialog._runAjaxRequest(C,B,Dialog.alert);return }C=C||"";B=B||{};var D=B.okLabel?B.okLabel:"Ok";B=Object.extend(B,B.windowParameters||{});B.windowParameters=B.windowParameters||{};B.className=B.className||"alert";var A="class ='"+(B.buttonClass?B.buttonClass+" ":"")+" ok_button'";var C="      <div class='"+B.className+"_message'>"+C+"</div>        <div class='"+B.className+"_buttons'>          <input type='button' value='"+D+"' onclick='Dialog.okCallback()' "+A+"/>        </div>";return this._openDialog(C,B)},info:function(B,A){if(B&&typeof B!="string"){Dialog._runAjaxRequest(B,A,Dialog.info);return }B=B||"";A=A||{};A=Object.extend(A,A.windowParameters||{});A.windowParameters=A.windowParameters||{};A.className=A.className||"alert";var B="<div id='modal_dialog_message' class='"+A.className+"_message'>"+B+"</div>";if(A.showProgress){B+="<div id='modal_dialog_progress' class='"+A.className+"_progress'>  </div>"}A.ok=null;A.cancel=null;return this._openDialog(B,A)},setInfoMessage:function(A){$("modal_dialog_message").update(A)},closeInfo:function(){Windows.close(this.dialogId)},_openDialog:function(E,D){var C=D.className;if(!D.height&&!D.width){D.width=WindowUtilities.getPageSize(D.options.parent||document.body).pageWidth/2}if(D.id){this.dialogId=D.id}else{var B=new Date();this.dialogId="modal_dialog_"+B.getTime();D.id=this.dialogId}if(!D.height||!D.width){var A=WindowUtilities._computeSize(E,this.dialogId,D.width,D.height,5,C);if(D.height){D.width=A+5}else{D.height=A+5}}D.effectOptions=D.effectOptions;D.resizable=D.resizable||false;D.minimizable=D.minimizable||false;D.maximizable=D.maximizable||false;D.draggable=D.draggable||false;D.closable=D.closable||false;var F=new Window(D);Element.update(F.getContent(),E);F.showCenter(true,D.top,D.left);F.setDestroyOnClose();F.cancelCallback=D.onCancel||D.cancel;F.okCallback=D.onOk||D.ok;return F},_getAjaxContent:function(A){Dialog.callFunc(A.responseText,Dialog.parameters)},_runAjaxRequest:function(C,B,A){if(C.options==null){C.options={}}Dialog.onCompleteFunc=C.options.onComplete;Dialog.parameters=B;Dialog.callFunc=A;C.options.onComplete=Dialog._getAjaxContent;new Ajax.Request(C.url,C.options)},okCallback:function(){var A=Windows.focusedWindow;if(!A.okCallback||A.okCallback(A)){$$("#"+A.getId()+" input").each(function(B){B.onclick=null});A.close()}},cancelCallback:function(){var A=Windows.focusedWindow;$$("#"+A.getId()+" input").each(function(B){B.onclick=null});A.close();if(A.cancelCallback){A.cancelCallback(A)}}};if(Prototype.Browser.WebKit){var array=navigator.userAgent.match(new RegExp(/AppleWebKit\/([\d\.\+]*)/));Prototype.Browser.WebKitVersion=parseFloat(array[1])}var WindowUtilities={getWindowScroll:function(parent){var T,L,W,H;parent=parent||document.body;if(parent!=document.body){T=parent.scrollTop;L=parent.scrollLeft;W=parent.scrollWidth;H=parent.scrollHeight}else{var w=window;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else{if(w.document.body){T=body.scrollTop;L=body.scrollLeft}}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else{if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}}}return{top:T,left:L,width:W,height:H}},getPageSize:function(D){D=D||document.body;var C,G;var E,B;if(D!=document.body){C=D.getWidth();G=D.getHeight();B=D.scrollWidth;E=D.scrollHeight}else{var F,A;if(window.innerHeight&&window.scrollMaxY){F=document.body.scrollWidth;A=window.innerHeight+window.scrollMaxY}else{if(document.body.scrollHeight>document.body.offsetHeight){F=document.body.scrollWidth;A=document.body.scrollHeight}else{F=document.body.offsetWidth;A=document.body.offsetHeight}}if(self.innerHeight){C=self.innerWidth;G=self.innerHeight}else{if(document.documentElement&&document.documentElement.clientHeight){C=document.documentElement.clientWidth;G=document.documentElement.clientHeight}else{if(document.body){C=document.body.clientWidth;G=document.body.clientHeight}}}if(A<G){E=G}else{E=A}if(F<C){B=C}else{B=F}}return{pageWidth:B,pageHeight:E,windowWidth:C,windowHeight:G}},disableScreen:function(C,A,D,E,B){WindowUtilities.initLightbox(A,C,function(){this._disableScreen(C,A,D,E)}.bind(this),B||document.body)},_disableScreen:function(C,B,E,F){var D=$(B);var A=WindowUtilities.getPageSize(D.parentNode);if(F&&Prototype.Browser.IE){WindowUtilities._hideSelect();WindowUtilities._showSelect(F)}D.style.height=(A.pageHeight+"px");D.style.display="none";if(B=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayShowEffectOptions){D.overlayOpacity=E;new Effect.Appear(D,Object.extend({from:0,to:E},Windows.overlayShowEffectOptions))}else{D.style.display="block"}},enableScreen:function(B){B=B||"overlay_modal";var A=$(B);if(A){if(B=="overlay_modal"&&Window.hasEffectLib&&Windows.overlayHideEffectOptions){new Effect.Fade(A,Object.extend({from:A.overlayOpacity,to:0},Windows.overlayHideEffectOptions))}else{A.style.display="none";A.parentNode.removeChild(A)}if(B!="__invisible__"){WindowUtilities._showSelect()}}},_hideSelect:function(A){if(Prototype.Browser.IE){A=A==null?"":"#"+A+" ";$$(A+"select").each(function(B){if(!WindowUtilities.isDefined(B.oldVisibility)){B.oldVisibility=B.style.visibility?B.style.visibility:"visible";B.style.visibility="hidden"}})}},_showSelect:function(A){if(Prototype.Browser.IE){A=A==null?"":"#"+A+" ";$$(A+"select").each(function(B){if(WindowUtilities.isDefined(B.oldVisibility)){try{B.style.visibility=B.oldVisibility}catch(C){B.style.visibility="visible"}B.oldVisibility=null}else{if(B.style.visibility){B.style.visibility="visible"}}})}},isDefined:function(A){return typeof (A)!="undefined"&&A!=null},initLightbox:function(E,C,A,B){if($(E)){Element.setStyle(E,{zIndex:Windows.maxZIndex+1});Windows.maxZIndex++;A()}else{var D=document.createElement("div");D.setAttribute("id",E);D.className="overlay_"+C;D.style.display="none";D.style.position="absolute";D.style.top="0";D.style.left="0";D.style.zIndex=Windows.maxZIndex+1;Windows.maxZIndex++;D.style.width="100%";B.insertBefore(D,B.firstChild);if(Prototype.Browser.WebKit&&E=="overlay_modal"){setTimeout(function(){A()},10)}else{A()}}},setCookie:function(B,A){document.cookie=A[0]+"="+escape(B)+((A[1])?"; expires="+A[1].toGMTString():"")+((A[2])?"; path="+A[2]:"")+((A[3])?"; domain="+A[3]:"")+((A[4])?"; secure":"")},getCookie:function(C){var B=document.cookie;var E=C+"=";var D=B.indexOf("; "+E);if(D==-1){D=B.indexOf(E);if(D!=0){return null}}else{D+=2}var A=document.cookie.indexOf(";",D);if(A==-1){A=B.length}return unescape(B.substring(D+E.length,A))},_computeSize:function(E,A,B,G,D,F){var I=document.body;var C=document.createElement("div");C.setAttribute("id",A);C.className=F+"_content";if(G){C.style.height=G+"px"}else{C.style.width=B+"px"}C.style.position="absolute";C.style.top="0";C.style.left="0";C.style.display="none";C.innerHTML=E;I.insertBefore(C,I.firstChild);var H;if(G){H=$(C).getDimensions().width+D}else{H=$(C).getDimensions().height+D}I.removeChild(C);return H}};TooltipManager={options:{cssClassName:"tooltip",delayOver:200,delayOut:1000,shiftX:10,shiftY:10,className:"ventana1",width:200,height:null,draggable:false,destroyOnClose:false,minimizable:false,maximizable:false,showEffect:Effect.Appear,hideEffect:Element.hide},ajaxInfo:null,elements:null,showTimer:null,hideTimer:null,init:function(A,B,C){TooltipManager.options=Object.extend(TooltipManager.options,C||{});A=TooltipManager.options.cssClassName||"tooltip";TooltipManager.ajaxInfo=B;TooltipManager.elements=$$("."+A);TooltipManager.elements.each(function(D){D=$(D);var E=TooltipManager._getInfo(D);if(E.ajax){D.ajaxId=E.id;D.ajaxInfo=B}else{D.tooltipElement=$(E.id)}D.observe("mouseover",TooltipManager._mouseOver);D.observe("mouseout",TooltipManager._mouseOut)});Windows.addObserver(this)},addHTML:function(A,B){A=$(A);B=$(B);A.tooltipElement=B;A.observe("mouseover",TooltipManager._mouseOver);A.observe("mouseout",TooltipManager._mouseOut)},addAjax:function(B,A){B=$(B);B.ajaxInfo=A;B.observe("mouseover",TooltipManager._mouseOver);B.observe("mouseout",TooltipManager._mouseOut)},addURL:function(C,B,D,A){C=$(C);C.url=B;C.frameWidth=D;C.frameHeight=A;C.observe("mouseover",TooltipManager._mouseOver);C.observe("mouseout",TooltipManager._mouseOut)},close:function(){if(TooltipManager.tooltipWindow){TooltipManager.tooltipWindow.hide()}},preloadImages:function(B,A,C){if(!C){C=".gif"}$A(A).each(function(D){var E=new Image();E.src=B+"/"+D+C})},_showTooltip:function(C){if(this.element==C){return }while(C&&(!C.tooltipElement&&!C.ajaxInfo&&!C.url)){C=C.parentNode}this.element=C;TooltipManager.showTimer=null;if(TooltipManager.hideTimer){clearTimeout(TooltipManager.hideTimer)}var A=Position.cumulativeOffset(C);var E=C.getDimensions();if(!this.tooltipWindow){this.tooltipWindow=new Window("__tooltip__",TooltipManager.options)}this.tooltipWindow.setLocation(A[1]+E.height+TooltipManager.options.shiftY,A[0]+TooltipManager.options.shiftX);Event.observe(this.tooltipWindow.element,"mouseover",function(F){TooltipManager._tooltipOver(F,C)});Event.observe(this.tooltipWindow.element,"mouseout",function(F){TooltipManager._tooltipOut(F,C)});this.tooltipWindow.height=TooltipManager.options.height;this.tooltipWindow.width=TooltipManager.options.width;if(C.ajaxInfo){var D=C.ajaxInfo.options.parameters;var B=D;if(C.ajaxId){if(D){D+="&id="+C.ajaxId}else{D="id="+C.ajaxId}}C.ajaxInfo.options.parameters=D||"";this.tooltipWindow.setHTMLContent("");this.tooltipWindow.setAjaxContent(C.ajaxInfo.url,C.ajaxInfo.options);C.ajaxInfo.options.parameters=B}else{if(C.url){this.tooltipWindow.setURL(C.url);this.tooltipWindow.setSize(C.frameWidth,C.frameHeight);this.tooltipWindow.height=C.frameHeight;this.tooltipWindow.width=C.frameWidth}else{this.tooltipWindow.setHTMLContent(C.tooltipElement.innerHTML)}}if(!C.ajaxInfo){this.tooltipWindow.show();this.tooltipWindow.toFront()}},_hideTooltip:function(A){if(this.tooltipWindow){this.tooltipWindow.hide();this.element=null}},_mouseOver:function(B){var A=Event.element(B);if(TooltipManager.showTimer){clearTimeout(TooltipManager.showTimer)}TooltipManager.showTimer=setTimeout(function(){TooltipManager._showTooltip(A)},TooltipManager.options.delayOver)},_mouseOut:function(B){var A=Event.element(B);if(TooltipManager.showTimer){clearTimeout(TooltipManager.showTimer);TooltipManager.showTimer=null;return }if(TooltipManager.tooltipWindow){TooltipManager.hideTimer=setTimeout(function(){TooltipManager._hideTooltip(A)},TooltipManager.options.delayOut)}},_tooltipOver:function(B,A){if(TooltipManager.hideTimer){clearTimeout(TooltipManager.hideTimer);TooltipManager.hideTimer=null}},_tooltipOut:function(B,A){if(TooltipManager.hideTimer==null){TooltipManager.hideTimer=setTimeout(function(){TooltipManager._hideTooltip(A)},TooltipManager.options.delayOut)}},_getInfo:function(A){var C=A.className.split(" ").detect(function(D){return D.indexOf("html_")==0});var B=true;if(C){B=false}else{C=A.className.split(" ").detect(function(D){return D.indexOf("ajax_")==0})}C=C.substr(C.indexOf("_")+1,C.length);return C?{ajax:B,id:C}:null},onBeforeShow:function(B,E){if(this.tooltipWindow==E){var D=parseFloat(E.getLocation().top);var C=E.element.getDimensions();if(D+C.height>TooltipManager._getScrollTop()+TooltipManager._getPageHeight()){var A=Position.cumulativeOffset(this.element);var D=A[1]-TooltipManager.options.shiftY-C.height;E.setLocation(D,A[0]+TooltipManager.options.shiftX)}}},_getPageWidth:function(){return window.innerWidth||document.documentElement.clientWidth||0},_getPageHeight:function(){return window.innerHeight||document.documentElement.clientHeight||0},_getScrollTop:function(){return document.documentElement.scrollTop||window.pageYOffset||0},_getScrollLeft:function(){return document.documentElement.scrollLeft||window.pageXOffset||0}};VentanaManager={options:{cssClassName:"ventana",shiftX:251,shiftY:53,className:"ventana_nota",width:415,height:523,effectOptions:{duration:0.4},draggable:false,minimizable:false,maximizable:false,showEffect:Effect.Appear,hideEffect:Effect.Fade},ajaxInfo:null,elements:null,showTimer:null,hideTimer:null,POS_element:null,init:function(A,C,B){VentanaManager.options=Object.extend(VentanaManager.options,B||{});VentanaManager.POS_element=$("cuadro_global");A=A||VentanaManager.options.cssClassName||"ventana";VentanaManager.ajaxInfo=C;if(A.indexOf("_")>-1){if(!VentanaManager._tipos(A)){return }VentanaManager._showVentana(null)}else{VentanaManager.elements=$$("."+A);VentanaManager.elements.each(function(D){D=$(D);var E=VentanaManager._getInfo(D);if(E.ajax){D.ajaxId=E.id;D.ajaxInfo=C}else{D.ventanaElement=$(E.id)}if(E.tipo){D.WType=E.tipo}if(E.tpl){D.tpl=E.tpl}D.stopObserving("click");D.observe("click",VentanaManager._mouseClick)})}Windows.addObserver(this)},_tipos:function(A){switch(A){case"ventana_nota":VentanaManager.options=Object.extend(VentanaManager.options,{shiftX:251,shiftY:53,width:415,height:523,className:"ventana_nota"});break;case"ventana_registro":VentanaManager.options=Object.extend(VentanaManager.options,{shiftX:116,shiftY:10,width:669,height:550+(Prototype.Browser.IE?15:0),className:"ventana_registro"});break;case"ventana_ficha":VentanaManager.options=Object.extend(VentanaManager.options,{shiftX:1,shiftY:-1,width:922,height:606,className:"ventana_ficha"});break;case"ventana_total":VentanaManager.options=Object.extend(VentanaManager.options,{shiftX:-34+(Prototype.Browser.Mac||Prototype.Browser.WebKit?10:0),shiftY:-(Prototype.Browser.Mac?10:0),width:966+(Prototype.Browser.Mac||Prototype.Browser.WebKit?0:(Prototype.Browser.IE?60:0)),height:658+(Prototype.Browser.Mac?32:(Prototype.Browser.IE?5:0)),className:"ventana_total"});break;default:return false}return true},addHTML:function(B,A){B=$(B);A=$(A);B.ventanaElement=A;B.observe("click",VentanaManager._mouseClick)},addAjax:function(B,A){B=$(B);B.ajaxInfo=A;B.observe("click",VentanaManager._mouseClick)},addURL:function(C,B,D,A){C=$(C);C.url=B;if(isString(D)){}else{if(isObject(D)){VentanaManager.options=Object.extend(VentanaManager.options,D)}else{C.frameWidth=D;C.frameHeight=A}}C.observe("click",VentanaManager._mouseClick)},close:function(A){if(VentanaManager.ventanaWindow){if(!A){VentanaManager.ventanaWindow.close()}VentanaManager.ventanaWindow=null;if(VentanaManager.element&&VentanaManager.element.observe){VentanaManager.element.observe("click",VentanaManager._mouseClick)}}else{if(A&&A.iniciador&&A.iniciador.observe){A.iniciador.observe("click",VentanaManager._mouseClick)}}return true},preloadImages:function(B,A,C){if(!C){C=$w(".gif .png")}else{C=$w(C)}$A(A).each(function(D){var E=new Image();$A(C).each(function(F){E.src=B+"/"+D+F;alert(E.src)})})},_showVentana:function(D){VentanaManager.showTimer=null;this.element=$(D);var A=Position.cumulativeOffset(this.POS_element);var F=this.POS_element.getDimensions();if(D&&D.WType){VentanaManager._tipos(D.WType)}if(this.ventanaWindow){}var C=(Math.round((Math.random()*99)+1));this.ventanaWindow=new Window("__ventanuca__"+C,VentanaManager.options);this.ventanaWindow.setCloseCallback(this.close);this.ventanaWindow.setDestroyOnClose(true);this.ventanaWindow.setLocation(A[1]+VentanaManager.options.shiftY,A[0]+VentanaManager.options.shiftX);this.ventanaWindow.iniciador=D;if(D){if(D.ajaxInfo){var E=D.ajaxInfo.options.parameters;var B=E;if(D.ajaxId){if(E){E+="&sec="+D.ajaxId}else{E="sec="+D.ajaxId;E+=(D.tpl?"&tpl="+D.tpl:"")}}else{if(D.parameters){if(E){E+=D.parameters}else{E=D.parameters}}}D.ajaxInfo.options.parameters=E||"";this.ventanaWindow.setHTMLContent("");this.ventanaWindow.setAjaxContent(D.ajaxInfo.url,D.ajaxInfo.options,false,true);D.ajaxInfo.options.parameters=B}else{if(D.url){this.ventanaWindow.setURL(D.url);this.ventanaWindow.setSize(D.frameWidth,D.frameHeight);this.ventanaWindow.height=D.frameHeight;this.ventanaWindow.width=D.frameWidth}else{this.ventanaWindow.setHTMLContent(D.innerHTML)}}}else{this.ventanaWindow.setHTMLContent("");this.ventanaWindow.setAjaxContent(VentanaManager.ajaxInfo.url,VentanaManager.ajaxInfo.options,false,true)}this.ventanaWindow.toFront();return false},_hideVentana:function(A){if(this.ventanaWindow){this.ventanaWindow.hide();this.element.observe("click",VentanaManager._mouseClick);this.element=null}},_mouseClick:function(B){B.stop();var A=Event.element(B);A.stopObserving("click");VentanaManager._showVentana(A);return false},_mouseOut:function(B){var A=Event.element(B);if(VentanaManager.showTimer){clearTimeout(VentanaManager.showTimer);VentanaManager.showTimer=null;return }if(VentanaManager.ventanaWindow){VentanaManager.hideTimer=setTimeout(function(){VentanaManager._hideVentana(A)},VentanaManager.options.delayOut)}},_ventanaOver:function(B,A){if(VentanaManager.hideTimer){clearTimeout(VentanaManager.hideTimer);VentanaManager.hideTimer=null}},_tooltipOut:function(B,A){if(VentanaManager.hideTimer==null){VentanaManager.hideTimer=setTimeout(function(){VentanaManager._hideVentana(A)},VentanaManager.options.delayOut)}},_getInfo:function(B){var E=B.className.split(" ").detect(function(F){return F.indexOf("html_")==0});var D=true;if(E){D=false}else{E=B.className.split(" ").detect(function(F){return F.indexOf("ajax_")==0})}var A=B.className.split(" ").detect(function(F){return F.indexOf("ventana_")==0});if(!A){A="ventana_nota"}var C=B.className.split(" ").detect(function(F){return F.indexOf("tpl_")==0});if(C){C="&tpl="+C.substr(C.indexOf("_")+1,C.length)}else{C=""}E=E.substr(E.indexOf("_")+1,E.length);return E?{ajax:D,id:E,tipo:A,tpl:C}:null},onBeforeShow:function(A,B){if(this.ventanaWindow==B){}},_getPageWidth:function(){return window.innerWidth||document.documentElement.clientWidth||0},_getPageHeight:function(){return window.innerHeight||document.documentElement.clientHeight||0},_getScrollTop:function(){return document.documentElement.scrollTop||window.pageYOffset||0},_getScrollLeft:function(){return document.documentElement.scrollLeft||window.pageXOffset||0}};/*	SWFObject v2.2 <http://code.google.com/p/swfobject/> 
	is released under the MIT License <http://www.opensource.org/licenses/mit-license.php> 
*/
var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return !a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();function AutoSuggestControl(C,B,D){var A={maxHeight:"250px",strict:false,submitOnEnter:true,onSelect:null,onNosel:null};this.cur=-1;this.options=Object.extend(A,D||{});this.layer=null;if(B.tagName&&B.tagName=="SELECT"){this.oSelect=B;B=new BuildProvider(B)}this.provider=B;if(this.provider.requestSuggestions==undefined){this.provider.requestSuggestions=this.Sugiere}this.textbox=C;this.init()}AutoSuggestControl.prototype.autosuggest=function(B,A){if(B.length>0){if(A){this.typeAhead(B[0])}this.showSuggestions(B)}else{if(this.options.strict){if(this.textbox.value.length){this.textbox.value=this.textbox.value.substring(0,this.textbox.value.length-1);return this.provider.requestSuggestions(this,true)}}else{this.hideSuggestions()}}};AutoSuggestControl.prototype.createDropDown=function(){var A=this;this.layer=document.createElement("div");this.layer.className="seleccion";this.layer.style.visibility="hidden";this.layer.style.display="none";this.layer.style.width=this.textbox.clientWidth+"px";this.layer.style.maxHeight=this.options.maxHeight;this.layer.style.overflow="auto";this.layer.onmousedown=this.layer.onmouseup=this.layer.onmouseover=function(B){B=B||window.event;oTarget=B.target||B.srcElement;if(B.type=="mousedown"){if(oTarget.firstChild.nodeValue){A.textbox.value=oTarget.firstChild.nodeValue;A.textbox.val=(oTarget.val?oTarget.val:undefined);if(A.provider.tipo=="select"){A.provider.selecciona(oTarget.val)}if(A.options.onSelect){A.options.onSelect((A.oSelect?A.oSelect:(oTarget.val?oTarget.val:A.textbox.value)))}A.hideSuggestions(true)}}else{if(B.type=="mouseover"){A.highlightSuggestion(oTarget)}else{A.textbox.focus()}}};document.body.appendChild(this.layer)};AutoSuggestControl.prototype.getLeft=function(){var B=this.textbox;var A=0;while(B&&B.tagName!="BODY"){A+=B.offsetLeft;B=B.offsetParent}return A};AutoSuggestControl.prototype.getTop=function(){var B=this.textbox;var A=0;while(B&&B.tagName!="BODY"){A+=B.offsetTop;B=B.offsetParent}return A};AutoSuggestControl.prototype.handleKeyDown=function(A){switch(A.keyCode){case 38:this.previousSuggestion();break;case 40:this.nextSuggestion();break;case 13:if(this.options.submitOnEnter&&this.layer.style.visibility=="hidden"){this.textbox.form.submit()}else{this.hideSuggestions(true)}break;case 27:this.hideSuggestions();this.clearRange();break;default:var B=A.keyCode;if(B<32||(B>=33&&B<46)||(B>=112&&B<=123)){return }if(this.options.inType){switch(this.options.inType){case"alpha":if(B<65||B>90){return StopEvent(A)}break;case"alphanum":if(!((B>47&&B<91)||(B>95&&B<106))){return StopEvent(A)}break;case"numeric":if(!(B>47&&B<58||B>95&&B<106)){StopEvent(A);return }break}}}};function StopEvent(A){if(!A){if(window.event){A=window.event}else{return }}if(A.cancelBubble!=null){A.cancelBubble=true}if(A.stopPropagation){A.stopPropagation()}if(A.preventDefault){A.preventDefault()}if(window.event){A.returnValue=false}if(A.cancel!=null){A.cancel=true}}AutoSuggestControl.prototype.handleKeyUp=function(A){var B=A.keyCode;if(B==8||B==46){this.textbox.val=undefined;if(this.options.onNosel){this.options.onNosel()}this.provider.requestSuggestions(this,false)}else{if(B<32||(B>=33&&B<46)||(B>=112&&B<=123)){}else{this.provider.requestSuggestions(this,true)}}};AutoSuggestControl.prototype.hideSuggestions=function(A){this.layer.style.visibility="hidden";this.layer.style.display="none";if(A==undefined||A!=true){this.textbox.val=undefined}};AutoSuggestControl.prototype.highlightSuggestion=function(A){for(var B=0;B<this.layer.childNodes.length;B++){var C=this.layer.childNodes[B];if(C==A){C.className="current"}else{if(C.className=="current"){C.className=""}}}};AutoSuggestControl.prototype.init=function(){var A=this;var B=Position.cumulativeOffset(A.textbox);if(B[0]==0||B[1]==0||this.textbox.clientWidth==0){return setTimeout(function(){A.init()},200)}this.textbox.getLayer=function(){return A.layer};this.textbox.onkeyup=function(C){if(!C){C=window.event}A.handleKeyUp(C)};this.textbox.onkeydown=function(C){if(!C){C=window.event}A.handleKeyDown(C)};this.textbox.onmousedown=function(C){if(!C){C=window.event}if(A.layer&&A.layer.style.visibility=="visible"){A.hideSuggestions()}else{A.provider.requestSuggestions(A,false,true)}};this.onblurIEfix=function(D){D=D||window.event;var C=D.target||D.srcElement;$$("input").each(function(E){E.stopObserving("click",A.onblurIEfix)});$$("select").each(function(E){E.stopObserving("click",A.onblurIEfix)});$$("table").each(function(E){E.stopObserving("click",A.onblurIEfix)});A.onblurIEfixSet=false;A.hideSuggestions(true)};this.textbox.onblur=function(){if(Prototype.Browser.IE){if(A.layer.style.visibility=="hidden"||A.onblurIEfixSet){return }$$("input").each(function(C){C.observe("click",A.onblurIEfix)});$$("select").each(function(C){C.observe("click",A.onblurIEfix)});$$("table").each(function(C){C.observe("click",A.onblurIEfix)});A.onblurIEfixSet=true;return }A.hideSuggestions(true)};this.createDropDown()};AutoSuggestControl.prototype.nextSuggestion=function(){var B=this.layer.childNodes;if(B.length>0&&this.cur<B.length-1){var A=B[++this.cur];this.highlightSuggestion(A);this.textbox.value=A.firstChild.nodeValue;this.textbox.val=(A.val?A.val:undefined);if(this.provider.tipo=="select"){this.provider.selecciona(this.textbox.val)}}};AutoSuggestControl.prototype.previousSuggestion=function(){var B=this.layer.childNodes;if(B.length>0&&this.cur>0){var A=B[--this.cur];this.highlightSuggestion(A);this.textbox.value=A.firstChild.nodeValue;this.textbox.val=(A.val?A.val:undefined);if(this.provider.tipo=="select"){this.provider.selecciona(this.textbox.val)}}};AutoSuggestControl.prototype.selectRange=function(A,B){if(this.textbox.createTextRange){var D=this.textbox.createTextRange();D.moveStart("character",A);var C=B-this.textbox.value.length;if(C==0){C=B}D.moveEnd("character",C);D.select()}else{if(this.textbox.setSelectionRange){this.textbox.setSelectionRange(A,B)}}this.textbox.focus()};AutoSuggestControl.prototype.clearRange=function(){if(this.textbox.setSelectionRange){this.textbox.value=this.textbox.value.substring(0,this.textbox.selectionStart)}this.textbox.focus()};AutoSuggestControl.prototype.showSuggestions=function(C){var A=null;this.layer.innerHTML="";for(var B=0;B<C.length;B++){A=document.createElement("div");A.val=C[B].val?C[B].val:undefined;A.appendChild(document.createTextNode(C[B].name?C[B].name:C[B]));this.layer.appendChild(A)}this.layer.style.left=this.getLeft()+1+"px";this.layer.style.top=(this.getTop()+this.textbox.offsetHeight)+"px";this.layer.style.visibility="visible";this.layer.style.zIndex=1000;this.layer.style.display="block";this.layer.style.visibility="visible"};AutoSuggestControl.prototype.typeAhead=function(B){if(this.textbox.createTextRange||this.textbox.setSelectionRange){var A=this.textbox.value.length;this.textbox.value=(B.name?B.name:B);this.textbox.val=(B.val?B.val:undefined);this.selectRange(A,(B.name?B.name.length:B.length));if(this.provider.tipo=="select"){this.provider.selecciona(this.textbox.val)}if(this.options.onSelect){this.options.onSelect((this.oSelect?this.oSelect:(B.val?B.val:this.textbox.value)))}}};AutoSuggestControl.prototype.Sugiere=function(H,F,B){var E=[];var G=H.textbox.value;if(G.length>0&&B==undefined){var D=RegExp(G,"i");for(var C=0;C<this.lista.length;C++){if((this.lista[C].name&&this.lista[C].name.search(D)==0)||(!this.lista[C].name&&this.lista[C].search(D)==0)){E.push(this.lista[C])}}}else{var A=(isInteger(B)?B:this.lista.length);for(var C=0;C<A;C++){E.push(this.lista[C])}}H.autosuggest(E,F)};function BuildProvider(B){this.name=B.id;this.tipo="select";this.oSelect=B;this.lista=new Array();for(var A=0;A<B.options.length;A++){this.lista.push({name:B.options[A].innerHTML,val:B.options[A].value})}}BuildProvider.prototype.selecciona=function(B){for(var A=0;A<this.oSelect.options.length;A++){if(this.oSelect.options[A].value==B){this.oSelect.selectedIndex=A;break}}};