﻿/**
 * Variable para indicar a flash que ya está listo el javascript
 */
readyForFlash = true;

/**
 * Función para incializar el editor flex.
 */
function jsReady() {
	readyForFlash = true;
	editorDiv = document.getElementById('flexEditor');
	editorDiv.style.display = 'none';
}

function isJSReady() {
	return readyForFlash;
}

/**
 * Muestra un mensaje en la barra de estado del navegador.
 * Depende de la configuración del navegador.
 * 
 * @param m Cadena con el mensaje a mostrar en la barra de estado
 * @return boolean
 */
function setStatus(m) {
	window.status = m;
	return true;
}
 
// EDITOR ************************************************************
 
var editorDiv;
var editorPath;

/**
 * Carga el editor y lo hace visible.
 */
function loadEditorDiv(){
	editorDiv.style.display = 'block';
	editorDiv.style.width = '100%';
	editorDiv.style.height = '100%';
	cad = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="editor" width="100%" height="100%" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">';
	cad += '<param name="movie" value="'+editorPath+'Editor.swf" />';
	cad += '<param name="quality" value="high" />';
	cad += '<param name="wmode" value="transparent" />';
	cad += '<param name="allowScriptAccess" value="always" />';
	cad += '<embed src="'+editorPath+'Editor.swf" wmode="transparent" quality="high" width="100%" height="100%" name="editor" align="middle" play="true" loop="false" quality="high" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/go/getflashplayer">';
	cad += '</embed>';
	cad += '</object>';
	editorDiv.innerHTML = cad;
}

/**
 * Comunica a la pelicula del portal que el editor está listo.
 */
function setEditorReady(ed){
	document.getElementById('portalWeb').setEditorReady(ed);
}

/**
 * Cierra el editor.
 */
function unloadEditorDiv(){
	editorDiv.style.display = 'none';
	editorDiv.innerHTML = '&nbsp;';
}