/*
	Descrição: e-U - Universidade Electrónica
	Autor: Innovagency.com - David Moisés Lages
*/

/* JANELA POPUP CENTRADA */
function popup(href, name) {
	var iLeft;
	var iTop;
	var iWidth = 650;
	var iHeight = 700;

	if ( screen.width > iWidth ) {
		iLeft = parseInt( ( screen.width - iWidth ) / 2 );
	} else {
		iLeft = 0
	}

	if ( screen.height > iHeight ) {
		iTop = parseInt( ( screen.height - iHeight ) / 2 );
	} else {
		iTop = 0
	}

	window.open(href, name, 'width=' + iWidth + ', height=' + iHeight + ', scrollbars=yes, toolbar=no, status=no, left=' + iLeft + ', top=' + iTop);
}


/* MOSTRA E ESCONDE VALUE NUM IMPUT TEXT */
function doFocus(obj, strName) {
	if (obj.value == strName) {
		obj.value = '';
	}
}
function doBlur(obj, strName) {
	if (obj.value == '') {
		obj.value = strName;
	}
}


/* CLEAR VALUE */
function clearDefault(el) {
	if (el.defaultValue==el.value) el.value = "";
}
function restoreDefault(el) {
	if (el.value == "") el.value = el.defaultValue;
}


/* LINK PARA FAVORITOS/BOOKMARK */
function CreateBookmarkLink() {
	if (window.sidebar) { // Mozilla Firefox Bookmark
		//alert('FF');
		window.sidebar.addPanel(document.title, location.href, "");
	} else if (window.external) { // IE Favorite
		//alert('IE');
		window.external.AddFavorite(location.href, document.title);
	} else if (window.opera && window.print) { // Opera Hotlist
		//alert('OP');
		var mbm = document.createElement('a');
		mbm.setAttribute('rel','sidebar');
		mbm.setAttribute('href',location.href);
		mbm.setAttribute('title',document.title);
		mbm.click();
	}
}


/* MUDA O STYLESHEET BACKGROUND-COLOR APLICADO */
function changeStyleBgColor(obj, strStyle) {
	obj.style.backgroundColor = '#' + strStyle;
}


/* MUDA O STYLESHEET BACKGROUND-COLOR APLICADO UTILIZANDO UM ID */
function changeClass(iID, objClass) {
	var obj = document.getElementById( iID );
	//alert( 'ID=' + iID + ' -------- Class=' + objClass );
	obj.style.backgroundColor = '#' + objClass;
}


/* SHOW HIDE LAYER's & BACKGROUND-COLOR - COM DETECÇÃO DE A LAYER ESTÁ VISIVEL OU NÃO */
function IN_ShowLayerAdvance(objectDiv, objectSupDiv, backColorOn, backColorOff, styleOn, styleOff) {
      if (document.getElementById(objectDiv).getAttribute("mode") == null) {
		document.getElementById(objectDiv).setAttribute("mode", 0);
      }
      if (document.getElementById(objectDiv).getAttribute("mode") == 1) {
		document.getElementById(objectDiv).style.display = 'none';
		document.getElementById(objectDiv).style.visibility = 'hidden';
		document.getElementById(objectDiv).style.position = 'absolute';
		document.getElementById(objectSupDiv).style.backgroundColor = '#' + backColorOff;
		objectSupDiv.className = styleOff;
		document.getElementById(objectDiv).setAttribute("mode", 0);
      } else {
		document.getElementById(objectDiv).style.visibility = 'visible';
		document.getElementById(objectDiv).style.position = 'relative';
		setTimeout("document.getElementById('"+ objectDiv +"').style.display = 'block';", 150);
		document.getElementById(objectSupDiv).style.backgroundColor = '#' + backColorOn;
		objectSupDiv.className = styleOn;
		document.getElementById(objectDiv).setAttribute("mode", 1);
	}
}

/* FILTERSTRING - FILTRAR UMA STRING */
function FilterString() {
	//var re;
	//var ch=String.fromCharCode(event.keyCode);
	if ((event.keyCode!=60)&&(event.keyCode!=62) && (event.keyCode!=34)&&(event.keyCode!=39)) {
		return;
	}
	event.returnValue=false;
}


function SubmitForm(){return true;}

