function setCookie(cookieName,cookieValue,nDays)
{var today=new Date();var expire=new Date();if(nDays==null||nDays==0)nDays=1;expire.setTime(today.getTime()+3600000*24*nDays);document.cookie=cookieName+"="+escape(cookieValue)+";expires="+expire.toGMTString();}
var now=new Date();var t_hour=now.getHours().toString();var t_min=now.getMinutes().toString();if(t_hour.length==1)t_hour="0"+t_hour;if(t_min.length==1)t_min="0"+t_min;setCookie('jsTime',t_hour+t_min,1000);function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_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=a[i];}}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function MM_openBrWindow(theURL,winName,features){window.open(theURL,winName,features);}
function MM_jumpMenu(targ,selObj,restore){eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");if(restore)selObj.selectedIndex=0;}
function MM_callJS(jsStr){return eval(jsStr)}
function binFill(Img){var Loc='/upl/ilustracije/';var Item=document.getElementById('Bin');Item.value=Loc+Img;}
function windowPopup(URL,Name,Width,Height)
{return window.open(URL,Name,"width="+Width+",height="+Height+",scrollbars=1");}
function popupVisaElectron()
{var Name='WindowPopupVisa';var URL='/popup.visa-electron-zahtjev.php';windowPopup(URL,Name,550,600);}
function popupVisaGift()
{var Name='WindowPopupVisa';var URL='/popup.visa-gift-zahtjev.php';windowPopup(URL,Name,550,600);}
function popupNlbKlik()
{var Name='WindowPopupKlik';var URL='http://mobileapp.asseco-see.hr/m-banking/demo/applet/nlb/applet.htm?width=310&height=690';windowPopup(URL,Name,310,690);}
function sendPage(Request)
{var Name='WindowSend';var URL='/send.php?q='+Request;windowPopup(URL,Name,550,600);}
function printPage(Request)
{window.print();}
function popupPage(Request)
{var Name='WindowPopup';var URL=Request;windowPopup(URL,Name,640,600);}
function checkSend(Forma)
{var sMsg="";var sN="\r\n";var sHeader="Niste podesili sledeca polja:"+sN+sN;if(Forma.Ime.value==""){sMsg+=" - Vase ime"+sN;Forma.Ime.style.backgroundColor='#ffeaea';}else{Forma.Ime.style.backgroundColor='white';}
if(Forma.Ime2.value==""){sMsg+=" - Ime primaoca"+sN;Forma.Ime2.style.backgroundColor='#ffeaea';}else{Forma.Ime2.style.backgroundColor='white';}
if(Forma.Email.value==""){sMsg+=" - E-mail primaoca"+sN;Forma.Email.style.backgroundColor='#ffeaea';}else{Forma.Email.style.backgroundColor='white';}
if(sMsg!=""){alert(sHeader+sMsg);return false;}else{return true;}}
function checkVisa(Forma,tip)
{var sMsg="";var sN="\r\n";var sHeader="Niste podesili sledeca polja:"+sN+sN;var radio1=false;radios1=document.getElementsByName("Motiv");for(var i=0;i<radios1.length;i++)
{if(radios1[i].checked)
{radio1=true;break;}}
if(!radio1){sMsg+=" - Motiv na kartici"+sN;document.getElementById('wrapperMotiv').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperMotiv').style.backgroundColor='white';}
if(Forma.Ime.value==""){sMsg+=" - Ime"+sN;document.getElementById('wrapperIme').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperIme').style.backgroundColor='white';}
if(Forma.Prezime.value==""){sMsg+=" - Prezime"+sN;document.getElementById('wrapperPrezime').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperPrezime').style.backgroundColor='white';}
if(Forma.JMBG.value==""){sMsg+=" - Maticni broj (za strance broj pasosa)"+sN;document.getElementById('wrapperJMBG').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperJMBG').style.backgroundColor='white';}
if(Forma.Mobilni.value==""){sMsg+=" - Mobilni telefon"+sN;document.getElementById('wrapperMobilni').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperMobilni').style.backgroundColor='white';}
if(Forma.Email.value==""){sMsg+=" - E-mail"+sN;document.getElementById('wrapperEmail').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperEmail').style.backgroundColor='white';}
if(Forma.Adresa.value==""){sMsg+=" - Adresa"+sN;document.getElementById('wrapperAdresa').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperAdresa').style.backgroundColor='white';}
if(Forma.Mjesto.value==""){sMsg+=" - Mjesto"+sN;document.getElementById('wrapperMjesto').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperMjesto').style.backgroundColor='white';}
if(tip=='electron')
{if(Forma.Racun.value==""&&Forma.Last4.value==""){sMsg+=" - Racun u banci ili 4 poslednje cifre na kartici"+sN;document.getElementById('wrapperRacun').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperRacun').style.backgroundColor='white';}}
if(Forma.Filijala.value<1){sMsg+=" - Filijala"+sN;document.getElementById('wrapperFilijala').style.backgroundColor='#ffeaea';}else{document.getElementById('wrapperFilijala').style.backgroundColor='white';}
if(sMsg!=""){alert(sHeader+sMsg);return false;}else{return true;}}
function checkMisljenje(Forma)
{var sMsg="";var sN="\r\n";var sHeader="Niste podesili sledeca polja:"+sN+sN;if(Forma.Tekst.value==""){sMsg+=" - Vase misljenje"+sN;Forma.Tekst.style.backgroundColor='#ffeaea';}else{Forma.Tekst.style.backgroundColor='white';}
if(sMsg!=""){alert(sHeader+sMsg);return false;}else{return true;}}
function checkKontakt(Forma)
{var sMsg="";var sN="\r\n";var sHeader="Niste podesili sledeca polja:"+sN+sN;if(Forma.Ime.value==""){sMsg+=" - Vase ime"+sN;Forma.Ime.style.backgroundColor='#ffeaea';}else{Forma.Ime.style.backgroundColor='white';}
if(Forma.Email.value==""){sMsg+=" - Vase email"+sN;Forma.Email.style.backgroundColor='#ffeaea';}else{Forma.Email.style.backgroundColor='white';}
if(Forma.Naslov.value==""){sMsg+=" - Naslov poruke"+sN;Forma.Naslov.style.backgroundColor='#ffeaea';}else{Forma.Naslov.style.backgroundColor='white';}
if(Forma.Tekst.value==""){sMsg+=" - Tekst poruke"+sN;Forma.Tekst.style.backgroundColor='#ffeaea';}else{Forma.Tekst.style.backgroundColor='white';}
if(sMsg!=""){alert(sHeader+sMsg);return false;}else{return true;}}
function kursnaRecalc()
{var divider="#";var from=0;var to=0;var fromParity=1;var toParity=1;var tempFrom=document.getElementById('valutaFrom').value;var tempTo=document.getElementById('valutaTo').value;if(tempFrom.indexOf(divider)>0)
{var array=tempFrom.split(divider);from=array[0];fromParity=array[1];}
else from=tempFrom;if(tempTo.indexOf(divider)>0)
{var array=tempTo.split(divider);to=array[0];toParity=array[1];}
else to=tempTo;document.getElementById('vrijednost').value='';var val=document.getElementById('iznos').value*from/fromParity/to*toParity;if(val>0)document.getElementById('vrijednost').value=roundNumber(val);}
function roundNumber(num)
{return Math.round(num*100)/100;}
function replaceComma(sString)
{return sString.replace(",",".");}
function replaceCommaAndDot(sString)
{return sString.replace(".","").replace(",",".");}
function parseInput(strField)
{var fVal;fVal=parseFloat(replaceCommaAndDot(strField.value));if(isNaN(fVal))
return 0;else
return fVal;}
function parseInputWithEdit(strField)
{var fVal;fVal=parseFloat(replaceCommaAndDot(strField.value));if(isNaN(fVal))
strField.value='';else
return fVal;}
function doEditWithWizard(data,field)
{$(field).set('text','');$(field).adopt(data);}
function toggleDiv(div)
{div=$(div);if(div.getStyle('display')!="none")
{div.fade('out');div.setStyle('display','none');}
else
{div.setStyle('display','block');div.fade('in');}}
function assign(){if(document.getElementById('mailButton'))document.getElementById('mailButton').onmouseover=function(){replaceText(document.getElementById('mailButtonText').innerHTML);}
if(document.getElementById('printButton'))document.getElementById('printButton').onmouseover=function(){replaceText(document.getElementById('printButtonText').innerHTML);}
if(document.getElementById('mailButton'))document.getElementById('mailButton').onmouseout=function(){replaceText('');}
if(document.getElementById('printButton'))document.getElementById('printButton').onmouseout=function(){replaceText('');}}
function replaceText(t){document.getElementById('buttonText').innerHTML=t;}
if(window.addEventListener)
{window.addEventListener('load',assign,false);}
else if(window.attachEvent)
{window.attachEvent('onload',assign);}
