function wz()
{
	var w=0;
	var h=0;
	if(!window.innerWidth){if(!(document.documentElement.clientWidth == 0)){w=document.documentElement.clientWidth;h=document.documentElement.clientHeight;}else{w=document.body.clientWidth;h=document.body.clientHeight;}}else { w=window.innerWidth; h=window.innerHeight;} return {width:w,height:h};
}

function show_lightbox()
{
	$$('select').hide();
	var lightbox = $('lightbox');
	lightbox.show();
	$('window_content').show();
}

function hide_lightbox()
{
	$$('select').show();
	$('lightbox').hide();
}

function resize_lightbox(width,height)
{
	var obj_w = document.getElementById('window');
	obj_w.style.height = height + 'px';
	obj_w.style.width = width + 'px';
	obj_w.style.top = -(height/2) + 'px';
	obj_w.style.left = -(width/2) + 'px';
}

function create_lightbox_html(html,width,height)
{
	var obj = document.getElementById('window_content');
	obj.innerHTML = html;
	resize_lightbox(width,height);
	return obj;
}

/*
function backend_confirmation(title,message,height,functionYes,functionNo) {
	var buttons = create_lightbox_question(title,message,height);
	show_lightbox();
	if (functionNo == undefined) {
		buttons[0].onclick = function() {
			backend_cancel_confirmation();
		}
	}
	if (functionYes != undefined) {
		buttons[1].onclick = functionYes;
	}
}

function create_lightbox_message(title,message,height)
{
	var obj = document.getElementById('window_content');
	obj.innerHTML = '<div class="p15"><h1>' + title + '</h1><div style="pb10">' + message + '</div><div class="buttons window_bottom"><a id="lightbox_question_ok" class="positive" href="#"><img src="/components/application_visuals/icons/tick.png" alt=""/>OK</a></div></div>';
	resize_lightbox(400,height);
	return document.getElementById('lightbox_question_ok');
}

function create_lightbox_question(title,text,height)
{
	var obj = document.getElementById('window_content');
	obj.innerHTML = '<div class="p15"><h1>' + title + '</h1><div style="pb10">' + text + '</div><div class="buttons window_bottom"><a id="lightbox_question_yes" class="positive" href="#"><img src="/components/application_visuals/icons/tick.png" alt=""/>Sim</a><a id="lightbox_question_no" class="negative" href="#"><img src="/components/application_visuals/icons/cross.png" alt=""/>Não</a></div></div>';
	resize_lightbox(400,height);
	return Array( document.getElementById('lightbox_question_no'), document.getElementById('lightbox_question_yes'));
}

*/

window.addEvent('domready',function() {
	
	var lightbox = new Element('div', {'id': 'lightbox'});
	var lb_background = new Element('div', {'id': 'background','html':'&nbsp;'});
	var lb_desktop = new Element('div', {'id': 'desktop'});
	var lb_window = new Element('div', {'id': 'window'});
	var lb_window_content = new Element('div', {'id': 'window_content'});
	
	lightbox.grab(lb_background);
	lightbox.grab(lb_desktop);
	lb_desktop.grab(lb_window);
	lb_window.grab(lb_window_content);
	$(document.body).grab(lightbox);

	if (Browser.Engine.trident && (Browser.Engine.version==4)) {
		lightbox.show();
		lightbox.setStyle('position','absolute');
		lightbox.pin();
		lightbox.hide();
	}

});
