// grants listing pages: populate empty spans of class 'closing-date' with text 'none'

function initSpanBehavior()
{
	var spans = document.getElementsByTagName('span');
	for (var i=0;i<spans.length;i++)
	{
		if (spans[i].className == "closing-date" && spans[i].innerHTML == "")
			spans[i].appendChild(document.createTextNode("none"));
	}
}


/* ------------
jQuery: Gets images within a div class="image", find the image width,
and then set the DIV inline stylesheet width to whatever the image width was.
DIV is then floated to right.
------------- */

window.onload = function() {
	$(".image").each(function(){
	        var width = $("//img",this).width();
		$(this).width(width);
	});
		
// initialise grants span function
  initSpanBehavior();
}



// window.onload is used instead of jQuery's $(document).ready(function() because
// window.onload actually waits for Everything to load within the window + document,
// including images. 
// ready() loads the document, before content.