$(document).ready(function(){
	

	$('#selCategoria').live('change',function(){
		var cat = $('#selCategoria option:selected').val();
		if(cat == "Estudante"){
			 $('#valor').val('4500');
			}
		if(cat == "Profissional"){
		 $('#valor').val('9500');
		}
   
		  
	 });
	 
	 	
	
  $('a.inativo').attr('href','javascript:void(0);');
  $('a.atual').attr('href','javascript:void(0);');
    
  $("a[href^='http'], .baixar").attr('target','_blank');
  $('.buscar').live('click', function(){
	  $('.section-full').removeClass('hide');
	  return false;
	});
	
	//box de mensagens
	$('.message').append('<em class="closeable" title="clique para fechar"></em>');
	$('.closeable').live("click",function(){
		$(this).parent().fadeOut("slow",function(){
			$('.closeable').parent().remove();
		});
		return false;
	 });
	
	//$('.resultados a').addClass('lightBox');
	$("a[rel^='prettyPhoto'],.lightBox").prettyPhoto();
	
  
  if ($.browser.webkit) {
     $('.bread-crumbs .ativo').css({backgroundPosition:'left 1px',padding:'2px 0px 3px 5px'});
	 $('.bread-crumbs .ativo > span').css({padding:'2px 15px 3px 5px'});
  }

  /* valida o formulário de contato  */
  	$('#formContato').validate();
	$('#txtFone').mask("(99) 9999-9999");
	$('#txtCelular').mask("(99) 9999-9999");
	$('#txtCpf').mask("999.999.999-99");
	$('#txtCep').mask("99999-999");
 
 
	/* Google Maps API
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>*/
	function initialize(){
		var latlng = new google.maps.LatLng(-8.059095,-34.900223);
		var myOptions = {zoom: 18,center: latlng,mapTypeId: google.maps.MapTypeId.ROADMAP};
		var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
		var marker = new google.maps.Marker({position: latlng,map: map,title:"IAB-PE : Instituto de Arquitetos do Brasil em Pernambuco"});   
	}
	
	// abre o mapda 
	$('.abreMapa').prettyPhoto({
		custom_markup: '<div id="map_canvas" style="width:900px; height:400px"></div>',	
		changepicturecallback: function(){ 
				initialize();
			}
		});
	
  //Colunas do mesmo tamanho
  equalHeight($(".coluna"));
 
  function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
  }
	
	
	$('.plano4 a')
		.mouseover(function(){
			$(this).stop().animate({backgroundPosition:"(-1px -30px)"}, {duration:500})
		})
		.mouseout(function(){
			$(this).stop().animate({backgroundPosition:"(-1px 0)"}, {duration:250, complete:function(){
				$(this).animate({backgroundPosition:"(-1px 0)"})
			}})
		})
 	
//fim document					   
});

/**
 * @author Alexander Farkas
 * v. 1.02
 */
(function($) {
	$.extend($.fx.step,{
	    backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
			}
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
	});
})(jQuery);


