function showmsgbox(msg)
{
	window_msgbox = document.getElementById('msgbox');
	msg_content = document.getElementById('msgcontent');
	msg_header = document.getElementById('msgheader');
	
	msg_header.innerHTML = '';
	
	window_msgbox.style.visibility = 'visible';
	document.getElementById('block_bg').style.display = 'block';
	msg_content.innerHTML = msg;
	
	document.getElementById('msgboxclose').focus();
}

function showmsgbox_result(msg)
{
	window_msgbox = document.getElementById('msgbox');
	msg_content = document.getElementById('msgcontent');
	msg_header = document.getElementById('msgheader');
	
	window_msgbox.style.visibility = 'visible';
	document.getElementById('block_bg').style.display = 'block';
	
	msg_content.innerHTML = msg[0];
	msg_header.innerHTML = msg[1];
	
	document.getElementById('msgboxclose').focus();
}

/*function eliminarList(list,params)
{
	document.getElementById('msgbox_delete').style.visibility = 'hidden'; 
	xajax_EliminarLista(xajax.getFormValues('frmGrid'),list,params);
}*/

function showmsgbox_delete()
{
	window_msgbox = document.getElementById('msgbox_delete');
	msg_content = document.getElementById('msgcontent_delete');
	msg_header = document.getElementById('msgheader_delete');
	
	msg_header.innerHTML = 'Confirmação';
	
	window_msgbox.style.visibility = 'visible';
	document.getElementById('block_bg').style.display = 'block';
	msg_content.innerHTML = 'Tem a certeza que deseja eliminar o(s) registo(s)?';
	
	document.getElementById('msgboxclose_delete').focus();
	
	/*btn = document.getElementById('msgboxconfirm_delete');
	
	params = params.replace(/'/g,"\\'");
	
	if( btn.attachEvent ){
		btn.attachEvent("onclick","eliminarList('"+ list + "','" +  params + "')"); 
	} else {
		 btn.setAttribute("onclick", "eliminarList('"+ list + "','" +  params + "')"); 
	}*/
}

function showloading()
{
	document.getElementById('loading').style.visibility='visible';
	document.getElementById('block_bg').style.display = 'block';
}

function hideloading()
{
	document.getElementById('loading').style.visibility='hidden';
	document.getElementById('block_bg').style.display = 'none';
}

function showblockbg()
{
	document.getElementById('block_bg').style.display = 'block';
}

function hideblockbg()
{
	document.getElementById('block_bg').style.display = 'none';
}

function findPos(obj) {
	var position = new Object;
	position.x = 0;
	position.y = 0;
	if (obj.offsetParent) {
		do {
			position.x += obj.offsetLeft;
			position.y += obj.offsetTop;
		} while (obj = obj.offsetParent);
		
		/*if(!window.innerHeight) height = document.body.clientHeight;
		else height = window.innerHeight;
		
		if(!window.innerWidth) width = document.body.clientWidth;
		else width = window.innerWidth;
		
		if(position.y >= height) position.y = position.y - 347;
		if(position.x >= (width - 280)) position.x = position.x - 260;
		
		position.y = position.y + 20;*/
		
		return position;
	}
}

function showObs()
{
	if(document.getElementById('show_obs0') == 1) return true;
	if(document.getElementById('show_obs1') == 1) return true;
	if(document.getElementById('show_obs2') == 1) return true;
	if(document.getElementById('show_obs3') == 1) return true;
	if(document.getElementById('show_obs4') == 1) return true;
	if(document.getElementById('show_obs5') == 1) return true;
	if(document.getElementById('show_obs6') == 1) return true;
}


