$().ready(function(){
	$('.list_questions a.link').each(function(){
		$this=$(this);
		$this.parent().next().hide();
		$this.click(function(){
			var $tgtli= $(this).parent().parent().get(0);
			var $tgtdiv= $(this).parent().next();
			if($tgtli.className==""){
				$tgtdiv.animate({opacity:'show'},'slow');
				$tgtli.className="expand";
			}else{
				$tgtdiv.hide();
				$tgtli.className="";
			};
			return false;
		});
	});
	
	$('ul#navlist > li').each(function(index,elem){
		$(this).hover(function(){
			if($(this).get(0).className.indexOf("current_page_item")<0){
				if($("body").get(0).className=="Services" && index==1){
				}else{
					$(this).css({backgroundPosition:"center -60px"});
					$(this).children().css({textDecoration:"none"});
				}

			};
			if($(this).prev().get(0)){
				if($(this).prev().get(0).className.indexOf("current_page_item")<0){
					if($("body").get(0).className=="Services" && (index-1)==1){
					}else{
						$(this).prev().css({backgroundPosition:"center 0"});
						$(this).prev().children().next().hide();
					}
				}
			}
			if($(this).next().get(0)){
				if($(this).next().get(0).className.indexOf("current_page_item")<0){		
					if($("body").get(0).className=="Services" && (index+1)==1){
					}else{
						$(this).next().css({backgroundPosition:"center 0"});
						$(this).next().children().next().hide();
					}
				}
			}

		}, function(){
			
			if($(this).get(0).className.indexOf("current_page_item")<0){
				if(index!=1){
					$(this).css({backgroundPosition:"center 0"});
					//$(this).children().css({textDecoration:"underline"});
					
				}
			}
		});
	});
	$('ul#navlist ul li a:eq(0)').parent().parent().parent().hover(function(){
		$(this).children().next().fadeIn();
	},function(){
		
		//$(this).next().hide();
	});
	$('ul#navlist ul li a').each(function(index,elem){
		$(this).hover(function(){
			if($(this).parent().parent().parent().get(0).className.indexOf("current_page_item")<0){	
				if($("body").get(0).className!="Services"){
					$(this).parent().parent().parent().css({backgroundPosition:"center -60px"});
				}
			}
		},function(){});
	});

	$('ul#navlist ul').hover(function(){},function(){
		
		$(this).fadeOut(function(){
			if($(this).parent().get(0).className.indexOf("current_page_item")<0){
				if($("body").get(0).className=="Services"){
				}else{
					$(this).parent().css({backgroundPosition:"center 0"});
				}

			};
		});
	});

	$('ul#navlist ul li:last').css({border:"none"});
	$('<li class="last"><img src="/wp-content/themes/talltrees/images/spacer.gif" /></li>').insertAfter('ul#navlist ul li:last');
});
