/* window.defaultStatus = ''; */
document.onmousemove = getMousePosition;

function setmsg_status(msg)
{
   window.status = window.defaultStatus + " - " + msg;
}

function update_parent()
{
   if (window.opener && !window.opener.closed)
   {
      window.opener.location.href = window.opener.document.URL;
   }
   self.close();
}

function frm_cancelar()
{
   if (window.history.length)
   {
      history.back();

   } else if (window.opener && !window.opener.closed)
   {
      self.close();
   }
}

function href_popup(s_url, n_largura, n_altura, s_scroll, s_nome)
{
   var win  = null;
   var winl = (screen.width - n_largura)/2;
   var wint = (screen.height - n_altura)/2;
   // var s_janela = href_popup.arguments[5];
   settings = 'height='+n_altura+',width='+n_largura+',top='+wint+',left='+winl+',scrollbars='+s_scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=yes'

   if (s_nome == '')
   {
      var s_nome = 'jan';
   }

   win = window.open (''+s_url+'', ''+s_nome+'', settings);
   if (parseInt(navigator.appVersion) >= 4)
   {
      win.window.focus();
   }
}

function getCookie(NameOfCookie)
{
   if (document.cookie.length > 0)
   {
      begin = document.cookie.indexOf(NameOfCookie+"=");
      if (begin != -1)
      {
         begin += NameOfCookie.length+1;
         end = document.cookie.indexOf(";", begin);
         if (end == -1)
         {
            end = document.cookie.length;
         }
         return unescape(document.cookie.substring(begin, end));
      }
   }
   return null;
}

function setCookie(NameOfCookie, value, expiredays)
{
   var ExpireDate = new Date ();
   ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
   document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}


function delCookie (NameOfCookie)
{
   if (getCookie(NameOfCookie))
   {
      document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
}

function val_frm()
{
   lenUsuNome  = document.frm_contato.CON_USU_NOME.value.length;
   lenUsuEmail = document.frm_contato.CON_USU_EMAIL.value.length;
   lenMensagem = document.frm_contato.CON_MENSAGEM.value.length;
   var s_msg   = 'Erros(s):\n';
   var send    = true;

   if (lenUsuNome < 1)
   {
      s_msg = '' + s_msg + '' + '\nVocê precisa informar seu nome.';
      var send = false;
   }

   if (lenMensagem < 1)
   {
      s_msg = '' + s_msg + '' + '\nQual mensagem deseja nos enviar?';
      var send = false;
   }

   if (lenUsuEmail < 1)
   {
      s_msg = '' + s_msg + '' + '\nVocê precisa informar seu e-mail corretamente.';
      var send = false;
   }

   if (send)
   {
      document.frm_contato.submit();
      return true;
   } else
   {
      alert(s_msg);
      return false;
   }
}

function changeBtn(id, n_secao_atual)
{
	// var id_final = xGetElementById(id);

	xGetElementById('mn_landnorte').src = '/imgs/btn_landnorte_x.png';
	/*
	if (n_secao_atual == 3)
	{
		// id_final.src = '/imgs/btn_' + id + '_2.png';
		xGetElementById('mn_landnorte').src = '/imgs/btn_landnorte_3.png';
	} else
	{
		id_final.src = '/imgs/btn_' + id + '_3.png';
	}
	*/
}

var tempX = 0;
var tempY = 0;

function getMousePosition(e)
{
   var IE = document.all ? true : false;
   if (!IE) document.captureEvents(Event.MOUSEMOVE);

   if (IE) { // grab the x-y pos.s if browser is IE
      tempX = event.clientX + document.body.scrollLeft
      tempY = event.clientY + document.body.scrollTop
   } else { // grab the x-y pos.s if browser is NS
      tempX = e.pageX
      tempY = e.pageY
   }

   // catch possible negative values in NS4
   if (tempX < 0){tempX = 0}
   if (tempY < 0){tempY = 0}

   return true;
}

function img_mostrar (s_arquivo, n_largura, n_altura, s_titulo, s_id)
{
   var n_left = xPageX(s_id) - 130; // tempX;
   var n_top  = xPageY(s_id) - 108; // tempY;

   xWidth('box_img', n_largura + 6);
   xHeight('box_img', n_altura + 6 + 20);
   xWidth('box_img_visualizar', n_largura);
   xHeight('box_img_visualizar', n_altura);
   xWidth('box_img_fechar', n_largura);
   xLeft('box_img', n_left);
   xTop('box_img', n_top);

   xInnerHtml('box_img_visualizar','<a href="javascript:void(0)" onclick="javascript:img_fechar()"><img src="' + s_arquivo + '" width="' + n_largura + '" height="' + n_altura + '" hspace="0" border="0" /></a>');
   xInnerHtml('box_img_titulo', s_titulo);
   xShow('box_img');
}

function img_fechar()
{
   xHide('box_img');
}

var img_exterior;

var mudar = function(o) {
	if (!img_exterior) {
		img_exterior = document.getElementById('img_exterior');
	}
	img_exterior.src = o.href;
	return false;
};






