sl = true;
myTick = false;
curr = 1;
function slideNews(id, human) {
if (sl == true) {
sl = false;
curr = id;
if (human == true) clearTimeout(myAutoTick);
// zmiana strzałki
for (i = 1; i <= 4; i++) {
instancja = document.getElementById('arr'+i);
instancja.innerHTML = '
';
}
instancja = document.getElementById('arr'+id);
instancja.innerHTML = '
';
var openedWidth = 564;
var closedWidth = 35;
for (i = 1; i <= 4; i++) {
instancja = document.getElementById('news'+i);
if (parseInt(instancja.style.width) > closedWidth)
closeNews = i;
}
slideIt(id, closeNews, openedWidth, closedWidth);
}
}
function slideIt(openNewsId, closeNewsId, openedWidth, closedWidth) {
var slideSpeed = 7;
openNews = document.getElementById('news'+openNewsId);
closeNews = document.getElementById('news'+closeNewsId);
thisCloseWidth = parseInt(closeNews.style.width);
thisOpenWidth = parseInt(openNews.style.width);
move = Math.ceil( (openedWidth - thisOpenWidth) / slideSpeed);
//alert(move);
openNews.style.width = (thisOpenWidth + move) + 'px';
closeNews.style.width = (thisCloseWidth - move) + 'px';
if (move > 0) {
myTick = setTimeout("slideIt("+openNewsId+", "+closeNewsId+", "+openedWidth+", "+closedWidth+")", 5);
}
if (move == 0) { unTick(); }
}
function unTick() {
clearTimeout(myTick);
sl = true;
}
function autoTick(id, human) {
nextId = id + 1;
if (nextId > 4) nextId = 1;
slideNews(nextId, human);
myAutoTick = setTimeout("autoTick("+nextId+", "+human+")", 5000);
}