// JavaScript Document
function initMenu() {
	
  $('.menuLevel1 ul').hide();
  $('.menuLevel1 ul:first').hide();
  $('.menuLevel1 li a.startLevel1').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('.menuLevel1 ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
      }
    );
  }

function initMenu2() {
  $('.menuLevel2 ul').hide();
  $('.menuLevel2 ul:first').hide();
  $('.menuLevel2 li a.startLevel2').click(
    function() {
      var checkElement = $(this).next();
      if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
        return false;
        }
      if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
        $('.menuLevel2 ul:visible').slideUp('normal');
        checkElement.slideDown('normal');
        return false;
        }
      }
    );
  }
 
$(document).ready(function() {
	initMenu(); 
	initMenu2();
 
 
 
 //Funcőes Básicas

    /* Target hack - para Strict */
    $('a.blank').click(function() {
        $(this).attr("target", "_blank");
    });

    $('a.self').click(function() {
        $(this).attr("target", "_self");
    });

    $('a.parent').click(function() {
        $(this).attr("target", "_parent");
    });

    /* Limpa o Input ao clicar */
    $('input:text').focus(function() {
        if ($(this).val() == $(this).attr("title")) {
            $(this).val("");
            if ($(this).hasClass("password")) {
                $(this).attr("type", "password");
            }
            $(this).bind("blur", function() {
                if ($(this).val() == '') {
                    if ($(this).hasClass("password")) {
                        $(this).attr("type", "text");
                    }
                    $(this).val($(this).attr("title"));
                }
            });
        }
    });

    // Ancoras
    $("#divAncoras a").click(function() {
        var e = $(this).attr("href");
        $(window).scrollTop($(e).offset().top + 30)
        return false;
    });
	
	var alturaEsquerda = $(".divSidebar").height();
	var alturaDireita = $(".divConteudo").height();
	if(alturaEsquerda > alturaDireita)
	{
	$(".divConteudo").css("height", alturaEsquerda);
	}
	else if(alturaDireita > alturaEsquerda)
	{
	$(".divSidebar").css("height", alturaDireita);	
	}

});

function getFlashMovieObject(movieName) {
	if (window.document[movieName]) {
		return window.document[movieName];
	}
	if (navigator.appName.indexOf("Microsoft Internet")==-1) {
		if (document.embeds && document.embeds[movieName]) return document.embeds[movieName]; 
	}
	else {
		return document.getElementById(movieName);
	}
}

function toggle(i) {
	if($(i).is(":hidden")) $(i).show();
	else $(i).hide();
}



// LIGHTBOX



//POP-UP

//tamanho tela FF
var w = 1017;
var h = 670;
//onload = start;
//onresize = start;
var x = (screen.width/2)-(w/2);
var y = (screen.height/2)-(h/2);
//tamanho tela I.E
if (navigator.appName=="Microsoft Internet Explorer") {
	w = 1024;
	h = 768;
	var x = (screen.width/2)-(w/2);
	var y = (screen.height/2)-(h/2);
}
 function mypopup( caminho )
 {
window.open (caminho,"_blank","top="+y+", left="+x+", location=0,status=1,scrollbars=1, location=no, width="+w+",height="+h+"");
 }
 
 
function openWindow() {
	if ((screen.width<1024) && (screen.height<768)) {
		window.open('index.html','','top='+y+', left='+x+',width=790,height=540,resizeable=0,scrollbars=1');
	} else {
		window.open('index.html','','top='+y+', left='+x+',width=795,height=592,resizeable=0,scrollbars=1');
	}
}
 









