ac_hide_enable=true;function switch_advanced_search(opt_cmd){var first_to_select='';switch(opt_cmd){case'adresa':var adv=document.getElementById('advanced_search_adresa');var adv_other=new Array($('advanced_search_brend'),$('advanced_search_telefon'));var jednostavna=document.getElementById('jednostavnaPretraga_adresa');var jednostavna_other=new Array($('jednostavnaPretraga_brend'),$('jednostavnaPretraga_telefon'));var radio_sel=document.getElementById('ao_adresa');first_to_select='search_adresa';break;case'brend':var adv=document.getElementById('advanced_search_brend');var adv_other=new Array($('advanced_search_adresa'),$('advanced_search_telefon'));var jednostavna=document.getElementById('jednostavnaPretraga_brend');var jednostavna_other=new Array($('jednostavnaPretraga_adresa'),$('jednostavnaPretraga_telefon'));var radio_sel=document.getElementById('ao_brend');first_to_select='search_brend';break;case'telefon':var adv=document.getElementById('advanced_search_telefon');var adv_other=new Array($('advanced_search_brend'),$('advanced_search_adresa'));var jednostavna=document.getElementById('jednostavnaPretraga_telefon');var jednostavna_other=new Array($('jednostavnaPretraga_brend'),$('jednostavnaPretraga_adresa'));var radio_sel=document.getElementById('ao_telefon');first_to_select='search_telefon_pozivni';break;default:var adv=document.getElementById('advanced_search');var adv_other=new Array($('advanced_search_adresa'),$('advanced_search_brend'),$('advanced_search_telefon'));var jednostavna=document.getElementById('jednostavnaPretraga');var jednostavna_other=new Array($('jednostavnaPretraga_brend'),$('jednostavnaPretraga_telefon'),$('jednostavnaPretraga_adresa'));break;}
if(document.frmMainSearchAdvanced.advancedOptions[0].checked){document.frmMainSearchAdvanced.search_telefon_pozivni.value='';document.frmMainSearchAdvanced.search_telefon_broj.value='';document.frmMainSearchAdvanced.search_telefon_broj_2.value='';document.frmMainSearchAdvanced.search_brend.value='';}else if(document.frmMainSearchAdvanced.advancedOptions[2].checked){if(document.frmMainSearchAdvanced.lokacija.value!='Beograd'&&document.frmMainSearchAdvanced.lokacija.value!='Srbija')document.frmMainSearchAdvanced.lokacija.value='';document.frmMainSearchAdvanced.search_adresa.value='';document.frmMainSearchAdvanced.search_broj.value='';document.frmMainSearchAdvanced.search_brend.value='';}else if(document.frmMainSearchAdvanced.advancedOptions[1].checked){if(document.frmMainSearchAdvanced.lokacija.value!='Beograd'&&document.frmMainSearchAdvanced.lokacija.value!='Srbija')document.frmMainSearchAdvanced.lokacija.value='';document.frmMainSearchAdvanced.search_adresa.value='';document.frmMainSearchAdvanced.search_broj.value='';document.frmMainSearchAdvanced.search_telefon_pozivni.value='';document.frmMainSearchAdvanced.search_telefon_broj.value='';document.frmMainSearchAdvanced.search_telefon_broj_2.value='';}
var sim=document.getElementById('simple_search');var napredna=document.getElementById('naprednaPretraga');var ac_lokacija=$('ac_lokacija');var ac_proizvod=$('ac_proizvod');var radios=$('advanced_search_radio');if(adv&&sim&&napredna&&jednostavna){if(opt_cmd=='hide'){adv.style.display='none';for(x=0;x<adv_other.length;x++)adv_other[x].style.display='none';for(x=0;x<jednostavna_other.length;x++)jednostavna_other[x].style.display='none';sim.style.display='block';napredna.style.display='block';jednostavna.style.display='none';radios.style.display='none';}else{if(adv.style.display=='none'){adv.style.display='block';if($(first_to_select))$(first_to_select).focus();for(x=0;x<adv_other.length;x++)adv_other[x].style.display='none';for(x=0;x<jednostavna_other.length;x++)jednostavna_other[x].style.display='none';sim.style.display='none';napredna.style.display='none';ac_lokacija.style.display='none';ac_proizvod.style.display='none';jednostavna.style.display='block';radios.style.display='block';radio_sel.checked=true;}else{adv.style.display='none';for(x=0;x<adv_other.length;x++)adv_other[x].style.display='none';sim.style.display='block';napredna.style.display='block';jednostavna.style.display='none';for(x=0;x<jednostavna_other.length;x++)jednostavna_other[x].style.display='none';radios.style.display='none';$('ctl_proizvod_usluga').style.display='block';$('ctl_naziv_firme').style.display='none';$('lokacija').style.display='block';$('proizvod').checked=true;if($('ctl_naziv_firme').style.display!='none')$('search_naziv_firme').focus();else $('search_proizvod').focus();}}}}
function tooltipSwitch(id_div){var obj=document.getElementById(id_div);if(obj){if(obj.style.display=='none'){obj.style.display='block';}else{obj.style.display='none';}}}
function profilListaSwitch(id_div,id_icon){var obj=document.getElementById(id_div);var icon=document.getElementById(id_icon);if(obj&&icon){if(obj.style.display=='none'){obj.style.display='block';icon.innerHTML='<img src="/images/basic/icon-double-arrow-up.gif" alt="" />';}else{obj.style.display='none';icon.innerHTML='<img src="/images/basic/icon-double-arrow-down.gif" alt="" />';}}}
function searchSwitch(id_div_show,id_div_hide,id_txt_hide,id_txt_show){var adv=document.getElementById('advanced_search');var sim=document.getElementById('simple_search');var obj_show=document.getElementById(id_div_show);var obj_hide=document.getElementById(id_div_hide);var obj_clear=document.getElementById(id_txt_hide);var obj_copy=document.getElementById(id_txt_show);if(obj_show&&obj_hide){obj_show.style.display='block';obj_hide.style.display='none';obj_copy.value=obj_clear.value;obj_clear.value='';switch_advanced_search('hide');}}
function switchPreporuke(akcija){if(akcija=='procitajte'){document.getElementById('preporukaProcitajte').style.display='block';document.getElementById('preporukaNapisite').style.display='none';}
if(akcija=='napisite'){document.getElementById('preporukaProcitajte').style.display='none';document.getElementById('preporukaNapisite').style.display='block';}}
function autocomplete_page(p,cnt){for(var i=0;i<cnt;i++){var obj=document.getElementById("sugglistdiv_"+i);if(obj){obj.style.display="none";}}
obj=document.getElementById("sugglistdiv_"+p);if(obj)
{obj.style.display="block";document.getElementById("ac_adresa").style.display="block";}}
function autocomplete_show(e,id_div,type,ctl_text_input,lang){var evt;if(window.event){evt=window.event;}else{evt=e;}
if(!lang)
{lang='sr';}
var list_pos=0;eval('list_pos = ac_pos_'+type+';');if(evt.keyCode==40){list_pos=ac_element_select(id_div,list_pos,1);eval('ac_pos_'+type+'=list_pos;');return;}
if(evt.keyCode==38&&list_pos>0){list_pos=ac_element_select(id_div,list_pos,-1);eval('ac_pos_'+type+'=list_pos;');return;}
eval('ac_pos_'+type+'=0;');if(evt.keyCode==13){if(id_div=='ac_lokacija'){var ajax=new Ajax.Updater({success:id_div},'/suggest/setsession/sr',{method:'post',parameters:'lokacija='+ac_get_list_value(id_div,list_pos),asynchronous:true,evalScripts:true});}
return;}
var query=ctl_text_input.value;if(query.length>=3){var ajax=new Ajax.Updater({success:id_div},'/suggest/index/'+lang,{method:'post',parameters:'query='+query+'&type='+type+'&id_input_text='+ctl_text_input.id+'&id_ac_div='+id_div,asynchronous:true,evalScripts:true,onComplete:function(request,json){ctl_text_input.className='forma';},onLoading:function(request,json){ctl_text_input.className='forma ajaxActive';}});document.getElementById(id_div).style.display='block';}else if(type=='lokacija'){type='lokacija_prazna';var ajax=new Ajax.Updater({success:id_div},'/suggest/index/'+lang,{method:'post',parameters:'query='+query+'&type='+type+'&id_input_text='+ctl_text_input.id+'&id_ac_div='+id_div,asynchronous:true,evalScripts:true});document.getElementById(id_div).style.display='block';}}
function ac_element_select(id_div,list_pos,inc){var obj=document.getElementById(id_div);var arr_li=obj.getElementsByTagName("LI");if(arr_li){var li_cnt=arr_li.length;var tmp_list_pos=list_pos+inc;if(inc==1){if(tmp_list_pos>li_cnt)return list_pos;}
if(inc==-1){if(tmp_list_pos<1)return list_pos;}
list_pos=tmp_list_pos;for(var i=0;i<li_cnt;i++){if(i==list_pos-1){arr_li[i].className="over";}else{arr_li[i].className="";}}
return list_pos;}}
function ac_get_list_value(id_div,position){var obj=document.getElementById(id_div);var arr_li=obj.getElementsByTagName("LI");if(arr_li){var tmp=arr_li[position-1];var tmp_sub=tmp.getElementsByTagName("A");if(tmp_sub){return tmp_sub[0].innerHTML;}}
return'';}
function tabRight(obj){if(obj.value.length==3){if(obj.id=='search_telefon_pozivni'){$('search_telefon_broj').focus();return;}
if(obj.id=='search_telefon_broj'){$('search_telefon_broj_2').focus();return;}}}
function capture_search(lang){if(ac_pos_proizvod==0&&ac_pos_lokacija==0){if(!search_check_fields(lang))return false;else return true;}else{if(ac_pos_proizvod>0){var value=ac_get_list_value('ac_proizvod',ac_pos_proizvod);document.frmMainSearchSimple.search_proizvod.value=value;document.frmMainSearchSimple.search_proizvod.focus();}
if(ac_pos_lokacija>0){var value=ac_get_list_value('ac_lokacija',ac_pos_lokacija);document.frmMainSearchSimple.lokacija.value=value;document.frmMainSearchSimple.lokacija.focus();}
return false;}}
function capture_search_advanced(lang){if(ac_pos_brend==0&&ac_pos_adresa==0){if(!search_check_fields(lang))
{return false;}else return true;}else{if(ac_pos_brend>0){var value=ac_get_list_value('ac_brend',ac_pos_brend);document.frmMainSearchAdvanced.search_brend.value=value;document.frmMainSearchAdvanced.search_brend.focus();return false;}else if(ac_pos_adresa>0){var value=ac_get_list_value('ac_adresa',ac_pos_adresa);document.frmMainSearchAdvanced.search_adresa.value=value;document.frmMainSearchAdvanced.search_adresa.focus();return false;}}}
function search_check_fields(lang){if($('simple_search').style.display!='none'){if(document.frmMainSearchSimple.proizvodFirma[0].checked)
{document.frmMainSearchSimple.lokacija.value=trim(document.frmMainSearchSimple.lokacija.value);document.frmMainSearchSimple.search_proizvod.value=trim(document.frmMainSearchSimple.search_proizvod.value);if(document.frmMainSearchSimple.lokacija.value==''||document.frmMainSearchSimple.search_proizvod.value==''||document.frmMainSearchSimple.lokacija.value.length<2||document.frmMainSearchSimple.search_proizvod.value.length<3){if(lang=='en')
{alert('Please fill in the search form.');}else{alert('Morate popuniti polja u formi za pretragu.');}
return false;}
else return true;}
if(document.frmMainSearchSimple.proizvodFirma[1].checked)
{document.frmMainSearchSimple.lokacija.value=trim(document.frmMainSearchSimple.lokacija.value);document.frmMainSearchSimple.search_naziv_firme.value=trim(document.frmMainSearchSimple.search_naziv_firme.value);if(document.frmMainSearchSimple.lokacija.value==''||document.frmMainSearchSimple.search_naziv_firme.value==''||document.frmMainSearchSimple.lokacija.value.length<2||document.frmMainSearchSimple.search_naziv_firme.value.length<2){if(lang=='en')
{alert('Please fill in the search form.');}else{alert('Morate popuniti polja u formi za pretragu.');}
return false;}
else return true;}}
if($('advanced_search_adresa').style.display=='block'){document.frmMainSearchAdvanced.lokacija.value=trim(document.frmMainSearchAdvanced.lokacija.value);document.frmMainSearchAdvanced.search_adresa.value=trim(document.frmMainSearchAdvanced.search_adresa.value);if(document.frmMainSearchAdvanced.lokacija.value!=''&&document.frmMainSearchAdvanced.search_adresa.value!=''&&document.frmMainSearchAdvanced.lokacija.value.length>2&&document.frmMainSearchAdvanced.search_adresa.value.length>2)return true;else{if(lang=='en')
{alert('Please fill in the search form.');}else{alert('Morate popuniti polja u formi za pretragu.');}
return false;}}
if($('advanced_search_telefon').style.display=='block'){if(document.frmMainSearchAdvanced.search_telefon_pozivni.value!=''&&(document.frmMainSearchAdvanced.search_telefon_broj.value!=''||document.frmMainSearchAdvanced.search_telefon_broj_2.value!=''))return true;else{if(lang=='en')
{alert('Please fill in the search form.');}else{alert('Morate popuniti polja u formi za pretragu.');}
return false;}}
if($('advanced_search_brend').style.display=='block'){document.frmMainSearchAdvanced.search_brend.value=trim(document.frmMainSearchAdvanced.search_brend.value);if(document.frmMainSearchAdvanced.search_brend.value!=''&&document.frmMainSearchAdvanced.search_brend.value.length>2)return true;else{if(lang=='en')
{alert('Please fill in the search form.');}else{alert('Morate popuniti polja u formi za pretragu.');}
return false;}}
if(lang=='en')
{alert('Please fill in the search form.');}else{alert('Morate popuniti polja u formi za pretragu.');}
return false;}
function autocomplete_show_spec(id_div,type,ctl_text_input,lang){var query=ctl_text_input.value;if(!lang){lang='sr';}
var ajax=new Ajax.Updater({success:id_div},'/suggest/index/'+lang,{method:'post',parameters:'query='+query+'&type='+type+'&id_input_text='+ctl_text_input.id+'&id_ac_div='+id_div,asynchronous:true,evalScripts:true});document.getElementById(id_div).style.display='block';ac_hide_enable=false;}
function autocomplete_set(id_input_text,value,id_ac_div,position){document.getElementById(id_input_text).value=value;document.getElementById(id_ac_div).style.display='none';if(id_ac_div=='ac_adresa')
{ac_pos_adresa=0;}
if(id_ac_div=='ac_proizvod')
{ac_pos_proizvod=0;}
if(id_ac_div=='ac_lokacija')
{ac_pos_lokacija=0;}
if(id_ac_div=='ac_brend')
{ac_pos_brend=0;}
if(id_ac_div=='ac_lokacija'){var ajax=new Ajax.Updater({success:id_ac_div},'/suggest/setsession/sr',{method:'post',parameters:'lokacija='+value,asynchronous:true,evalScripts:true});}}
function autocomplete_hide(){if(!ac_hide_enable){ac_hide_enable=true;return;}
var pro=$('ac_proizvod');var lok=$('ac_lokacija');var bre=$('ac_brend');var adr=$('ac_adresa');if(pro||lok||bre||adr){if(pro&&pro.style.display!='none'){pro.style.display='none';}
if(lok&&lok.style.display!='none'){lok.style.display='none';}
if(bre&&bre.style.display!='none'){bre.style.display='none';}
if(adr&&adr.style.display!='none'){adr.style.display='none';}}}
function show_ad(filename,lang,adtitle){var showOglas=document.getElementById("showOglas");if(lang==null){lang='sr';}
var ajax=new Ajax.Updater({success:'showOglas'},'/firma/oglas/'+lang,{method:'post',parameters:'filename='+filename+'&f=true&adtitle='+adtitle,asynchronous:true,evalScripts:true});showOglas.style.display='block';showOglas.style.top=0+'px';showOglas.style.width=getWidth()+'px';}
function hide_ad(){var showOglas=document.getElementById("showOglas");showOglas.innerHTML='';showOglas.style.display='none';}
function show_contact(firma_id,firma_ime,lang){var div_contact=document.getElementById("showEmailKontakt");if(lang==null){lang='sr';}
var ajax=new Ajax.Updater({success:'showEmailKontakt'},'/firma/email/'+lang,{method:'post',parameters:'email_firmaid='+firma_id+'&f=true',asynchronous:true,evalScripts:true});div_contact.style.display='block';div_contact.style.top=getScrollTop()+'px';div_contact.style.width=getWidth()+'px';}
function hide_contact(){var div_contact=document.getElementById("showEmailKontakt");div_contact.innerHTML='';div_contact.style.display='none';}
function show_comment(id,lang){var div_comment=document.getElementById("showKomentar");if(lang==null){lang='sr';}
var ajax=new Ajax.Updater({success:'showKomentar'},'/preporuke/noviKomentar/'+lang,{method:'post',parameters:'preporuka_id='+id+'&f=true',asynchronous:true,evalScripts:true});div_comment.style.display='block';div_comment.style.top=getScrollTop()+'px';div_comment.style.width=getWidth()+'px';}
function getScrollTop(){var iebody=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var dsoctop=document.all?iebody.scrollTop:pageYOffset;var h=iebody.clientHeight;var ytop=Math.round(dsoctop+h/2-200);return ytop;}
function getWidth(){var iebody=(document.compatMode&&document.compatMode!="BackCompat")?document.documentElement:document.body;var w=iebody.clientWidth;return w;}
function hide_comment(){var div_contact=document.getElementById("showKomentar");div_contact.innerHTML='';div_contact.style.display='none';}
function getPageTotalHeight(){var pageHeight;if(window.innerHeight&&window.scrollMaxY)
{pageHeight=window.innerHeight+window.scrollMaxY;}
else if(document.body.scrollHeight>document.body.offsetHeight)
{pageHeight=document.body.scrollHeight;}
else
{pageHeight=document.body.offsetHeight+document.body.offsetTop;}
return pageHeight;}
function getPageScrollTop(){return(document.all)?document.body.parentNode.scrollTop:window.scrollY;}
function show_flash_oglas(){var showFlashOglas=document.getElementById('showFlashOglas');showFlashOglas.style.display='block';new Ajax.Updater({success:'showFlashOglas'},'/market/oglasi/sr',{method:'post',parameters:'',asynchronous:true,evalScripts:true});showFlashOglas.style.top=0+'px';showFlashOglas.style.width=getWidth()+'px';}
function show_flash_oglas_i(){var showFlashOglasI=document.getElementById('showFlashOglasI');showFlashOglasI.style.display='block';new Ajax.Updater({success:'showFlashOglasI'},'/market/oglasiinternet/sr',{method:'post',parameters:'',asynchronous:true,evalScripts:true});showFlashOglasI.style.top=0+'px';showFlashOglasI.style.width=getWidth()+'px';}
function hide_flash_oglas(){var div_contact=document.getElementById("showFlashOglas");div_contact.innerHTML='';div_contact.style.display='none';}
function hide_flash_oglas_i(){var div_contact=document.getElementById("showFlashOglasI");div_contact.innerHTML='';div_contact.style.display='none';}
function show_video_oglas(videoPath,foreign,video_id,lang,seekTime){if(lang==null){lang='sr';}
var videoOglasDiv=document.getElementById('videoOglasDiv');videoOglasDiv.style.display='block';new Ajax.Updater({success:'videoOglasDiv'},'/firma/video/'+lang,{method:'post',parameters:'videos='+videoPath+'&foreign='+foreign+'&video_id='+video_id+'&seekTime='+seekTime,asynchronous:true,evalScripts:true});videoOglasDiv.style.top=0+'px';videoOglasDiv.style.width=getWidth()+'px';}
function hide_video_popup(){var popupDiv=document.getElementById("videoOglasDiv");popupDiv.innerHTML='';popupDiv.style.display='none';}
function send_video_oglas(videoId,lang){hide_video_popup();embededVideo=document.getElementById('embeded_video_content');if(embededVideo!=null)
embededVideo.style.display="none";if(lang==null){lang='sr';}
var videoOglasDiv=document.getElementById('sendVideoOglasDiv');videoOglasDiv.style.display='block';new Ajax.Updater({success:'sendVideoOglasDiv'},'/firma/sendVideo/'+lang,{method:'post',parameters:'video_id='+videoId,asynchronous:true,evalScripts:true});videoOglasDiv.style.top=0+'px';videoOglasDiv.style.width=getWidth()+'px';}
function hide_send_video_popup(){embededVideo=document.getElementById('embeded_video_content');if(embededVideo!=null)
embededVideo.style.display="block";var popupDiv=document.getElementById("sendVideoOglasDiv");popupDiv.innerHTML='';popupDiv.style.display='none';}
function get_video_oglas(videoId,lang){hide_video_popup();embededVideo=document.getElementById('embeded_video_content');if(embededVideo!=null)
embededVideo.style.display="none";if(lang==null){lang='sr';}
var videoOglasDiv=document.getElementById('sendVideoOglasDiv');videoOglasDiv.style.display='block';new Ajax.Updater({success:'sendVideoOglasDiv'},'/firma/getVideo/'+lang,{method:'post',parameters:'video_id='+videoId,asynchronous:true,evalScripts:true});videoOglasDiv.style.top=0+'px';videoOglasDiv.style.width=getWidth()+'px';}
function show_nova_preporuka(val,lang,uid){if(val>0){document.getElementById('preporukaSubmit').style.display='block';if(lang==null){lang='sr';}
new Ajax.Updater({success:'preporukaSubmit'},'/preporuke/novaProfil/'+lang,{method:'post',parameters:'uid='+uid+'&tipPreporuke='+val,asynchronous:true,evalScripts:true});}
document.getElementById('preporukaSubmit').style.top=getScrollTop()+'px';document.getElementById('preporukaSubmit').style.width=getWidth()+'px';}
function show_preporuke(i){var div_1=document.getElementById("preporuka_1");var div_2=document.getElementById("preporuka_2");var div_3=document.getElementById("preporuka_3");var cnt_pohvala_value=document.getElementById("preporukaCnt2").innerHTML;var cnt_primedba_value=document.getElementById("preporukaCnt1").innerHTML;var cnt_preporuka_value=document.getElementById("preporukaCnt3").innerHTML;var suma=0;if(div_2){if(document.frmPreporukeSelektor.proizvodFirma[0].checked){div_2.style.display='block';suma+=parseInt(cnt_pohvala_value);}else{div_2.style.display='none';}}
if(div_1){if(document.frmPreporukeSelektor.proizvodFirma[1].checked){div_1.style.display='block';suma+=parseInt(cnt_primedba_value);}else{div_1.style.display='none';}}
if(div_3){if(document.frmPreporukeSelektor.proizvodFirma[2].checked){div_3.style.display='block';suma+=parseInt(cnt_preporuka_value);}else{div_3.style.display='none';}}
if(suma>0){document.getElementById("divPreporukeMsg").style.display="none";}else{document.getElementById("divPreporukeMsg").style.display="block";}}
function hide_preporuke(){var div_contact=document.getElementById("preporukaSubmit");div_contact.innerHTML='';div_contact.style.display='none';}
function show_pitanja(i){var div_4=document.getElementById("pitanje_4");var div_5=document.getElementById("pitanje_5");var cnt_pitanje_value=document.getElementById("preporukaCnt4").innerHTML;var cnt_ponuda_value=document.getElementById("preporukaCnt5").innerHTML;if(div_4){var suma=0;if(document.frmPitanjaSelektor.proizvodFirma[0].checked){div_4.style.display='block';suma+=parseInt(cnt_pitanje_value);}else{div_4.style.display='none';}}
if(div_5){if(document.frmPitanjaSelektor.proizvodFirma[1].checked){div_5.style.display='block';suma+=parseInt(cnt_ponuda_value);}else{div_5.style.display='none';}}
if(suma>0){document.getElementById("divPitanjaMsg").style.display="none";}else{document.getElementById("divPitanjaMsg").style.display="block";}}
function fnPreporukaStep1(){document.getElementById("preporukaStep1").style.display='block';document.getElementById("preporukaStep2").style.display='none';}
function fnPreporukaStep2(){if(document.frmNovaPreporuka.preporukaTema.value!=0&&document.frmNovaPreporuka.preporukaNaslov.value!=''&&document.frmNovaPreporuka.preporukaTekst.value!=''){document.getElementById("preporukaStep1").style.display='none';document.getElementById("preporukaStep2").style.display='block';}}
function fnKomentarStep1(){document.getElementById("komentarStep1").style.display='block';document.getElementById("komentarStep2").style.display='none';document.getElementById("komentarStep3").style.display='none';}
function fnKomentarStep2(){if(document.frmNoviKomentar.komentarNaslov.value!=''&&document.frmNoviKomentar.komentarTekst.value!=''){document.getElementById("komentarStep1").style.display='none';document.getElementById("komentarStep2").style.display='block';document.getElementById("komentarStep3").style.display='none';}}
function fnKomentarStep3(){if(document.frmNoviKomentar.komentarImePrezime.value!=''&&document.frmNoviKomentar.komentarMesto.value!=''&&document.frmNoviKomentar.komentarAdresa.value!=''&&document.frmNoviKomentar.komentarEmail.value!=''&&document.frmNoviKomentar.komentarTelefon.value!=''){document.getElementById("komentarStep1").style.display='none';document.getElementById("komentarStep2").style.display='none';document.getElementById("komentarStep3").style.display='block';document.getElementById("komentarPregled").innerHTML=document.frmNoviKomentar.komentarNaslov.value+"<br><br>"+document.frmNoviKomentar.komentarTekst.value;}}
function signup_validate(){var res=true;if(document.frmSignup.osoba_kontakt_ime.value==''){res=false;document.frmSignup.osoba_kontakt_ime.className='error';}else{document.frmSignup.osoba_kontakt_ime.className='';}
if(document.frmSignup.osoba_kontakt_prezime.value==''){res=false;document.frmSignup.osoba_kontakt_prezime.className='error';}else{document.frmSignup.osoba_kontakt_prezime.className='';}
if(document.frmSignup.naziv_firme.value==''){res=false;document.frmSignup.naziv_firme.className='error';}else{document.frmSignup.naziv_firme.className='';}
if(document.frmSignup.delatnost_firme.value=='0'){res=false;document.frmSignup.delatnost_firme.className='error';}else{document.frmSignup.delatnost_firme.className='';}
if(document.frmSignup.pib.value==''){res=false;document.frmSignup.pib.className='error';}else{document.frmSignup.pib.className='';}
if(document.frmSignup.adresa.value==''){res=false;document.frmSignup.adresa.className='error';}else{document.frmSignup.adresa.className='';}
if(document.frmSignup.mesto.value==''){res=false;document.frmSignup.mesto.className='error';}else{document.frmSignup.mesto.className='';}
if(document.frmSignup.opstina.value=='0'){res=false;document.frmSignup.opstina.className='error';}else{document.frmSignup.opstina.className='';}
if(document.frmSignup.telefon.value==''){res=false;document.frmSignup.telefon.className='error';}else{document.frmSignup.telefon.className='';}
if(document.frmSignup.email.value==''){res=false;document.frmSignup.email.className='error';}else{document.frmSignup.email.className='';}
if(document.frmSignup.profil_sr.value==''){res=false;document.frmSignup.profil_sr.className='error';}else{document.frmSignup.profil_sr.className='';}
var msg=' Polja oznacena zvezdicom su obavezna.';if(!res){alert(msg);}
return res;}
function signup_validate_page(page){var msg=' Polja oznacena zvezdicom su obavezna.';var res=true;var frm=document.frmSignup;if(page==1){if(trim(frm.naziv_firme.value)==''){res=false;frm.naziv_firme.className='error';}else{frm.naziv_firme.className='';}
if(trim(frm.ulica.value)==''){res=false;frm.ulica.className='error';}else{frm.ulica.className='';}
if(trim(frm.broj.value)==''){res=false;frm.broj.className='error';}else{frm.broj.className='';}
if(frm.opstina.value=='0'){res=false;frm.opstina.className='error';}else{frm.opstina.className='';}
if(trim(frm.mesto.value)==''){res=false;frm.mesto.className='error';}else{frm.mesto.className='';}}else if(page==2){if(frm.delatnost_firme.value=='0'){res=false;frm.delatnost_firme.className='error';}else{frm.delatnost_firme.className='';}
if(trim(frm.telefon1.value)==''){res=false;frm.telefon1.className='error';}else{frm.telefon.className='';}
if(trim(frm.email.value)==''){res=false;frm.email.className='error';}else{frm.email.className='';}
if(trim(frm.rv1.value)!=''&&trim(frm.rv1.value).length!=11){res=false;frm.rv1.className='error';}else{frm.rv1.className='';}
if(trim(frm.rv2.value)!=''&&trim(frm.rv2.value).length!=11){res=false;frm.rv2.className='error';}else{frm.rv2.className='';}
if(trim(frm.rv3.value)!=''&&trim(frm.rv3.value).length!=11){res=false;frm.rv3.className='error';}else{frm.rv3.className='';}}else if(page==3){var editor=CKEDITOR.instances.profil_sr;if(trim(editor.getData())==''){res=false;editor.className='error';}else{editor.className='';}}else if(page==4){if(trim(frm.keywords_sr.value)==''){res=false;frm.keywords_sr.className='error';}else{frm.keywords_sr.className='';}}else if(page==6){if(trim(frm.pib.value)==''){res=false;frm.pib.className='error';}else{frm.pib.className='';}
if(trim(frm.maticni_broj.value)==''){res=false;frm.maticni_broj.className='error';}else{frm.maticni_broj.className='';}
if(trim(frm.dat_osnivanja.value)==''){res=false;frm.dat_osnivanja.className='error';}else{frm.dat_osnivanja.className='';}}else if(page==7){if(trim(frm.ime.value)==''){res=false;frm.ime.className='error';}else{frm.ime.className='';}
if(trim(frm.prezime.value)==''){res=false;frm.prezime.className='error';}else{frm.prezime.className='';}
if(trim(frm.email.value)==''){res=false;frm.email.className='error';}else{frm.email.className='';}
if(trim(frm.telefon1.value)==''){res=false;frm.telefon1.className='error';}else{frm.telefon1.className='';}}else if(page==8){if(trim(frm.d_ime.value)==''){res=false;frm.d_ime.className='error';}else{frm.d_ime.className='';}
if(trim(frm.d_prezime.value)==''){res=false;frm.d_prezime.className='error';}else{frm.d_prezime.className='';}
if(trim(frm.d_email.value)==''){res=false;frm.d_email.className='error';}else{frm.d_email.className='';}
if(trim(frm.d_telefon1.value)==''){res=false;frm.d_telefon1.className='error';}else{frm.d_telefon1.className='';}}
if(!res){alert(msg);}
return res;}
function searchFocus(){if($('simple_search').style.display!='none'){if($('ctl_proizvod_usluga').style.display!='none'){$('search_proizvod').focus();}
if($('ctl_naziv_firme').style.display!='none'){$('search_naziv_firme').focus();}}
if($('advanced_search_adresa').style.display!='none'){$('search_adresa').focus();}
if($('advanced_search_telefon').style.display!='none'){$('search_telefon_broj').focus();}
if($('advanced_search_brend').style.display!='none'){$('search_brend').focus();}}
function fireNews(){var ul=document.getElementById("blicNews");var scroller=document.getElementById("vestiScrollContainer");var _news=ul.getElementsByTagName("li");if(_news.length){scroller.vesti=_news;scroller._position=0;goNews();}}
function goNews(){var scrollTimeout=3;var scrollSpeed=5;var scroller=document.getElementById("vestiScrollContainer");scroller.timeOut=scrollTimeout*1000;scroller.speed=Math.round((6-scrollSpeed)*100);var current=document.getElementById("trenutnaVest");var next=document.getElementById("sledecaVest");var cp=parseInt(scroller._position);var np=(cp==parseInt(scroller.vesti.length)-1)?0:cp+1;current.innerHTML=scroller.vesti[cp].innerHTML;next.innerHTML=scroller.vesti[np].innerHTML;scroller._to=setTimeout("scrollNews()",scroller.timeOut);}
var i=0;function scrollNews(){var scroller=document.getElementById("vestiScrollContainer");var current=document.getElementById("trenutnaVest");var next=document.getElementById("sledecaVest");i++;var _height=current.offsetHeight;var mt=current.style.marginTop?parseInt(current.style.marginTop.replace("px","")):0;var diff=(_height+mt);if(diff>5){current.style.marginTop=(mt-Math.round(diff/2))+"px";scroller._to=setTimeout("scrollNews()",scroller.speed);}else{current.innerHTML=next.innerHTML;current.style.marginTop="0px";scroller._position=(scroller._position==(scroller.vesti.length-1))?0:scroller._position+1;next.innerHTML=scroller.vesti[scroller._position].innerHTML;clearTimeout(scroller._to);setTimeout("goNews()",scroller.timeOut);}}
function trim(stringToTrim){return stringToTrim.replace(/^\s+|\s+$/g,"");}
function ltrim(stringToTrim){return stringToTrim.replace(/^\s+/,"");}
function rtrim(stringToTrim){return stringToTrim.replace(/\s+$/,"");}