function showError(str){
	$(".erro").html("<span>"+str+"<span>");
	$(".erro").fadeIn("slow");
}
function showSucess(str){
	$(".sucesso").html("<span>"+str+"<span>");
	$(".sucesso").fadeIn("slow");
}

function gotoPage(page, id){
	$("#comprarfoto").attr("action", "ver-evento.php?id="+id+"&page="+page);
	$("#comprarfoto").submit();
}

function InitDefault(){
  $('.externo').attr('target', '_blank');
  
  var params = {
    wmode:"transparent"
  };
  swfobject.embedSWF("swfs/menu.swf", "swftopo", "950", "180", "9.0.0", "mod/swfobject2.2/expressInstall.swf", "", params);
  
  Cufon.replace(".fonte", {fontFamily: "PT Sans"});
  Cufon.replace(".fonteb", {fontFamily: "PT Sans Caption"});

}

//function InitEventos(){
  
     /*
     var i = 1;
     $("#checa").click(function(){
       
       if(i == 1){
         $("form input:checkbox").attr("checked", "checked");
         $(this).text("Desmarcar tudo");
         i++;
       } else {
         $("form input:checkbox").attr("checked", "");
         $(this).text("Marcar tudo");
         i = 1;
       }
     });*/
//}
function InitEmpresa(){
	$('a[rel*=shadowbox]').lightBox();
}
function InitVerPortifolio(){
	$('a[rel*=shadowbox]').lightBox();
}
function InitServicos(){
	$('a[rel*=shadowbox]').lightBox();
}
function InitVerEventos(){
	$('a[rel*=shadowbox]').lightBox();
	
    $(".btn-finaliza-pedido").click(function(){
    	$('#comprarfoto').submit();
    });
    
    $('input:checkbox').checkbox({cls:'fotorondon-checkbox', empty:'lib/checkbox/empty.png'});

     
     var i = 1;
     $("#marcar").click(function(){
       
       if(i == 1){
         $("form input:checkbox").attr("checked", "checked");
         $(this).css('background-position', '0px -21px');
         i++;
       } else {
         $("form input:checkbox").attr("checked", "");
         $(this).css('background-position', '0px 0px');
         i = 1;
       }
     });
     
}

function InitProcessarPedido(){
	$("#pagSg").submit();
}

function InitSlider(){
      $('#slider').coinslider({
        width:770,
        height:200
      });
}
function InitCadastro(){
	function myOnComplete()
	{
	    /*
	    alert("The form validates! (normally, it would submit the form here).");
	    return false;
	    */
	}

	$("#form-cadastro").RSV({
	  onCompleteHandler: myOnComplete,
	  errorFieldClass: "errorFieldDemo5",
	  errorTargetElementId: "errocadastro",
	  displayType: "display-html",
	  errorHTMLItemBullet: "&#8212; ",
	  rules: [
			"required,nome,<em>Nome</em>",
			"valid_email,email,<em>Email</em>",
			"length>4,senha,<em>Senha</em> (No mínimo 5 caracteres)",
			"same_as,senha,confsenha,<em>Confirmação de senha</em>(Deve conter o mesmo valor do campo senha)",
			"length>10,cpf,<em>CPF</em>",
			"required,endereco,<em>Endere&ccedil;o</em>",
			"required,bairro,<em>Bairro</em>",
			"length=8,cep,<em>CEP</em>",
			"required,cidade,<em>Cidade</em>",
			"required,estado,<em>Estado</em>",
			"required,telefone,<em>Telefone</em>"
    ]
	});
}

function InitFinalizaPedido(){function InitRevelacao(){
	 $(".btn-enviar-imagens").click(function(){
		 window.location = './revelacao-online.php?envio-de-fotos=1';
	 });
}

	$("#pagamento").change(function(){
		var v = $(this).val();
		if(v == 'c1' || v == 'c2' || v == 'c3'){
			var percent = valortotal*7/100;
			var vresult = Math.round(valortotal+percent);
			$("#vtotal span").text("R$ "+vresult+",00");
		} else {
			$("#vtotal span").text("R$ "+valortotal+",00");
		}
	
		//alert($(this).val());
		/*
 		var name = $(this).attr("name");
 		var id = getNumber(name);
 		var val = $(this).val();
 		
			var vuid = "vunitario"+id;
			var valorr = valor[val];

			$("#vunitario"+id).html("R$ "+valorr+",00");

			var quantidade = $("#q"+id).val();
			var total = quantidade*valorr;

			$("#vtotal"+id).html("R$ "+total+",00");

			atualizaTotal();
			*/
	});
}



$(document).ready(function(){
  InitDefault();
});

