function lol(path,id)
{

var path;
var xPos;
var yPos;
width=600;
height=670;
xPos = (window.screen.width/2) - (width/2 + 10);
yPos = (window.screen.height/2) - (height/2 + 50);
var win2 = window.open(path+"?id="+id+"","Window2","status=no,height="+height+",width="+width+",resizable=yes,left=" + xPos + ",top=" + yPos + ",screenX=" + xPos + ",screenY=" + yPos + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
win2.focus();
}
function print(path,slika)
{

var path;
var xPos;
var yPos;
width=650;
height=670;
xPos = (window.screen.width/2) - (width/2 + 10);
yPos = (window.screen.height/2) - (height/2 + 50);
var win2 = window.open(path+"?id="+slika+"","Window2","status=no,height="+height+",width="+width+",resizable=yes,left=" + xPos + ",top=" + yPos + ",screenX=" + xPos + ",screenY=" + yPos + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
win2.focus();
}
///////////////// pretraga ///////////
	function test() {
  el=document.getElementById("myTable");
	var tmp = el.offsetLeft;
	el = el.offsetParent
	while(el) {
		tmp += el.offsetLeft;
		el = el.offsetParent;
	}
	return tmp;
}
 function ds_getleft(el) {
	var tmp = el.offsetLeft;
	el = el.offsetParent
	while(el) {
		tmp += el.offsetLeft;
		el = el.offsetParent;
	}
	return tmp;
}
function ds_gettop(el) {
	var tmp = el.offsetTop;
	el = el.offsetParent
	while(el) {
		tmp += el.offsetTop;
		el = el.offsetParent;
	}
	return tmp;
}
				function showResult(t,path)
{ 


//alert(tap)
 
//tap=document.getElementById("tap").value;

document.getElementById("livesearch").style.display="block";
  polje_left = test();
	the_left = ds_getleft(t);
	the_top = ds_gettop(t) + t.offsetHeight;
	element=document.getElementById("livesearch");

	element.style.top=the_top + 'px';
	element.style.left=the_left + 'px';
	
if (str.length<2)
  { 
  document.getElementById("livesearch").innerHTML="";
  document.getElementById("livesearch").style.border="0px";
  return;
  }
  document.getElementById("livesearch").style.border="1px solid black";
  var url=path+"search.php";
   
    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();// Mozilla/Safari
    }else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");// IE
    }

    xmlHttp.onreadystatechange=AJAXresponse;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null)

/*jQuery('#livesearch').html('load...');
  var url="<?=base_url()?>index.php/racun_za_usluge/livesearch/"+str+"/"+kolona+"/"+tabela;
 jQuery('#livesearch').load(url);
 */
}
function AJAXresponse(){
 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
   document.getElementById("livesearch").innerHTML=xmlHttp.responseText;
// ddrivetip(xmlHttp.responseText);
}
    else{
        document.getElementById("livesearch").innerHTML = 'load...';
    }
}
function sakrij()
{
document.getElementById("livesearch").style.display="none";
}
function hide()
{
	tid = window.setTimeout("sakrij()",1500);
}

 
 function show_resulti(ivent,div){
	o = document.getElementById(div);
	if(ivent==1){
		o.style.display = "block";
		if(window.stid){
			clearTimeout(stid);	
		}
		tid = window.setTimeout("prikazi('"+div+"')",100);
	}else if(ivent==2){
	if(o.style.opacity==100){
			if(window.tid){
				clearTimeout(tid);	
			}
			zatvori();
	}else{
			stid = window.setTimeout("zatvori('"+div+"')",1000);
	}
	}
}
function pokreni_ponovo(ivent,div){
	if(ivent==1){
		if(window.stid){
			clearTimeout(stid);	
		}
	}else if(ivent==2){
		stid = window.setTimeout("zatvori('"+div+"')",1000);
	}
}
function prikazi(div){
if(div=="resulti"){
//document.getElementById("resulti").style.display="none";
//document.getElementById("resulti2").style.display="none";
}
if(div=="resulti1"){
document.getElementById("resulti").style.display="none";
document.getElementById("resulti2").style.display="none";
}
if(div=="resulti2"){
document.getElementById("resulti").style.display="none";
document.getElementById("resulti1").style.display="none";
}
	o = document.getElementById(div);
	palfa = o.style.opacity*100;
	if(!palfa){
		palfa = 0;
	}
	novialfa = palfa + 20;

	if(palfa<95){
		o.style.opacity=novialfa/100;
		o.style.filter = "alpha(opacity:"+novialfa+")";
		tid = window.setTimeout("prikazi('"+div+"')",10);
	}else{
		if ( window.tid ) {	
			clearTimeout(tid);
		}
	}
}
function zatvori(div){
	o = document.getElementById(div);

	
	o.style.display="none";
}

function produziPmeni(div){
	if ( window.stid ) {		
		clearTimeout(stid);
	}
	stid = window.setTimeout("zatvori('"+div+"')",1000);
}

function displaySubs(id,vr,path,t){

if(vr=='yes' && id>0)
{
info(t);
}

nek=vr;
path1=path

    var url=path+"/private/korpa_add.php?id="+id+"&vr="+vr+"&rand=" + Math.random();

    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();// Mozilla/Safari
    }else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");// IE
    }

    xmlHttp.onreadystatechange=AJAXresponser;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null)
}

function displaySubs1(id,vr,path,t){
kolicina=document.getElementById("kolicina").value;
sifra=document.getElementById("sifra1").value;
if(sifra==0)
info1(t);
else{
if(vr=='yes' && id>0)
{
info(t);
}

nek=vr;
path1=path

    var url=path+"/korpa_add.php?id="+id+"&vr="+vr+"&kolicina="+kolicina+"&sifra="+sifra+"&rand=" + Math.random();

    if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();// Mozilla/Safari
    }else if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");// IE
    }

    xmlHttp.onreadystatechange=AJAXresponser;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null)
}
}
function AJAXresponser(){
 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
  
   document.getElementById("result").innerHTML=xmlHttp.responseText;
// ddrivetip(xmlHttp.responseText);
}
    else{
  
        document.getElementById("result").innerHTML = '';
    }
}
function info(t)
{
the_left = ds_getleft(t);
	the_top = ds_gettop(t) + t.offsetHeight;
	document.getElementById("info").style.display="block";
	setTimeout ( "setToBlack()", 3000 );
}
function info1(t)
{
the_left = ds_getleft(t);
	the_top = ds_gettop(t) + t.offsetHeight;
	document.getElementById("info1").style.display="block";
	setTimeout ( "setToBlack1()", 3000 );
}
function setToBlack (id)
{
$("#info").hide(500);
}
function setToBlack1 (id)
{
$("#info1").hide(500);
}

