// Lembrar de sempre especificar o que cada comando vai fazer
// e sempre usar da identeção pra pemitir uma melhor leitura
// do futuro desenvolvedor

$(document).ready(function() {
	$("#lista-imagens-perfil").cycle({prev: "#prev", next: "#next", before:  onBefore });
	function onBefore() {
		$("#qualperfil .fancy").hide();
		$('#'+this.alt).show();
	}
	$('a[href^=#]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
				var $target = $(this.hash);
				$target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
				var targetOffset = $target.offset().top;
				$('html,body').animate({scrollTop: targetOffset}, 1000);
				return false;
			}
		});
	$(".fancy, #maps").fancybox({
		"frameWidth": 575,
		"frameHeight": 450
	});
	$("#campanha").fancybox({
		"frameWidth": 320,
		"frameHeight": 240
	})
});

function imprimirFlash(arquivo,w,h,transparente,params,id) {
	document.write('<object' + ((typeof id == 'undefined')?'':' id="'+id+'"') + ' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="movie" value="'+arquivo+'">');
	document.write('<param name=quality value=high>');
	document.write('<param name="menu" value="false">');
	if (typeof params != 'undefined') {
		var p = '';

		for (var i in params) {
			p += i + '="' + params[i] + '" ';
			document.write('<param name="'+i+'" value="'+params[i]+'">');
		}
	}
	if (transparente) {
		document.write('<param name="wmode" value="transparent">');
	}
	document.write('<embed' + ((typeof id == 'undefined')?'':' id="'+id+'"') + ' src="'+arquivo+'" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" ');
	if (transparente) {
		document.write('wmode="transparent" ');
	}
	document.write(p);
	document.write('menu="false"></embed>');
	document.write('</object>');
}
