﻿var minWidth = 950;
var minHeight = 590;
var directory = "";

// --------------------------------------------------------- SWFs 
// Creacion de SWF
	function mainSWF() {
		var flashvarsObj = {
			seccionFV	: swfobject.getQueryParamValue("seccion"),
			directoryFV	: directory
		};
		var paramsObj = {
			menu	: "false",
			bgcolor	: "#FFFFFF",
			scale	: "noscale",
			AllowScriptAccess : "always"
		};
		var attributesObj = {
			id		: "MainClip",
			name	: "MainClip"
		};
		createCSSFull();
		swfobject.embedSWF(
			directory + "swf/main.swf", 
			"flashFullSWF", 
			"100%", 
			"100%", 
			"9.0.0", 
			false, 
			flashvarsObj, 
			paramsObj, 
			attributesObj
		);
		swfobject.addDomLoadEvent(createFullBrowserFlash);
	}
// Creacion de estilos para contenedor de SWF
	function createCSSFull() {
		swfobject.createCSS("*", "margin:0; padding:0;");
		swfobject.createCSS("object", "display:block");
		swfobject.createCSS("html", "height:100%;");
		swfobject.createCSS("body", "height:100%;");
		swfobject.createCSS(
			"#flashFull", 
			"margin:0; width:100%; height:100%; min-width:" + 
			minWidth + "px; min-height:" + minHeight + "px;"
		);
	}
// Patch para minHeight en ie
	function getViewportSize() { 
		var size = [0, 0]; 
		if (typeof window.innerWidth != "undefined") { 
			size = [window.innerWidth, window.innerHeight];
		} 
		else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0) {
			size = [document.documentElement.clientWidth, document.documentElement.clientHeight]; 
		}
		else {
			size = [document.getElementsByTagName("body")[0].clientWidth, document.getElementsByTagName("body")[0].clientHeight]; 
		}
		return size; 
	}
// Embbed
	function createFullBrowserFlash() {
		window.onresize = function() {
			var el = document.getElementById("flashFull");
			var size = getViewportSize(); 
			el.style.width = size[0] < minWidth ? (minWidth + "px") : "100%";
			el.style.height = size[1] < minHeight ? (minHeight +"px") : "100%";
		};
		window.onresize();
	}

// --------------------------------------------------------- Nivel de directorio
	function setLevel(number) {
		directory = level(number);
		directoryLogout = level(number - 1);
	}
	function level(number) {
		var level_str = "";	
		for (var a = 0; a < number; a++) {
			level_str += "../";
		}	
		return level_str;
	}
	
// --------------------------------------------------------- PopUps
	function popUpw(url, wW, wH){ 
		var
		wX = (screen.width - wW)/2,
		wY = (screen.height - wH)/2,
		other = ',toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,directories=no,location=no',
		windowFeatures = 'width=' + wW + ',height=' + wH + ',left=' + wX + ',top=' + wY + other;
		window.open(url, 'ventana' + randRange(1, 100000), windowFeatures);
	}
	function randRange(min, max) {
		var randomNum = Math.floor(Math.random() * (max - min + 1)) + min;
		return randomNum;
	}
	function masInfo(direccion) {
		popUpw(direccion, '320', '200');
	}
