function preloadHoverImages() {
  $("img").each(function() {
  
    var src = $(this).attr("src");
    if(src.indexOf("base") != -1) {
    
      var img = new Image();
      img.src = src.replace(/base/, "hover");
    }
  });
} 

function submitVote(building_id, funct) {

  $.get('/viewer/shapeVote', 
        {
            
            id: building_id
            
        }, funct);
}

function rank(building_id, value, funct) {

  $.get('/viewer/rank',
        {
        
            id: building_id,
            value: value
            
        }, funct);
}

//
// On Document Ready...
//
// ...roll over code for images
// 
$(document).ready(function() {
 
   // load the hover images
   preloadHoverImages();
   
   // assign the rollover code
   $(".ro").hover(
     function() {
     
       var src = $(this).attr("src");
       $(this).attr("src", src.replace(/base/, "hover"));
     },
     function() {
     
       var src = $(this).attr("src");
       $(this).attr("src", src.replace(/hover/, "base"));
     }
   );
 
 });