$(document).ready(function(){
currentPosition97 = 0;
var sliderHeight97 = $('#dt_newsslider97').height();
var slides97 = $('#dt_newsslider97 .dt_newsslider_slide');
var numberOfSlides97 = slides97.length;
slideWidth97 = $('#dt_newsslider97').width();
$('#dt_newsslider97 .dt_newsslider_slide').css('height', sliderHeight97);
slides97.wrapAll('<div id="dt_newsslider_wrap97"></div>').css({'float' : 'left', 'width' : slideWidth97});
$('#dt_newsslider_wrap97').css('width', slideWidth97 * numberOfSlides97);
$(window).resize(function() {
reSizeSlider97();
});
manageControls97(currentPosition97);
$('#dt_newsslider97 .dt_newsslider_control').bind('click', function() {
currentPosition97 = ($(this).attr('id')=='dt_newsslider_next97') ? currentPosition97 + 1 : currentPosition97 - 1;
manageControls97(currentPosition97);
('#dt_newsslider_wrap97').animate({'marginLeft': slideWidth97 * -currentPosition97});
});
var pause97 = false;
var rotator97 = function() {
if(!pause97) {
slideTime97 = setTimeout(slideShow97, 500);
}
};
$('#dt_newsslider97').hover(function() {
clearTimeout(slideTime97);
pause97 = true;
}, function() {
pause97 = false;
rotator97();
});
rotator97();
function slideShow97() {
if(currentPosition97 !== numberOfSlides97-1) {
$('#dt_newsslider97 #dt_newsslider_next97').click();
rotator97();
}
else {
$('#dt_newsslider97 #dt_newsslider_wrap97').animate({'marginLeft' : 0});
currentPosition97 = 0;
manageControls97(currentPosition97);
rotator97();
}
}
function reSizeSlider97() {
slideWidth97 = $('#dt_newsslider97').width();
$('#dt_newsslider97 .dt_newsslider_slide').css('width', slideWidth97);
$('#dt_newsslider_wrap97').css('width', slideWidth97 * numberOfSlides97);
$('#dt_newsslider97 #dt_newsslider_wrap97').animate({'marginLeft' : 0});
$('#dt_newsslider_prev97').hide();
currentPosition97 = 0;
manageControls97(currentPosition97);
}
function manageControls97(position) {
if(position == 0) {
$('#dt_newsslider_prev97').hide();
}
else {
$('#dt_newsslider_prev97').show();
}
if(position == numberOfSlides97 - 1) {
$('#dt_newsslider_next97').hide();
}
else {
$('#dt_newsslider_next97').show();
}
}
});