$(function(){
	$.fn.truncate.defaults = {
	    max_length: 100,
	    more: '... More&rsaquo;',
	    less: '&lsaquo;Less',
		onDownComplete:function() {
			$('#gray_bg').height('100%');
			$('#gray_bg img').height('100%');
			resizeBG();
			//alert('down comp')
		},
		onUpComplete:function() {
			$('#gray_bg').height('100%');
			$('#gray_bg img').height('100%');
			resizeBG();
		}
	  };
  $('.trunk').truncate({max_length: 200});
	//
	$('#right_btn').livequery('click',function(){
		var next = $('#center_nav ul li.selected').nextAll();
		if(next.length >= 1){
			var next_loc = $("#center_nav ul li.selected").next().find('a').attr('href');
		}else{
			var next_count = $('#left_nav ul li.selected').nextAll();
			if(next_count.length >= 2){
			var next_loc = $('#left_nav ul li.selected').next().find('a').attr('href');
			}else{
			var next_loc = $('#left_nav ul li:first').find('a').attr('href');
			}
			
		}
		if(next_loc){
		window.location = next_loc;
		}
	return false;
	});
	//
	$('#left_btn').livequery('click',function(){
			var prev = $('#center_nav ul li.selected').prevAll();
			if(prev.length >=1){
				var prev_loc = $("#center_nav ul li.selected").prev().find('a').attr('href');
			}else{
				var prev_count = $('#left_nav ul li.selected').prevAll();
				if(prev_count.length >= 1){
				var prev_loc = $('#left_nav ul li.selected').prev().find('a').attr('href');
				}else{
				var prev_loc = $('#left_nav ul li:last').find('a').attr('href');
				}
				prev_loc += '/last';
			}
			if(prev_loc){
			window.location = prev_loc;
			}
	return false;
	});
	
	//
	//$("div#view_desc").jTruncate({length:350,moreText:"More>",lessText:"Less>"});
});
