// JavaScript Document
function createSwfMenu(opc,sec,ancho,alto)
{
	if(sec==0){
		ruta='../swf'
		}
	else if(sec==1){
		ruta='../swf'
		}
	else{
		ruta='../../swf'
		}
	if ((window.ActiveXObject) && 
		  (navigator.userAgent.indexOf("MSIE")!= -1) && (navigator.userAgent.indexOf("Windows") != -1))
		{
			
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' width="'+ancho+'" height="'+alto+'" id="'+opc+'" align="top">');
		document.write(' <param name="movie" value="../js/'+ruta+'/'+opc+'.swf">');
		document.write(' <param name=quality value=high>');
		document.write(' <param name=wmode value=transparent>');
		document.write(' <param name=menu value=false>');
		document.write(' <param name="scale" value="noscale">');
		document.write(' <param name="swliveconnect" value="true">');
		document.write(' <param name="salign" value="lt">');
		document.write('<' + '/object>');
		}
	else
		{
		var version_check = getFlashPluginVersion();
		if (version_check.scriptable)
			{

			
			document.write('<object id="'+opc+'" data="'+ruta+'/'+opc+'.swf" type="application/x-shockwave-flash"');
			document.write(' width="'+ancho+'" height="'+alto+'" align="top">');
			document.write('<param name="movie" value="../js/'+ruta+'/'+opc+'.swf" type="application/x-shockwave-flash">');
			document.write('<param name="quality" value="high">');
			document.write(' <param name="scale" value="noscale">');
			document.write(' <param name="salign" value="lt">');
			document.write('<param name="swliveconnect" value="true">');    	
			document.write('<embed src="../js/'+ruta+'/'+opc+'.swf" quality="high" scale="noscale" salign="lt" width="'+ancho+'" height="'+alto+'" name="'+opc+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'); 
			document.write('<\/object>'); 
			}
	else
		identifyFlash()
		}
	
	}

//Detección de plugin
function getFlashPluginVersion() 
{ 
  var version = { 
        major: -1, 
        minor: -1, 
        installed: false,
        scriptable: false,
        machoArchitectureProblem: false
      };
var osxFlashVersion = 12;

  var plugin = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin; 
  if (!plugin) 
  {
    return version;
  }

  version.installed = true;

  var description = plugin.description; 
  
  // use RegExp to obtain the relevant version strings 
  // obtain an array of size 2 with version information
  
  var versionArray = description.match(/[\d.]+/g); 
  
  if (!versionArray)
  {
    return version;
  }

  if (versionArray.length >= 1 && !isNaN(versionArray[0]))
  {
    version.major = parseFloat(versionArray[0]);
  }

  if (versionArray.length >= 2 && !isNaN(versionArray[1]))
  {
    version.minor = parseFloat(versionArray[1]);
  }
    
  if (version.major < 6 || navigator.product != 'Gecko')
  {
    return version;
  }

  if (version.major > 6 || version.minor >= 47)
  {
    version.scriptable = true;
  }
  
  if((version.major < osxFlashVersion) && (navigator.userAgent.indexOf("Mach-O") != -1))
  {
  	version.scriptable = false;
  	version.machoArchitectureProblem = true;
  
  }

  return version;
}


function identifyFlash() 
{ 
  if ((window.ActiveXObject) && 
      (navigator.userAgent.indexOf("MSIE")!= -1) && (navigator.userAgent.indexOf("Windows") != -1))
  {
    document.write("<p>This browser is an <b>IE browser<\/b> which" +
        " supports ActiveX -- this article is about scripting the plugin in Netscape Gecko browsers.<\/p>");
    return;
  }
  var flashversion = getFlashPluginVersion();

  if (!flashversion.installed)
  {
    document.write("<p>Flash is not installed as a plugin. " +
                   "You need to install the latest version available from " +"<\/p>");
     return;
	 
  }

  if (flashversion.major == -1 || flashversion.minor == -1)
  {
    document.write("<p>Flash is installed as a plugin but the version could not be determined.<\/p>");
    return;
  }

  if (flashversion.scriptable)
  {
    document.write("<p>Flash is installed as a plugin and is scriptable in Gecko. " +
				   "The version of Flash installed is " + flashversion.major + "r" + flashversion.minor + "<\/p>");
    return;
  }
  if ((!flashversion.scriptable) && (!flashversion.machoArchitectureProblem))
  {
	document.write("<p>Flash is not scriptable and so the examples in this article will not work ." +
                   "You need to install the latest scriptable version available from macromedia.com" + "<\/p>");
                 
    return;
  }
if(flashversion.machoArchitectureProblem)
{
	document.write("<p>Flash is not yet scriptable for your OS X browser.  Check back soon for updates -- currently, the examples in this article will not work.  " +
					"The version of Flash installed is " + flashversion.major + "r" + flashversion.minor + "<\/p>");
	return;
	document.getElementById('menu_wcag').style.visibility = 'visible';			 
}
  document.write("<p>Flash is installed as a plugin and " +
                 "is version " + flashversion.major + "r" +
                 flashversion.minor + "<\/p>");
  document.getElementById('menu_wcag').style.visibility = 'visible';			
} 

//PARTE DE CÓDIGO EDITADA POR GUILLERMO 7-MARZO-2007 PARA GENERACIÓN DE BOTONES EN FLASH

	
//////////////////////////////GESTOR
function pasaFormulario(theurl)
	{
	clearInterval(intervalo)
	document.location.href=theurl;
	}
function CreateSwfMenuintranet(random1){
	
	var mstr = '../../xml/archivo'+random1+'.xml';
	//alert(mstr);
	if ((window.ActiveXObject) && 
		  (navigator.userAgent.indexOf("MSIE")!= -1) && (navigator.userAgent.indexOf("Windows") != -1))
		{
			
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' width="220" height="657" id="menu" align="top">');
		document.write(' <param name="movie" value="file:///F|/Estudios Rey/Proyectos/alimer/swf/menu_dinamico_inicio.swf?op='+mstr+'">');
		document.write(' <param name=quality value=high>');
		document.write(' <param name=wmode value=transparent>');
		document.write(' <param name=menu value=false>');
		document.write(' <param name="scale" value="noscale">');
		document.write(' <param name="swliveconnect" value="true">');
		document.write(' <param name="salign" value="lt">');
		document.write('<' + '/object>');
		}
	else
		{
		var version_check = getFlashPluginVersion();
		if (version_check.scriptable)
			{

			
			document.write('<object id="menu" data="../../swf/menu_dinamico_inicio.swf?op='+mstr+'" type="application/x-shockwave-flash"');
			document.write(' width="220" height="657" align="top">');
			document.write('<param name="movie" value="file:///F|/Estudios Rey/Proyectos/alimer/swf/menu_dinamico_inicio.swf?op='+mstr+'" type="application/x-shockwave-flash">');
			document.write('<param name="quality" value="high">');
			document.write(' <param name="scale" value="noscale">');
			document.write(' <param name="salign" value="lt">');
			document.write('<param name="swliveconnect" value="true">');    	
			document.write('<embed src="../swf/menu_dinamico_inicio.swf?op='+mstr+'" quality="high" scale="noscale" salign="lt" width="220" height="657" name="menu" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'); 
			document.write('<\/object>'); 
			}
	else
		identifyFlash()
		}
	
	}
/////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////FUNCION DE CARGA///////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////
function nuevoAjax()
{ 
	/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
	lo que se puede copiar tal como esta aqui */
	
	var xmlhttp=false; 
	try 
	{ 
		// Creacion del objeto AJAX para navegadores no IE
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			// Creacion del objet AJAX para IE 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 

	return xmlhttp; 
}
function cargar(url){
	
	top.document.getElementById('cargando').style.visibility='visible';
	var contenido=top.document.getElementById('testiframe');
	ajax = nuevoAjax();
	ajax.open("GET", url,true);
	ajax.onreadystatechange=function(){
	if(ajax.readyState==1){
	
	}else if(ajax.readyState==4){
		
		if(ajax.status==200){
			
			top.document.getElementById('testiframe').src=url;
			top.document.getElementById('cargando').style.visibility='hidden';
		}else if(ajax.status==404){
			
			top.document.getElementById('testiframe').src='../administrador/bienvenida/404.php';
			top.document.getElementById('cargando').style.visibility='hidden';
			//cargando.innerHTML = "<span class='aviso'>Lo sentimos, pero la página solicitada no existe en nuestro servidor</span>";
		}else{
			cargando.innerHTML = "<center><span class='aviso'>Se ha producido un error en el servidor. Inténtelo de nuevo más tarde</span></center>";
		}
	}
}
ajax.send(null);
}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
function createSwfTitle(objeto,anchura,altura,sec,vari){
	if(sec==0){
		ruta='../swf'
		
		}else if(sec==1){
			
			ruta='swf'
			
			}else if(sec==2){
				ruta='../../../swf'
				}
	
	if ((window.ActiveXObject) && 
		  (navigator.userAgent.indexOf("MSIE")!= -1) && (navigator.userAgent.indexOf("Windows") != -1))
		{
			
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write(' width="'+anchura+'" height="'+altura+'" id="'+objeto+'" align="top">');
		document.write(' <param name="movie" value="../../js/'+ruta+'/'+objeto+'.swf?texto='+vari+'&id=20001">');
		document.write(' <param name=quality value=high>');
		document.write(' <param name=menu value=false>');
		document.write('<param name="AllowScriptAccess" value="always">');
		document.write(' <param name="scale" value="noscale">');
		document.write(' <param name="swliveconnect" value="true">');
		document.write(' <param name="salign" value="lt">');
		document.write('<' + '/object>');
		}
	else
		{
		var version_check = getFlashPluginVersion();
		if (version_check.scriptable)
			{

			
			document.write('<object id="'+objeto+'" data="'+ruta+'/'+objeto+'.swf?texto='+vari+'&id=20001" type="application/x-shockwave-flash"');
			document.write(' width="'+anchura+'" height="'+altura+'" align="top">');
			document.write('<param name="movie" value="../../js/'+ruta+'/'+objeto+'.swf?texto='+vari+'&id=20001" type="application/x-shockwave-flash">');
			document.write('<param name="quality" value="high">');
			document.write(' <param name="scale" value="noscale">');
			document.write('<param name="AllowScriptAccess" value="always">');
			document.write(' <param name="salign" value="lt">');
			document.write('<param name="swliveconnect" value="true">');    	
			document.write('<embed src="../../js/'+ruta+'/'+objeto+'.swf?texto='+vari+'&id=20001" quality="high" scale="noscale" salign="lt" width="'+anchura+'" height="'+altura+'" name="'+objeto+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">'); 
			document.write('<\/object>'); 
			}
	else
		identifyFlash()
		}
	
	}
//Function de ajuste del IFRAME
function adjustIFrameGest(iframeWindow){

var ie4 = (document.all) ? true : false;
var ns4 = (top.document.layers) ? true : false;
var ns6 = (top.document.getElementById && !document.all) ? true : false;
 
 var oBody= testiframe.document.body;
 oFrame = document.getElementById("testiframe").style;
 oFrame.verticalAlign = 'top';
oFrame.top = 0;
oFrame.height = 705;
 if (ie4)
 {	
     oFrame= document.all("testiframe").style;
	 oFrame.height='1px';
	 oFrame.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
 }
 else
 {	
     oFrame.height='1px';
     oFrame.height = oBody.offsetHeight - oBody.clientHeight;
 }
 parent.scrollTo(1,1);
//document.getElementById('pie_pagina').style.visibility = 'visible';
}

