
function getElm(id) {
	return document.getElementById(id);
}

// altera a visibilidade de um objeto
function toggle(id) {
	var e = document.getElementById(id);
	e.style.display = (e.style.display != 'none' ? 'none' : '');
}


function ScreenSize(qual) {
	var myWidth = 0, 
		myHeight = 0;
	if (typeof(window.innerWidth) == 'number') {// Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	if (qual == 'w') {
		return myWidth;
	} else {
		return myHeight;
	}
}


// POPUP functions
function abre_janela(width, height, nome) {
	var top = ((screen.height / 2) - (height / 2));
	var left = ((screen.width / 2) - (width / 2));
	window.open('', nome, 'width='+width+',height='+height+',scrollbars=yes,toolbar=no,location=no,status=no,menubar=no,resizable=no,left='+left+',top='+top);
}
function pop_up_center(local, w, h, scrol)
{
	var XX = (screen.width - w) / 2;
	var YY = (screen.height - h) / 2;
	var janela = window.open(local,'POP_UP','width='+w+',height='+h+',left='+XX+',top='+YY+',scrollbars='+scrol+',status=no,resizable=yes, toolbar=no,directories=no,menubar=no');
	janela.focus();
}

function pop_up_center_flex(local, w, h, opt)
{
	var XX = (screen.width - w) / 2;
	var YY = (screen.height - h) / 2;
	var janela = window.open(local,'POP_UP_FLEX','width='+w+',height='+h+',left='+XX+',top='+YY+','+opt);
	janela.focus();
}

function _go(selObj)
{
	valor = selObj.options[selObj.selectedIndex].value;
	if (valor != '#') {
		self.location = valor;
	}
}

function in_array(value, array)
{
	for (var i = 0; i < array.length; i++)
		if (array[i] === value)
			return true;

	return false;
}

function hideDefault(input){
  if(typeof(input.defaultValue)=="undefined")
    input.defaultValue = input.value;
  if(input.value == input.defaultValue)
    input.value = "";
  return true;
}
function showDefault(input){
  if(input.value == "" && typeof(input.defaultValue)!="undefined")
    input.value = input.defaultValue;
  return true;
}
// ex: <INPUT onFocus="return hideDefault(this);" onBlur="return showDefault(this);" value="Type your full name here" />