// JavaScript Document

function showhide(whatdiv) {
  if (document.getElementById(whatdiv)) {
    var submenu = document.getElementById(whatdiv);

    if (submenu.style.display == "none") {
      submenu.style.display = "block";
    } else {
      submenu.style.display = "none";
    }
  }
}

function showdiv(whatdiv) {
  if (document.getElementById(whatdiv)) {
    var submenu = document.getElementById(whatdiv);
    submenu.style.display = "block";
  }
}

function showhideclass(whatdiv) {
  if (document.getElementById(whatdiv)) {
    var submenu = document.getElementById(whatdiv);

    if (submenu.className == "oculto") {
      submenu.className = "visible";
    } else {
      submenu.className = "oculto";
    }
  }
}



/*
Detección del Plugin de Adobe Reader
*/

// Retorna si el Plugin se ha encontrado (true) o no (false)
function isAcrobatInstalled() {
	var isInstalled = false;
	var acrobatVersion = null;
	if (window.ActiveXObject) {
    	var control = null;
   		try {
    	    // AcroPDF.PDF es usado por la versión 7 y superiores
    	    control = new ActiveXObject('AcroPDF.PDF');
    	} catch (e) {
    	    // Do nothing
    	}
    	if (!control) {
    	    try {
    	        // PDF.PdfCtrl es usado por la versión 6 y anteriores
        	    control = new ActiveXObject('PDF.PdfCtrl');
        	} catch (e) {
        	    return;
        	}
    	}
    	if (control) {
        	isInstalled = true;
        	acrobatVersion = control.GetVersions().split(',');
        	acrobatVersion = acrobatVersion[0].split('=');
        	acrobatVersion = parseFloat(acrobatVersion[1]);
    	}
	} else {
   		// Verifica navigator.plugins por si existe "Adobe Acrobat"
    	if (navigator.plugins != null && navigator.plugins.length > 0) {
    		for (i=0; i < navigator.plugins.length; i++ ) {
         		var plugin = navigator.plugins[i];
         		if (plugin.name.indexOf("Adobe Acrobat") > -1 || plugin.name.indexOf("Reader") > -1) {
					acrobatVersion = 1;
         		}
      		}
   		}
	}
	return acrobatVersion != null;
}

