var _most_news_last = null;
$(document).ready(function(){

	$(".jcarusel").jCarouselLite({
	    visible: 3,
	    start: 0,
		scroll: 1,
	    btnNext: "#wrapper .next",
	    btnPrev: "#wrapper .prev",
		
	    btnGo:
	    [".select-news .1", ".select-news .2", ".select-news .3", ".select-news .4", ".select-news .5", ".select-news .6",
	    ".select-news .7", ".select-news .8", ".select-news .9", ".select-news .10", ".select-news .11", ".select-news .12"]
	});

	featuredcontentglider.init({
		gliderid: "feat-col", //ID of main glider container
		contentclass: "columnist", //Shared CSS class name of each glider content
		togglerid: "row", //ID of toggler container
		remotecontent: "", //Get gliding contents from external file on server? "filename" or "" to disable
		selected: 0, //Default selected content index (0=1st)
		persiststate: false, //Remember last content shown within browser session (true/false)?
		speed: 500, //Glide animation duration (in milliseconds)
		direction: "leftright", //set direction of glide: "updown", "downup", "leftright", or "rightleft"
		autorotate: false, //Auto rotate contents (true/false)?
		autorotateconfig: [3000, 2] //if auto rotate enabled, set [milliseconds_btw_rotations, cycles_before_stopping]
	})
	
	  $(".footer-slider").jCarouselLite({
        btnNext: ".rotator-container .forward",
        btnPrev: ".rotator-container .back",
		scroll: 5,
		visible: 5
    });

	$('#most_popular').click(function(){

              $('#mn1-container').show();
		$('#mn2-container').hide();
		$('#mn3-container').hide();
	});
	$('.most-view').click(function(){
		$('#mn1-container').hide();
		$('#mn2-container').show();
		$('#mn3-container').hide();
	});
	$('.most-email').click(function(){
		$('#mn1-container').hide();
		$('#mn2-container').hide();
		$('#mn3-container').show();
	});
	
		$('a.view-banner').click(function(){
		var el = $(this).parent().find('div.new-banner').html();
		$('#banner-rotator').html(el);
	});

});

var show = 0;
function displayColum(){
		if (show == 0){
			show = 1;
			$(".colunist-more").show();
		} else {
			show = 0;
			$(".colunist-more").hide();
		}

}

function resizeFont(size){
		$(".large-indent").css('font-size',size +'px');
}

function emailPage() {

//*patched using addthis
    addthis_sendto('email');

//	window.open( '/share/email/?url='+escape(top.location)+'&title='+escape(document.title), 'emailthis', 'location=0,status=0,scrollbars=0,width=300,height=200');

}

function signIn() {

	var o = document.getElementById('sign-form');
//	o.elements['return_to'].value = "http://beta.newamericamedia.org/redirect.php?url=" + urlEncode( top.location );
	o.elements['return_to'].value = top.location;
	o.submit();

}

function urlEncode(str) {

    return escape(str).replace(/\+/g,'%2B').replace(/%20/g, '+').replace(/\*/g, '%2A').replace(/\//g, '%2F').replace(/@/g, '%40');

}



