// JavaScript Document
function notEmpty(){
	var myTextField = document.getElementById('myText');
	if(myTextField.value = "")
		alert("Morate unijeti obavezan tekst?")		
}

function popWindow(wName,asa){
	
	if (asa==1) {
		features = 'width=715,height=600,toolbar=no,location=no,directories=no,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes';
		pop = window.open('',wName,features);
		if(pop.focus){ pop.focus(); }
		return true;
	}
	if (asa==2) {
		if (document.getElementById("ime").value != "" && document.getElementById("adresa").value != ""
			&& document.getElementById("mesto").value != "" && document.getElementById("telefon").value != "") {
		} else {
			alert("Morate popuniti sva polja da bi ste porucili konfiguraciju!");
			return false;
		}

		features = 'width=200,height=80,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,resizable=yes';
		pop = window.open('',wName,features);
		if(pop.focus){ pop.focus(); }
		return true;
	}



}

function startclock()
{
var thetime=new Date();

var nhours=thetime.getHours();
var nmins=thetime.getMinutes();
var nsecn=thetime.getSeconds();
var nday=thetime.getDay();
var nmonth=thetime.getMonth();
var ntoday=thetime.getDate();
var nyear=thetime.getYear();
var AorP=" ";

if (nhours>=12)
    AorP="P.M.";
else
    AorP="A.M.";

if (nhours>=13)
    nhours-=12;

if (nhours==0)
   nhours=12;

if (nsecn<10)
 nsecn="0"+nsecn;

if (nmins<10)
 nmins="0"+nmins;

if (nday==0)
  nday="Nedelja";
if (nday==1)
  nday="Ponedeljak";
if (nday==2)
  nday="Utorak";
if (nday==3)
  nday="Srijeda";
if (nday==4)
  nday="Cetvrtak";
if (nday==5)
  nday="Petak";
if (nday==6)
  nday="Subota";

nmonth+=1;

if (nyear<=99)
  nyear= "19"+nyear;

if ((nyear>99) && (nyear<2000))
 nyear+=1900;

document.getElementById("Vreme").innerHTML = nhours+": "+nmins+": "+nsecn+" "+AorP;
document.getElementById("Datum").innerHTML = nday+", "+ntoday+"."+nmonth+"."+nyear;

setTimeout('startclock()',1000);

} 

// JavaScript Document
function konfigurator1(par_ime,par_vrednost)
{
	var r,ime,vrednost,minus_iznos,saldo,saldo1,saldoSaPdv,pdv1,iznos_pdv,saldoBezPdv;
	var iznos,iznos1,iznos2,iznos2;
	var temp = new Array();
	
//	document.write(par_vrednost);
	
	r = par_ime;
	vrednost = par_vrednost;
	temp = vrednost.split('|');

	minus_iznos = document.getElementById("oDiv"+r).innerHTML;
//	document.getElementById("oDiv"+r).innerHTML = vrednost;
	document.getElementById("oDiv"+r).innerHTML = temp[0];
	
	document.getElementById("cena"+r).value = temp[0];
//	document.getElementById("cena"+r).value = vrednost;
	document.getElementById("nazivLista"+r).value = temp[1];
	
	iznos = document.getElementById("oDiv"+r).innerHTML;

	saldo = document.getElementById("oDivS").innerHTML;
	saldoSaPdv = (parseInt(saldo)-parseInt(minus_iznos)) + parseInt(iznos);
	document.getElementById("oDivS").innerHTML  = (saldoSaPdv.toFixed(2));
	
	saldo1 = document.getElementById("oDivS").innerHTML;
	pdv1 = (saldo1 * 17)/117;
	iznos_pdv = (pdv1.toFixed(2));
	document.getElementById("oDivPdv").innerHTML = iznos_pdv;
	saldoBezPdv = saldo1 - iznos_pdv;
	document.getElementById("oDivBezPdv").innerHTML = (saldoBezPdv.toFixed(2));

	document.getElementById("iznosBezPdv").value = saldoBezPdv.toFixed(2);
	document.getElementById("iznosPdv").value = pdv1.toFixed(2);
	document.getElementById("iznosSaPdv").value = saldoSaPdv.toFixed(2);
}