var wbV  = parseInt(navigator.appVersion);
var wbNS = navigator.appName=="Netscape";
var wbIE = navigator.appName=="Microsoft Internet Explorer";
var wbO = (navigator.userAgent.indexOf('Opera') != -1);
var vrati = "";

var odabraniapp = "";
var st1_seldate1 = "";
var st1_seldate1_obj;
var st1_seldate2 = "";
var st1_seldate2_obj;
var smjestiRezArray = "";

var sum_all = 0.00;
var sum_dat= 0.00;
var sum_brodr= 0.00;
var sum_brdjdo12= 0.00;
var sum_brdjdo18= 0.00;
var sum_dodkrevet= 0.00;
var sum_kuclj= 0.00;
var sum_obezkreveta = 0.00;

// Preload Images.... send array
function PreloadImages() 
{ 
  var d=document;
  if(d.images)
  {
  	if(!d.MM_p) d.MM_p=new Array();
  	
    var i,j=d.MM_p.length,a=PreloadImages.arguments;
    for(i=0; i<a.length; i++)
   		if (a[i].indexOf("#")!=0)
   		{ 
   			d.MM_p[j]=new Image;
   			d.MM_p[j++].src="images/"+a[i];
   		}
   }
}

function popupEvent(ev,w,h) {
 var winl=(screen.width-w) / 2;
 var wint=(screen.height-h) / 2;
 win=window.open("escal/escalEV.php?ev="+ev+"&readFile=0&readSQL=1&id="+odabraniapp+"&lan="+langi,"Calendar","scrollbars=no,status=no,location=no,toolbar=no,menubar=no,directories=no,resizable=no,width="+w+",height="+h+",top="+wint+",left="+winl+"");
 if (parseInt(navigator.appVersion) >=4) { win.window.focus();}
 }
function book_popupEvent(ev,w,h) {
 var winl=(screen.width-w) / 2;
 var wint=(screen.height-h) / 2;
 win=window.open("escal/escalEV.php?ev="+ev+"&readFile=0&readSQL=1&id="+odabraniapp+"&lan="+langi,"Calendar","scrollbars=no,status=no,location=no,toolbar=no,menubar=no,directories=no,resizable=no,width="+w+",height="+h+",top="+wint+",left="+winl+"");
 if (parseInt(navigator.appVersion) >=4) { win.window.focus();}
 }

function popupdiv( obj, L, T, e ) 
{
var mX,mY;
	//if (wbO) //opera
	//{
	//	mX = e.x;
	//	mY = e.y;
	//}
	//if (document.all){  // IE
		//if ((e.offsetX != e.x) || (e.offsetY != e.y))
		//	return;
	//	mX = e.offsetX;
	//	mY = e.offsetY;
	//}
	//if (document.layers){  // NN 4.x
	//	mX = e.x;
	//	mY = e.y;
	//}
	//if ((!document.all)&&(!document.layers)){	//NN 6
	//	mX = e.layerX;
	//	mY = e.layerY;
	//}
	mY=0;
	mX=0;
	if (document.all){
	mY=-10;
	
	}

	
	document.getElementById(obj).style.display = "block";
	document.getElementById(obj).style.position = "absolute";
	document.getElementById(obj).style.left = (mX+L)+"px";
	document.getElementById(obj).style.top = (mY-T)+"px";
	
	if (obj == "st2_k2") document.getElementById("djeca_12_18").style.visibility = "hidden";
	
}

function unpupdiv(obj) 
{ 
document.getElementById(obj).style.display = "none"; 
if (obj == "st2_k2") document.getElementById("djeca_12_18").style.visibility = "visible";
}
 

function getResponse(url, query)
{
	var tmpurl, rnd1, rnd2;
	tmpurl = "";
	rnd1 = Math.random();
	rnd2 = Math.random();
	if (document.all && !wbO) {
		oxmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
	}
	else {
		oxmlRequest = new XMLHttpRequest();
	}
	tmpurl += url + "?" + query +"&rnd1=" + rnd1 + "&rnd2=" + rnd2;
	oxmlRequest.open("GET", tmpurl, false);
	oxmlRequest.send(null);
	return oxmlRequest.responseText;
}

function callfillcalendars(id)
{
	var tmpQuery = "type=send_me_fillcalendars";
	tmpQuery += "&id="+id;
	tmpQuery += "&lan="+langi;
	var tmpReply = getResponse("include/fillcalendars.php", encodeURI(tmpQuery));
	document.getElementById("fillcalendars").innerHTML = tmpReply;
}

function submitContactForm()
{
	if (!IsValidField(document.getElementById("ime").value)) 
	{	
		alert (alert2);
		return false;
	}
	if (!IsValidField(document.getElementById("email").value)) 
	{
		alert (alert3);
		return false;
	}
	if (!IsValidField(document.getElementById("poruka").value)) 
	{
		alert (alert4);
		return false;
	}
	if (!document.getElementById("poruka").value) 
	{
		alert(alert5);
		return false;
	}
	var tmpQuery = "type=send_me_mail&lan="+langi;
	tmpQuery += "&ime="+document.getElementById("ime").value;
	tmpQuery += "&email="+document.getElementById("email").value;
	tmpQuery += "&poruka="+document.getElementById("poruka").value;
	var tmpReply = getResponse("send_mail.php", encodeURI(tmpQuery));

	if (tmpReply.length > 14)
		alert(tmpReply.substring(tmpReply.indexOf('user ERROR:: ')+13,tmpReply.indexOf('ENDuser ERROR::')));
	document.getElementById("poruka").value = "";
}

function IsValidField(s)
{
	var znakovi='\'"\\|#$^&*[]{}><`~';
	for (var oi=0;oi<s.length;oi++)
	{
		var onechar=s.substr(oi,1);
		if (znakovi.indexOf(onechar)>-1)
			{
				//s.focus();
				//s.value='';
				return false;
			}
	}
	return true;
}

function showhidescript(id)
{
	var obj = document.getElementById(id);
		if (obj.style.display == "block") obj.style.display = "none";
		else obj.style.display = "block";
	return true;
}

function underline_link(obj)
{
	obj.style.color = "#192F4D";
	obj.style.textDecoration = "none"
	//text-decoration: underline; color: 
}

function underline_hover(obj)
{
	obj.style.color = "#FF0000";
	obj.style.textDecoration = "underline"
	//text-decoration: underline; color: 
}
function changestylecol(obj,id)
{
	if (id == 0) obj.style.color = "#192F4D";
	else if (id == 1) obj.style.color = "red";
}
function popupslike(link)
{
	var v3 = window.open("slika.php?"+link,"popup_slika", "height=25, width=55, menubar=no, scrollbars=no, resizable=1");
	
	//window.v3.document.focus();

}
function showme(id)
{
	document.getElementById("step1").style.display = "none";
	document.getElementById("step1").style.visibility = "hidden";
	document.getElementById("step2").style.display = "none";
	document.getElementById("step2").style.visibility = "hidden";
	document.getElementById("step3").style.display = "none";
	document.getElementById("step3").style.visibility = "hidden";
	document.getElementById("step4").style.display = "none";
	document.getElementById("step4").style.visibility = "hidden";
	document.getElementById("step5").style.display = "none";
	document.getElementById("step5").style.visibility = "hidden";
	
	document.getElementById("step"+id).style.visibility = "visible";
	document.getElementById("step"+id).style.display = "block";
	
}

function checkme(id)
{

	switch (id)
	{
		case "2":
			//provjera stepa 1
			if (odabraniapp == "") vrati += "\n"+alert_st1_1;
			if (st1_seldate1 == "") vrati += "\n"+alert_st1_2;
			if (st1_seldate2 == "") vrati += "\n"+alert_st1_3;
			if (vrati != "") 
				{
					vrati = alert_st1+"\n"+vrati;
					return false;
				}
			return true;
		break;
		
		case "3":
			if (!checkme("2")) return false;
			//provjera stepa 2
			if (document.getElementById("ime").value == "") vrati += "\n"+alert_st2_1;
			if (document.getElementById("prezime").value == "") vrati += "\n"+alert_st2_2;
			if (document.getElementById("email").value == "") vrati += "\n"+alert_st2_3;
			if (document.getElementById("telefon").value == "") vrati += "\n"+alert_st2_4;
			
			
			if (vrati != "") 
				{
					vrati = alert_st2+"\n"+vrati;
					return false;
				}
			return true;
		break;
		
		case "4":
			if (!checkme("3")) return false;
			//provjera stepa 3
			
			if (vrati != "")
				{
					vrati = "U treæem koraku nedostaje:\n"+vrati;
					return false;
				}
			return true;
		break;
	} 
}

function goStep1()
{
	var i = 1;
	while (document.getElementById("booktd_"+i))
	{
		document.getElementById("booktd_"+i).className = "bookapp_td_false"; 
		i++;
	}
	if (odabraniapp != "") 
	{
		document.getElementById("booktd_"+odabraniapp).className = "bookapp_td"; 
		callfillcalendars(odabraniapp);
	}
	st1_obojikalendar();
	linksovi(true,1);

	showme(1);
}

function goStep2()
{
vrati ="";
	if (!checkme("2")) { if (vrati!="") alert(vrati); goStep1();  return false;}
	linksovi(true,2);
	showme(2);
}

function goStep3()
{
vrati ="";
	if (!checkme("3")) { if (vrati!="") alert(vrati);goStep2(); return false;}
	linksovi(true,3);
	showme(3);
	
	uk_izracun();
}

function goStep4()
{
vrati ="";
	if (!checkme("4")) { if (vrati!="") alert(vrati); goStep3();return false;}
	
	var tmpQuery = "asdlkjdasdadsadsfsdioaspdas=9&getmestrlan="+langi;
	tmpQuery += "&getmestrime="+document.getElementById("ime").value;
	tmpQuery += "&getmestrprezime="+document.getElementById("prezime").value;
	tmpQuery += "&getmestremail="+document.getElementById("email").value;
	tmpQuery += "&getmestradresa="+document.getElementById("adresa").value;
	tmpQuery += "&getmestrfax="+document.getElementById("fax").value;
	tmpQuery += "&getmestrtel="+document.getElementById("telefon").value;
	tmpQuery += "&getmestrdrzava="+document.getElementById("drzava").value;
	tmpQuery += "&getmestrmob="+document.getElementById("mobitel").value;
	tmpQuery += "&getmestrgrad="+document.getElementById("grad").value;
	tmpQuery += "&getmestrid_app="+odabraniapp;
	
	tmpQuery += "&getmestrakontacija="+sum_all.toString();
	tmpQuery += "&getmestrizrsum_dat="+sum_dat.toString();
	tmpQuery += "&getmestrizrsum_brodr="+sum_brodr.toString();
	tmpQuery += "&getmestrizrsum_brdjdo12="+sum_brdjdo12.toString();
	tmpQuery += "&getmestrizrsum_brdjdo18="+sum_brdjdo18.toString();
	tmpQuery += "&getmestrizrsum_dodkrevet="+sum_dodkrevet.toString();
	tmpQuery += "&getmestrizrsum_kuclj="+sum_kuclj.toString();
	tmpQuery += "&getmestrizrsum_obezkreveta="+sum_obezkreveta.toString();
	
	tmpQuery += "&getmestrdatum_od="+st1_seldate1;
	tmpQuery += "&getmestrdatum_do="+st1_seldate2;
	tmpQuery += "&getmestrosoba_odraslih="+document.getElementById("odrasli_po_osobi_na_dan").value;
	tmpQuery += "&getmestrosoba_djeca="+document.getElementById("djeca_12").value;
	tmpQuery += "&getmestrosoba_bez_lezaja="+document.getElementById("os_bez_lezaja").value;
	tmpQuery += "&getmestrosoba_djeca_od12do18="+document.getElementById("djeca_12_18").value;
	tmpQuery += "&getmestrdod_krevet="+document.getElementById("dod_krevet").checked;
	tmpQuery += "&getmestrljubimac="+document.getElementById("kucni_ljubimac").checked;

	var tmpReply = getResponse("include/finish_me.php", encodeURI(tmpQuery));
	if (tmpReply.length > 11 && tmpReply.indexOf("../download/") != -1) 
	{
		document.getElementById("link_rezervacije").href = document.location.host+"/"+tmpReply.substring(tmpReply.indexOf("../download/"),tmpReply.indexOf(".pdf")+4);
		showme(4);
		linksovi(false);
	
	}
	else
	{
		if (tmpReply.length > 14)
		document.getElementById("error_rezervacije").innerHTML = tmpReply.substring(tmpReply.indexOf('user ERROR:: ')+13);
		showme(5);
		linksovi(true);
	}
}

function linksovi(obj,id)
{
	if (obj)
	{
		document.getElementById("link_step1").innerHTML = "<br><a onclick=\"javascript:goStep1();\" href=# class=\"koraci\">.: "+korak1+" :.</a><br>";
		document.getElementById("link_step2").innerHTML = "<br><a onclick=\"javascript:goStep2();\" href=# class=\"koraci\">.: "+korak2+" :.</a><br>";
		document.getElementById("link_step3").innerHTML = "<br><a onclick=\"javascript:goStep3();\" href=# class=\"koraci\">.: "+korak3+" :.</a><br>";
		document.getElementById("link_step4").innerHTML = "<br><a onclick=\"javascript:goStep4();\" href=# class=\"koraci\">.: "+korak4+" :.</a><br>";
		
		if (id) document.getElementById("link_step"+id).innerHTML = "<br><a href=# class=\"diskoraci\">.: "+(id == 1 ? korak1 : (id == 2 ? korak2 : (id == 3 ? korak3 : korak4) ) )+" :.</a><br>";
	}
	else
	{
		document.getElementById("link_step1").innerHTML = "<br><a href=# class=\"diskoraci\">.: "+korak1+" :.</a><br>";
		document.getElementById("link_step2").innerHTML = "<br><a href=# class=\"diskoraci\">.: "+korak2+" :.</a><br>";
		document.getElementById("link_step3").innerHTML = "<br><a href=# class=\"diskoraci\">.: "+korak3+" :.</a><br>";
		document.getElementById("link_step4").innerHTML = "<br><a href=# class=\"diskoraci\">.: "+korak4+" :.</a><br>";
	}
}

function step1_odabraniapp(id,daliimaextrakreveta,daliimaljubimca)
{
	odabraniapp = id;
	document.getElementById("kucni_ljubimac").checked = false;
	document.getElementById("dod_krevet").checked = false;
	document.getElementById("kucni_ljubimac").disabled = !daliimaljubimca;
	document.getElementById("dod_krevet").disabled = !daliimaextrakreveta;
	st1_ponistidatume();
	changeExtraosobe();
	goStep1();
}

function st1_goSelectDate(sdate,obj)
{
	
		if (!st1_seldate1 || !st1_seldate1_obj || (st1_seldate1_obj && !st1_seldate2_obj && parseInt(st1_seldate1_obj.id.substring(7)) > parseInt(obj.id.substring(7))))
		{
			if (st1_seldate1_obj)	st1_seldate1_obj.className = "s2";
				st1_seldate1 = sdate;
				st1_seldate1_obj = obj;
				document.getElementById("pocdat").value = sdate;
				st1_seldate1_obj.className = "s22_book";
		}
		else if (!st1_seldate2 || !st1_seldate2_obj)
		{
			if (!st1_checkrez(obj.id.substring(7)))
			{
				if (parseInt(parseInt(obj.id.substring(7)) - parseInt(st1_seldate1_obj.id.substring(7))) > 30)	
				{
					alert(alert30dana);
					return false;	
				}
				if (parseInt(obj.id.substring(7)) == parseInt(st1_seldate1_obj.id.substring(7)))
				return;
				
				st1_seldate2 = sdate;
				st1_seldate2_obj = obj;
				document.getElementById("kondat").value = sdate;
				st1_seldate2_obj.className = "s22_book";
			}
			else
				{
					alert(alert1);
					return false;	
				}
		}
		else if (st1_blizeprvome(st1_seldate1_obj.id.substring(7),st1_seldate2_obj.id.substring(7),obj.id.substring(7)))
		{
			if (!st1_checkrez(obj.id.substring(7)))
			{
				if ( parseInt(st1_seldate2_obj.id.substring(7)) - parseInt(parseInt(obj.id.substring(7))) > 30)	
				{
					alert(alert30dana);
					return false;	
				}
				st1_seldate1 = sdate;
				st1_seldate1_obj = obj;
				document.getElementById("pocdat").value = sdate;
			}
			else
				{
					alert(alert1);
					return false;	
				}
		}
		else
		{
			if (!st1_checkrez(obj.id.substring(7)))
			{
				if (parseInt(parseInt(obj.id.substring(7)) - parseInt(st1_seldate1_obj.id.substring(7))) > 30)	
				{
					alert(alert30dana);
					return false;	
				}
				if (parseInt(obj.id.substring(7)) == parseInt(st1_seldate1_obj.id.substring(7)))
				return;
				st1_seldate2 = sdate;
				st1_seldate2_obj = obj;
				document.getElementById("kondat").value = sdate;
			}
			else
				{
					alert(alert1);
					return false;	
				}	
		}
		st1_vecidatum();
		document.getElementById("ukizr").innerHTML = ukizracuni+" <b>"+st1_izracun()+" &#8364;</b>";
		st1_obojikalendar();
		
}

function st1_obojikalendar()
{
	if (st1_seldate1_obj && st1_seldate2_obj)
	{
		i=0;
		while (document.getElementById("st1ctd_"+i))
		{
			if (document.getElementById("st1ctd_"+i).className == "s22" || document.getElementById("st1ctd_"+i).className == "s23" || document.getElementById("st1ctd_"+i).className == "s21" || document.getElementById("st1ctd_"+i).className == "s28" || document.getElementById("st1ctd_"+i).className == "s29") {	i++;	continue;	}
			else if (document.getElementById("st1ctd_"+i).title == dokadjerezervirano) document.getElementById("st1ctd_"+i).className = "s210";
			else if (document.getElementById("st1ctd_"+i).title == odkadjerezervirano) document.getElementById("st1ctd_"+i).className = "s29";
			else if (parseInt(document.getElementById("st1ctd_"+i).id.substring(7)) < parseInt(st1_seldate1_obj.id.substring(7)) || parseInt(st1_seldate2_obj.id.substring(7)) < parseInt(document.getElementById("st1ctd_"+i).id.substring(7)))	document.getElementById("st1ctd_"+i).className = "s2";
			else document.getElementById("st1ctd_"+i).className = "s22_book";
			i++;
		}
		st1_seldate1_obj.className = "s22_book";
	}
	else if (st1_seldate1_obj==null && st1_seldate2_obj==null)
	{
		i=0;
		while (document.getElementById("st1ctd_"+i))
		{
			if (document.getElementById("st1ctd_"+i).className == "s22" || document.getElementById("st1ctd_"+i).className == "s23" || document.getElementById("st1ctd_"+i).className == "s21" || document.getElementById("st1ctd_"+i).className == "s28" || document.getElementById("st1ctd_"+i).className == "s29") {	i++;	continue;	}
			else if (document.getElementById("st1ctd_"+i).title == dokadjerezervirano) document.getElementById("st1ctd_"+i).className = "s210";
			else if (document.getElementById("st1ctd_"+i).title == odkadjerezervirano) document.getElementById("st1ctd_"+i).className = "s29";
			else document.getElementById("st1ctd_"+i).className = "s2";
			i++;
		}
	}
}

function st1_checkrez(obj)
{
var kolacici = document.getElementById("smjestiRezArray").value.split(",");
	for (var k=0; k< kolacici.length; k++)
	{
		if (kolacici[k] != "") 
		{
			if (parseInt(st1_seldate1_obj.id.substring(7)) < parseInt(kolacici[k]) && parseInt(obj) > parseInt(kolacici[k]))	return true;
			if (st1_seldate2_obj) if (parseInt(st1_seldate2_obj.id.substring(7)) > parseInt(kolacici[k]) && parseInt(obj) < parseInt(kolacici[k]))	return true;
		}
	}
	return false;
}

function st1_ponistidatume()
{
	st1_seldate1 = "";
	st1_seldate1_obj = null;
	st1_seldate2 = "";
	st1_seldate2_obj = null;
	document.getElementById("pocdat").value = "";
	document.getElementById("kondat").value = "";
	document.getElementById("ukizr").innerHTML = ukizracuni+" <b>0 &#8364;</b>";
	st1_obojikalendar();
}


function getNearest(obj1)
{
	
}

function st1_blizeprvome(date1,date2,datenow)
{
	date1 = parseInt(date1);
	date2= parseInt(date2);
	datenow= parseInt(datenow);
	
	if (datenow <= date1)	return true;
	else
	{
			
		if (datenow >= date2)	return false;
		else
		{
			if ((datenow-date1) < (date2-datenow))	return true;
			else if ((datenow-date1) > (date2-datenow))	return false;
			else
				return false;
		}
	}
}

function st1_vecidatum()
{
	if (st1_seldate2_obj && st1_seldate1_obj)
	{
		var privremena, privremena2;
		
		if (parseInt(st1_seldate2_obj.id.substring(7)) < parseInt(st1_seldate1_obj.id.substring(7)))
		{
			privremena = st1_seldate1_obj;
			st1_seldate1_obj = st1_seldate2_obj;
			st1_seldate2_obj = privremena;
			
			privremena2 = st1_seldate1;
			st1_seldate1 = st1_seldate2;
			st1_seldate2 = privremena2;
			
			document.getElementById("kondat").value = st1_seldate2;
			document.getElementById("pocdat").value = st1_seldate1;
			
		}
	}
}

function st1_izracun()
{
var proracun = 0.00;
	if (st1_seldate2_obj && st1_seldate1_obj)
	{
		var cijene = document.getElementById("cijapp_"+odabraniapp).name.split("; ");
		for (var k=parseInt(st1_seldate1_obj.id.substring(7)); k< parseInt(st1_seldate2_obj.id.substring(7)); k++)
		{
			if (k < 61)
				proracun = (parseFloat(proracun) + parseFloat(cijene[0])).toFixed(2);
			else if (k < 123)
				proracun = (parseFloat(proracun) + parseFloat(cijene[1])).toFixed(2);
			else if (k < 153)
				proracun = (parseFloat(proracun) + parseFloat(cijene[2])).toFixed(2);
		}	
	}
	return proracun;
}



function uk_izracun()
{


var brojdana = parseInt(st1_seldate2_obj.id.substring(7)) - parseInt(st1_seldate1_obj.id.substring(7));
	//sum_all = 0.00;
	document.getElementById("sum_imeapp").innerHTML = odabraniapp;
	
	//datumi
	document.getElementById("sum_dat").innerHTML = st1_seldate1 + " - " + st1_seldate2; 
	
	sum_dat = (parseFloat(st1_izracun() + 0.00)).toFixed(2);
	sum_all = parseFloat(sum_dat + 0.00).toFixed(2);
	document.getElementById("sum_dat_uk").innerHTML = sum_all.toString()+" &#8364;"; 
	var kolkodana = parseInt(st1_seldate2_obj.id.substring(7)) - parseInt(st1_seldate1_obj.id.substring(7)); 
	document.getElementById("sum_datrazl_uk1").innerHTML =kolkodana; 
	document.getElementById("sum_datrazl_uk2").innerHTML =kolkodana; 
	document.getElementById("sum_datrazl_uk3").innerHTML =kolkodana; 
	document.getElementById("sum_datrazl_uk4").innerHTML =kolkodana; 
	document.getElementById("sum_datrazl_uk5").innerHTML =kolkodana; 
	document.getElementById("sum_datrazl_uk6").innerHTML =kolkodana; 
	document.getElementById("sum_datrazl_uk7").innerHTML =kolkodana; 
	
	//br odraslih	
	document.getElementById("sum_br_od").innerHTML = document.getElementById("odrasli_po_osobi_na_dan").value+""; 
	sum_brodr = ((parseFloat(extrap0) * parseInt(document.getElementById("odrasli_po_osobi_na_dan").value)) * brojdana).toFixed(2);
	sum_all = (parseFloat(sum_all) + parseFloat(sum_brodr)).toFixed(2);
	document.getElementById("sum_br_od_uk").innerHTML =  sum_brodr.toString()+" &#8364;"; 
	
	//br osoba bez kreveta
	changeExtraosobe();
	document.getElementById("sum_obezkreveta").innerHTML = document.getElementById("os_bez_lezaja").value+""; 
	sum_obezkreveta = ((parseFloat(extrap3) * parseFloat(document.getElementById("os_bez_lezaja").value)) * brojdana).toFixed(2);
	sum_all = (parseFloat(sum_all) + parseFloat(sum_obezkreveta)).toFixed(2);
	document.getElementById("sum_obezkreveta_uk").innerHTML =  sum_obezkreveta+" &#8364;"; 
	
	//djeca do 12
	document.getElementById("sum_djdo12").innerHTML = document.getElementById("djeca_12").value+""; 
	sum_brdjdo12 = ((parseFloat(extrap5) * parseFloat(document.getElementById("djeca_12").value)) * brojdana).toFixed(2);
	sum_all = (parseFloat(sum_all) + parseFloat(sum_brdjdo12)).toFixed(2) ;
	document.getElementById("sum_djdo12_uk").innerHTML = sum_brdjdo12+" &#8364;"; 
	
	//od 12 - 18
	document.getElementById("sum_djod12do18").innerHTML = document.getElementById("djeca_12_18").value+""; 
	sum_brdjdo18 = ((parseFloat(extrap1) * parseFloat(document.getElementById("djeca_12_18").value)) * brojdana).toFixed(2);
	sum_all = (parseFloat(sum_all) + parseFloat(sum_brdjdo18)).toFixed(2) ;
	document.getElementById("sum_djod12do18_uk").innerHTML = sum_brdjdo18 +" &#8364;"; 

	//dodatni krevet
	document.getElementById("sum_dodkrevet").innerHTML = (document.getElementById("dod_krevet").checked ? "1" : "0"); 
	if (document.getElementById("dod_krevet").checked)
	{
		sum_dodkrevet = ((parseFloat(extrap2)) * brojdana).toFixed(2);
		sum_all = (parseFloat(sum_all) + parseFloat(sum_dodkrevet)).toFixed(2) ;
		document.getElementById("sum_dodkrevet_uk").innerHTML = sum_dodkrevet +" &#8364;"; 
	}
	else
		document.getElementById("sum_dodkrevet_uk").innerHTML =  "0.00 &#8364;";
	
	//kucni ljubimac
	document.getElementById("sum_kucnilj").innerHTML = (document.getElementById("kucni_ljubimac").checked  ? "1" : "0"); 
	if (document.getElementById("kucni_ljubimac").checked)
	{
		sum_kuclj = ((parseFloat(extrap4)) * brojdana).toFixed(2);
		sum_all = (parseFloat(sum_all) + parseFloat(sum_kuclj)).toFixed(2);
		document.getElementById("sum_kucnilj_uk").innerHTML = sum_kuclj +" &#8364;"; 
	}
	else
		document.getElementById("sum_kucnilj_uk").innerHTML =  "0.00 &#8364;";
	
	document.getElementById("sum_uk").innerHTML = sum_all+" &#8364;"; 
}

function changeExtraosobe()
{
var uk_br_osoba = parseInt(document.getElementById("odrasli_po_osobi_na_dan").value) + parseInt(document.getElementById("djeca_12_18").value);
	var total = 0;
	
	total = uk_br_osoba - (parseInt(document.getElementById("kolkreveta_"+odabraniapp).value) + (document.getElementById("dod_krevet").checked ? 1 : 0));
	if (total < 0) total = 0;
	document.getElementById("os_bez_lezaja").value = total;
}
