var App = {
	overlay : (function(){
		var enabled = true;
		var App = {
			e : null,
			show : function()
			{
				//this.e.css('height', (wst.get('#main').attr('offsetHeight') + 20) + 'px');
				this.e.show();
			},
			hide : function()
			{
				this.e.hide();
			},
			error : function(html)
			{
				this.e.children(1).content('<div class="errMsg"><div>' + html + '</div></div>');
			},
			msg : function(html)
			{
				this.e.children(1).content('<div class="appMsg"><div>' + html + '</div></div>');
			},
			content : function(html)
			{
				this.e.children(1).content(html);
			},
			enable : function(bool){
				if(bool !== undefined)
					enabled = bool;
				else
					return enabled;
			}
		};
		
		return App;
	})(),
	box : function(content, width)
	{
		wst.modules.load('roundedBox');
		content = '' || content;
		var box = wst('<div>' + content + '</div>');

		App.overlay.e.children(1).append(box)
			.roundedBox({
				top : 'imgs/box/mid.png',
				topLeft : 'imgs/box/mid.png',
				topRight : 'imgs/box/tr.png',
				left : 'imgs/box/mid.png',
				right : 'imgs/box/mid.png',
				bottomLeft : 'imgs/box/bl.png',
				bottomRight : 'imgs/box/br.png',
				bottom : 'imgs/box/mid.png',
				cornerWidth : 25,
				middleWidth : 25,
				topBottomHeight : 25,
				bgColor : '#4B7A05',
				width : width
			})
			.css({
				'margin-left' : '-250px',
				'top' : '70px'
			});

		box.parent().opacity.set(73);
		return box;
	}
};

wst.doc.ready(function(){
	App.overlay.e = wst.get('#overlay');
	App.overlay.e.on('click', function(){
		if(App.overlay.enable())
			wst.get(this).hide();
	});
});