
var PopupStoreBlock = new Class({

	initialize: function(){
		this.action = '/njoy/frmStoreBlock';
	},

	close: function(){
		opener.location.href= unescape(opener.location.href);
		window.close();
	},

	open: function(module, id){

		var width = 700;
		var height = 600;

		var url = this.action + '/' + id + '/' + module;
		return new Popup(url, width, height).open();
	},

	openByUrl: function(url){

		var width = 700;
		var height = 600;

		return new Popup(url, width, height).open();
	}
});



var Language = new Class({

	initialize: function(lang){

		this.lang = lang;
		this.action = "changeLang";
	},

	change: function(url){

		var myAjax = new Ajax(url + this.lang, {
			method: 'post', onComplete: function() {
				parent.location.href= unescape(parent.location.href);
			}
		});

		myAjax.request();

	}
});


var Popup = new Class({

	initialize: function(url, width, height){

		this.url = url;
		this.width = width;
		this.height = height;

	},

	open: function(){

		var opts = "width="+this.width+",height="+this.height;
			opts += ",scrollbars=off,dependent,resizable=off";

		if ( window.screen ) {

			var ah = screen.availHeight - 30;
			var aw = screen.availWidth - 10;

			var xc = ( aw - this.width ) / 2;
			var yc = ( ah - this.height ) / 2;

			opts += "width="+this.width+",height="+this.height;
			opts += ",left=" + xc + ",screenX=" + xc;
			opts += ",top=" + yc + ",screenY=" + yc;
		}

//		var opts = "width="+this.width+",height="+this.height+",scrollbars=off,dependent,resizable=off";
		var popupWin = window.open(this.url, "puWin", opts);
		popupWin.focus();

		//return popupWin;
	},

	close: function(){

		window.close();
	}
});