function TrackTabs(TabYear){
	var s=s_gi(s_account);
	s.linkTrackVars='prop6';
	s.linkTrackEvents='';
	s.events='';
	s.prop6="'" + TabYear + "'";
	s.tl(this,'o',"'Miss Howard TV'");
}

var MissHoward = {
	activeButton : null,
	activeArea : null,
	rating: 5,
	hideShow : function(button, elem) {
		if(elem == $('#video')) {
			if (flashObj.playVideo) flashObj.playVideo();
		}
		else {
			if (flashObj.stopVideo) flashObj.stopVideo();
		}
		this.activeButton.removeClass('selected');
		this.activeArea.addClass('hidden');
		button.addClass('selected');
		elem.removeClass('hidden');
		this.activeButton = button;
		this.activeArea = elem;
	},
	showYear: function(year, elem) {
		elem.className = "current";
		$("#archiveYear span").each(function (i) {
			if(this != elem) this.className = "";
		});
		$("#leftColumn ul li").each(function (i) {
			if(this.className == 'year'+year) this.style.display = ""
			else this.style.display = "none";
		});
		TrackTabs(year);
	},
	setButton : function(elem) {
		elem.mouseover(function(e) { elem.addClass('rollover'); });
		elem.mouseout(function(e) { elem.removeClass('rollover'); });
	},
	setSubmitButton: function() {
		elem = $('#ratingSubmit');
		elem.mouseover(function(e) { elem.addClass('ratingSubmitOver'); });
		elem.mouseout(function(e) { elem.removeClass('ratingSubmitOver'); });
		elem.click(function(e) { sendMissHTVRating(MissHoward.rating); });
	},
	setRatingSystem: function() {
		$('#sliderBar').slider({
			steps: 10,
			startValue: 40,
			slide: function(e, ui) {
				MissHoward.rating = ui.value/10;
				$('#sliderBar .display').html(""+MissHoward.rating);
			}
		});
		$('#sliderBar').css("cursor", "pointer");
		$('#sliderBar .display').html(MissHoward.rating);
		$('.ui-slider-handle').show("slow");
	},
	showRating: function() {
		barWidth = (21.7 * $('#missHowardTVRating').val()); //350 is the max width of all 
		$('#ratingBar').css({display: 'none'});
		$('#ratingBar').css({width: barWidth});
		$('#ratingBar').show("slow");
	}	
};
$(function() {
	$('#gallery a').lightBox({
		imageLoading: '/images/lightbox-ico-loading.gif',
		imageBtnClose: '/images/lightbox-btn-close.gif',
		imageBtnPrev: '/images/lightbox-btn-prev.gif',
		imageBtnNext: '/images/lightbox-btn-next.gif',
		imageBlank: '/images/lightbox-blank.gif'
	});
	
	if($('#ratingSubmit').length > 0) {
		MissHoward.setRatingSystem();
		MissHoward.setSubmitButton();
	}
	else {
		MissHoward.showRating();
	}
	
	MissHoward.activeButton = $('#galleryButton');
	MissHoward.activeArea = $('#gallery');
	
	
	MissHoward.setButton($('#galleryButton'));
	$('#galleryButton').click(function(e) {
		if($('#galleryButton').hasClass('selected')) return;
		MissHoward.hideShow($(this), $('#gallery'));
	});
	
	MissHoward.setButton($('#videoButton'));
	$('#videoButton').click(function(e) {
		if($('#videoButton').hasClass('selected')) return;
		MissHoward.hideShow($(this), $('#video'));
	});
	
	MissHoward.setButton($('#twentyquestButton'));
	$('#twentyquestButton').click(function(e) {
		if($('#twentyquestButton').hasClass('selected')) return;
		MissHoward.hideShow($(this), $('#twentyQuestions'));
	});
	
	MissHoward.setButton($('#blogButton'));	
	$('#blogButton').click(function(e) {
		if($('#blogButton').hasClass('selected')) return;
		MissHoward.hideShow($(this), $('#blog'));
	});	
});
