/**
 * Resets column heights
 * 
 * @return		void
 */
function resetColumns() {
	$("#menu, #content, #sidebar").equalizeCols();
}
/**
 * Resets column heights on window load event
 */
$(window).bind("load", function() {
	resetColumns();
});
/**
 * Performs global initialization
 */
$(document).ready(function () {
	// Resets column heights when font is resized
	$(document).bind("fontresize", function(event, data) {
		resetColumns();
	});
	//Add confirmation for external links
	$("a").filter(function() {
		return this.hostname && this.hostname !== location.hostname;
	}).addClass("external").bind("click", function(e) {
		// Prevent redirect
		e.preventDefault();
		
		var url 		= new String(this);
		var title		= this.innerHTML;
		var subStr	= url.substring(0, 28);

		if(url.substring(0, 28) != "http://www.arroyogrande.org/") {
			var msg = "<p>You are about to leave the AGPD website to visit the website"
								+ " <b>\"" + title + "\"</b>.</p>"
								+ "<p>Do you wish to proceed?</p>";
			
			Boxy.confirm(
			  msg,
				function() {
			  	self.location.href = url;
				},
				{title: "Confirmation Required"}
			);
		}
		else {
			self.location.href = url;
		}
  });
});