
function switchAppIcons(){
  jQuery.each($('.iconswitcher'), function(){
    if($(this).find('ul.alternativeicons').length > 0){
      var img = $(this).find('img.baseimg');
      var images = $(this).find('ul.alternativeicons img');
      var firstnew = images[images.length-1];
      var found = false;
      var switched = false;
      while(!found && images.length>0){
        found = (img.attr('src') == $(images.pop()).attr('src'))
      }
      if(!found || images.length==0){
        img.attr('src',$(firstnew).attr('src'));
      } else {
        img.attr('src',$(images.pop()).attr('src'));
      }
    }
  });
  tid = setTimeout(switchAppIcons, 3000);
}

$(document).ready(function() {
  var tid = setTimeout(switchAppIcons, 1000);
});
