$(document).ready(function(){


	// do the superfish navigation
	$("ul.nav").superfish({
		delay		: 1, /* slight delay to avoid popout bug */
		//animation	: {height:"show"}, /* we do height instead of opacity to avoid antialiasing text */
		speed		: "fast" /* duh. */
	}); 
	
	// add rounded corners to the bottom of the menus that drop down
	//$("ul.nav ul").append("<li class=\"corners\">&nbsp;</li>");

	
	var x = $(".mapssections .mainpagetext .childpage");
	var xsize = x.length;
	if(xsize && xsize > 0){
		var divby = xsize/3;
		//alert(divby);
		$(".mapssections .mainpagetext .childpage").slice(0,divby).wrapAll("<div class='mapssectioncolumn1'></div>");
		$(".mapssections .mainpagetext .childpage").slice(divby, divby+divby).wrapAll("<div class='mapssectioncolumn2'></div>");
		$(".mapssections .mainpagetext .childpage").slice(divby+divby).wrapAll("<div class='mapssectioncolumn3'></div>");
	}
	
});

function refinePage(query, selector){
	try{
		var currentloc = window.location.toString();

		//remove any themes that already exist
		hasMoreSelectors = currentloc.indexOf(selector);
		while(hasMoreSelectors != -1){
			firstPart = currentloc.substring(0, currentloc.indexOf(selector));
			
			temp = currentloc.substring(currentloc.indexOf(selector)+selector.length);
			indexOfQuery = temp.indexOf(".");

			secondPart = temp.substring(indexOfQuery);

			currentloc = firstPart + secondPart;
			hasMoreSelectors = currentloc.indexOf(selector);
		}

		lastindex = currentloc.lastIndexOf(".");
		newlocal = currentloc.substring(0,lastindex);
		newlocal += selector + query + currentloc.substring(lastindex);
		window.location = newlocal;
	}
	catch(e){}
}

function say(arg){
	alert(arg);
}



    		


