﻿// JavaScript Document

var xmlHttp
var xmlHttp2
var stran = 0
var stran2 = 0

function showIzjavo()
{ 

xmlHttp2=GetXmlHttpObject()

if (xmlHttp2==null)
 {
 alert ("Brskalnik ne podpira HTTP Request")
 return
 }

var url="na.php"
url=url+"?&sid="+Math.random()+"&i="+stran;
xmlHttp2.onreadystatechange=stateChanged2
xmlHttp2.open("GET",url,true)
xmlHttp2.send(null)
stran++;
if (stran >= 5) stran = 0;
setTimeout("showIzjavo()", 10000);
}

function showIzjavo2()
{ 

xmlHttp=GetXmlHttpObject()

if (xmlHttp==null)
 {
 alert ("Brskalnik ne podpira HTTP Request")
 return
 }

var url="na2.php"
url=url+"?&sid="+Math.random()+"&i="+stran2
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
stran2++;
if (stran2 >= 5) stran2 = 0;
setTimeout("showIzjavo2()", 10000);
}

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	if (xmlHttp.status == 200 || xmlHttp.status == 304) {
 document.getElementById("prva_novice").innerHTML=xmlHttp.responseText }
 } 
}

function stateChanged2() 
{ 
if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
 { 
 	if (xmlHttp2.status == 200 || xmlHttp2.status == 304) {
 document.getElementById("prva_aktualno").innerHTML=xmlHttp2.responseText }
 } 
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 //Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}