jQuery().ready(function() {
	var originalTabHeight;
	var newTabHeight;
	
	//jQuery('#tabs div').hide();
	var tabChildren = jQuery("#tabs").children().length;
	for (var i=1; i<tabChildren; i++){
		jQuery(jQuery("#tabs").children()[i]).hide();
	}
	
	jQuery('#tabs div:first').show();
	jQuery('#tabs ul#tabsul li.tabsli:first').addClass('active');
	jQuery('#tabs ul#tabsul li.tabsli a').click(function(){ 
		jQuery('#tabs ul#tabsul li.tabsli').removeClass('active');
		jQuery(this).parent().addClass('active'); 
		var currentTab = jQuery(this).attr('href'); 
		//jQuery('#tabs div').hide();
		for (i=1; i<tabChildren; i++){
			jQuery(jQuery("#tabs").children()[i]).hide();
		}
		jQuery(currentTab).show();
		
		if(jQuery(this).attr("id") == "panoramioLink"){
			if(typeof pI != "object"){
				// init the panoramio code
				panoramioInit();
			}
		}
		
		if(jQuery(this).attr("id") == "walkscoreLink"){
			jQuery("#tabscontainer").height(newTabHeight);
			jQuery(currentTab).height(newTabHeight);
			if(document.getElementById('walkscoreframe').src != walkscoreurl){
				document.getElementById('walkscoreframe').src=walkscoreurl;
			}
		} else if(jQuery(this).attr("id") == "censusLink" || jQuery(this).attr("id") == "censusLink2" || jQuery(this).attr("id") == "censusLink3" || jQuery(this).attr("id") == "censusLink4" ){
			jQuery("#tabscontainer").height(365);
			jQuery(currentTab).height(365);			
		}else{
			jQuery("#tabscontainer").height(originalTabHeight);
			jQuery(currentTab).height(originalTabHeight);
			
		}
		
		return false;
	});
	
	originalTabHeight =  parseInt(jQuery(jQuery("#tabs").children()[1]).height());
	newTabHeight = parseInt(jQuery("#walkscoreframe").attr("height"));
	newTabHeight++; // 1 pixel border
});
