<!-- // good old hiding from stupid user agents
// set namespace definitions for home page scripts
// failsafe to prevent instantiation errors
if(!org){
  var org = {};
  org.ileap = {};
}
else {
  if(!org.ileap) { org.ileap = {}; }
}
if(!org.ileap.utils) {
  org.ileap.utils = {}; // set our animation data into it's own namespace/class
}

// animation class with data pre-filled
org.ileap.utils.Animation = function() {

  return {
    count:          0, // counter
    transition:     1000, // animtion transition, in milliseconds
    interval:       10000, // animtion interval, in milliseconds
    is_animating:   false, // flag to prevent changes during animation process
    
    // numerically indexed array of data objects for content animation
    // be sure to omit the last comma in list - else IE7 will add one to the index!
    data: [
      {bgimage: 'themes/skyhand/images/anim/264262_2035545922493_1059544411_3730046_2114987_n.jpg'},
      {bgimage: 'themes/skyhand/images/anim/4908106395_7494943176_o.jpg'},
      {bgimage: 'themes/skyhand/images/anim/BY-780.jpg'},
      {bgimage: 'themes/skyhand/images/anim/DSC_0430.jpg'},
      {bgimage: 'themes/skyhand/images/anim/group_2.jpg'},
      {bgimage: 'themes/skyhand/images/anim/hitomiarisa.jpg'},
      {bgimage: 'themes/skyhand/images/anim/image1.jpg'},
      {bgimage: 'themes/skyhand/images/anim/image2.jpg'},
      {bgimage: 'themes/skyhand/images/anim/IMG_1650.jpg'},
      {bgimage: 'themes/skyhand/images/anim/IMG_1720.jpg'},
      {bgimage: 'themes/skyhand/images/anim/Japan_Fellows_25.jpg'},
      {bgimage: 'themes/skyhand/images/anim/o13.jpg'},
      {bgimage: 'themes/skyhand/images/anim/P1010026.jpg'},
      {bgimage: 'themes/skyhand/images/anim/Rocio_with_kids.jpg'}
    ], 
    
    // randomize the data
    randomizeData: function() {
      this.data.sort(function(a,b){
        // Get a random number between 0 and 10
        var temp = parseInt( Math.random()*10 );
        // Get 1 or 0, whether temp is odd or even
        var isOddOrEven = temp%2;
        // Get +1 or -1, whether temp greater or smaller than 5
        var isPosOrNeg = temp>5 ? 1 : -1;
        // Return -1, 0, or +1
        return( isOddOrEven*isPosOrNeg );
      });
    },
            
    // class method to get current position and increment counter
    getCounter: function() {
      if(this.count++ >= this.data.length - 1)
        this.count = 0;
      return this.count;
    },
  
    // animate the home headline, image, and widget
    homeAnimate: function (i) {
      this.is_animating = true; // lock-out changes
      
      // set bg image
      var img_1 = jQuery('#header_image img');
      var img_2 = img_1.clone(true);
      img_2.attr('src', this.data[i].bgimage);
      img_2.insertAfter(img_1).hide();
      
      // animate
      xf_time = this.transition;
      img_1.fadeOut(xf_time * 0.6, function(){jQuery(this).remove()});
      img_2.fadeIn(xf_time);
      
      window.setTimeout(function(){org.ileap.utils.Animation.is_animating = false;}, xf_time + 100); // reset lock
    },
    
    // wraper method for Interval timer start / resume
    homeCycle: function homeCycle() {
        i = this.getCounter();
        this.homeAnimate(i);
    }
  };
} (); // end org.ileap.utils.Animation


// implement the above on docuent load event
jQuery(document).ready(function(){
  org.ileap.utils.Animation.randomizeData(); // init
  jQuery('#header_image img').attr('src', org.ileap.utils.Animation.data[org.ileap.utils.Animation.data.length - 1].bgimage);// replace initial img with last on rotation
	org.ileap.utils.Animation.intervalID = self.setInterval('org.ileap.utils.Animation.homeCycle()', org.ileap.utils.Animation.interval);
});
// -->
