/* author: Diogo Righi Barbosa
   e-mail: diogorighi@gmail.com
   agencia: Ratts Ratis Comunicação  */

$(function(){
	//scroll
	
	$('ul.menu_preto, ul.menu_branco ').localScroll();

	//Numero de Seguidores
	
	$.ajax({
		url: 'http://api.twitter.com/1/users/show.json',
		data: {screen_name: 'seisemponto'},
		dataType: 'jsonp',
		success: function(data) {
			$('#followers').html(data.followers_count);
		}
	});
	
	//Google Maps
	
	function inicializar() {
		var latlng = new google.maps.LatLng(-5.821707,-35.213593);
		
		var styles = [
		{
			featureType: "landscape.natural",
			elementType: "all",
			stylers: [
				{ hue: "#90142e" },
				{ saturation: 67 },
				{ lightness: -65 }
			]
		},{
			featureType: "road.highway",
			elementType: "all",
			stylers: [
				{ hue: "#ffdd00" },
				{ saturation: 100 },
				{ lightness: -22 }
			]
		},{
			featureType: "road.local",
			elementType: "all",
			stylers: [
				{ hue: "#ffdd00" },
				{ saturation: 100 },
				{ lightness: -50 }
			]
		}
		];
		
		var options = {
			mapTypeControlOptions: {
				mapTypeIds: [ 'Styled']
			},
			center: latlng,
			zoom: 16,
			mapTypeId: 'Styled',
			streetViewControl: false,
			scaleControl: false,
			mapTypeControl: false
		};
		
		var map = new google.maps.Map(document.getElementById("map_canvas"), options);
		var styledMapType = new google.maps.StyledMapType(styles, { name: 'Seis em Ponto' });
		map.mapTypes.set('Styled', styledMapType);
		
		var image = new google.maps.MarkerImage(
		  'http://www.ratts.com.br/icons/icon_seisemponto.png',
			new google.maps.Size(50,50),
			new google.maps.Point(0,0),
			new google.maps.Point(0,-10)
		);
		
		var marker = new google.maps.Marker({
			clickable: false,
			position: latlng, 
			map: map,
			title:"Seis em Ponto",
			icon: image
		});   
	}
	
	inicializar();
	
	var $followers = $('#followers').text();
	if($followers == '') {
		$('<strong>muitos</strong>').appendTo('#followers')	
	}
	
	//Fancybox Newsletter
	$('#newsletter_fancy').fancybox();
	$('#fotos_col_left ul li a').fancybox({
		openEffect	: 'none',
		closeEffect	: 'none',
		helpers		: { 
			title	: { type : 'inside' },
			buttons	: {},
			overlay	: {
				opacity : 0.8,
				css : {
					'background-color' : '#000'
				}
			},
			thumbs	: {
				width	: 50,
				height	: 50
			}
		}
	});
	
	$('#testeteste').click(function(){
		var url = $(this).attr('href');
		alert(url)
		window.location.replace(url);	
	});
	
	
});
