$(document).ready(function(){
	$.gaTracker(
	'UA-8459260-1',
	{
	external:	'/external/',
	mailto:		'/mailto/',
	download:	'/downloads/',
	extensions:	[
	'pdf','doc','xls','csv','jpg','gif', 'mp3',
	'swf','txt','ppt','zip','gz','dmg','xml'
	]
	}
	);
	if ($(".section-category").length || $(".section-vacation-rentals").length || $(".section-rental-properties").length) {
		//alert('yes');
		var more = $("<a style='float:right;margin:-10px 20px 0 0;' class='listing-more' href='' title='View More About This Listing' >View More Details</a>");
		$(".node-teaser .node-inner h2").after(more);
		$('.listing-more').each(function(){
			var link = $(this).parent('.node-inner').children('h2').children("a").attr('href');
			$(this).attr('href',link);
			$(this).after($('<div class="clearfix" style="display: block; clear: both;"></div>'));
		});
	}
	/** Disable the 'Temporary User' section of the user account page for non-admin users **/
	$("body.section-user #main #content ul.tabs.secondary .tab").each(function(){
		if (($(this).text() == 'Temporary User') && $("body").hasClass('not-admin'))
		{
			$(this).parent("a").click(function(e){e.preventDefault();alert('You do not have sufficient permissions.');});
		}
	});
	
	/** ADD DYNAMIC ANCHOR LINKS AND A TOP CONTAINER TO HOLD QUICKLINKS TO ALL THE GENERATED ANCHORS **/
	var anchorWrapper = $("<div class='anchors clear-block'></div>");
	$(".section-strata .fieldgroup legend").each(function(){
		var link = $("<a class='legend-anchor' name='"+$(this).text().toLowerCase()+"'>"+$(this).text()+"</a>");
		$(this).html("<a class='legend-anchor' name='"+$(this).text().toLowerCase()+"'>"+$(this).text()+"</a>");
		anchorWrapper.append("<a class='anchor-link' href='#"+$(this).text().toLowerCase()+"'>"+$(this).text()+"</a>");
	});
	$("#mission").addClass('clear-block').after(anchorWrapper);

	$("#sidebar-left ul.menu li a").each(function(){
		if ($(this).text()=='Log out') {
			$(this).css('font-weight','bold').css('text-decoration','underline').css('color','#000000');
		}

	});


	//$("body.logged-in #content").prepend("<a href='/logout' id='strataLogout' title='Click here to Log Out'>Strata Log Out</a>");
	//if(!(location.href.match(/\/strata-management/)) && !(location.href.match(/com\/$/))){
	//if(!(location.href.match(/com\/$/))){
		$("body.logged-in #content").prepend("<a href='/logout' id='strataLogout' title='Click here to Log Out'><img src='/sites/all/themes/zen/zen_classic/images/logout-button.gif'/></a>");
	//};

	// Show Tenant Application button only on "/rental-properties" page
	
	if(location.href.match(/\/rental-properties/) || location.href.match(/\/category\/long-term-rentals.*/)){
		$("body #content").prepend("<a href='/application' id='tenant-application' title='Tenant Application'><img src='/sites/all/themes/zen/zen_classic/images/tenant-app-button.gif'/></a>");
	};
	
	if((location.href.match(/\/strata-management/)) || (location.href.match(/com\/$/))){
		$("body.logged-in #content a").each(function(){
			if($(this).attr('id') == 'strataLogin' || $(this).attr('href') == '/user'){
				$(this).remove();
			}
		});


	};

	
});