/*---------------------------------------- EXTENSI�N PROTOTYPE ----------------------------------------*/
Object.extend(Event, {
	wheel:function (event)
	{
    var delta = 0;
    if(!event) 
    	event = window.event;
    if(event.wheelDelta) 
    {
    	delta = event.wheelDelta/120;
      if(window.opera) 
      	delta = -delta;
    } 
    else if(event.detail)
    {
    	delta = -event.detail/3;
    }
    return Math.round(delta); //Safari Round
	},
	teclaPulsada:function(evt) 
	{
		evt = (evt) ? evt : event;
		var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0));
		return charCode;
	}
});
/*//////// STRING ////////*/
Object.extend(String.prototype, {
	ltrim:function(caracteres)
	{
		if(!caracteres) caracteres = "\\s";
		return this.replace(new RegExp("^["+caracteres+"]+"), '');
	},
	rtrim:function(caracteres)
	{
		if(!caracteres) caracteres = "\\s";
		return this.replace(new RegExp('['+caracteres+']+$'), '');
	},
	trim:function(caracteres)
	{
		return this.ltrim(caracteres).rtrim(caracteres);
	}
});
/*//////// ELEMENT ////////*/
Element.addMethods({
	setWidth:function(element, w, disparar) {
	   	element = $(element);
    	element.style.width = (!isNaN(w)) ? w+"px" : w;
    	if(disparar) element.fire('element:resize', {width: w});
		return element;
	},
	setHeight: function(element, h, disparar) {
   		element = $(element);
    	element.style.height = (!isNaN(h)) ? h+"px" : h;
    	if(disparar) element.fire('element:resize', {height: h});
		return element;
	},
	setSize:function(element,w,h) {
		element = $(element);
		return element.setWidth(w).setHeight(h);
	},
	setTop: function(element,t) {
   	element = $(element);
  	element.style.top = t +"px";
		return element;
	},
	setLeft: function(element,l) {
   	element = $(element);
  	element.style.left = l +"px";
		return element;
	},
	setOffset:function(element, offset)
	{
		element = $(element);
		element.style.top = offset.top +"px";
  	element.style.left = offset.left +"px";
		return element;
	},
	rollOver:function(elemento, sufijo)
	{
		elemento = $(elemento);
		if(sufijo == undefined) 
			sufijo = 'Over';
		if(!elemento.className.endsWith(sufijo)) 
			elemento.className += sufijo;
		return elemento;
	},
	rollOut:function(elemento, sufijo)
	{
		elemento = $(elemento);
		if(sufijo === undefined) 
			sufijo = 'Over';
		if(elemento.className.endsWith(sufijo)) 
			elemento.className = elemento.className.slice(0, elemento.className.length-sufijo.length);
		return elemento;
	},
	focoOn:function( elemento )
	{
		return Element.rollOver(elemento, 'Foco');
	},
	focoOff:function( elemento )
	{
		return Element.rollOut(elemento, 'Foco');
	},
	removeAllChild:function(elemento)
	{
		var elem = $(elemento);
		if( !elem ) return null;
		
		var hijosEliminados = [];
		while( elem.childNodes.length )
			hijosEliminados[hijosEliminados.length] = elem.removeChild( elem.childNodes[0] );
		return hijosEliminados;
	},
	clic:function(elemento)
	{
		var elem = $(elemento);
		if(elem.dispatchEvent)
		{
			var evt = elem.ownerDocument.createEvent("MouseEvents");
		   	evt.initMouseEvent("click", true, true, elem.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
		   	elem.dispatchEvent(evt);
		}
		else if(elem.fireEvent)
		{
			elem.fireEvent("onclick");
		}
	},
	addClassName:function(element, className) 
	{
    if(!(element = $(element))) return;
    if(!element.hasClassName(className))
      element.className = className + (element.className ? ' ' : '') + element.className;
    return element;
  },
  setLastClassName:function(element, className)
  {
  	if(!(element = $(element))) return;
    if(!element.hasClassName(className))
    {
    	var clases = $w(element.className);
    	if(clases.length > 0)
    		clases[clases.length-1] = className;
    	else
    		clases.push(className);
      element.className = clases.join(' ');
    }
    return element;
  }
});
/*//////// OBJECT ////////*/
Object.extend(Object, {
	implode:function(obj, union)
	{
		if(typeof(union) == 'undefined') union = ', ';
		var retorno = '';
		var pref = '';
		for( prop in obj )
		{
			retorno += pref+prop+'='+obj[prop];
			pref = union;
		}
		return retorno;
	}
});
/*//////// ARRAY ////////*/
Object.extend(Array.prototype, {
	crearRoll:function()
	{
		for(var i=0, l=this.length; i<l; i++)
		{
			var elem = this[i];
			elem.observe('mouseover', function(){ Element.rollOver(this, 'Over'); });
			elem.observe('mouseout', function(){ Element.rollOut(this, 'Over'); });
		}
	}
});
/*//////// FORM ////////*/
Form.serializeElements = function(elements, options) 
{
  if (typeof options != 'object') options = { hash: !!options };
  else if (options.hash === undefined) options.hash = true;
  var key, value, submitted = false, submit = options.submit;

  var data = elements.inject({ }, function(result, element) {
    if(!element.disabled && element.name) 
    {
    	key = element.name; value = $(element).getValue();
      if (/** cambio value != null && **/(element.type != 'submit' || (!submitted && submit !== false && (!submit || key == submit) && (submitted = true)))) 
      {
      	/** cambio **/
				var posCorchete = key.search(/\[/);
				if(posCorchete == -1) 
				{
					/** anterior **/
					if(key in result) 
					{
						if(element.type != 'radio') /** cambio **/
						{
							if(element.type == 'checkbox' && !value)
								return result;
							/* a key is already present; construct an array of values */
							if(!Object.isArray(result[key])) 
								result[key] = [result[key]];
							result[key].push(value);	
						}
						else
						{
							if(value) 
								result[key] = value;
						}					
					}
					else 
						result[key] = value;
					/**/
				}
				else 
				{
					var variable = result;
					var nomVar = key.substr(0, posCorchete);
					
					key.scan(/\[(.*?)\]/, function(match){
						var subvar = match[1].strip();
						if(Object.isUndefined(variable[nomVar])) 
							variable[nomVar] = (subvar.length == 0) ? [] : {};
						if(subvar.length == 0) 
							subvar = variable[nomVar].length;
						
						variable = variable[nomVar];
						nomVar = subvar;
					});
					if(element.type != 'checkbox' || value)
						variable[nomVar] = value;
				}
			 /**/
      }
    }
    return result;
  });
  return options.hash ? data : Object.toQueryString(data);
};
Object.extend(Form.Element.Serializers, {
	selectMany:function(element) 
	{
		var values = [], length = element.length;
	  if(!length) 
	  	return null;

		var todos = element.getAttribute('todos');
		if(todos === undefined || !todos)
		{
			for(var i=0; i<length; i++) 
			{
		    var opt = element.options[i];
		    if(opt.selected) 
		    	values.push(this.optionValue(opt));
		  }
		}
		else
		{
			for(var i=0; i<length; i++)
				values.push(this.optionValue(element.options[i]));
		}
	  return values;
	}
});
Object.extend(Form.Methods, {
	getElement:function(form, elemento)
	{
		return $(form[elemento]);
	},
	limpiar:function(form)
	{
		form.getElements().each(function(elem)
		{
			if((elem.tagName == 'INPUT' && elem.type && elem.type != 'submit' && elem.type != 'reset' && elem.type != 'button') || elem.tagName == 'TEXTAREA')
				elem.value = '';
		});
	},
	request:function(form, options) 
	{
		Placom.cargarJsg('placom/PAjax');
		
    form = $(form);
    options = Object.clone(options || { });

    var params = options.parameters, accion = (options.action) ? options.action : (form.readAttribute('action') || '');
    if(accion.blank()) accion = ('enviar-'+form.readAttribute('id').dasherize()).camelize();
    options.parameters = form.serialize(true);
	    
		if(params)
    {
    	if(Object.isString(params)) 
    		params = params.toQueryParams();
    	Object.extend(options.parameters, params);
    }
    if(typeof(options.prototype) == 'undefined')/* if( form.hasAttribute('method') && !options.method ) options.method = form.method; */
    	pajax.invocarMetodo(null, accion, [options.parameters]);
    else
    {
    	if(form.hasAttribute('method') && !options.method)
    		options.method = form.method;
    	return new Ajax.Request(accion, options);
    }
	},
	enviar:function(form, options)
	{
		form = $(form);
    options = Object.clone(options || { });

    var accion = ((options.action) ? options.action : (form.readAttribute('action') || '.')).rtrim() + '/';
    var objetivo = (typeof(options.target) == 'string') ? options.target : (form.readAttribute('target') || null);
    var elementos = form.serialize(true);
    for(var elem in elementos)
    {
    	var valor = elementos[elem];
    	if(valor)
    		accion += encodeURIComponent(elem) + '/' + encodeURIComponent(elementos[elem]) + '/';
    }
    Placom.irA(accion, objetivo);
	},
	serialize:function(form, options)
	{
		if(typeof(tinyMCE) != 'undefined') 
			tinyMCE.triggerSave();
		if(typeof(Placom_Editor_EditArea) != 'undefined')
			Placom_Editor_EditArea.substituirElementosForm(form);
		return Form.serializeElements(Form.getElements(form), options);
	}
});
Element.addMethods();
/*//////// GENERADOR EVENTOS ////////*/
GeneradorEventos = Class.create(Enumerable, {
	initialize:function()
	{
		this.detectores = [];
	},
  _each:function(iterator) 
	{
  	this.detectores._each(iterator);
  },
  agregarDetector:function(detector) 
	{
   	if(!this.include(detector))	
   		this.detectores.push(detector);
    return this;
  },
  agregarDetectorEvento:function(evento, funcion)
  {
  	var objeto = {};
  	objeto[evento] = funcion;
  	this.agregarDetector(objeto);
  	return this;
  },
  eliminarDetector:function(detector) 
	{
   	this.detectores = this.detectores.without(detector);
   	return this;
  },
  dispararEvento:function(evento, args) 
	{
		if(typeof(args) == 'undefined')
			args = [];
  	this.each(function(detector){
  		if(Object.isFunction(detector[evento])) {
      	try {
        		detector[evento].apply(detector, args);
      	} catch(e) { }
  		}
  	});
  	return this;
  }
});
/*//////// ICONO ////////*/
var Icono = {
	iconizar:function()
	{
		//var funcExt = (Prototype.Browser.IE && Placom.estaCargadoJs('placom/Prototip')) ? Tooltips.extraerContenidoDeTitle.bind(Tooltips) : Prototype.emptyFunction;
		var iconos = $$('.pcIcono');
		for(var i=0, l=iconos.length; i<l; i++)
		{
			$I(iconos[i]).iconizar();
			//funcExt(iconos[i]);
		}
	}
};
Icono.Methods = {
	iconoOver:function(evento)
	{
		elemento = this;
		var imagen = this.iconoImg();
		if(imagen !== undefined)
		{
			if(imagen.__ouSrc) 
				imagen.src = imagen.__ouSrc;
			else
			{
				var fuente = (typeof(imagen.src__orig) == 'undefined') ? imagen.src : imagen.src__orig; 
				var longitud = fuente.length;
				var posPunto = fuente.lastIndexOf('.');
				var extension = fuente.substr(posPunto);
				imagen.__ovSrc = fuente;
				var fuenteOver = fuente.substr(0, posPunto);
				var sufijoOver = 'Over';
				if(this.rel) 
				{
					var rels = this.rel.split(',');
					for(var i=0; i<rels.length; i++)
						if(rels[i].strip().endsWith(sufijoOver)) 
						{
							sufijoOver = rels[i];
							break;
						}
				}
				fuenteOver += ((!fuenteOver.endsWith(sufijoOver)) ? sufijoOver+extension : extension);
				imagen.src = fuenteOver;
				imagen.__ouSrc = fuenteOver;
			}
		}
		if(elemento.id && Placom.estaCargadoJs('placom/Prototip'))
		{
			Prototips.crearEnElemento(this, evento);
			Event.stop(evento);
		}
		return elemento;
	},
	iconoOut:function(evento)
	{
		if(!this.seleccionado)
		{
			elemento = this;
			var imagen = this.iconoImg();
			if(imagen !== undefined && imagen.__ovSrc) 
				imagen.src = imagen.__ovSrc;
		}
		return elemento;
	},
	iconoLimpiar:function()	
	{
		var imagen = this.iconoImg();
		imagen.__ouSrc = false;
		imagen.__ovSrc = false;
		return this;
	},
	iconoImg:function()
	{
		return this.down('img:not([class~=pcImgFija])'); //getElementsByTagName('img')[0];
	},
	iconizar:function()
	{
		if(this.__iconizado) 
			return this;
		this.__iconizado = true;
		this.seleccionado = false;
		this.observe('mouseover', this.iconoOver.bindAsEventListener(this));
		this.observe('mouseout', this.iconoOut.bindAsEventListener(this));
		if(this.hasClassName('pcIconoRollable'))
		{
			this.observe('mouseover', function(){ Element.rollOver(this, 'Over'); });
			this.observe('mouseout', function(){ Element.rollOut(this, 'Over'); });
		}
		if(this.onclick)
			this.href = 'javascript:void(0);';
		this.removeAttribute('title');
		/* Limpiamos los atributos alt de las imágenes para que en IE no aparezca el tip del navegador */
		if(Prototype.Browser.IE)
		{
			this.select('img[alt]').each(function(imagen){
				imagen.removeAttribute('alt');
			});
		}
		return this;
	},
	setSeleccionado:function(sel)
	{
		this.seleccionado = sel;
		return this;
	}
};
function $I(element) 
{
	if (arguments.length > 1) 
  	{
    	for(var i=0, elements=[], length=arguments.length; i<length; i++)
    		elements.push($I(arguments[i]));
    	return elements;
  	}
  	element = $(element);
  	if(!element || element._iconoExtendido) return element;
	Object.extend(element, Icono.Methods);
	element._iconoExtendido = Prototype.emptyFunction;
	return element;
};

/*---------------------------------------- PLANETACION ----------------------------------------*/
var Placom = (function(){
	/*_____ Propiedades privadas _____*/
	var _rutaCargador = 'cargar.php?';
	var _rutaBase = $$('base')[0];
	_rutaBase = (_rutaBase) ? _rutaBase.href : './';
	var _cabecera = $$('head')[0];
	var _jsCargados = {};
	var _jsCacheCodigos = {};
	var _funcEvaluar = null;
	var _esDepuracion = false;
	var _lenguaje;
	
	if(Prototype.Browser.IE) 
	{
	  Prototype.Browser.IEVersion = parseFloat(navigator.appVersion.split(';')[1].strip().split(' ')[1]);
	  if(Prototype.Browser.IEVersion >= 8)
	  	Object.extend(Element._attributeTranslations.write.names, {'class': 'class', 'for': 'for'});
	}	
	/*_____ Funciones privadas _____*/
	var _cargarCss = function(css)
	{
		var enlaces = document.getElementsByTagName('link');
		for(var i=0, le = enlaces.length; i<le; i++)
			if(enlaces[i].href == css) 
				return;

		var estilo = document.createElement('LINK');
		estilo.type = 'text/css';
		estilo.rel  = 'stylesheet';
		estilo.href = css;
		_cabecera.insert({bottom: estilo});		
	};
	var _cargarJs = function(js, variable)
	{
		if(!Placom.estaCargadoJs(js))
		{
			var codigoJs = window.top.Placom.getCodigoJs(js);
			if(codigoJs)
			{
				_jsCargados[js] = true;
    		Placom.evaluar(codigoJs);
			}				
			var params = {};
			params[variable] = js;
			new Ajax.Request(_rutaCargador, {
        method:       'get',
      	asynchronous: false,
    		evalJSON:     false,
    		evalJS:       false,
    		parameters:   params,
      	onSuccess:function(transporte)
				{
	    		_jsCargados[js] = true;
					window.top.Placom.setCodigoJs(js, transporte.responseText);
	    		Placom.evaluar(transporte.responseText);
	      },
		    onFailure:function(transport){
					Placom.mostrarError("Imposible cargar: "+js);
				},
		    onException:function(request, excepcion){ 
					Placom.mostrarError('[Placom.cargarJs] Imposible cargar: '+js);
				}
	    });
		}
	};
	var _funcInsertarScript = function(codigo)
	{
		var s = document.createElement("script");
    s.type = "text/javascript";
    s.text = codigo;
    _cabecera.appendChild(s);
    if(Placom.enServidor) _cabecera.removeChild(s);
	};
	
	return {
		/*_____ Propiedades públicas _____*/
		enServidor:(window.location.hostname != 'placom'),
		prefPag:'./',
		peticion:{},
		/*_____ Funciones públicas _____*/
		esDepuracion:function()
		{
			return _esDepuracion;
		},
		mostrarError:function(mensaje)
		{
			if(Placom.esDepuracion() && window.console)
				console.error(mensaje);
		},
		setPeticion:function(prefPag, modulo, controlador, accion, esDepuracion)
		{
			this.prefPag = prefPag;
			this.peticion.modulo = modulo;
			this.peticion.controlador = controlador;
			this.peticion.accion = accion;
			_esDepuracion = esDepuracion;
			return this;
		},
		getRutaBase:function()
		{
			return _rutaBase;
		},
		getRutaIni:function()
		{
			return _rutaBase + this.prefPag;
		},
		getLocalizacion:function()
		{
			return {
				prefPag: this.prefPag,
				base: _rutaBase,
				direccion: window.location.href
			};
		},
		getLenguaje:function()
		{
			if(!_lenguaje)
			{
				var etiquetaHtml = $$('html')[0];
				if(etiquetaHtml)
				{
					_lenguaje = etiquetaHtml.readAttribute('lang');
					if(!_lenguaje)
						_lenguaje = etiquetaHtml.readAttribute('xml:lang');
				}
				if(!_lenguaje)
					_lenguaje = 'es';
			}
			return _lenguaje;
		},
		getImgg:function(img)
		{
			return _rutaCargador + 'imgg=' + img;
		},
		cargarCssg:function(css)
		{
			_cargarCss(_rutaCargador + 'cssg=' + css);
			return this;
		},
		cargarCss:function(css, ruta)
		{
			if(!css.startsWith('http://') && ruta != undefined && !ruta.strip().empty())
				css = ruta+css;
			if(css.startsWith('http://'))
			{
				if(!css.endsWith('.css')) css += '.css';
			}		
			else
				css = _rutaCargador + 'css=' + css;
			_cargarCss(css);
			return this;
		},
		cargarJsg:function(js)
		{
			_cargarJs(js, 'jsg');
			return this;
		},
		cargarJs:function(js)
		{
			_cargarJs(js, 'js');
			return this;
		},
		cargadoJs:function(js)
		{
			_jsCargados[js] = 1;
			return this;
		},
		estaCargadoJs:function(js)
		{
			return (typeof(_jsCargados[js]) != 'undefined');
		},
		getCodigoJs:function(js)
		{
			return _jsCacheCodigos[js];
		},
		setCodigoJs:function(js, codigo)
		{
			return _jsCacheCodigos[js] = codigo;
		},		
		evaluar:function(codigo)
		{
			if(typeof(codigo) != "string") return false;
			_funcInsertarScript(codigo);
		},
		tipoVar:function(value) 
		{
	    var s = typeof value;
	    if(s === 'object') 
	    {
        if( value ) 
        {
          if(typeof(value.length) === 'number' && !(value.propertyIsEnumerable('length')) && typeof(value.splice) === 'function') 
          	s = 'array';
        } 
        else s = 'null';
	    }
	    return s;
		},
		irA:function(ruta, objetivo)
		{
			if(!ruta.startsWith('http://')) 
				ruta = _rutaBase+ruta;
			
			if(objetivo)
			{
				var formulario = new Element('form', {id: '__irA', target: objetivo, method: 'get', action: ruta});
				window.document.body.appendChild(formulario);
				$('__irA').submit();
				window.document.body.removeChild(formulario);
			}
			else
			{
				if(Prototype.Browser.IE)
				{
					//Placom.cargarJsg('scriptaculous/builder');
					var enlace = new Element('a', {id: '__irA', target: '_self', href: ruta}); 
					window.document.body.appendChild(enlace);
					setTimeout("$('__irA').click();", 100);
				}
				else window.location.assign(ruta);
			}
		},
		saltarA:function(ruta)
		{
			this.irA(this.prefPag+ruta);
		},
		lanzarCallback:function(callback)
		{
			switch(typeof(callback))
			{
				case 'object':
					if(typeof(callback.scope) == 'string') 
						callback.scope = window.eval(callback.scope);
					func = (typeof(callback.func) == 'string') ? callback.scope[callback.func] : callback.func;
					if(typeof(func) == 'undefined')
						throw new Error("Funcion '"+callback.func+"' inexistente");
					func.apply(callback.scope, callback.args);
					break;
				
				case 'function':
					callback.call();
					break;
					
				case 'string':
					window.eval(callback);
					break;
			}
		},
		resolucionPantalla:function()
		{
			return {ancho: screen.width, alto: screen.height};
		},
		tamanyoPantalla:function()
		{
		  var xScroll, yScroll;
		  var windowWidth, windowHeight;
	    var pageHeight, pageWidth;
	
	    if (window.innerHeight && window.scrollMaxY) {  
	      xScroll = document.body.scrollWidth;
	      yScroll = window.innerHeight + window.scrollMaxY;
	    } else if (document.body.scrollHeight > document.body.offsetHeight){ /* all but Explorer Mac */
	      xScroll = document.body.scrollWidth;
	      yScroll = document.body.scrollHeight;
	    } else { /* Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari */
	      xScroll = document.body.offsetWidth;
	      yScroll = document.body.offsetHeight;
	    }
	
	
	    if (self.innerHeight) {  /* all except Explorer */
	      windowWidth = self.innerWidth;
	      windowHeight = self.innerHeight;
	    } else if (document.documentElement && document.documentElement.clientHeight) { /* Explorer 6 Strict Mode */
	      windowWidth = document.documentElement.clientWidth;
	      windowHeight = document.documentElement.clientHeight;
	    } else if (document.body) { /* other Explorers */
	      windowWidth = document.body.clientWidth;
	      windowHeight = document.body.clientHeight;
	    }  
	
	    /* for small pages with total height less then height of the viewport */
	    if(yScroll < windowHeight){
	      pageHeight = windowHeight;
	    } else { 
	      pageHeight = yScroll;
	    }
	
	    /* for small pages with total width less then width of the viewport */
	    if(xScroll < windowWidth){  
	      pageWidth = windowWidth;
	    } else {
	      pageWidth = xScroll;
	    }
	    return {anchoPag: pageWidth ,altoPag: pageHeight , ancho: windowWidth, alto: windowHeight};
		},
		scrollPantalla:function()
		{
		  var scrOfX = 0, scrOfY = 0;
		  if(typeof( window.pageYOffset) == 'number')
		  { /* Netscape compliant */
		    scrOfY = window.pageYOffset;
		    scrOfX = window.pageXOffset;
		  }
		  else if(document.body && (document.body.scrollLeft || document.body.scrollTop))
		  { /* DOM compliant */
		    scrOfY = document.body.scrollTop;
		    scrOfX = document.body.scrollLeft;
		  }
		  else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop))
		  { /* IE6 standards compliant mode */
		    scrOfY = document.documentElement.scrollTop;
		    scrOfX = document.documentElement.scrollLeft;
		  }
		  return {x: scrOfX, y: scrOfY};
		},
		deshabilitarClick:function(e)
		{
			var deshabilitar = false;
			if( document.all ) 
			{
				if( ( event.button==2 || event.button==3 ) && event.srcElement.tagName=="IMG") deshabilitar = true;
			}
			else if (document.layers) 
			{
				if( e.which == 3 ) deshabilitar = true;
			}
			else if (document.getElementById)
			{
				if( e.which==3 && e.target.tagName=="IMG" ) deshabilitar = true;
			}
			if( deshabilitar )
			{
				if( this.msjDeshabImg ) alert( this.msjDeshabImg );
				return false;
			}
		},
		deshabilitarClickImgs:function()
		{
			this.msjDeshabImg = (arguments.length >  1 && typeof(arguments[1]) != 'string') ? arguments[1] : 'Función deshabilitada';
		
			if( document.all )
			 	document.onmousedown = this.deshabilitarClick.bind( this );
			else if( document.getElementById )
				document.onmouseup = this.deshabilitarClick.bind( this );
			else if( document.layers )
			{
				for( i=0; i<document.images.length; i++ )
					document.images[i].onmousedown = this.deshabilitarClick.bind( this );
			}
			document.oncontextmenu = new Function("return false;");
		},	
		abrirPopUp:function(dir, ancho, alto, opciones)
		{
			if(typeof(ventanaPopUp) != 'undefined' && ventanaPopUp != null && !ventanaPopUp.closed && ventanaPopUp.location)
				ventanaPopUp.location.href = dir;
			else
			{
				var x = (screen.width-ancho)/2;
				var y = (screen.height-alto)/2;
				
				opciones = Object.extend({
					channelmode: 'no', 
					directories: 'no',
					fullscreen: 'no',
					location: 'no', 
					toolbar: 'no', 
					resizable: 'no', 
					menubar: 'no', 
					status: 'no', 
					titlebar: 'no', 
					marginwidth: '0', 
					marginheight: '0', 
					frameborder: '0'
				}, opciones || {});
				
				ventanaPopUp = window.open(dir, "", "width="+(ancho)+", height="+(alto)+", "+Object.implode(opciones) );
				ventanaPopUp.moveTo(x,y);
				if(ventanaPopUp && !ventanaPopUp.opener) 
					 ventanaPopUp.opener = self;
			}
			if(!window.focus)
				ventanaPopUp.focus();
		}
	};
})();
