// ancora padrao que leva ao topo de cada pg.
document.write ("<a name=topo></a>");
	hoje = new Date()
	dia = hoje.getDate()
	dias = hoje.getDay()
	mes = hoje.getMonth()
	ano = hoje.getYear()
	 if (dia < 10)
	  dia = "0" + dia
	 if (ano <200)
	 ano = 1900 + ano
	 if (ano < 2000)
     ano = "19" + ano
	 
 function CriaArray (n) {
 this.length = n }
 NomeDia = new CriaArray(7)
 NomeDia[0] = "Domingo"
 NomeDia[1] = "Segunda-feira"
 NomeDia[2] = "Terça-feira"
 NomeDia[3] = "Quarta-feira"
 NomeDia[4] = "Quinta-feira"
 NomeDia[5] = "Sexta-feira"
 NomeDia[6] = "Sábado"
 //
 NomeMes = new CriaArray(12)
 NomeMes[0] = "Janeiro"
 NomeMes[1] = "Fevereiro"
 NomeMes[2] = "Março"
 NomeMes[3] = "Abril"
 NomeMes[4] = "Maio"
 NomeMes[5] = "Junho"
 NomeMes[6] = "Julho"
 NomeMes[7] = "Agosto"
 NomeMes[8] = "Setembro"
 NomeMes[9] = "Outubro"
 NomeMes[10] = "Novembro"
 NomeMes[11] = "Dezembro"
 //&#231; &#225;
 function criaData(){
 document.write (""+ NomeDia[dias] + ", " + dia + " de " + NomeMes[mes] + " de " + ano +"")
 }
 function criaRelogio(){
    momentoAtual = new Date()
    hora = momentoAtual.getHours()
    minuto = momentoAtual.getMinutes()
    segundo = momentoAtual.getSeconds()

    str_segundo = new String (segundo)
    if (str_segundo.length == 1)
       segundo = "0" + segundo

    str_minuto = new String (minuto)
    if (str_minuto.length == 1)
       minuto = "0" + minuto

    str_hora = new String (hora)
    if (str_hora.length == 1)
       hora = "0" + hora

	
    horaImprimivel = hora + " : " + minuto + " : " + segundo

    rel = document.getElementById('relogio');
	rel.value = horaImprimivel;

    setTimeout("criaRelogio()",1000) 
}

 //função abre página em popup
 function popup(pagina,janela,parametros) {
	 win=window.open(pagina, janela, parametros); 
	 text = "Se a janela nao estava abrindo\ntalvez seja porque voce tenha um\nprograma e/ou browser bloqueador de pop-up!";
		if(win == null) { alert(text); return; }
 } 
// Função paa abrir galeria de imagem DALBUM em fullscreen
function telacheia(quem)
{	
var agt=navigator.userAgent.toLowerCase();
   	var is_ie   = (agt.indexOf("msie") != -1);
	var features;
	if (is_ie)
	{
	 	features="fullscreen=yes";
	}
	else
	{
		features="toolbar=0,scrollbars=1,location=0,border=0,status=0,menubar=0,";
		features=features + 'outerHeight=' + screen.availHeight + ',outerWidth=' + (screen.availWidth-2);
	}
	var w=window.open(quem,'fullscreen',features);
	if (w!=null)
	{
		if (!is_ie && screen.availLeft!=null && screen.availTop!=null)
			w.moveTo(screen.availLeft,screen.availTop);
		w.focus();
	}
}
function addSWF (URL, WIDTH, HEIGHT, TRANSPARENT)
{
document.write (' <object classid="clsid:27CDB6E-AE6D-11cf-96B8-444553540000" ');
document.write (' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" ');
document.write (' width="'+ WIDTH +'" height="'+ HEIGHT +'">');
document.write (' <param name="movie" value="'+ URL +'" />');
document.write (' <param name="quality" value="high" />');

if ( TRANSPARENT ) {
  document.write (' <param name="Wmode" value="Transparent" />'); 
}

document.write (' <embed src="'+ URL +'" quality="high" ');

if ( TRANSPARENT ) {
document.write (' Wmode = "transparent" ');
}

document.write (' pluginspage="http://www.macromedia.com/go/getflashplayer" ');
document.write (' type="application/x-shockwave-flash" width="'+ WIDTH +'" height="'+ HEIGHT +'"></embed> ');
document.write (' </object>');

}

function addFavorito(){
    var url      = "http://www.centralcaj.com.br";
    var title    = "Grupo Central de Cobranças";
    if (window.sidebar) window.sidebar.addPanel(title, url,"");
    else if(window.opera && window.print){
        var mbm = document.createElement('a');
        mbm.setAttribute('rel','sidebar');
        mbm.setAttribute('href',url);
        mbm.setAttribute('title',title);
        mbm.click();
    }
    else if(document.all){window.external.AddFavorite(url, title);}
}

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_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_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_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 iniciarChat(obj){
		if(obj=='S'){
			/*Credit: JavaScript Kit www.javascriptkit.com more JavaScripts here.*/
			win=window.open("/chatonline/livehelp.php?department=1","","width=550,height=450,scrollbars=no");
			//interceptacao de erro na abertura da janela
			text = "Se a janela nao estava abrindo\ntalvez seja porque voce tenha um\nprograma bloqueador de pop-up!";
			if(win == null)
			{ 
				alert(text); 
				return;
			}
			//fim
			win.moveTo(150,150);
		}else{
			window.location='contato.php';
		}
}
