/* Bryan Kwon */
$(function() {
    
// add a class of noUl to the top nav list elements for distinct styling.
$('#nav > ul > li').eq(0).addClass('noUl').end()
                   .eq(4).addClass('noUl');

/* dropdown menu */                 
    $('#nav ul li').hover(function() {
		$(this).addClass('hover');
		$('ul:first', this).css('visibility', 'visible');
		Cufon.refresh('#nav > ul > li > a');
    }, function() {
        $(this).removeClass('hover');
        $('ul:first', this).css('visibility', 'hidden');
		Cufon.refresh('#nav > ul > li > a');
    });

$('#stockquote').css('cursor', 'pointer').click(function() {
	window.location = '/s/StockInfo.asp';
});
   
/* if subpages, */
if($('body#sub').length) {
	$('#nav > ul > li').removeClass('active');
	var thisSub = $('#sidebar > h2').text().toLowerCase().replace(/ /g,'').replace(/&/g,'');
	$('#nav > ul > li').filter('#' + thisSub).addClass('active');
	
	$('#sidebar ul li').removeClass('active')
	var thisPage = $('#main > h2:first').text().toLowerCase().replace(/ /g,'').replace(/&/g,'');
	$('#sidebar ul li').filter('.' + thisPage).addClass('active');
	
	var theStripe = "<img id='stripes' src='/i/common/stripe_" + thisSub + ".png' />";
	$('#wrapper_in').prepend(theStripe);
	
	// Newsletter placeholder text
	$('#email').addClass('placeholder');
	$('#email').bind('focusin', function(event){
	var obj = $(event.target);
		obj.removeClass('placeholder');
		if(obj.val() == obj.attr('title')) obj.val('');
	});
	$('#email').bind('focusout', function(event){
		var obj = $(event.target);
		if((obj.val() == '') || (obj.val() == obj.attr('title'))) {
			obj.val(obj.attr('title'));
			obj.addClass('placeholder');
		}
	});
	
} else { // home page
	$('#wrapper_in').prepend("<img id='stripes' src='/i/common/stripe_home.png' />");
}

});

