$(window).load(function(){
 
$("#scroll-wrap").randomize(".scroll-image");

    $('a[href^="http://"]')
  .attr("target", "_blank");


    var regEx = /(\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)/;

    $(".charity-span").filter(function() {
        return $(this).html().match(regEx);
    }).each(function() {
        $(this).html($(this).html().replace(regEx, "<a href=\"mailto:$1\">$1</a>"));
    });

 $('#scroll-wrap').cycle({
        fx: 'fade', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
        timeout:5000,
        speed:1500
    });
    $(".corner").corner(50);
     $(".nav-a").corner("6px");

     $(".corner-top").corner("top");
      $(".corner-bottom").corner("bottom");
    $('#map-button').lightBox(); // Select all links with lightbox class

     $('#top-link').click(function(event){

        $('html, body').animate({
            scrollTop:0
        }, 'slow');
        event.preventDefault();
    });
});


(function($) {

$.fn.randomize = function(childElem) {
  return this.each(function() {
      var $this = $(this);
      var elems = $this.children(childElem);

      elems.sort(function() { return (Math.round(Math.random())-0.5); });

      $this.remove(childElem);

      for(var i=0; i < elems.length; i++)
        $this.append(elems[i]);

  });
}
})(jQuery);

