var selectedItem=-1;var numItems=0;var time_int=0;$(document).ready(function(){var a=$("#home_hero_block").find("div.hero_content");setupGallery(a);startTimer()});function startTimer(){time_int=setInterval(automate_gallery,6800)}function stopTimer(){clearInterval(time_int)}function automate_gallery(){if(selectedItem<(numItems-1)){selectGalleryItem(selectedItem+1)}else{selectGalleryItem(0)}}function setupGallery(a){a.css("overflow","");var b=a.find("li");numItems=b.length;if(numItems>1){createList(numItems,a);selectGalleryItem(0)}}function createList(c,e){var a=$("<div id='gallery_nav'/>");var b=$("<a href='#forward'><img src='/content/website/image/home/left_arrow.png'/></a>");b.click(function(f){stopTimer();selectGalleryItem(selectedItem-1)});a.append(b);var d=$("<a href='#backward' style='float:right;'><img src='/content/website/image/home/right_arrow.png'/></a>");d.click(function(f){stopTimer();selectGalleryItem(selectedItem+1)});a.append(d);e.append(a)}function selectGalleryItem(d){if(d>-1&&d<numItems){if(selectedItem>-1){var a=$("#home_hero_block").find("div.hero_content ul.hero_gallery_nav li").eq(selectedItem).find("div");a.animate({"background-color":"#003d7d"},500)}selectedItem=d;var b=$("#home_hero_block").find("div.hero_content ul.hero_gallery_nav li").eq(selectedItem).find("div");b.animate({"background-color":"#ffffff"},500);$("#home_hero_block").find("div.hero_content ul.hero_gallery").animate({"margin-left":-(selectedItem*1280)+"px"},600);var e=$("#home_hero_block").find("div.hero_content ul.hero_gallery li").eq(selectedItem);var c=e.find("a").attr("href");_gaq.push(["_trackPageview",c])}};
