var current_vijest = 0;
var vijesti_arr = new Array("slika1","slika2","slika3","slika4","slika5");
var interval = '';

function proces_onload(){
    toggle_vijesti(current_vijest);
//interval = setInterval('toggle_vijesti(current_vijest+1)', 10000);
}

function toggle_vijesti(position){
    if(position < 0){ //back je kliknut
        position = vijesti_arr.length - 1;
    }
    else if(position >= vijesti_arr.length){
        position = 0;
    }
    
    current_vijest = position;
    for(var i=0; i<vijesti_arr.length;i++){
        if(i!=current_vijest){
            document.getElementById(vijesti_arr[i]).style.display = 'none';
        }
    }

    document.getElementById(vijesti_arr[current_vijest]).style.display = '';
    var speed = Math.round(5);
    var timer = 0;
    for(i = 0; i <= 100; i++)
    {
        setTimeout("change_opacity(" + i + ",'" + vijesti_arr[current_vijest] + "')",(timer * speed));
        timer++;
    }
    if(interval == '' || interval == undefined){
        set_interval();
    }
}

function clear_interval(){
    interval = clearInterval(interval);
}

function set_interval(){
    interval = setInterval('toggle_vijesti(current_vijest+1)', 10000);
}

function change_opacity(opacity) {
    document.getElementById(vijesti_arr[current_vijest]).style.opacity = (opacity / 100);
    document.getElementById(vijesti_arr[current_vijest]).style.MozOpacity = (opacity / 100);
    document.getElementById(vijesti_arr[current_vijest]).style.KhtmlOpacity = (opacity / 100);
    document.getElementById(vijesti_arr[current_vijest]).style.filter = "alpha(opacity=" + opacity + ")";
}

function show_video(video, lang)
  {
   open_win=dhtmlwindow.open("open_win2", "iframe", "video_inc/video.php?video="+video+"&lang="+lang, "Video ", "width=340px,height=265px,left=320px,top=20px,resize=0,scrolling=1");
  }
