$.fn.reorder = function() {
 
  // random array sort from
  // http://javascript.about.com/library/blsort2.htm
  function randOrd() { return(Math.round(Math.random())-0.5); }
 
  return($(this).each(function() {
    var $this = $(this);
    var $children = $this.children();
    var childCount = $children.length;
 
    if (childCount > 1) {
      $children.remove();
 
      var indices = new Array();
      for (i=0;i<childCount;i++) { indices[indices.length] = i; }
      indices = indices.sort(randOrd);
      $.each(indices,function(j,k) { $this.append($children.eq(k)); });
 
    }
  }));
  
  
}



$(document).ready(function(){
				
	//Project Slideshow				 		
	$('#banner').cycle({
			fx:     'fade',
			random: 1,
			timeout: 8000
	});
	
	$("#testlist").reorder();
	$("#testlist li:gt(4)").hide();
	$("#boardtest").reorder();
	
	
	
	//Cufon
	/*
	Cufon.replace('h2')
	Cufon.now();
	
*/


	
});



//GoogleMaps
function showAddress(address) {
	var map = null;
	var geocoder = null;			
	var blueIcon = new GIcon(G_DEFAULT_ICON);
	blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
	blueIcon.iconSize = new GSize(32, 32); 
	blueIcon.shadowSize = new GSize(36, 32);
	markerOptions = { icon:blueIcon };	
	geocoder = new GClientGeocoder();
	if (geocoder) {
		geocoder.getLatLng(
			address,
			function(point) {
				if (!point) {
					alert(address + " not found");
				} else {
				
					if (GBrowserIsCompatible()) {
						map = new GMap2(document.getElementById("map"));
						map.setCenter(point, 12);
						var marker = new GMarker(point, markerOptions);
						map.addOverlay(marker);
						map.addControl(new GMapTypeControl());
						map.addControl(new GSmallMapControl());

					}						
			 
				}
			}
		);
	}
}
