/*
 
Correctly handle PNG transparency in Win IE 5.5 & 6.
http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.

Use in <HEAD> with DEFER keyword wrapped in conditional comments:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->

*/
/*
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters)) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}

*/




function procurar() {
    //first, call the same validation function used in the form.onsubmit event handler
    //var thisresult = validateMyForm();
    //alert('submitMyForm: validateMyForm returned: ' + thisresult);

    //if the function returned true, submit the form
    //if (thisresult) 
    //{
      //  alert('submitMyForm: javascript will submit form');
        //document.searchForm.submit();
    //}
	
	
	if (document.pesquisar.pesq.value == "Pesquise aqui..." || document.pesquisar.pesq.value == "") { 
		alert("Escreva algo para procurar");
		return false;
	}
		
	//document.pesquisar.submit();

	else { document.pesquisar.submit(); return true; }
}


function getElementsByName_iefix(tag, name) {
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}


function abre_menu2(sub1,sub2,sub3) {
		if (sub1 == "") sub1 = sub2;
		if (sub2 == "") sub2 = sub3;
		
 		if (document.getElementById(sub1)) document.getElementById(sub1).style.display = "block";
		if (document.getElementById(sub2)) document.getElementById(sub2).style.display = "block";
		//document.getElementById(sub3).style.textDecoration = "underline";	
		
		if (document.getElementById(sub3)) document.getElementById(sub3).style.fontWeight = "bold";
}

function abre_menu(sub) {
		var tabela = document.getElementById(sub).style;       
        if(tabela.display=="") tabela.display="none";
        else tabela.display="";
}

function abre_menu_nivel(sub,nivel) {	
		var init_state = document.getElementById(sub).style.display;
		
		var tag = "tr";
		//if (nivel = "nivel2") tag = "tr";
		//alert(nivel);	
		
		var tamanho = getElementsByName_iefix(tag,nivel).length;

		for(var i = 0; i < tamanho; i++) {
				var id = getElementsByName_iefix(tag,nivel)[i].id;
				//document.getElementById(id).style.display = "none";
		}	
		
		if(init_state == "none") abre_menu(sub);
	
}


     
x = screen.width; 
y=  screen.height;
t = x / 2;
l = y / 2;
	 
function popUp(foto,nome) {
	window.open("/../../popup.php?foto="+foto,"Produto","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=50,height=50,top="+t+",left="+l+"");
 }
 
 function popup_filmes(foto,nome) {
	window.open("/../../popup_filme.php?foto="+foto,"Produto", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=425, height=344, top="+t+",left="+l+"");
 }
 
<!--Funcoes para flash -->

function InsertSampleMovie() {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="510" height="120">\n');
 		document.write('<param name="movie" value="images/banner_legislativas.swf">\n');
  		document.write('<param name="quality" value="high">\n');
		document.write('<embed src="images/banner_legislativas.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="510" height="120"></embed>\n');
		document.write('</object>\n');
}

$(document).ready(function() {
	$("a[rel^='prettyPhoto']").prettyPhoto({
				animation_speed: 'normal', /* fast/slow/normal */
				slideshow: 5000, /* false OR interval time in ms */
				autoplay_slideshow: true, /* true/false */
				opacity: 0.80, /* Value between 0 and 1 */
				show_title: true, /* true/false */
				theme: 'pp_default', /* pp_default / light_rounded / dark_rounded / light_square / dark_square / facebook */
				overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
				});
	
	
	
	// Regular hover
	$(".hover").hover(function() {
		var img = $(this).attr("src");
		var hover = img.replace(".png","_over.png");
		$(this).attr({"src":hover});
	}, function() {
		var img = $(this).attr("src");
		var hover = img.replace("_over.png",".png");
		$(this).attr({"src":hover});
	});
	
	
	//menu produtos e cursos
	// Submenu hover
	$(".hover2").hover(function() {
		var target = $(this).css('backgroundImage').replace(/^url|[\(\)]/g, '');
		var hover = target.replace(".png","-hover.png");
		$(this).css('background-image', 'url('+hover+')');
	}, function() {
		var target = $(this).css('backgroundImage').replace(/^url|[\(\)]/g, '');
		var hover = target.replace("-hover.png",".png");
		$(this).css('background-image', 'url('+hover+')');
	});
	
	$(".produto_small_top").hide();
	
	$(".produto_small").hover(function() {
		$(this).parents('div:eq(0)').find('.produto_small_top').show();
		}, function() {
		$(this).parents('div:eq(0)').find('.produto_small_top').hide();
	});
});

function goTop()
{
	window.scrollTo(0,0);
}
