jQuery(function($) {
		$(".selected .expand-button").parent().addClass("open");
		//Create the accordion box.
		var selectedSection = -1;
		$("#accordion h3").each(function(index,element) {
			if($(element).hasClass("section-selected"))
			{
				selectedSection = index;
			}
			
		});
		
		if(selectedSection == -1){
			selectedSection = false;
		}
		$("#accordion").accordion({ autoHeight: false, collapsible: false, active: selectedSection});
		
		if (jQuery.browser.msie && jQuery.browser.version.substr(0,1)<8) {
			
			jQuery("#accordion").accordion("option", "animated", false);
   			
	   		$(".expand-button:not(.selected .expand-button)").click(function(){
				$(this).parent().children("ul").toggle();
				$(this).parent().toggleClass("open");
				}
			);
		
		}else{
			$(".expand-button:not(.selected .expand-button)").click(function(){
				$(this).parent().children("ul").toggle("show");
				$(this).parent().toggleClass("open");
				}
			);
		}
		
		$(".expand-button:not(.selected .expand-button)").hover(function(){
				$(this).toggleClass("hover"); 
			}, function(){
				$(this).toggleClass("hover");
			});

		$('.seminarPopup').popupWindow({ 
			centerBrowser:1,
			height:600,
			width:760,
			location:0,
			menubar:0,
			resizable:1,
			scrollbars:1,
			status:1,
			toolbar:0
		});
		
		$('#SearchForm_SearchForm_Search').click(function(){
			$(this).val('');
		});
		
		// Fix on page links
		/*
		var pathname = window.location.pathname;
		$("#content a[href^='#']").attr('href', function(i, val) {
			return pathname + val
		});
		*/	
			
		$("a[href$='.pdf'],a[href$='.PDF']").click(function(e){
			trackEvent('PDF Download', $(this).attr("href"));
		});
		

		$("a[href^='mailto']").click(function(e){
			trackEvent('Mail To', $(this).text());
		});
		
		$("a.member-login").click(function(e){
			trackEvent('LG Online', 'Member');
		});
		
		$("a.employer-login").click(function(e){
			trackEvent('LG Online', 'Employer');
		});
		
		$(".calcbox a").click(function(e){
			trackEvent('Calculator', $(this).text());
		});
	
				
	});
	jQuery.noConflict();
	
	
function trackEvent(category, action, opt_label, opt_value) {
    _gaq.push(['_trackEvent', category, action, opt_label, opt_value]);
}
