function abre_pop(pagina,nome,larg,altu,rolagem) {
	window.open(pagina,nome,"resizable=no,toolbar=no,status=no,menubar=no,scrollbars="+rolagem+",width="+larg+",height="+altu)
}

// TROCA COR 
function troca_cor(dequem,qualcor) {
	document.getElementById(dequem).style.backgroundColor=qualcor;
}

//APARECE MENU FUTUANTE
function menus(acao,quem){
	document.getElementById(quem).style.visibility=acao;
}


// MUDA IMAGEM
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}

function MM_showHideLayers() { //v3.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; }
}

var mac = (navigator.appVersion.indexOf("Mac") != -1) ? true : false;
var ie = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var fire = (navigator.userAgent.toLowerCase().indexOf("firefox") != -1) ? true : false;

if(mac && ie) document.write ('<style>.sc{padding-right:15px;}body{overflow:hidden;}</style>');

var oldo = '';

function getOffsetTop(element, deep) {
	return getOffsetProperty(element, 'Top', deep);
}

function getOffsetLeft(element, deep) {
	return getOffsetProperty(element, 'Left', deep);
}

function getOffsetProperty(element, property, deep) {
   var offsetValue = 0;
   offsetProperty = 'offset' + property;
   
   do {
      offsetValue += element[offsetProperty];
      element = element.offsetParent;
   } while (deep == true && element != document.body && element != null);
   return offsetValue;
}

function showC(o,texto) {
	if(!fire && !mac) {
		if(o) document.getElementById('comd').style.pixelTop = getOffsetTop(o,1) + 26;
		else document.getElementById('comd').style.pixelTop = getOffsetTop(oldo,1) + 26;
		if(o) document.getElementById('comd').style.pixelLeft = getOffsetLeft(o,1) - 35;
		else document.getElementById('comd').style.pixelLeft = getOffsetLeft(oldo,1) - 35;
		document.getElementById('comd').style.display='block';
		document.getElementById('c_texto2').innerHTML = "<em>"+texto+"</em>";
		oldo = o;
	}
}

function hideC() {
	if(!fire && !mac) {
	document.getElementById('comd').style.display='none';
	}
}

mouseover=true;

function coordinates() {
	if (!moveMe) {return}
	if (event.srcElement.id=="moveMe")	{
		mouseover=true;
		pleft=document.getElementById('moveMe').style.pixelLeft;
		ptop=document.getElementById('moveMe').style.pixelTop;
		xcoor=event.clientX;
		ycoor=event.clientY;
		document.onmousemove=moveImage;
		if (pleft==0 && ptop==0) {
			pleft=460;
			ptop=50;
		}
	}
}

function moveImage() {
	if (mouseover&&event.button==1)	{
		document.getElementById('moveMe').style.pixelLeft=pleft+event.clientX-xcoor;
		document.getElementById('moveMe').style.pixelTop=ptop+event.clientY-ycoor;
		document.getElementById('moveMe2').style.pixelLeft=pleft+event.clientX-xcoor;
		document.getElementById('moveMe2').style.pixelTop=ptop+event.clientY-ycoor;
		return false;
	}
}

function mouseup() {mouseover=false}

function escreve(texto,foto) {
	document.getElementById('nome').innerHTML = texto;
	var a_foto;
	a_foto = foto;
	document.arquivo.src = a_foto;
}

function explicaCampo(nomeObjeto, texto) {
	document.getElementById(nomeObjeto).innerHTML = texto;
	document.getElementById(nomeObjeto).style.display = "block";
}

function he1(classe) {
	document.writeln("<div class='"+classe+"'>")
}

function he2(classe) {
	document.writeln("</div><div class='"+classe+"'>")
}

function he3() {
	document.writeln("</div>")
}

function trocaConteudo(objetoBlock, objetoNone) {
	document.getElementById(objetoBlock).style.display = "block";
	document.getElementById(objetoNone).style.display = "none";
}

function mudaImagem(posicao) {
	if (posicao == "direita") {
		if (index+1 == total) {
			index = 0;
		} else {
			index++;
		}
	} else {
		if (index <= 0) {
			index = total-1;
		} else {
			index--;
		}
	}
	
	muda_img("fotoDestaque", arrImagens[index]);
	document.getElementById("statusImg").innerHTML = (index+1) + " / " + total;
	document.getElementById("fotoDestaque").style.visibility = "visible";
}

function confirmaAtendimento() {
	if (confirm ("Para prosseguir com o atendimento certifique-se que o bloqueador de pop-up está desativado.") )
	{
		abre_pop("http://www.e-live.com.br/ejuspodivm/pedido.php?login=ejuspodivm&yid=1&deptid=0",'Atendimento',1,1,'no');
		//window.location.href = "http://www.e-live.com.br/ejuspodivm/pedido.php?login=ejuspodivm&yid=1&deptid=0";
		abre_pop("http://chat.atendimentoaovivo.com.br/mail.asp?idc=000014200",'Atendimento',1,1,'no');
		//javascript:alert('O serviço de ATENDIMENTO ON-LINE ficará desativado até o dia 03/01/10. Qualquer dúvida poderá ser esclarecida através do FALE CONOSCO (fale@editorajuspodivm.com.br). As mensagens enviadas serão respondidas no máximo em 24h, excluindo-se os finais de semana e feriados.\n\n Atenciosamente, \n\n EDITORA JUSPODIVM ')
	} 
	else 
		//{return;}
	
	//alert("Atendimento em manutenção!");
	return;
	
}

function montaSwfIE7(nome, largura, altura) {
	if (AC_FL_RunContent == 0) {
		
	} else {
		AC_FL_RunContent(
			'codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0',
			'width', largura,
			'height', altura,
			'src', nome,
			'quality', 'high',
			'pluginspage', 'https://www.macromedia.com/go/getflashplayer',
			'align', 'middle',
			'play', 'true',
			'loop', 'true',
			'scale', 'showall',
			'wmode', 'transparent',
			'devicefont', 'false',
			'id', nome,
			'name', nome,
			'menu', 'true',
			'allowFullScreen', 'false',
			'allowScriptAccess','sameDomain',
			'movie', nome,
			'salign', ''
			);
	}
}

function montaSwf(nome, largura, altura) {
	var monta = "" ;
	monta += "<noscript>" ;
	monta += "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+largura+"' height='"+altura+"' id='"+nome+"' align='middle'>" ; 
	monta += 	"<param name='allowScriptAccess' value='sameDomain' />" ;
	monta += 	"<param name='allowFullScreen' value='false' />" ;
	monta += 	"<param name='movie' value='"+nome+".swf' />" ;
	monta += 	"<param name='quality' value='high' />" ;
	monta += 	"<param name='wmode' value='transparent' />" ;
	monta += 	"<embed src='"+nome+".swf' quality='high' wmode='transparent' width='"+largura+"' height='"+altura+"' name='"+nome+"' align='middle' allowScriptAccess='sameDomain' allowFullScreen='false' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer' />" ;
	monta += "</object>" ;
	monta += "</noscript>" ;
	return monta ;
}

function manipulaBalao(acao) {
	document.getElementById("balao").style.display = acao;
}

function filtroAcompanhe(inoltz) {
	if (inoltz.email.value == "digite seu e-mail") {
		alert("Favor informar o email.");
		inoltz.email.focus();
		return;
	}
	if (conferemail(inoltz.email)==true) {return;}
	
	if (inoltz.senha.value == "digite sua senha") {
		alert("Favor informar a senha.");
		inoltz.senha.focus();
		return;
	}
	if (confere(inoltz.senha,'É necessário informar a senha')==true) {return;}
	inoltz.submit();
}

function filtroAcompanhe3(inoltz) {
	if (conferemail(inoltz.email)==true) {return;}
	inoltz.action.value = 'envia_senha';
	inoltz.submit();
}

function limpaCampo(campo) {
	if (campo.name == "email") {
		if (campo.value == "digite seu e-mail") {
			campo.value = "";
		}
	} else {
		if (campo.value == "digite sua senha") {
			campo.value = "";
		}
	}
	
}
