$(function(){
	$("a[rel^='prettyOverlay']").prettyPhoto({
  animationSpeed: 'normal',
  padding: 40,
  opacity: 0.35,
  showTitle: false,
  allowresize: true,
  counter_separator_label: ' de '
 });
	//alert("teste");
	$("#topicos h3 a").click(function(){
			var target = $(this).parents().next('div.top-info');
			$("div.top-info:visible").not(target).slideUp();
			target.slideToggle();
			return false;
			
		});

/*		
	var precheck = $(".slide_input").attr("checked");
	var pretarget = $(".slide_input").parents().siblings('div.details');
	if(precheck == true) {
		pretarget.show();
	} else {
		pretarget.hide();
	};
*/
	
	$(".slide_input").each(function(){
		if ($(this).is(':checked')) {
			$(this).parents().siblings('div.details').show();
		} else {
			$(this).parents().siblings('div.details').hide();
		}
	});


	$(".slide_input").click(function(){
			var check = $(this).attr("checked");
			var target = $(this).parents().siblings('div.details');
			//$("div.details:visible").not(target).slideUp();
			if(check == true) {
				target.slideDown();
			} else {
				target.slideUp();
			}		
		});

	$(".opt_orc p span input").click(function(){
			var check = $(this).attr("checked");
			var target = $(this).parents().parents().siblings('p.dets');
			target.slideToggle();		
		});
	
	
	$(".help-icon").mouseover(function(e){
		var x = $(this).offset().left;
		var y = $(this).offset().top;
		var clientW = document.body.clientWidth;
		var itemW = (x+30)+180;
		
		hContainer = $(this).parents("div").eq(0);
		help = $(hContainer).children(".ovrHelp");
		
		if (itemW > clientW) {
			$(help).css({ "left":x-210,"top":y }).show();
		} else {
			$(help).css({ "left":x+30,"top":y }).show();
		}
	}).mouseout(function(){
		$(help).hide();
	});

		$(".help-icon").click(function(){
			return false;	
		});
		
});

