function scroller(content, divId, divGeneral){
    this.content  = content;
    this.tickerid = divId;

    var sHTML = "";
        sHTML = sHTML + "<DIV id='"+ divId + "' style='position: relative; overflow: hidden'>";
        sHTML = sHTML + "       <DIV style='position: absolute; width: 100%; visibility: hidden' id='" + divId + "0'>" + content[0] + "</DIV>";
        sHTML = sHTML + "       <DIV style='position: absolute; width: 100%; visibility: hidden' id='" + divId + "1'>" + content[1] + "</DIV>";
        sHTML = sHTML + "       <DIV style='position: absolute; width: 100%; visibility: hidden' id='" + divId + "2'>" + content[2] + "</DIV>";
        sHTML = sHTML + "       <DIV style='position: absolute; width: 100%; visibility: hidden' id='" + divId + "3'>" + content[3] + "</DIV>";
        sHTML = sHTML + "       <DIV style='position: absolute; width: 100%; visibility: hidden' id='" + divId + "4'>" + content[4] + "</DIV>";
        sHTML = sHTML + "       <DIV style='position: absolute; width: 100%; visibility: hidden' id='" + divId + "5'>" + content[5] + "</DIV>";
        sHTML = sHTML + "       <DIV style='position: absolute; width: 100%; visibility: hidden' id='" + divId + "6'>" + content[6] + "</DIV>";
        sHTML = sHTML + "       <DIV style='position: absolute; width: 100%; visibility: hidden' id='" + divId + "7'>" + content[7] + "</DIV>";
        sHTML = sHTML + "</DIV>";

    var oDiv = getObject("DIV", divGeneral);
        oDiv.innerHTML = sHTML;
}

scroller.prototype.initialize = function(iStart, iFinish){
    this.tickerdiv     = getObject("DIV", this.tickerid);
    this.visiblediv    = getObject("DIV", this.tickerid + iStart.toString());
    this.hiddendiv     = getObject("DIV", this.tickerid + iFinish.toString());

    //Tum nesneleri gizle
    for (var i=0;i<this.content.length;i++){
        var oDiv = getObject("DIV", this.tickerid + i.toString());
            oDiv.style.visibility = "hidden";
    }

    this.visibledivtop          = parseInt(scroller.getCSSpadding(this.tickerdiv));
    this.visiblediv.style.width = this.hiddendiv.style.width = this.tickerdiv.offsetWidth-(this.visibledivtop*2) + "px";

    this.getinline(this.visiblediv, this.hiddendiv);

    this.hiddendiv.style.visibility = "visible";
}

scroller.prototype.showFirst = function(iStart){
    this.visiblediv = getObject("DIV", this.tickerid + iStart.toString());
    this.visiblediv.style.visibility = "visible";
}

scroller.prototype.animateup = function(){
    if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop + 10)){
            this.visiblediv.style.top = parseInt(this.visiblediv.style.top) - 10 + "px";
            this.hiddendiv.style.top  = parseInt(this.hiddendiv.style.top)  - 10 + "px";

            var scrollerInstance = this;
                setTimeout(function(){scrollerInstance.animateup()}, 1);
    }
    else{
            this.getinline(this.hiddendiv, this.visiblediv);
            this.swapdivs();
    }
}

scroller.prototype.swapdivs = function(){
    var tempcontainer = this.visiblediv;
        this.visiblediv = this.hiddendiv;
        this.hiddendiv  = tempcontainer;
}

scroller.prototype.getinline = function(div1, div2){
    div1.style.top = this.visibledivtop + "px";
    div2.style.top = Math.max(div1.parentNode.offsetHeight, div1.offsetHeight) + "px";
}

scroller.getCSSpadding = function(tickerobj){
    if (tickerobj.currentStyle)
        return tickerobj.currentStyle["paddingTop"];
    else if (window.getComputedStyle)
        return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top");
    else
        return 0;
}
/**********************************************************************************/
function animateObject(){
    oScroller.initialize(iStart,iFinish);
    oScroller.showFirst(iStart);
    oScroller.animateup();

    iStart  = iStart + 1;
    iFinish = iFinish + 1;
    if (iStart>=arrContent.length) iStart  = 0;
    if (iFinish>=arrContent.length)iFinish = 0;
}

function animateUp(){
    //***********************************
    //Zoom nesnesini gizle
    hiddenZoom();
    //***********************************
    var oDivData = getObject("DIV", "divMain2");
    var oImgLoad = getObject("IMG", "imgLoad");
        if (oDivData.innerHTML!=""){
            //***********************************
            oImgLoad.className = "DisplayNone";
            //***********************************
            animateObject();
            //***********************************
        }else{
            //***********************************
            oImgLoad.className = "";
            //***********************************
            loadList();
            //***********************************
            window.setTimeout("animateUp();", 1250);
        }
}

function zoomIn(img){
}

function hiddenZoom(){
    var oSpnZoom = getObject("DIV", "divZoom");
        oSpnZoom.className = "DisplayNone";
}

function zoomOut(img){
    var sText   = img.className.toString();

    var arrText = sText.split("$TAB$")
        if (arrText.length!=9) return false;

    var sTemplate = getObject("DIV", "divZoomTemplate").innerHTML;
    var sTemplate = sTemplate.replace("#AUTO_ID#",           arrText[0]);
    var sTemplate = sTemplate.replace("#AUTO_ID#",           arrText[0]);
    var sTemplate = sTemplate.replace("#AUTO_ID#",           arrText[0]);
    var sTemplate = sTemplate.replace("#LOGIN_ID#",          arrText[1]);
    var sTemplate = sTemplate.replace("#LOGIN_ID#",          arrText[1]);
    var sTemplate = sTemplate.replace("#LOGIN_ID#",          arrText[1]);
    var sTemplate = sTemplate.replace("#AUTO_YEAR#",         arrText[2]);
    var sTemplate = sTemplate.replace("#AUTO_TITLE#",        arrText[3]);
    var sTemplate = sTemplate.replace("#AUTO_SELLINGPRICE#", arrText[4]);
    var sTemplate = sTemplate.replace("#LOGIN_NAME#",        arrText[5]);
    var sTemplate = sTemplate.replace("#AUTO_KM#",           arrText[6]);
    var sTemplate = sTemplate.replace("#AUTO_STAR#",         arrText[7]);
    var sTemplate = sTemplate.replace("#AUTO_SOLD#",         arrText[8]);

    var oImage = img;
        oImage.style.position = "relative";

    var oDivScroller = getObject("DIV", "divScrollerMain");
        oDivScroller.style.position = "relative";

    var oSpnZoom = getObject("DIV", "divZoom");
        oSpnZoom.innerHTML = sTemplate;
        oSpnZoom.className = "DisplayNone";

    var iLeft = oDivScroller.offsetLeft + (oImage.offsetLeft - 20);
    var iTop  = oImage.offsetTop + oImage.offsetHeight + 18;
        if (iTop>118){
        iTop  = iTop + 161;
        }
        oSpnZoom.style.position   = "absolute";
        oSpnZoom.style.background = "#ebebeb";
        oSpnZoom.style.left       = iLeft;
        oSpnZoom.style.top        = iTop;
        oSpnZoom.zIndex           = 9999999;

        oSpnZoom.className = "BorderColor2";

        oImage.style.position = "";
}
/**********************************************************************************/
var bLoad = false;
    function loadList(){
        if (bLoad==false){
            getLoadPage("/Scripts/Main/");
        }
    }