// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function detectar_soporte_ajax() {
    if (!Ajax.getTransport()) {
      var texto = '<p>Su navegador no soporta o no tiene habilitada la tecnología Ajax</p>';
      texto+='<p>Para algunas opciones interactivas de esta página es necesario contar con esta tecnología en su navegador.</p>';
      texto+='<p>Le recomendamos que actualice su navegador y active esta función</p>';
      texto+='<p>En los navegadores más modernos viene activada por defecto</p>';
      document.getElementById("alerta_ajax").style.display="block"   
      document.getElementById("alerta_ajax").innerHTML = texto;      
    }
 }
 
function detectar_soporte_cookies() {
    var tmpcookie = new Date();
    chkcookie = (tmpcookie.getTime() + '');
    document.cookie = "chkcookie=" + chkcookie + "; path=/";
    if (document.cookie.indexOf(chkcookie,0) < 0) {      
      var texto = '<p>Su navegador no soporta o no tiene habilitadas las cookies</p>';
      texto+='<p>Necesita tener un navegador con soporte para cookies para utilizar esta página.</p>';
      document.getElementById("alerta_cookies").style.display="block"   
      document.getElementById("alerta_cookies").innerHTML = texto;
      }

}

function goToAnchor(anchor) {
	if(document.location.href.indexOf("#")==-1){
		document.location.href+="#"+anchor
	}

}

function pageScroll(scroll_vertical) {
    	window.scroll(0,scroll_vertical); // horizontal and vertical scroll increments
    	/*scrolldelay = setTimeout('pageScroll()',intervalo); // scrolls every 100 milliseconds
    	clearTimeout(scrolldelay);*/
}

function toggle_vis(obj) {
	var el = document.getElementById(obj);
	el.style.display = (el.style.display != 'none' ? 'none' : '' );
        el.style.visibility = (el.style.visibility != 'visible' ? 'visible' : 'hidden' );
}
