$j(function(){var timer=6;timer=timer*1000;var clicked=null;$j.ajax({type:"GET",url:xmlUrl,dataType:"xml",success:function(xml){var lastOccur=xmlUrl.lastIndexOf('=');var len=xmlUrl.length;var start=parseInt(xmlUrl.substring(lastOccur+1))+1;var titleList=new Array;var descList=new Array;hrefList=new Array;var photoList=new Array;bgcolorList=new Array;var $tCounter=0;var $dCounter=0;var $pCounter=0;var $counter=1;$j(xml).find('link').each(function(){var title=$j(this).find('title').text();var desc=$j(this).find('description').text();var href=$j(this).find('href').text();var photo=$j(this).find('photos').find('photo').text();var bgcolor=$j(this).find('photos').find('photo').attr('bgcolor');titleList.push(title);descList.push(desc);hrefList.push(href);photoList.push(photo);bgcolorList.push(bgcolor);$j('#slideshow').append('<img src="/images/common/spacer.gif" alt="slideImg" />');$j('.paging ul').append('<li><a href="#" rel="'+$counter+'"><span class="href"></span><span class="bullet">></span><span class="title"></span><span class="description"></span></a></li>');$counter++;});$j('.paging li a span.title').each(function(){$j(this).html(titleList[$tCounter]);$tCounter++;});$j('.paging li a span.description').each(function(){$j(this).html(descList[$dCounter]);$dCounter++;});$j('#slideshow img').each(function(){$j(this).attr('src',photoList[$pCounter]);$pCounter++;});var randNum=Math.round(Math.random()*$tCounter);var randomSlideNum=(randNum==0)?1:randNum;if(!isNaN(start)){curSlide=start-1;$j('.paging ul li:nth-child('+start+') a').addClass("active").parent('li').addClass("active");$j('#slideshow img:nth-child('+start+')').addClass('active-image');$j('.paging').addClass(bgcolorList[start-1]);}
else{curSlide=randomSlideNum-1;$j('.paging ul li:nth-child('+randomSlideNum+') a').addClass("active").parent('li').addClass("active");$j('#slideshow img:nth-child('+randomSlideNum+')').addClass('active-image');$j('.paging').addClass(bgcolorList[randomSlideNum-1]);}
$j('li.active').stop().height(22).animate({height:'80px'},1000);$j('a.active').stop().height(22).animate({height:'65px'},1000);$j(".paging a").click(function(){$active=$j(this);clicked=$active.attr('rel');clearInterval(play);rotate();var timeout=setTimeout('rotateSwitch()',23000);return false;});},error:function(XMLHttpRequest,textStatus,errorThrown){}});rotate=function(){$j.each($j('.paging li'),function(){$j(this).stop().height(22);});var curImgNum=$active.attr("rel");var nextImgNum=$active.parent().next().children('a').length?$active.parent().next().children('a').attr("rel"):1;var colorClass=bgcolorList[curImgNum-1];$j('.paging').removeClass('blue teal purple yellow').addClass(colorClass);$j(".paging a").removeClass('active');$j(".paging a").parent().removeClass('active');$active.addClass('active');var parent=$active.parent();parent.addClass('active');parent.css('height','80px');$active.stop().height(22).animate({height:'65px'},1000);$j('.paging li.active a span.href').click(function(){window.location=hrefList[curImgNum-1];});var curImg=$j('#slideshow img.active-image').length==0?$j('#slideshow img:last'):$j('#slideshow img.active-image');if(clicked){var nextImg=$j('#slideshow img:nth-child('+clicked+')')}else{var nextImg=curImg.next().length?curImg.next():$j('#slideshow img:first');}
clicked=null;curImg.addClass('last-active').removeClass('active-image');nextImg.css({opacity:0.0}).addClass('active-image').animate({opacity:1.0},1000,function(){curImg.removeClass('active-image last-active');});}
play=null;rotateSwitch=function(){clearInterval(play);play=setInterval(function(){$active=$j('.paging a.active').parent().next().children('a');if($active.length===0){$active=$j('.paging li:first a');}
rotate();},timer);};rotateSwitch();});
