$(document).ready(function(){
	
	var qstr = document.location.search.substring(1);	
	if ((qstr) && (qstr == 'OpenUpdate'))
	{		
	   $('li#sub-menu3').find('ul').css('display','block');	   
		
	}
	
	$('li#sub-menu,li#sub-menu2,li#sub-menu3').hover(
	function() { $('ul',this).css('display','block');
			
	$(this).parent().css('margin-top','0px');
	$(this).parent().css('background-position','left 70%');
		
	},
	function() { $('ul',this).css('display','none');
	
	$(this).parent().css('background-position','left 70%');
	}
	

	);
	
	
	
	

	$(".btn-slide").click(function(){			
		$(this).parent(['div']).find('div.panel').toggle();		
		
		 var image = $(this).children('img');		
		 
		 if (image.attr('src') =="images/morebtn.png")	 {
			
					image.attr('src',"images/less.png");						
				
				}
			else 	{
				image.attr('src',"images/morebtn.png");
				anchor = '#anchor-' + $(this).parent(['div']).attr('id');					
				window.location.href=anchor;								
				
				}					 		 	 
	
	return false;
		 
	});

	
	$(".print").click(function(){		 
	 	var id = $(this).parent(['div']).attr('id');
	
	 	var divId = ".article#" + id;
	 	
	 	$(divId).printElement({ overrideElementCSS: ['print.css'],pageTitle: 'St. Ledger-Roty Neuman & Olson LLP ... slrno@slrno.com'});
	
	return false;	
		
	});
	
	$(".print-all").click(function(){
		
		$('div#all-articles').printElement({ overrideElementCSS: ['print.css'],pageTitle: 'St. Ledger-Roty Neuman & Olson LLP ... slrno@slrno.com'});
	 
	 return false;	
		
	});
	
	// highlight and fade background on named anchors
	// requires jquery.color.js http://plugins.jquery.com/project/color
	function highlight(elemId){	
	    var elem = $(elemId);
	    elem.css("backgroundColor", "#ffffff"); // hack for Safari
	    //elem.animate({ backgroundColor: '#ffffaa' }, 1500);
	    elem.animate({ backgroundColor: 'pink' }, 1500);
	    setTimeout(function(){$(elemId).animate({ backgroundColor: "#ffffff" }, 3000)},1000);
	}
	   
	if (document.location.hash) {
	    highlight(document.location.hash);
	}
	$('#main a[href*=#]').click(function(){
	    var elemId = '#' + $(this).attr('href').split('#')[1];
	    highlight(elemId);
	});
	
	
});
