$(document).ready(function() {
	
$('a img').parents('a').css('border','none');
	
var menuHoverActive = true;
	
	// drop-down menu
	$('#block-system-main-menu ul li').hover(
		function() {
			if (menuHoverActive == true) {
				menuHoverActive = false;
	  			$(this).children("ul").children("li").slideDown(100, function() { menuHoverActive = true; });
			}
		},
		function() {
	  			$(this).children("ul").children("li").slideUp(100, function() { menuHoverActive = true; });
				menuHoverActive = true;
		}
	);
	
	// hide Login link in main nav for not-front pages
	$("body.not-front li a[title=Login]").parents('li').hide();
	
	// right sidebar rollovers
	$('#block-views-featured-items-block .node').hover(
		function() {
	  		$(this).css("background-position-y","-25px");
		},
		function() {
	  		$(this).css("background-position-y","0");
		}
	);
	
	// quick links block manipulation
		
	var quickLinkIndex = 0;
	var quickLinkUrl;
	$("#block-views-quick-links-block .quick-link-url").each(function(quickLinkIndex) {
		quickLinkUrl = $(this).html();
		$(this).parents(".views-field").siblings(".views-field-field-icon").children().wrap('<a href="http://' + quickLinkUrl + '" />');
		quickLinkIndex ++;	
	});
	
	// append destination parameter to login / logout links in main nav
	// destination parameters are converted to the js var "args"
	// via the function convert_current_path_to_js_vars() in
	// template.php
	
	// exclude the My Account link which uses the same path
	
	var exclude;
	
	$("#block-system-main-menu a").each(function() {
		if($(this).text() == 'My Account') { exclude = $(this) }
	});
	
	$("#block-system-main-menu a[href='/user']").not(exclude).attr('href',('/user/login?destination=' + args));
	
	$("#block-system-main-menu a[href='/user/logout']").attr('href',('/user/logout?destination=' + args));

		
});
