// JavaScript Document
// JavaScript Kod Generisan Maj 2009
// Generisao: Meda ExYuTeamOrg
// Copyright Meda, Trigon Dizajn


//Funkcije za pozivanje fajla (ucitavanje strane)...
var eID = '';

//function ucitajFajl(Adresa,idElementa)
function getFile(pURL,identIF) {
    eID=identIF; 
	
	if (window.XMLHttpRequest) {  //za Ostale browsere
      xmlhttp=new XMLHttpRequest();
      xmlhttp.onreadystatechange=postFileReady;
      xmlhttp.open("GET", pURL, true);
      xmlhttp.send(null);
    }
    else if (window.ActiveXObject) { //za IE
      xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
      if (xmlhttp) {
         xmlhttp.onreadystatechange=postFileReady;
         xmlhttp.open('GET', pURL, true);
         xmlhttp.send();
      }
   }
}

function postFileReady() {
   if (xmlhttp.readyState==4) {
      if (xmlhttp.status==200) {
         document.getElementById(eID).innerHTML=xmlhttp.responseText;
      }
   }
}

//////////////////////////////////
// Dodao Cedo
//////////////////////////////////
// Ajax - Asinhroni java skript asinhrono ucitava stranicu sa interneta i smesta je u tag sa prosledjenim id-jem.
// http://www.w3schools.com/Ajax/Default.Asp

function createXmlHttpObject()
{
	if (window.XMLHttpRequest)
  	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
  		return new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		// code for IE6, IE5
		return new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		return null;
	}
}

function loadAndShow(url, tag_id)
{
	var xmlhttp = createXmlHttpObject();

	if(xmlhttp != null)
	{
		xmlhttp.onreadystatechange = function()
		{
			if(xmlhttp.readyState==4)
			{
				document.getElementById(tag_id).innerHTML = xmlhttp.responseText;
			}
		}

		xmlhttp.open("GET", url, true);
		xmlhttp.send(null);	
	}
	else
	{
		document.getElementById(tag_id).innerHTML = "Vas veb pregledac je isuvise star.";
	}
}
