function miniwindow(link, width, height, scroll) {
	emergente = window.open(link , "navegador", "width=" + width + ",height=" + height + ",toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=1,resizable=1");
	emergente.resizeTo(width, height + 28);
	emergente.moveTo((screen.width -  width)/2,(screen.height - height)/2);
	emergente.focus();
}
function miniwindow2(link, width, height, scroll) {
	emergente = window.open(link , "navegador", "width=" + width + ",height=" + height + ",toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=1,resizable=1");
	emergente.resizeTo(width, height + 28);
	emergente.moveTo((screen.width -  width)/2,(screen.height - height)/2);
	emergente.focus();
}
function createCookie(name,value,days)
{
	if (days)
	{
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0){
			var ck=c.substring(nameEQ.length,c.length);
			window.document.banner.SetVariable("ck", ck);
			//return ck;
		}
	}
	//return null;
}

function readCookieJS(name)
{
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++)
	{
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0){
			var ck=c.substring(nameEQ.length,c.length);
			return ck;
		}
	}
	return null;
}
function eraseCookie(name)
{
	createCookie(name,"",-1);
}
function initMenu(){
	var i; 
	//var mapnext=document.getElementById("vnext");
	//alert(">>"+mapnext);
	// alert(typeof(mapnext));
	//divHg=document.getElementById("contenido");
	//alert("--"+divHg);
	for (i=0;i<document.links.length;i++) {
		if (document.links[i].id=="vnext"){
	   var nx=document.links[i].href;
	   }
	   if (document.links[i].id=="vprev"){
	   var prv=document.links[i].href;
	   }
	}
	if (!prv){
		prv="";
	}
	if (!nx){
		nx="";
	}
	var oid=document.location.href;
	var id=String(oid)
	var tempid = id.split("/");
		id = tempid[tempid.length-1];
		tempid = id.split("\\");
		id = tempid[tempid.length-1];
		
	//vud será la carpeta+los 3 primeros caracteres de la id
	vud="";
	var saveud=String(oid);
	var tempud=saveud.split("/");
	if (tempud.length < 2){
		vud=tempud[0];
		}else{
		vud=tempud[tempud.length-2];
		}
		tempud=vud.split("\\");
		if (tempud.length<2){
		vud=tempud[0];
		}else{
		vud=tempud[tempud.length-2];
		}
		vud=vud.split("%20").join("");
		//alert(vud);
	tempud=id.split("_");
	vud=vud+tempud[0];	
	
	var mo=readCookieJS(vud+"menuOpen")
	if (mo==null){
		mo="false";
	}
	if (mo=="false" || mo=="closed"){
		var fh=78;
	}else{
		var fh=mo;
	}
			//alert(mo);
   var fo = new FlashObject("../swf/banner_loader.swf", "banner", "100%", fh, "6", "#f3f1e5","high","","false");
   //fo.addParam("scaleMode", "noScale");
   //fo.addParam("wmode", "opaque");
   fo.addParam("quality", "high");
	fo.addParam("swliveconnect", "true");
	fo.addParam("allowScriptAccess","sameDomain")
	fo.addVariable("mo",mo);
  	fo.addVariable("bprev", prv);
   fo.addVariable("bnext", nx);
   fo.addVariable("id", id);
   fo.addVariable("vud", vud);
   fo.addVariable("cargadaPag", "true");
   fo.write("fbanner");
}

function passFlashVar(){
	var i; 
	for (i=0;i<document.links.length;i++) {
		if (document.links[i].id=="vnext"){
	   var nx=document.links[i].href;
	   }
	   if (document.links[i].id=="vprev"){
	   var prv=document.links[i].href;
	   }
	}
	var id=document.location;
	if (!prv){
		prv="";
	}
    window.document.banner.SetVariable("bprev", prv);
	window.document.banner.SetVariable("bnext", nx);
	//window.document.banner.SetVariable("id", id);
	if (window.document.portada){
	window.document.portada.SetVariable("bnext", nx);
	}
}
function cargadaPag(){
	myInterval=setInterval ("checkFlash();",500);
	window.document.banner.SetVariable("cargadaPag", "true");
	passFlashVar();	
}
function checkFlash(){
	var recibidoFlash=window.document.banner.GetVariable("recibido");
	if (recibidoFlash=="false"){
		passFlashVar();	
		//alert ("undefined");
	}else{
	//alert ("-"+recibidoFlash);
	clearInterval (myInterval);
	}
}
	
function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW+"px";
	document.getElementById("fbanner").style.width = newW+"px";
}
function setFlashHeight(divid, newH){
	document.getElementById(divid).style.height = newH+"px";
	document.getElementById("fbanner").style.height = newH+"px";
	//alert("resize:"+newH);
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function MM_preloadImages() { //v3.0
//	cargadaPag();
	initMenu();
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if ( innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH ) location.reload();
}
MM_reloadPage(true);

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
function vinculos () {	
	var i; 
	for (i=0;i<document.links.length;i++) 
	   { 
		   if (document.links[i].id=="vprev"){
		   alert (document.links[i].href);
		   }
		   if (document.links[i].id=="vnext"){
		   alert (document.links[i].href);
		   }
		}
}


<!-- Inserted by:
// SCORM Runtime Wrapper
// version 1.2.6     09/09/02
// Copyright 2000, 2001, 2002 Macromedia, Inc. All rights reserved.
// ----------------------------------------------------

// define global var as handle to API object
var mm_adl_API = null;

// mm_getAPI, which calls findAPI as needed
function mm_getAPI()
{
  var myAPI = null;
  var tries = 0, triesMax = 100;
  while (tries < triesMax && myAPI == null)
  {
    window.status = 'Looking for API object ' + tries + '/' + triesMax;
    myAPI = findAPI(window);
    if (myAPI == null && typeof(window.parent) != 'undefined') myAPI = findAPI(window.parent)
    if (myAPI == null && typeof(window.top) != 'undefined') myAPI = findAPI(window.top);
    if (myAPI == null && typeof(window.opener) != 'undefined') if (window.opener != null && !window.opener.closed) myAPI = findAPI(window.opener);
    tries++;
  }
  if (myAPI == null)
  {
    window.status = 'API not found';
  }
  else
  {
    mm_adl_API = myAPI;
    window.status = 'API found';
  }
}

// returns LMS API object (or null if not found)
function findAPI(win)
{
  // look in this window
  if (typeof(win) != 'undefined' ? typeof(win.API) != 'undefined' : false)
  {
    if (win.API != null )  return win.API;
  }
  // look in this window's frameset kin (except opener)
  if (win.frames.length > 0)  for (var i = 0 ; i < win.frames.length ; i++);
  {
    if (typeof(win.frames[i]) != 'undefined' ? typeof(win.frames[i].API) != 'undefined' : false)
    {
	     if (win.frames[i].API != null)  return win.frames[i].API;
    }
  }
  return null;
}

// call LMSInitialize()
function mm_adlOnload()
{
  if (mm_adl_API != null)
  {
    mm_adl_API.LMSInitialize("");
    // set status
    mm_adl_API.LMSSetValue("cmi.core.lesson_status", "browsed");
  }
}

// call LMSFinish()
function mm_adlOnunload()
{
  if (mm_adl_API != null)
  {
    // set status
    mm_adl_API.LMSSetValue("cmi.core.lesson_status", "browsed");
    mm_adl_API.LMSCommit("");
    // mm_adl_API.LMSFinish("");
  }
}
//
function mm_trace()
{
  if (mm_adl_API != null)
  {
    // set status
   var lessSt=mm_adl_API.LMSGetValue("cmi.core.lesson_status");
   var est=mm_adl_API.LMSGetValue("cmi.core.student_name");
   var loc=mm_adl_API.LMSGetValue("cmi.core.lesson_location");
   
   alert ("--"+lessSt+" -- "+est+" -- "+loc)
    // mm_adl_API.LMSFinish("");
  }
}
function passVar(st)
{
	if (mm_adl_API != null)
	  {
		// set status
		//alert ("-"+st);
	   var v=mm_adl_API.LMSGetValue(st);
   		window.document.banner.SetVariable("txt", v);
	}
}
function scoGetLocation()
{
		if (mm_adl_API != null)
	  {
		   mm_adl_API.LMSInitialize("");
		   var v=mm_adl_API.LMSGetValue("cmi.core.lesson_location");
		   var est=mm_adl_API.LMSGetValue("cmi.core.student_name");
		   var lessSt=mm_adl_API.LMSGetValue("cmi.core.lesson_status");
   			window.document.banner.SetVariable("scoLocation", v);
			window.document.banner.SetVariable("scoStudent", est);
			window.document.banner.SetVariable("errStatus", lessSt);
	}
	else
	{
		var location=readCookieJS(vud+'clocation');	
		//alert ("location "+location);
		if (location==null){
			//alert ("location es:"+location);
			//createCookie('clocation','0',1000);
			location="0";
		}
		window.document.banner.SetVariable("scoLocation", location);
		window.document.banner.SetVariable("scoStudent", "noApi");
		window.document.banner.SetVariable("errStatus", "noApi");		
	}
	
}
function scoSetLocation(value,status)
{
	if (mm_adl_API != null)
	  {
		// set status
		var e=mm_adl_API.LMSSetValue("cmi.core.lesson_location", value);
		var s=mm_adl_API.LMSSetValue("cmi.core.lesson_status", status);
    	mm_adl_API.LMSCommit("");
		window.document.banner.SetVariable("scoLocation", e);
		window.document.banner.SetVariable("errStatus", s);
		}else{
			window.document.banner.SetVariable("scoLocation", "noApi");
		}
}



function writeVar(variable,value)
{
	if (mm_adl_API != null)
	  {
		// set status
		alert (variable+"-"+value);
		 var e=mm_adl_API.LMSSetValue(variable, value);
    	mm_adl_API.LMSCommit("");
		window.document.banner.SetVariable("txt", e);
		}
}
		
//
// get the API
mm_getAPI();
// -->

<!--
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Gestionar todos los mensajes de FSCommand de una película Flash
function banner_DoFSCommand(command, args) {
	var bannerObj = isInternetExplorer ? document.all.banner : document.banner;
	//
	// Introduzca su código aquí.
	//
}
// Ancla para Internet Explorer
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub banner_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call banner_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}
//funciones chapuza

function avanza() {
	url = self.location.href;	subcad = url.split('_0',3);	cadfin = subcad[subcad.length-1];
	trozoscadfin = cadfin.split('.'); num = trozoscadfin[0];	numdestino = String(Number(num)+1);
	if(numdestino.length == 1){
	numdestino = '_00'+numdestino;
	}
	if(numdestino.length == 2){
	numdestino = '_0'+numdestino;
	}
	destino = subcad[0].concat(numdestino,'.htm');
	self.location.href = String(destino);
}
function retrocede() {
	url = self.location.href;	subcad = url.split('_0',3);	cadfin = subcad[subcad.length-1];
	trozoscadfin = cadfin.split('.'); num = trozoscadfin[0];	numdestino = String(Number(num)-1);
	if(numdestino.length == 1){
	numdestino = '_00'+numdestino;
	}
	if(numdestino.length == 2){
	numdestino = '_0'+numdestino;
	}
	destino = subcad[0].concat(numdestino,'.htm');
	self.location.href = String(destino);
}
//-->
