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

function MM_reloadPage(init) {  
  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_preloadImages() { 
  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() { 
  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_findObj(n, d) { 
  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() { 
  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 envia1(f)
{
var chosen;
escolhido=f.go1.options[f.go1.selectedIndex].value;
self.location=escolhido;
return false;
}

function arruma(src, mask) 
{
  var i = src.value.length;
  var saida = mask.substring(0,1);
  var texto = mask.substring(i)
if (texto.substring(0,1) != saida) 
  {
	src.value += texto.substring(0,1);
  }
}

		var tabAtual = 1
 
		mudarTab = function(numeroTab) {
			$("#tab_"+tabAtual).toggle()
			$("#tab_"+numeroTab).toggle()
			tabAtual = numeroTab
		}

function enquete(URL) {
aWindow=window.open(URL,"Large","toolbar=no,width=350,height=300, status=no,scrollbars=yes,resize=no,menubars=no");
}

function mostra(num)
{
    for(i=1;i<=4;i++)
    {
        document.getElementById('aba_'+i).style.display = 'none';
    }
    document.getElementById('aba_'+num).style.display = 'block';
}



function setOnde(value)
{
    document.getElementById('onde1').value = value;
    document.getElementById('n_09').innerHTML = (value==1)?'Conte�do':'Not�cias';
}

try
{
    var montharray=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
    var yr = 2010;
    var m = 06;
    var d= 21;
}
catch(ExceptionCode)
{

}
   function countdown(){
        try
        {
            theyear=yr;
            themonth=m;
            theday=d;
            var today=new Date()
            var todayy=today.getYear();
            if (todayy < 1000)
                todayy+=1900;
            var todaym=today.getMonth();
            var todayd=today.getDate();
            var todayh=today.getHours();
            var todaymin=today.getMinutes();
            var todaysec=today.getSeconds();
            var todaystring=montharray[todaym]+" "+todayd+", "+todayy+" "+todayh+":"+todaymin+":"+todaysec;
            futurestring=montharray[m-1]+" "+d+", "+yr;
            dd=Date.parse(futurestring)-Date.parse(todaystring);
            dday=Math.floor(dd/(60*60*1000*24)*1);
            dhour=Math.floor((dd%(60*60*1000*24))/(60*60*1000)*1);
            dmin=Math.floor(((dd%(60*60*1000*24))%(60*60*1000))/(60*1000)*1);
            dsec=Math.floor((((dd%(60*60*1000*24))%(60*60*1000))%(60*1000))/1000*1);
            //if(dday==0&&dhour==0&&dmin==0&&dsec==1){
            if(dmin==0 || dmin<0){
              document.getElementById(alvo).innerHTML = "00";
              return;
            }
            else
            {
                    dday = (dday.toString().length==1)?"0"+dday:dday;
                    document.getElementById('c_04').innerHTML = dday;
           }
           //setTimeout("countdown()",1000);
        }catch(ExceptionCode)
        {

        }
    }

    $(document).ready(function()
    {
	
    $('#empindex').cycle({
        fx:'scrollHorz',
        timeout: 0,
        next: '#empindexprox',
        prev: '#empindexant'
    });

    $(".ca3").CloudCarousel(
		{
			xPos: 219,
			yPos: 40,
			buttonLeft: $("#left-but"),
			buttonRight: $("#right-but"),
			altBox: $("#alt-text"),
                        xRadius: 219,
                        yRadius: -40,
                        reflHeight: 0,
                        reflGap: 0,
                        reflOpacity: 0.4,
                        speed: 0.3,
                        autoRotate: 'right',
                        autoRotateDelay: 3000,
                        FPS: 30,
			titleBox: $("#title-text")
		}
    );
        
    $('#visimagens').cycle({
        fx:'scrollHorz',
        timeout: 0,
        next: '#imgprox',
        prev: '#imgant'
    });

    $('#visplantas').cycle({
        fx:'scrollHorz',
        timeout: 0,
        next: '#pltprox',
        prev: '#pltant'
    });

    $('#vismapas').cycle({
        fx:'slideY',
        timeout: 0,
        next: '#mapaprox',
        prev: '#mapaant'
    });

    $('#visestagios').cycle({
        fx:'slideY',
        timeout: 0,
        next: '#estgprox',
        prev: '#estgant'
    });

    $('#visorientacao').cycle({
        fx:'slideY',
        timeout: 0,
        next: '#orieprox',
        prev: '#orieant'
    });
	
    $("#empree").mouseenter(function(){
        $("#prod_sub").show();
        $("#prod_sub").mouseleave(function(){
            $("#prod_sub").hide();
        });
    });

    $('.invest').fancybox();
	
	abasEmp('#mostra32');

    $('#centralimagens').show();
        $('#centralimagens').cycle({
        fx:'scrollHorz',
        timeout: 0,
        next: '#centralimgprox',
        prev: '#centralimgant'
    });
	
        try
        {
            countdown();
        }
        catch(ExceptionCode)
        {

        }
    }
);

   function carregaCotacao(){
  var mes= $("#mes").val();
  var indicativo = $("#indicativo").val();

  $("#resultado_busca").load("http://www.cattaneo.com.br/informe-se/cotacao.php?ind="+indicativo+"&mes="+mes);

  }
  
  function abasEmp(div){
    $("#load_abas div").hide();
    $(div).show();
    $(div+' div').show();
}
