// Set up our RCMS namespace
if(typeof(RCMS)=="undefined"){RCMS={};}

/* Popup Window Behavior
-----------------------------------------------------*/
RCMS.Popup = Behavior.create({

	anchor: null,
	
	windowOptions: null,
	height: 500,
	location: 0,
	menubar: 0,
	resizable: 0,
	scrollbars: 0,
	status: 0,
	toolbar: 0,
	width: 700,
	
	
  initialize: function(options) {
		this.anchor = this.element;
		
		// Initialize our options
		if(options != null && typeof(options) != 'undefined') {
			if(typeof(options.height) != "undefined") {
				this.height = options.height;
			}
			if(typeof(options.location) != "undefined") {
				this.location = options.location;
			}
			if(typeof(options.menubar) != "undefined") {
				this.menubar = options.menubar;
			}
			if(typeof(options.resizable) != "undefined") {
				this.resizable = options.resizable;
			}
			if(typeof(options.scrollbars) != "undefined") {
				this.scrollbars = options.scrollbars;
			}
			if(typeof(options.status) != "undefined") {
				this.status = options.status;
			}
			if(typeof(options.toolbar) != "undefined") {
				this.toolbar = options.toolbar;
			}
			if(typeof(options.width) != "undefined") {
				this.width = options.width;
			}
		}
		
		this.windowOptions = "height="+this.height+",location="+this.location+",menubar="+this.menubar+",resizable="+this.resizable+",scrollbars="+this.scrollbars+",status="+this.status+",toolbar="+this.toolbar+",width="+this.width;
  },

	onclick: function(event) {
		this.openWindow();
		Event.stop(event);
	},

	openWindow: function() {
		window.open(this.anchor.href, '', this.windowOptions);
	}
	
});
