// JavaScript Document

jQuery.showHide2 = function() {
	 var ocampo = arguments[0];
	 var classe = arguments[1];
	 var displa = arguments[2];
	 var oform =ocampo.form;
	 $("div[class="+classe+"]").each(function() {
		if(displa=='some') { 
			$(this).slideUp('normal');
		}
		if(displa=='apar') {
			$(this).slideDown('normal');
		}
	 })
}

function confaction(msg) {
	msg="Tem certeza que deseja\n"+msg;
	var resp = confirm(msg);
	return resp;
}

function OpenSaibaMais(){
window.open('byvisa.php','principal','height=435,width=270,top=0,left=0,resizable=no,status=1');
}

jQuery.preloadImages = function() {
  for(var i=0; i<arguments.length; i++)   {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$(function(){
	//$.preloadImages("img/ani_home/foto0.jpg","img/ani_home/foto1.jpg","img/ani_home/foto2.jpg","img/ani_home/foto3.jpg");
	
	if($("#ani_home").length>0) {
		var rand_no = Math.floor(4*Math.random());
		afoto=ender+"img/ani_home/foto"+rand_no+".jpg";
		$("#foto_ani").attr("src",afoto);
	}
	
	// fix for target="_blank"
	$("a[rel*='external']").click(function(){
		window.open($(this).attr("href"), 'janela','scrollbars=yes,resizable=yes,width=800,height=600');
		return false;
	});
	
    // Submenus
	var initz = $(".menutree").css("z-index");
	$('.menumain').click(function () {
	$(this).next().slideToggle('normal', function() {
		initz++;
		$(this).css("z-index",initz );
		});
    });
	
	// Cadastro prof: veri
	$("#cadastrado1").click(function() {$.showHide2(this,'hideit','some')});
	$("#cadastrado2").click(function() {$.showHide2(this,'hideit','apar')});
	
	$("#bt_noticias").click(function() {
		$("#bx_twitter").css('display','none');
		$("#cont_noticias").fadeIn('normal');
	});
	$("#bt_twitter").click(function() {
		$("#cont_noticias").css('display','none');
		$("#bx_twitter").fadeIn('normal');
	});
	
	// Gera recibo
	$('.gera_recibo').click(function() {
		var bradesco = $(this).attr('href');
		window.location.href="comprovanteBradesco.php?bradesco="+bradesco;
		return true;
	})
	
});

