//////////////////////////////////////////////////////////
/////////////////funcao p/ jump menu//////////////////////
//////////////////////////////////////////////////////////
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function markAsRead(id,id_usuario){

		document.getElementById('acao').value = "markAsRead";
		document.getElementById('id_arquivo').value = id;
		document.formulario.action = 'ga_visualizar.php';
		document.formulario.submit();
}
function excluirNoticia(id_noticia,pg){
	
confirma = confirm('Tem certeza que deseja excluir esta noticia?');
	if(confirma){
	location.href='noticias_visualizar.php?remover=noticia&id_noticia='+id_noticia+'&pg='+pg;

		}else{
			return false;
}
}
function excluirDepoimento(id_depoimento,pg){
	
confirma = confirm('Tem certeza que deseja excluir este depoimento?');
	if(confirma){
	location.href='depoimentos_visualizar.php?remover=depoimento&id_depoimento='+id_depoimento+'&pg='+pg;

		}else{
			return false;
}
}
function excluirRepresentante(id_representante){
	
confirma = confirm('Tem certeza que deseja excluir este representante?');
	if(confirma){
	location.href='representantes_visualizar.php?remover=representante&id_representante='+id_representante;

		}else{
			return false;
}
}
function addImagem(){

	var totalCampos = parseInt(document.getElementById('totalAp').value);
	var idAtual = parseInt(totalCampos + 1);

	var string = '<table width="100%" cellspacing="1" cellpadding="0" id="ap'+idAtual+'" class="formulario" style="border-bottom:1px solid #FFFFFF; ">';
	string += 	'<tr>';
    string +=		'<th scope="row" width="140">Imagem</th>';
    string +=		'<td><input name="arquivo[]" type="file" id="arquivo[]" size="35" style="float:left"><a href="javascript:removerCampo(\'ap'+idAtual+'\');"><img src="images/icone_excluir2.gif" border="0" alt="Excluir Imagem" style="float:right" /></a></td>';
    string +=    '</tr>';
	string += '</table>';

	document.getElementById('totalAp').value = idAtual;
	var campo = document.getElementById('ap');
	campo.innerHTML =  campo.innerHTML += string;
	//campo.insertAdjacentHTML('BeforeEnd',string);
}
function removerCampo(idCampo){

		var campo = document.getElementById(idCampo);
		var tamanho = campo.rows.length;

		for(var i=0; i < tamanho; i++){
			campo.deleteRow(0);
		}

	navegador = /msie/i.test(navigator.userAgent);

	if(navegador == false){
		campo.innerHTML = ""
	}

}
function excluiImagem(id_categoria,id_imagem)
{	
confirma = confirm('Tem certeza que deseja excluir esta imagem?');
	if(confirma)
	{
		location.href='fotos_visualizar.php?remover=imagem&id_categoria='+id_categoria+'&id_imagem='+id_imagem;
	}else{
			return false;
	}
}

function excluiFotoNoticia(id_noticia,id_imagem)
{	
confirma = confirm('Tem certeza que deseja excluir esta imagem?');
	if(confirma)
	{
		location.href='noticias_fotos_visualizar.php?remover=imagem&id_noticia='+id_noticia+'&id_imagem='+id_imagem;
	}else{
			return false;
	}
}

function centerPopup(mypage, myname, w, h, scroll, resize) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',resizable='+resize+',scrollbars='+scroll
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4){
		win.window.focus();
	}
}

// ---------------- 
// ---------------- função para exibir/esconder divs
// ---------------- 
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
