var lightwindow_pc = Class.create(lightwindow,{
	initialize: function($super){
		$super();
	},
	_loadWindow: function($super) {
	var responder = {
		  onCreate: function() {
			Ajax.activeRequestCount++;
		  },
		  onComplete: function() {
			Ajax.activeRequestCount--;
		  }
		};

		// Copiado directamente de lightwindow.js para anexar funcionalidad requerida.
		if(this.windowType == 'page') {
			var newAJAX = new Ajax.Request(
				this.contentToFetch, {
					method: 'get', 
					parameters: '', 
					onComplete: function(response) {
						// Anexé evaluacion del javascript interno.
						$('lightwindow_contents').innerHTML += response.responseText;
						var salidas = response.responseText.extractScripts().map(
								function(script) {
									return eval(script);
								}
							);
						this.resizeTo.height = $('lightwindow_contents').scrollHeight+(this.options.contentOffset.height);
						this.resizeTo.width = $('lightwindow_contents').scrollWidth+(this.options.contentOffset.width);
						this._processWindow();
						//aca hay que disparar un evento con defer.
						//Event.fire()
					}.bind(this),
					onException: function(obj, exc) {
						Prototype.Exeption.handle(exc);
					}
				}
			);
		} 
		else{
			$super();
		}
		
		Ajax.Responders.register(responder);
	},
	deactivate : function($super) {
		// EN EL PADRE SE CORRE CUANDO SE DESACTIVA LA VENTANA.
		// LO EXTIENDO PARA QUE DISPARE UN EVENTO Y SE PUEDA HACER ALGO LUEGO.
		document.fire(":ligthwindow_unload");
		$super();
	},
	_processLink : function($super,link){
		$super(link);
	}
});	


/*-----------------------------------------------------------------------------------------------*/

Event.observe(window, 'load', lightwindowInit, false);

//
//	Set up all of our links
//
var myLightWindow = null;
function lightwindowInit() {
	myLightWindow = new lightwindow_pc();
}