//alert('funtions');

function mostrar_naoregistrado() {
	obj = document.getElementById('naoregistrado');
	if (obj) {
		obj.style.visibility = "visible";	  
	}
}

function ocultar_naoregistrado() {
	obj = document.getElementById('naoregistrado');
	if (obj) {
		obj.style.visibility = "hidden";	  
	}
}

var jnevtnm = 1;
function abrir_janela(file,width,height) {

	jnevtnm = jnevtnm + 1;
	w = window.open(file, "JanelaEvtIPC"+jnevtnm, 'width='+width+',height='+height+',resizable,scrollbars=no,status=0');
	w.focus();
}

function abrir_jan(file,width,height) {

	w = window.open(file, "popup", 'width='+width+',height='+height+',resizable,scrollbars=no,status=0');
	w.focus();
}

function abrir_zoom(file) {

	w = window.open(file, "popup", 'width='+635+',height='+500+',resizable,scrollbars=no,status=0');
	w.focus();
}
var PEQUENO = 10;
var MEDIO = 12;
var GRANDE = 14;
var TAMANHO = 12;
function cl_tamanho(nTamanho) {
	if (nTamanho == PEQUENO) TAMANHO = TAMANHO - 1;
	else TAMANHO = TAMANHO + 1;
	if (TAMANHO < 8) TAMANHO = 8;
	if (TAMANHO > 20) TAMANHO = 20;
	if (document.all)document.all.textoTamanho.style.fontSize = TAMANHO +'px';
	else	document.getElementById('textoTamanho').style.fontSize = TAMANHO +'px';
	}

function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function cl_verificarEnter(formulario) {
	if (event.keyCode == 13)
		cl_realizarBusca (formulario);
}

function cl_realizarBusca(formulario) {
	// if para saber qual ?Eo tipo de resultado que ir?Etrazer N = Noticias  I = Imagens
	if (formulario.radiobutton[1].checked) {
		strLink = 'resultado_busca.asp?descrIdioma=br&Tipo=2&txtBusca=' + (formulario.txtBusca.value);
		window.location.href = strLink;
	} else {
		strLink = 'resultado_busca.asp?descrIdioma=br&Tipo=1&txtBusca=' + (formulario.txtBusca.value);
		window.location.href = strLink;
	}
}

function MostrarVideo() {
	obj = document.getElementById('video');
	if (obj) {
		if (typeof obj.style !== "undefined") {
			obj.style.display = 'block';

			try {
				embedvideo.DoPlay();
			} catch (e) {
				embedvideo.Play();
			}
		}
	}
}

function EsconderVideo() {
	obj = document.getElementById('video');
	if (obj) {
		if (typeof obj.style !== "undefined") {
			obj.style.display = 'none';

			try {
				embedvideo.DoStop();
			} catch (e) {
				embedvideo.Stop();
			}
		}
	}
}

function TocarAudio() {
	obj = document.getElementById('audio');
	if (obj) {
		if (typeof obj.style !== "undefined") {
			obj.style.display = 'block';

			try {
				embedaudio.DoPlay();
			} catch (e) {
				embedaudio.Play();
			}
		}
	}
}

function mostrar_naoregistrado() {
	obj = document.getElementById('naoregistrado');
	if (obj) {
		obj.style.visibility = "visible";
	}
}

function mostrar_fechar() {
	obj = document.getElementById('naoregistrado');
	if (obj) {
		obj.style.visibility = "hidden";
	}
}

function clVerificarTamanho(campo) {
	edit = document.getElementById('txtNumero');
	numero = 800 - campo.value.length;

	if (numero < 0) numero = 0;
	edit.value = numero;

	if (campo.value.length > 800) {
		alert('Nao e possivel inserir mais caracteres');  //N? Eposs?el inserir mais caracteres
		campo.value = campo.value.substr(0, 800);
		return false;
	}

	if (campo.value.length > 0){
		document.getElementById("s_button").style.visibility="visible";
	}
	else{
		document.getElementById("s_button").style.visibility="hidden";
	}
}

function cl_cadastrar(formulario, logado) {
	if (logado == '') {
		alert('Necessário ser um Usuário Registrado para enviar comentários\n'); //Necessrio estar logado para enviar comentrios
	} else {
		msgErro = '';
		if (formulario.txtDescricao.value == '')
			msgErro += 'Campo Descrio sem preechimento\n'; //Campo Descrio sem Preenchimento\n'

		if (msgErro=='')
			formulario.submit();
		else
			alert (msgErro);
		msgErro = '';
	}
}


 function clImprimir(picName){
	picURL=picName
	newWindow=window.open(picURL,'newWin','toolbar=no,status=no,  width='+picName.width+',height='+picName.height)
	strHTML = '<html><head><link href="ipc_brasil.css" rel="stylesheet" type="text/css"></head><body leftmargin=0 topmargin=0><table align=center border="0"><tr><td><div align="center"><img src="/design/ipcdigital/images/barra_herramientas/new_bt_print.gif"></div></td>'
	strHTML += '<td class="textoLS12"><a href="javascript:window.print();location.reload()">'
	strHTML += 'Imprimir'
	strHTML += '</a></td>'
	strHTML += '</tr></table>'
	strHTML += '<img border=0 src="' + picURL + '"></body></html>'
	newWindow.document.write( strHTML )
	newWindow.resizeBy(picName.width-newWindow.document.body.clientWidth, picName.height-newWindow.document.body.clientHeight + 20)
	newWindow.focus()
}

function cl_abrir(caminho, nomeJanela, vWidth, vHeight, vScroll) {
	newWindow=window.open(caminho,nomeJanela,'RESIZABLE=1, scrollbars=1, toolbar=no,  width=' + vWidth + ',height=' + vHeight )
	newWindow.focus()
}

function cl_zoom(caminho) {
	screenwidth = 1024;
	screenheight = 768;
	if (typeof screen !== 'undefined') {
		if (typeof screen.width !== 'undefined') {
			screenwidth = screen.width;
			screenheight = screen.height;
		}
	}
	try {
		var imgwidth = widthimg[savecodigo];
		var imgheight = heightimg[savecodigo];
	} catch(e) {
		var imgwidth = 700;
		var imgheight = 500;
	}

	var left = (screenwidth / 2) - (imgwidth / 2);
	var top = (screenheight / 2) - (imgheight / 2);

	var width = imgwidth;
	var height = imgheight+25;

	var newWindow=window.open(caminho + '&img=/paginas/noticias/imagens/gd_' + arrayimg[savecodigo] + '&t=d','ipcZoomWindow','RESIZABLE=1, scrollbars=0, toolbar=no,  menubar=no, left='+left+',top='+top+',width='+width+',height='+height);
	newWindow.focus();
}


function cl_abrirprint(caminho, nomeJanela, vWidth, vHeight, vScroll, vMenu) {
	if (savecodigo != 0) {
		if (typeof vMenu == 'undefined') vMenu = 'no';
		newWindow=window.open(caminho + '&img=/paginas/noticias/imagens/gd_' + arrayimg[savecodigo] + '&t=d',nomeJanela,'RESIZABLE=1, scrollbars=1, toolbar=no,  width=' + vWidth + ',height=' + vHeight + ',menubar=' + vMenu );
		newWindow.focus();
	}
}