/**
 * @author xe54
 */
function findScreenSize(margin, min){
    var visHeight =$(window).height();
		  
	 visHeight = visHeight - margin;
	 if (visHeight < min) visHeight = min;
	 return visHeight;
};

function setScreenSize(h){
	$("#banner").height(h);
};

function updateScreenSize(){
	var ss = findScreenSize(500,1);
	setScreenSize(ss);
};


// Ride the carousel...
jQuery(document).ready(function() {
   
	 jQuery("#scrollcolumn").jcarousel({
        itemVisible: 1,
        itemScroll: 1,
        autoScroll: 5,
        wrap: true
    });
	/*
	$("a.next").click(function(){
		moveToPost(ind+1);
		alert('scroll left to post-'+ind);
	});
	$("a.last").click(function(){
		moveToPost(ind-1);
		alert('scroll right to post-'+ind);
	});
	*/
	
	// Add thickbox to all image wrapping a links :
	// <a title="delete me asap" href="http://www.saffrolla.com/wp-content/uploads/saleend.gif">
	$("#scrollcolumn a[@href*=/uploads/]").addClass("thickbox");
	// reset thickbox
	tb_init('a.thickbox');//pass where to apply thickbox
	
	updateScreenSize();
});

//window.onload = updateScreenSize;
window.onload = function(){
	updateScreenSize();
}

jQuery(window).resize(function() { 
	updateScreenSize();
} );