if(typeof deconcept == "undefined") var deconcept = new Object();
if(typeof deconcept.util == "undefined") deconcept.util = new Object();
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = new Object();
deconcept.SWFObject = function(swf, id, w, h, ver, c, useExpressInstall, quality, xiRedirectUrl, redirectUrl, detectKey){
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = new Object();
	this.variables = new Object();
	this.attributes = new Array();
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', useExpressInstall);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name];
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name];
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = new Array();
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs.push(key +"="+ variables[key]);
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "PlugIn"); }
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) { this.addVariable("MMplayerType", "ActiveX"); }
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
		}
	}else{
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // throws if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	if (window.opera || !document.all) return;
	var objects = document.getElementsByTagName("OBJECT");
	for (var i=0; i < objects.length; i++) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
// fixes bug in fp9 see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
deconcept.SWFObjectUtil.prepUnload = function() {
	__flash_unloadHandler = function(){};
	__flash_savedUnloadHandler = function(){};
	if (typeof window.onunload == 'function') {
		var oldUnload = window.onunload;
		window.onunload = function() {
			deconcept.SWFObjectUtil.cleanupSWFs();
			oldUnload();
		}
	} else {
		window.onunload = deconcept.SWFObjectUtil.cleanupSWFs;
	}
}
if (typeof window.onbeforeunload == 'function') {
	var oldBeforeUnload = window.onbeforeunload;
	window.onbeforeunload = function() {
		deconcept.SWFObjectUtil.prepUnload();
		oldBeforeUnload();
	}
} else {
	window.onbeforeunload = deconcept.SWFObjectUtil.prepUnload;
}
/* add Array.push if needed (ie5) */
if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;





////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                               funciones de galeria de imagenes por kenneth rodriguez                       //                       
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////



id = function(o) {
	return document.getElementById(o);
}

px = function (x) {
	return ''.concat(Math.round(x), 'px');
}

pxLeft = function(o) {
	for (var x = 0; o != null; o = o.offsetParent) x += o.offsetLeft;
	return x;
}

pxTop = function(o) {
	for (var x = 0; o != null; o = o.offsetParent) x += o.offsetTop;
	return x;
}

/* ==== DOM 2 add event ==== */
addEvent = function (o, e, f) {
	var r = false;
	if (window.addEventListener) {
		o.addEventListener(e, f, false);
		r = true;
	} else if (window.attachEvent) {
		r = o.attachEvent('on' + e, f);
	}
	return r;
}


////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//                               funciones de galeria de imagenes por kenneth rodriguez                       //                       
//
////////////////////////////////////////////////////////////////////////////////////////////////////////////////


var diap = {
	/////////////////////////////////
	BR : 2,     // border size in px
	ZR : .75,   // zoom ratio
	SP : .1,    // speed
	/////////////////////////////////
	V : false,
	S : false,
	G : true,

	resize : function () {
		/* ==== window resize event ==== */
		diap.nw = diap.scr.offsetWidth;
		diap.nh = diap.scr.offsetHeight;
		diap.nwu = (diap.nw * diap.ZR);
		diap.nhu = (diap.nh * diap.ZR);
		diap.nwt = Math.floor((diap.nw * (1 - diap.ZR) * .5) / (diap.NX - 1)) - diap.BR;
		diap.nht = Math.floor((diap.nh * (1 - diap.ZR) * .5) / (diap.NY - 1)) - diap.BR;
		diap.rc  = 255 / ((diap.nw / diap.NX) - diap.nwt);
		if (diap.N) {
			diap.setPosition();
			if (!diap.G) diap.delLabels();
		}
	},

	setPosition : function () {
		/* ==== calculate image target position  ==== */
		var k = 0;
		var y = this.S ? this.BR + Math.floor((this.NY - this.Y - 1) * (this.nht + this.BR)) : 0;
		for (var j = 0; j < this.NY; j++) {
			var x = this.S ? this.BR + Math.floor((this.NX - this.X - 1) * (this.nwt + this.BR)) : 0;
			for (var i = 0; i < this.NX; i++) {
				var o = this.spa[k++];
				o.y1 = y;
				o.x1 = x;
				o.w1 = this.S ? (o == this.S ? this.nwu - this.BR : this.nwt) : Math.ceil(this.nw / this.NX) - this.BR;
				o.h1 = this.S ? (o == this.S ? this.nhu - this.BR : this.nht) : Math.ceil(this.nh / this.NY) - this.BR;
				x += this.S ? ((this.X == i) ? this.nwu : this.nwt + this.BR) : Math.ceil(this.nw / this.NX);
			}
			y += this.S ? ((this.Y == j) ? this.nhu : this.nht + this.BR) : Math.ceil(this.nh / this.NY);
		}
	},

	delLabels : function () {
		/* ==== quita texto ==== */
		for ( var i = 0; i < diap.N; i++) {
			var o = diap.spa[i];
			if (o.T) diap.scr.removeChild(o.T);
			o.T = false;
		}
	},

	run : function () {
		/* ==== loop principal ==== */
		for ( var i = 0; i < diap.N; i++) diap.spa[i].move();
		setTimeout(diap.run, 16);
	},

	init : function (container, NX, NY, path, images) {
		/* ==== inicia script ==== */
		this.scr = id(container);
		if (!this.scr || NX * NY != images.length) { alert('ID-10-T error...'); return false; }
		this.NX = NX;
		this.NY = NY;
		this.spa = {};
		this.resize();
		var k = 0;
		for (var y = 0; y < this.NY; y++) {
			for (var x = 0; x < this.NX; x++) {
				/* ==== crea el html ==== */
				var s = this.spa[k] = document.createElement('div');
				s.img = document.createElement('img');

				/* ==== funcion de opacidad ==== */
				s.img.setOpacity = function (alpha) {
					if (alpha < 0) alpha = 0; else if (alpha > 100) alpha = 100;
					if (alpha == 100) {
						/* ==== velocida ==== */
						this.style.visibility = 'visible';
						this.style.filter = '';
						this.style.opacity = 1;
						return 100;
					} else if (alpha == 0) {
						/* ==== oculpa ==== */
						this.style.visibility = 'hidden';
						this.style.filter = '';
						this.style.opacity = 0;
						return 0;
					}
					if (this.filters) {
						/* ==== IE filter ==== */
						if (!this.filters.alpha) this.style.filter = 'alpha(opacity=' + alpha + ')';
						else this.filters.alpha.opacity = alpha;
					/* ==== CSS  ==== */
					} else this.style.opacity = alpha * .01;
					return alpha;
				}
				s.img.src = id('loading').src;
				s.appendChild(s.img);
				this.scr.appendChild(s);

				/* ==== pre-load imagen ==== */
				s.pre = new Image();
				s.pre.obj = s;
				s.pre.onload = function() { this.obj.img.src = this.src; }
				s.pre.src = path + images[k][0];

				/* ==== image variables ==== */
				s.x  = x;
				s.y  = y;
				s.x0 = x * (this.nw / this.NX) + (this.nw / this.NX) / 2;
				s.y0 = y * (this.nh / this.NY) + (this.nh / this.NY) / 2;;
				s.x1 = x * (this.nw / this.NX);
				s.y1 = y * (this.nh / this.NY);
				s.w0 = 0;
				s.h0 = 0;
				s.w1 = 0;
				s.h1 = 0;
				s.V  = 0;
				s.t  = images[k][1];
				s.T  = false;

				/* ==== function mover image ==== */
				s.move = function() {
					/* ==== posicion images ==== */
					this.style.left   = px(this.x0 += (this.x1 - this.x0) * diap.SP);
					this.style.top    = px(this.y0 += (this.y1 - this.y0) * diap.SP);
					this.style.width  = px(this.w0 += (this.w1 - this.w0) * diap.SP);
					this.style.height = px(this.h0 += (this.h1 - this.h0) * diap.SP);
					if (this != diap.S) {
						/* ==== image background color ==== */
						if (Math.abs(this.w1 - this.w0) > 1) {
							var c = (!diap.G && this.V > 0) ? 255 : 16 + Math.round(255 - diap.rc * (this.w0 - diap.nwt));
							this.style.background = 'RGB('.concat(c, ',', c, ',', c, ')');
						}
						if (this == diap.V) {
							/* ==== on mouseover: fade in ==== */
							if (this.V < 100) this.img.setOpacity(this.V += 5);
						} else {
							/* ==== fade out ==== */
							if (this.V >= 0 && diap.G != this) this.img.setOpacity(this.V -= 2);
						}
					}
					/* ==== efecto texto ==== */
					if (this.T) this.dispLabel();
				}

				/* ==== muestra texto (typewriter FX) ==== */
				s.dispLabel = function() {
					if (diap.G || diap.S == this) {
						/* ==== zoomed image ==== */
						this.T.style.left  = px(this.x0);
						this.T.style.top   = px(this.y0);
						this.T.style.width = px(this.w0);
					} else {
						/* ==== calculo de pocicion de texto ==== */
						var xt = diap.S.x0 + this.w0 + diap.BR;
						if (this.y == diap.Y) {
							this.T.style.top = px(this.y0 - this.f - diap.BR);
							if (this.y == 0) var xt = diap.S.x0;
						} else this.T.style.top = px(this.y0 - (this.y <= diap.Y ? diap.BR : 0));
						if (this.x > diap.X) this.T.style.left = px(diap.S.w0 + diap.S.x0 - diap.nwu * .5);
						else this.T.style.left = px(xt);
						if (this != diap.V) {
							/* ==== text type out ==== */
							this.Tp--;
							this.T.innerHTML = this.t.substring(0, this.Tp);
							if (this.Tp < 1) {
								diap.scr.removeChild(this.T);
								this.T = false;
							}
						} else {
							if (this.Tp < this.t.length) {
								/* ==== text type in ==== */
								this.Tp++;
								this.T.innerHTML = this.t.substring(0, this.Tp);
							}
						}
					}
				}

				/* ==== create text function ==== */
				s.createLabel = function () {
					this.T = document.createElement('div');
					this.T.className = 'label';
					if (!diap.G && this.x > diap.X) this.T.style.textAlign = 'right';
					this.f = 4 + Math.round(Math.sqrt(diap.nht * 2));
					if(this == diap.S) {
						this.f *= 2;
						this.T.style.background = 'none';
						this.T.style.textAlign = 'center';
					}
					this.T.style.fontSize = ''.concat(this.f, 'px');
					this.T.innerHTML   = this.t;
					this.T.style.left = px(-1000);
					this.T.style.width = px(diap.nwu * .5);
					this.T.style.height = px(this.f + 3);
					this.Tp = 0;
					diap.scr.appendChild(this.T);
				}

				/* ==== on mouse over event ==== */
				s.onmouseover = function() {
					if (diap.S != this && diap.G != this) {
						/* ==== display image ==== */
						this.img.setOpacity(100);
						this.V = this.img.setOpacity(20);
					}
					/* ==== create text ==== */
					if (!this.T) this.createLabel();
					diap.V = this;
				}

				/* ==== on click event ==== */
				s.onclick = function() {
					/* ==== memorize selected image ==== */
					diap.X = this.x;
					diap.Y = this.y;
					diap.V = false;
					diap.G = false;
					this.V = this.img.setOpacity(100);
					diap.delLabels();
					if (diap.S == this) {
						/* ==== zoom out - grid mode on ==== */
						diap.S = false;
						diap.G = this;
						for (var i = 0; i < diap.N; i++) diap.spa[i].createLabel();
					} else {
						/* ==== zoom in ==== */
						diap.S = this;
						this.createLabel();
					}
					diap.setPosition();
				}
				s.createLabel();
				s.ondblclick = s.onclick;
				s.ondrag = function () { return false; }
				k++;
			}
		}
		this.N = NX * NY;
		/* ==== add resize event ==== */
		this.resize();
		addEvent(window, 'resize', diap.resize);
		/* ==== start main loop ==== */
		this.run();
	}
}
