﻿/// <reference path="jquery-1.3.2.min.js" />

/// <reference path="jquery-1.3.2.js" />

/// <reference path="jquery-1.3.2-vsdoc.js" />


var timer;
var imgTime = 1000;
var divId;
var className;
var speed;

function Start(pDivId, pClassName, pSpeed) {
    divId = pDivId;
    className = pClassName;
    speed = pSpeed;
    //birinci resim hariç görünmez yapıyoruz.
    $("#" + pDivId + " " + "a").css({ opacity: 0.0 });
    $("#" + pDivId + " " + "a:first").css({ opacity: 1.0 });
    $("#" + pDivId + " " + "a:first").addClass(className);
    $("#" + divId).append("<img id=" + '"' + "pouseImg" + '"' + " src=" + '"' + "images/dur.png" + '"' + " style=" + '"' + "right:5px; bottom:5px;border:0px; position:absolute; z-index:600" + '"' + "  />");
    timer = setInterval(gallery, speed);
    $("#pouseImg").hide();
}

function Stop() {
    clearInterval(timer);
    $("#pouseImg").toggle(250);
}

function Next() {
    timer = setInterval(gallery, speed);
    $("#pouseImg").toggle(250);
}


function gallery() {
    var current = $("#" + divId + " a." + className) ? $("#" + divId + " a." + className) : $("#" + divId + " a:first");
    var next = current.next("a").length ? current.next("a") : $("#" + divId + " a:first");
    next.css({ opacity: 0.0 })
        .addClass(className)
        .animate({ opacity: 1.0 }, imgTime);

    current.removeClass(className)
        .animate({ opacity: 0.0 }, imgTime);
}
