function setBackgroundOver(par) {
	backNow = document.getElementById(par).style.backgroundColor;
	document.getElementById(par).style.backgroundColor = "#FFDB75";
	return true;
}

function setBackgroundOut(par) {
	document.getElementById(par).style.backgroundColor = backNow;
	return true;
}

function searchExpression(pNameField,pSearch,pTable,pFrame,pFormName,pCondition) {
	/* if	(pSearch != '') { */
	var link = '../inc/searchExpressionTable.php?table='+pTable+'&search='+pSearch+'&fieldName='+pNameField+'&frame='+pFrame+'&formName='+pFormName;
	if	(pCondition != null) {
		link = link+'&condition='+pCondition;
	}
	openWindow(link,420,550,'yes','no');
	/* } */
}

function openWindow(pParametro,pWidth,pHeight,scrollbars,resizable) {
	var xAvaliableWidth = screen.availWidth;
	var xAvaliableHeight = screen.availHeight;
	xLeft = (xAvaliableWidth-pWidth)/2;
	xTop = (xAvaliableHeight-pHeight)/2;
    window.open(pParametro,'window','dependent=yes,scrollbars='+scrollbars+',resizable='+resizable+',status=yes,width='+pWidth+',height='+pHeight+',left='+xLeft+',top='+xTop);
}

function reloadSearch(par,expressao,cidade,uf,classificacaoCurso,aspas) {
	window.location.href = 'buscaRapidaIndex.php?expressao='+expressao+'&cidade='+cidade+'&uf='+uf+'&classificacaoCurso='+classificacaoCurso+'&tipoSearch='+par+aspas;
}

function goIndex(to) {
	var go = '';
	if	(to == 0) {
		go = 'index.php';
	} 
	if	(to == 1) {
		go = 'cursoIndex.php?tipo=on';
	} 
	if	(to == 2) {
		go = 'cursoIndex.php?tipo=off';
	} 
	if	(to == 3) {
		go = 'instituicaoIndex.php';
	} 
	if	(to == 4) {
		go = 'palestraIndex.php';
	} 
	document.location.href = go;
}

function checkBuscaPrincipalForm() {
	if	(document.buscaPrincipalForm.classificacaoCurso.value == ''
	  	&& document.buscaPrincipalForm.uf.value == ''
	  	&& document.buscaPrincipalForm.expressao.value == ''
	  	&& document.buscaPrincipalForm.cidade.value == '') {
		alert('Informe pelo menos um campo para efetuar a consulta');
		return false;
	}
	return true;
}

function setTipoEntidadeCheck(pForm) {
	document.forms[pForm].tiposEntidadeId.value = '';
	if	(document.forms[pForm].EnsinoFundamental.checked) {
		document.forms[pForm].tiposEntidadeId.value = '1;';
	}
	if	(document.forms[pForm].EnsinoMedio.checked) {
		document.forms[pForm].tiposEntidadeId.value = document.forms[pForm].tiposEntidadeId.value+'2;';
	}
	if	(document.forms[pForm].EnsinoSuperior.checked) {
		document.forms[pForm].tiposEntidadeId.value = document.forms[pForm].tiposEntidadeId.value+'3;';
	}
	if	(document.forms[pForm].CursosDeExtensao.checked) {
		document.forms[pForm].tiposEntidadeId.value = document.forms[pForm].tiposEntidadeId.value+'4;';
	}
	if	(document.forms[pForm].CursosPreparatorios.checked) {
		document.forms[pForm].tiposEntidadeId.value = document.forms[pForm].tiposEntidadeId.value+'5;';
	}
	if	(document.forms[pForm].CursosProfissionalizantes.checked) {
		document.forms[pForm].tiposEntidadeId.value = document.forms[pForm].tiposEntidadeId.value+'6;';
	}
	return true;
}
