
	jQuery('document').ready( function() {
		
		if(jQuery.browser.msie && jQuery.browser.version.substr(0,1) < 7) {
			var spacerGif = "http://www.macmillanmh.com/tlxnews/wp-content/themes/tlx/img/spacer.gif";
			jQuery("img[src$='.png']").each(function() {
				var src = jQuery(this).attr('src');
				jQuery(this).attr("src", spacerGif).attr("style", "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "');");
			});
			
			jQuery("input[src$='.png']").each(function() {
				var src = jQuery(this).attr('src');
				src = src.split('.png').join('-ie.gif');
				jQuery(this).attr("src", src);
			});
		}

		jQuery("#expand").click( function() {
			if( jQuery("#essential ul:visible").length ) {
				jQuery("#essential ul").slideUp('slow');
				jQuery(this).children('img').attr('src', '/tlxnews/wp-content/themes/tlx/img/essential-more.gif');
			} else {
				jQuery("#essential ul").slideDown('slow');
				jQuery(this).children('img').attr('src', '/tlxnews/wp-content/themes/tlx/img/essential-less.gif');
			}
			return false;
 		});

		/** slideshow module **/
		jQuery('#slideshow-images').cycle({
			prev:   '#slideshow-prev',
			next:   '#slideshow-next',
			timeout: 0,
			before: function() {
				jQuery('#slideshow-credit').html(this.title);
				jQuery('#slideshow-caption').html(this.alt);
			}
		});


//		jQuery("#essential-holder").height( jQuery("#essential").height() - 15 );
		jQuery("#glossary dd, #glossary dt").hide();
		jQuery("#glossary dd:first").show();
		jQuery("#glossary dt:first").show();

		jQuery("#team ul li").hide()
			.filter('.prev').show().end()
			.filter('.next').show().end()
			.eq(1).show().end()
			.eq(2).show();

		/** show image titles **/
		jQuery('.wp-caption').each(function() {
			var title = jQuery(this).find('img').attr('title');
			if(title.length) {
				jQuery(this).find('p.wp-caption-text').prepend('<small>' + title + '</small><br />');
			}
		});
		
		jQuery("a[rel^='prettyPhoto']").prettyPhoto({theme: 'dark_rounded'}); 
		jQuery("#helpVideo").click();
		
	});



	function pollShowResults() {
		pollVote(-1);
	}

	function pollVote(poll, answer) {
		jQuery("#poll-inside").load("/tlxnews/wp-content/plugins/dt-polls/vote.php?poll=" + poll + "&ans=" + answer);
		return false;
	}

	function loadTeamBio(member) {
		var html = jQuery('#' + member).children('div').html();
		jQuery("#teamBio").html( html );
	}

	function prevBio() {
		var res = jQuery("#team ul li:visible").eq(1).prevAll('li').not('.prev');
		if( res.length ) {
			jQuery("#team ul li:visible").not('.prev').eq(1).hide();
			res.eq(0).show();
		}
	}

	function nextBio() {
		var res = jQuery("#team ul li:visible").not('.prev').eq(1).nextAll('li').not('.next');
		if( res.length ) {
			jQuery("#team ul li:visible").not('.prev').eq(0).hide();
			res.eq(0).show();
		}
	}

	function prevTerm() {
		if( jQuery("#glossary dd:visible").prevAll('dd').length ) {
			jQuery("#glossary dd:visible").hide().prevAll('dd').eq(0).show();
			jQuery("#glossary dt:visible").hide().prevAll('dt').eq(0).show();
		} else {
			jQuery("#glossary dd:visible").hide();
			jQuery("#glossary dt:visible").hide();
			jQuery("#glossary dd:last").show();
			jQuery("#glossary dt:last").show();
		}
	}

	function nextTerm() {
		if( jQuery("#glossary dd:visible").nextAll('dd').length > 0 ) {
			jQuery("#glossary dd:visible").hide().nextAll('dd').eq(0).show();
			jQuery("#glossary dt:visible").hide().nextAll('dt').eq(0).show();
		} else {
			jQuery("#glossary dd:visible").hide();
			jQuery("#glossary dt:visible").hide();
			jQuery("#glossary dd:first").show();
			jQuery("#glossary dt:first").show();
		}
	}
