﻿// Barbaros YATKIN - 2009

var sayac=0;
var aResimler = new Array();
var tmr_SlideShow;

var tmr_ImageResize;
var iImgWidth = 50;
var iImgHeight = 50;
    
function f_SlideShow(sResimler,ImageID)
{
    if(aResimler.length==0)
    {
        aResimler = new String(sResimler).split(",");        
    }
    var img = MyGetElementById(new String(ImageID));
    img.src = aResimler[sayac];
    if(img.getAttribute('width') > 400) 
    {
        img.style.width = 400;
    }
    if(img.getAttribute('height') > 250) {
        img.style.height = 250;
    }
    
//    iImgWidth = 50;
//    iImgHeight = 50;
//    img.style.width = 50;
//    img.style.height = 50;
//    clearTimeout(tmr_ImageResize);
//    tmr_ImageResize = setTimeout("f_ResizeImage('"+ImageID+"')",5);
    
    sayac = (sayac == aResimler.length-1 ? 0 : sayac+=1);

    tmr_SlideShow = setTimeout("f_SlideShow('"+sResimler+"','"+ImageID+"')",4000);

    var spnSH_State = MyGetElementById('lblSH_State');
    spnSH_State.innerHTML = "(Auto)";
    spnSH_State.style.color = "Green";
    
}
function f_SlideShowStop()
{
    clearTimeout(tmr_SlideShow);
    var spnSH_State = MyGetElementById('lblSH_State');
    spnSH_State.innerHTML = "(Manual)";
    spnSH_State.style.color = "Red";
}
function f_ChangeImage(sResim,ImageID)
{
    var img = MyGetElementById(new String(ImageID));
    img.src = sResim;
}


function f_ResizeImage(ImageID)
{
    var Img = document.getElementById(ImageID);
    
    if(iImgWidth<430)
    {
        iImgWidth = iImgWidth + 10;
    }
    if(iImgHeight<280)
    {
        iImgHeight = iImgHeight + 10;
    }
    Img.style.width = iImgWidth;
    Img.style.height = iImgHeight;
    tmr_ImageResize = setTimeout("f_ResizeImage('"+ImageID+"')",5); 
}

function f_ResizeImage_Fix(ImageID)
{
    var Img = document.getElementById(ImageID);
    
    if(iImgWidth>400)
    {
        iImgWidth = 400;
    }
    if(iImgHeight>280)
    {
        iImgHeight = 280;
    }
    Img.style.width = iImgWidth;
    Img.style.height = iImgHeight;
}

