/* sTexto = sTexto.replace('','\u00e1'); sTexto = sTexto.replace('','\u00e9'); sTexto = sTexto.replace('','\u00ed'); sTexto = sTexto.replace('','\u00f3'); sTexto = sTexto.replace('','\u00fa'); sTexto = sTexto.replace('','\u00c1'); sTexto = sTexto.replace('','\u00c9'); sTexto = sTexto.replace('','\u00cd'); sTexto = sTexto.replace('','\u00d3'); sTexto = sTexto.replace('','\u00da'); sTexto = sTexto.replace('','\u00f1'); sTexto = sTexto.replace('','\u00d1'); */ function pulsarLink( sId, bOtraVentana ) { if( sId != -1 && document.getElementById( sId ) != null && document.getElementById( sId ).href != "" ) { if( bOtraVentana != null && bOtraVentana == true ) window.open( document.getElementById( sId ).href ); else document.location.href = document.getElementById( sId ).href; } } function adaptarEnlacesAURLsAmigables( sTexto ) { alert( sTexto ); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CAMNIAR PARAMETROS /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function cambiarParam( objDiv, sParam, sValor ) { objDiv.style[ sParam ] = sValor; } function cambiarColor( objDiv, sColor ) { objDiv.style.color = sColor; } function cambiarAlpha( objDiv, nAlpha ) { objDiv.style.opacity = nAlpha; objDiv.style.filter = "alpha(opacity="+nAlpha*100+")"; } function cambiarFondo( objDiv, sImagen ) { objDiv.style.backgroundImage = "url(media/imagenes/"+sImagen+")"; } function cambiarImagen( objIMG, sImagen ) { objIMG.src = sImagen; } function getOrigenPadre( objDIV ) { var nXPos = 0;//objDIV.offsetLeft; var nYPos = 0;//objDIV.offsetTop; var sParentNode = ""; do { sParentNode += ".parentNode"; var objPadre = eval( "objDIV"+sParentNode ); nXPos += objPadre.offsetLeft; nYPos += objPadre.offsetTop; //alert( objPadre.id+"//"+nXPos+","+nYPos+"//"+objPadre.offsetLeft+","+ objPadre.offsetTop ); } while( objPadre == "[object HTMLDivElement]" ) return Array( nXPos, nYPos ); } function calcularTamDiv( objDIV ) { var nAltura = 0; for( i=0; i< objDIV.childNodes.length; i++ ) { if( objDIV.childNodes[ i ] == "[object HTMLDivElement]" && nAltura < objDIV.childNodes[ i ].offsetTop + objDIV.childNodes[ i ].scrollHeight ) { if( sNavegador != "safari" ) nAltura = objDIV.childNodes[ i ].offsetTop + objDIV.childNodes[ i ].scrollHeight; } for( n=0; n< objDIV.childNodes[ i ].childNodes.length; n++ ) { if( objDIV.childNodes[ i ].childNodes[ n ] == "[object HTMLDivElement]" && nAltura < objDIV.childNodes[ i ].childNodes[ n ].offsetTop + objDIV.childNodes[ i ].childNodes[ n ].scrollHeight ) { nAltura = objDIV.childNodes[ i ].childNodes[ n ].offsetTop + objDIV.childNodes[ i ].childNodes[ n ].scrollHeight; if( sNavegador == "safari" ) nAltura += objDIV.childNodes[ i ].offsetTop; } } } //alert( nAltura); return nAltura; } function calcularAnchuraDiv( objDIV ) { var nAnchura = 0; for( i=0; i< objDIV.childNodes.length; i++ ) { if( objDIV.childNodes[ i ] == "[object HTMLDivElement]" && nAnchura < objDIV.childNodes[ i ].offsetLeft + objDIV.childNodes[ i ].scrollWidth ) { if( sNavegador != "safari" ) nAnchura = objDIV.childNodes[ i ].offsetLeft + objDIV.childNodes[ i ].scrollWidth; } for( n=0; n< objDIV.childNodes[ i ].childNodes.length; n++ ) { if( objDIV.childNodes[ i ].childNodes[ n ] == "[object HTMLDivElement]" && nAnchura < objDIV.childNodes[ i ].childNodes[ n ].offsetLeft + objDIV.childNodes[ i ].childNodes[ n ].scrollWidth ) { nAnchura = objDIV.childNodes[ i ].childNodes[ n ].offsetLeft + objDIV.childNodes[ i ].childNodes[ n ].scrollWidth; if( sNavegador == "safari" ) nAnchura += objDIV.childNodes[ i ].offsetLeft; } } } //alert( nAnchura); return nAnchura; } function alternarVisibility( sId, sIdTexto, sTexto1, sTexto2 ) { if( document.getElementById( sId ).style.visibility == "visible" ) { document.getElementById( sId ).style.visibility = "hidden"; document.getElementById( sIdTexto ).innerHTML = sTexto1; } else { document.getElementById( sId ).style.visibility = "visible"; document.getElementById( sIdTexto ).innerHTML = sTexto2; } } function alternarDisplay( sId, sIdTexto, sTexto1, sTexto2 ) { if( document.getElementById( sId ).style.display == "block" ) { document.getElementById( sId ).style.display = "none"; document.getElementById( sIdTexto ).innerHTML = sTexto1; } else { document.getElementById( sId ).style.display = "block"; document.getElementById( sIdTexto ).innerHTML = sTexto2; } } function getPosicionAbsolutaDeRespectoA( sIdDe, sIdRespectoA ) { var nXPos = 0;//document.getElementById( sIdDe ).offsetLeft; var nYPos = 0;//document.getElementById( sIdDe ).offsetTop; var sParentNode = ""; var objPadre = eval( "document.getElementById( sIdDe )"+sParentNode ); while( objPadre == "[object HTMLDivElement]" && objPadre.id != sIdRespectoA ) { nXPos += objPadre.offsetLeft; nYPos += objPadre.offsetTop; //alert( objPadre.id+","+sIdRespectoA+"//"+objPadre.offsetLeft+","+ objPadre.offsetTop+"//"+nXPos+","+nYPos ); var objPadre = objPadre.parentNode; } return Array( nXPos, nYPos ); } function cerrarSesion( sPag ) { var sTexto = "Desea cerrar la Sesi\u00f3n?"; if( sPag != "index" ) { if( sLngA == "en" ) sTexto = "Do you really want to close the session?"; else if( sLngA == "fr" ) sTexto = "Voulez-vous vous d\u00e9connecter?"; } if( confirm( sTexto ) ) { if( sPag.indexOf( "?" ) == -1 ) document.location.href=sPag+".php?accion=cerrar_sesion"; else document.location.href=sPag+"&accion=cerrar_sesion"; } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // GOOGLE MAPS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function cargarMapa( nLat, nLong, nLatMarcador, nLongMarcador, sMarcador, objDivForzado ) { var latlng = new google.maps.LatLng( nLat, nLong); //Mapa var myOptions = { zoom: 15, center: latlng, mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, navigationControl: true, navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL}, mapTypeId: google.maps.MapTypeId.ROADMAP } var objDiv = null; if( objDivForzado != null ) objDiv = objDivForzado; else objDiv = document.getElementById("iMapa"); var map = new google.maps.Map( objDiv, myOptions ); //Marcador var companyPos = new google.maps.LatLng(nLatMarcador, nLongMarcador); var companyMarker = new google.maps.Marker( {position: companyPos,map: map,title:sMarcador}); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // ARRAYS /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function ordenar(o) { var v=new Array(); for (var i=0; i= nX && nRatonX <= nX + nW && nRatonY >= nY && nRatonY <= nY + nH ) return true; return false; } function rotar(obj,angulo) { if (angulo >= 0) { var rotation = Math.PI * angulo / 180; } else { var rotation = Math.PI * (360+angulo) / 180; } var costheta = Math.cos(rotation); var sintheta = Math.sin(rotation); if (document.createElement("canvas").getContext) { /* ---- canvas ---- */ var c=document.createElement('canvas'); c.width = Math.abs(costheta*obj.width) + Math.abs(sintheta*obj.height); c.style.width = c.width+'px'; c.height = Math.abs(costheta*obj.height) + Math.abs(sintheta*obj.width); c.style.height=c.height+'px'; c.id=obj.id; c.style.position='absolute'; var ctx=c.getContext('2d'); ctx.save(); if (rotation <= Math.PI/2) { ctx.translate(sintheta*obj.height,0); } else if (rotation <= Math.PI) { ctx.translate(c.width,-costheta*obj.height); } else if (rotation <= 1.5*Math.PI) { ctx.translate(-costheta*obj.width,c.height); } else { ctx.translate(0,-sintheta*obj.width); } ctx.rotate(rotation); ctx.drawImage(obj, 0, 0, obj.width, obj.height); obj.parentNode.replaceChild(c,obj); ctx.restore(); } else { /* ---- DXImageTransform ---- */ obj.style.position='absolute'; obj.style.filter="progid:DXImageTransform.Microsoft.Matrix(sizingMethod='auto expand')"; obj.filters.item(0).M11 = costheta; obj.filters.item(0).M12 = -sintheta; obj.filters.item(0).M21 = sintheta; obj.filters.item(0).M22 = costheta; } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // EVENTOS /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function nuevoEvento( elemento, evento, funcion ) { if ( elemento.addEventListener ) { elemento.addEventListener( evento, funcion, false ); } else { elemento.attachEvent( "on"+evento, funcion ); } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CSS /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function inicializarDivParaCSS( objDiv, sSelector ) { for ( nCSS=0; nCSS < clasesCSS.length; nCSS++) { if ( clasesCSS[ nCSS ].selectorText.toLowerCase() == sSelector.toLowerCase() ) { objDiv.style.left = clasesCSS[ nCSS ].style.left; objDiv.style.top = clasesCSS[ nCSS ].style.top; objDiv.style.width = clasesCSS[ nCSS ].style.width; objDiv.style.height = clasesCSS[ nCSS ].style.height; break; } } } function leerCSS() { //if (document.all) clasesCSS = document.styleSheets[0].rules; //else clasesCSS = document.styleSheets[0].cssRules; clasesCSS = new Array(); var misReglas = new Array(); if( sNavegador.indexOf( "explorer" ) != -1 ) { for( rul=0; rul < document.styleSheets.length; rul++ ) misReglas[ misReglas.length ] = document.styleSheets[ rul ].rules; } else { for( rul=0; rul < document.styleSheets.length; rul++ ) misReglas[ misReglas.length ] = document.styleSheets[ rul ].cssRules; } for( reg=0; reg < misReglas.length; reg++ ) { for( rul=0; rul < misReglas[ reg ].length; rul++ ) clasesCSS[ clasesCSS.length ] = misReglas[ reg ][ rul ]; } } function getClaseCSS( selector ) { for ( nCSS=0; nCSS < clasesCSS.length; nCSS++) { if ( clasesCSS[ nCSS ].selectorText.toLowerCase() == selector.toLowerCase() ) return clasesCSS[ nCSS ]; } } function getProp( selector, propiedad ) { for ( nCSS=0; nCSS < clasesCSS.length; nCSS++) { if ( clasesCSS[ nCSS ].selectorText.toLowerCase() == selector.toLowerCase() ) return clasesCSS[ nCSS ].style[ propiedad ]; } } function setProp( selector, propiedad, valor ) { for ( nCSS=2; nCSS < clasesCSS.length; nCSS++) { if ( clasesCSS[ nCSS ].selectorText.toLowerCase() == selector.toLowerCase() ) { return clasesCSS[ nCSS ].style[ propiedad ] = valor; } } } function getPropNum( selector, propiedad ) { for ( nCSS=1; nCSS < clasesCSS.length; nCSS++) { if ( clasesCSS[ nCSS ].selectorText.toLowerCase() == selector.toLowerCase() ) { return 1*( clasesCSS[ nCSS ].style[ propiedad ].substring( 0, clasesCSS[ nCSS ].style[ propiedad ].indexOf( "px" ) ) ); } } } function getPropIdNum( id, propiedad ) { return 1*( document.getElementById( id ).style[ propiedad ].substring( 0, document.getElementById( id ).style[ propiedad ].indexOf( "px" ) ) ); } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // NAVEGADOR /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function getPropiedadTransform() { var sPropiedad = ""; if( sNavegador.indexOf( "explorer" ) != -1 ) sPropiedad = 'msTransform'; else if( sNavegador == "safari" ) sPropiedad = 'WebkitTransform'; else if( sNavegador == "ipad" ) sPropiedad = 'WebkitTransform'; else if( sNavegador == "iphone" ) sPropiedad = 'WebkitTransform'; else if( sNavegador == "firefox" ) sPropiedad = 'MozTransform'; else if( sNavegador == "opera" ) sPropiedad = 'OTransform'; else if( sNavegador == "chrome" ) sPropiedad = 'khtmlTransform'; else sPropiedad = 'transform'; return sPropiedad; } function getNavegador() { //var a = new Array( navigator.appCodeName, navigator.appName, navigator.appVersion, navigator.cookieEnabled, navigator.platform, navigator.userAgent ); var sNavegador = ""; if( navigator.userAgent.toLowerCase().indexOf( "ipad" ) != -1 ) { sNavegador = "ipad"; } else if( navigator.userAgent.toLowerCase().indexOf( "iphone" ) != -1 ) { sNavegador = "iphone"; } else if( navigator.userAgent.toLowerCase().indexOf( "android" ) != -1 ) { sNavegador = "android"; } else if( navigator.appName.toLowerCase().indexOf( "explorer" ) != -1 ) { if( navigator.appVersion.indexOf("MSIE 6") != -1 || navigator.appVersion.indexOf("MSIE 7") != -1) { //alert( "Esta web no funciona en esta versi\u00f3n de Internet Explorer.\nUsar IE v8 o superior, aunque se recomienda FireFox." ); //document.location.href = "http://www.mozilla.org/es-ES/firefox/new/"; return "explorer67"; } else if( navigator.appVersion.indexOf("8.") != -1 ) return "explorer8"; else if( navigator.appVersion.indexOf("9.") != -1 ) return "explorer9"; } else if( navigator.userAgent.toLowerCase().indexOf( "firefox" ) != -1 ) { sNavegador = "firefox"; var asPartes = navigator.userAgent.toLowerCase().split( "firefox/" ); var nPosSpace = asPartes[ 1 ].indexOf( " " ); var sVersion = asPartes[ 1 ].substr( 0, nPosSpace ); var asPartes = sVersion.split( "." ); if( parseInt( asPartes[ 0 ] ) >= 3 && parseInt( asPartes[ 1 ] ) >= 6 && parseInt( asPartes[ 2 ] ) >= 10 ); else { //alert( "Esta web ha sido desarrollada para una versin superior de FireFox\nPuede descargar la versin correcta aqu..." ); //window.location.href = "http://www.mozilla-europe.org/es/firefox/"; } } else if( navigator.userAgent.toLowerCase().indexOf( "chrome" ) != -1 ) { sNavegador = "chrome"; var asPartes = navigator.userAgent.toLowerCase().split( "chrome/" ); var nPosSpace = asPartes[ 1 ].indexOf( " " ); var sVersion = asPartes[ 1 ].substr( 0, nPosSpace ); var asPartes = sVersion.split( "." ); if( parseInt( asPartes[ 0 ] ) >= 6 && parseInt( asPartes[ 1 ] ) >= 0 && parseInt( asPartes[ 2 ] ) >= 472 ); else { //alert( "Esta web ha sido desarrollada para una versin superior de Google Chrome\nPuede descargar la versin correcta aqu..." ); //window.location.href = "http://www.google.es/chrome/?installdataindex=nosearch&hl=es&brand=CHMA&utm_campaign=es&utm_source=es-ha-emea-es-bk&utm_medium=ha"; } } else if( navigator.userAgent.toLowerCase().indexOf( "safari" ) != -1 ) { sNavegador = "safari"; var asPartes = navigator.userAgent.toLowerCase().split( "version/" ); var nPosSpace = asPartes[ 1 ].indexOf( " " ); var sVersion = asPartes[ 1 ].substr( 0, nPosSpace ); var asPartes = sVersion.split( "." ); if( parseInt( asPartes[ 0 ] ) >= 5 && parseInt( asPartes[ 1 ] ) >= 0 && parseInt( asPartes[ 2 ] ) >= 1 ); else { //alert( "Esta web ha sido desarrollada para una versin superior de Safari\nPuede descargar la versin correcta aqu..." ); // //window.location.href = "http://www.apple.com/es/safari/download/"; } } else if( navigator.userAgent.toLowerCase().indexOf( "opera" ) != -1 ) { sNavegador = "opera"; if( navigator.userAgent.toLowerCase().indexOf( "version/" ) >= 0 ) { var asPartes = navigator.userAgent.toLowerCase().split( "version/" ); //alert(navigator.userAgent.toLowerCase()); var sVersion = asPartes[ 1 ].substr( 0 ); var asPartes = sVersion.split( "." ); if( parseInt( asPartes[ 0 ] ) >= 10 && parseInt( asPartes[ 1 ] ) >= 62 ); else { //alert( "Esta web ha sido desarrollada para una versin superior de Opera\nPuede descargar la versin correcta aqu..." ); //window.location.href = "http://www.opera.com/download/"; } } } else if( navigator.appName.toLowerCase().indexOf( "netscape" ) != -1 ) sNavegador = "netscape"; //alert( navigator.appCodeName+","+navigator.appName+","+navigator.appVersion+","+navigator.cookieEnabled+","+navigator.platform+","+navigator.userAgent ); return sNavegador; }