$(document).ready(function() {

	// create non-critical navigation wrapper to keep dropdown links clickable over ie6 AlphaImageLoader filter (no js => no dropdown to begin with)
	$('#main_navigation ul').wrap('<div class="dropdown_wrap"></div>');
	
	// assign dropdown classes
	$('#main_navigation ul li:first-child').addClass('first');
	$('#main_navigation ul li:last-child').addClass('last');

	// create entry page section memory
	$('#enter_list li').each(function() {
		var section_name = $(this).attr('id');
		var new_content = $('<label><input type="checkbox" /> <span>Always take me to this site</span></label>');
		var new_input = new_content.find('input');

		$('.content a', this).before(new_content).click(function() {
			if (new_input.attr('checked')) {
				$.cookie('pge_section', section_name, {expires: 365});
			}
		});
	});

	// Print the page using print.css
	$('#print').click(function(){
		window.print();
    });

	// login page equal-height columnizer (disabled for xpand function)
	/*
	if ($('body.login').length) {
		var login = $('div.login');
		var mod_col = $('div.module_cols');
		var mods = $('div.module');

		var max_height = 1;
		
		if (login.height() > mod_col.height()) {
			mods.each(function() {
				$(this).height(login.height() - 175);
			});
		} else {
			var diff = mod_col.height() - login.height();
			login.children('.login_wrap').css('padding-bottom',20+diff);
		}
	}
	*/

	// suckerfish
	$('ul#main_navigation li').hover(function() {
		$(this).addClass('scriptfocus');
	}, function() {
		$(this).removeClass('scriptfocus');
	});

	// Logged status on top nav
	if ($.cookie('SMSESSION') == null || $.cookie('SMSESSION') == 'LOGGEDOFF'){
		var txt = $('<a href="https://www.pge.com/csol">Login</a>');
    	$('#log').html(txt);
	}
	else {
		var txt = $('<a alt="Click here to return to your account" href="https://www.pge.com/csol">Logged in</a>');
    	$('#log').html(txt);
	}

	/* TEMPORARY: Disabled the uncompleted footer options
	$("#footer .inline_nav li:gt(2)").css("display","none");
	$("#footer .inline_nav li:eq(2)").attr("class","last");
	*/

});
