$(document).ready(function(){function i(){e=setInterval(function(){b+=2;b>=q&&(b=1);j();f((b-1)/2);k()},r)}function k(){l.animate({"margin-top":m[(c-1)/2]+"px"},g)}function j(){n();o.animate({opacity:0},s,function(){$(this).css("background",'url("'+d.eq(b).attr("src")+'") center no-repeat').animate({opacity:1},0).attr("title",t.eq((c-1)/2).html())});c=b;u()}function n(){o.css("background",'url("'+d.eq(c).attr("src")+'") center no-repeat');v.css("background",'url("'+d.eq(b).attr("src")+'") center no-repeat')} function f(a){p.each(function(b){b!=a?$(this).find("img").animate({opacity:w},g):$(this).find("img").animate({opacity:1},g)})}function u(){x.each(function(a){$(this).removeClass("selected");a==c&&$(this).addClass("selected")})}var a=$("#rotator"),x=a.find("li"),t=a.find("h2"),y=a.find("a"),d=a.find("img"),q=d.length,c=1,b=1,r=1E4,s=500,g=700,e=0,w=0.7,m=[23,100,177,254];a.find("ul").remove();a.find("h1").remove();a.prepend('<div class="rotator-background-2"></div><div class="rotator-background-1"></div><div class="pointer"></div>'); var o=a.find(".rotator-background-1"),v=a.find(".rotator-background-2"),l=a.find(".pointer"),h='<ul class="rotator-navigation">';d.each(function(){$(new Image).attr("src",$(this).attr("src"));175==$(this).attr("width")&&(h+='<li><img src="'+$(this).attr("src")+'" alt="'+$(this).attr("alt")+'" title="'+$(this).attr("alt")+'" /></li>')});a.append(h);var p=$(".rotator-navigation").find("li");n();f(0);a.show();l.animate({"margin-top":m[(c-1)/2]+"px",opacity:1},500);i();a.click(function(){window.location.href= y.eq((c-1)/2).attr("href")});p.each(function(a){$(this).bind("click",function(){b=2*a+1;e=clearInterval(e);j();f(a);i();k();return!1})})});
