$(document).ready(function(){	
	var anchors = $('a');
	anchors.filter('[rel="gall1"]').colorbox();
	anchors.filter('[rel="gall2"]').colorbox();
	anchors.filter('[rel="gall3"]').colorbox();
	
	if( document.forms[0] ){
		document.forms[0].elements[0].focus();	
	}
	
	if( $('#anthonyMap').length ){
		initMap();	
	}
	
	if( $('#home').length ){
		$('h3.collapsed').each(function(i){
			var jThis = $(this),
				 jThisContent = jThis.nextUntil('h3');
			jThisContent.hide();
			jThis.addClass('clickable');
			jThis.bind('click', function(){
				jThis.toggleClass('collapsed');
				jThisContent.slideToggle(300);
				return false;
			});
		});
		
		$('#routeLink').colorbox();
	}
	
	if( $('#askMayor').length ){
		$('p.toggle_content.hidden').css('display', 'none');
		
		$('h4.toggle_ctrl').click(function(){ 
			$(this).nextAll().toggle(200);
		});
	}
});

function initMap() {
	var latlng = new google.maps.LatLng(31.994446,-106.596479);
 	var opts = {
		zoom: 12,
		center: latlng,
		mapTypeId: google.maps.MapTypeId.ROADMAP
 	};
 	var map = new google.maps.Map(document.getElementById('anthonyMap'), opts);
	
	var marker = new google.maps.Marker({
		position: latlng, 
		map: map, 
		title:'The Town of Anthony'
	}); 
}
