/***********************************************************************
*	MAIN.JS
*  
*	(c) 2005 Walker Art Center - Brent Gustafson / Justin heideman
***********************************************************************/

var pageTotal = 0;

function searchGo(url,val) {
	if ((val > 0) && (val <= pageTotal)) document.location = url + val;
	else return false;
}

function popup(url,width,height) {
	var properties = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height;
	var myPopup = window.open(url, "myPopup", properties);
	myPopup.focus();
}

$(document).ready(function(){
	//cut down length of entries
	$('#blogEntry > *').each(function(i){
		if (i >2){
			console.log($(this));
		} else {
			$(this).css('display','block');
		}
	});
	
	$('#blogEntry  img').each(function(i){
		if (i >0){
			console.log($(this));
			$(this).remove();
		}
	});
	
	
	//add read more link
	$('#blogEntry').append('<a href="'+$('#blogEntryLink').attr('href')+'" class="more">read more &raquo;</a>');
	
	//scale down images
	$('#blogEntry img').each(function(i){
		h = $(this).height();
		w = $(this).width();
		if (w > 350){
			ratio = h/w;
			newH = 350*ratio;
			$(this).height(newH);
			$(this).width(350);
		}
	});
  	
	
});
