var flash_playing=false;var flash_tid,flash_countdown_tid;var foto_preview_tid=Array();var flash_countdown_timer=60;var preview_playing='00';var mp3_playing='00';var http_host=base_href+'/';var typing_tid;var popup_timeout_tid;var favicon_alert_tid;var tid_slide;var typing_1_b;var kursna_list_from_index,kursna_list_to_index;var ajax_zanimljivost_text,ajax_zanimljivost_source;var os_vest_tid,add_friend_tid;var streamer=null;var search_resizing=false;var last_scroll_position;var unsaved_changes=false;var ping_news_count=0;var ping_pp_count=-1;var notifications=Array();notifications['vest']=0;notifications['pp']=0;var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y<X;Y++){U[Y]()}}function K(X){if(J){X()}else{U[U.length]=X}}function s(Y){if(typeof O.addEventListener!=D){O.addEventListener("load",Y,false)}else{if(typeof j.addEventListener!=D){j.addEventListener("load",Y,false)}else{if(typeof O.attachEvent!=D){i(O,"onload",Y)}else{if(typeof O.onload=="function"){var X=O.onload;O.onload=function(){X();Y()}}else{O.onload=Y}}}}}function h(){if(T){V()}else{H()}}function V(){var X=j.getElementsByTagName("body")[0];var aa=C(r);aa.setAttribute("type",q);var Z=X.appendChild(aa);if(Z){var Y=0;(function(){if(typeof Z.GetVariable!=D){var ab=Z.GetVariable("$version");if(ab){ab=ab.split(" ")[1].split(",");M.pv=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}else{if(Y<10){Y++;setTimeout(arguments.callee,10);return}}X.removeChild(aa);Z=null;H()})()}else{H()}}function H(){var ag=o.length;if(ag>0){for(var af=0;af<ag;af++){var Y=o[af].id;var ab=o[af].callbackFn;var aa={success:false,id:Y};if(M.pv[0]>0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad<ac;ad++){if(X[ad].getAttribute("name").toLowerCase()!="movie"){ah[X[ad].getAttribute("name")]=X[ad].getAttribute("value")}}P(ai,ah,Y,ab)}else{p(ae);if(ab){ab(aa)}}}}}else{w(Y,true);if(ab){var Z=z(Y);if(Z&&typeof Z.SetVariable!=D){aa.success=true;aa.ref=Z}ab(aa)}}}}}function z(aa){var X=null;var Y=c(aa);if(Y&&Y.nodeName=="OBJECT"){if(typeof Y.SetVariable!=D){X=Y}else{var Z=Y.getElementsByTagName(r)[0];if(Z){X=Z}}}return X}function A(){return!a&&F("6.0.65")&&(M.win||M.mac)&&!(M.wk&&M.wk<312)}function P(aa,ab,X,Z){a=true;E=Z||null;B={success:false,id:X};var ae=c(X);if(ae){if(ae.nodeName=="OBJECT"){l=g(ae);Q=null}else{l=ae;Q=X}aa.id=R;if(typeof aa.width==D||(!/%$/.test(aa.width)&&parseInt(aa.width,10)<310)){aa.width="310"}if(typeof aa.height==D||(!/%$/.test(aa.height)&&parseInt(aa.height,10)<137)){aa.height="137"}j.title=j.title.slice(0,47)+" - Flash Player Installation";var ad=M.ie&&M.win?"ActiveX":"PlugIn",ac="MMredirectURL="+O.location.toString().replace(/&/g,"%26")+"&MMplayerType="+ad+"&MMdoctitle="+j.title;if(typeof ab.flashvars!=D){ab.flashvars+="&"+ac}else{ab.flashvars=ac}if(M.ie&&M.win&&ae.readyState!=4){var Y=C("div");X+="SWFObjectNew";Y.setAttribute("id",X);ae.parentNode.insertBefore(Y,ae);ae.style.display="none";(function(){if(ae.readyState==4){ae.parentNode.removeChild(ae)}else{setTimeout(arguments.callee,10)}})()}u(aa,ab,X)}}function p(Y){if(M.ie&&M.win&&Y.readyState!=4){var X=C("div");Y.parentNode.insertBefore(X,Y);X.parentNode.replaceChild(g(Y),X);Y.style.display="none";(function(){if(Y.readyState==4){Y.parentNode.removeChild(Y)}else{setTimeout(arguments.callee,10)}})()}else{Y.parentNode.replaceChild(g(Y),Y)}}function g(ab){var aa=C("div");if(M.win&&M.ie){aa.innerHTML=ab.innerHTML}else{var Y=ab.getElementsByTagName(r)[0];if(Y){var ad=Y.childNodes;if(ad){var X=ad.length;for(var Z=0;Z<X;Z++){if(!(ad[Z].nodeType==1&&ad[Z].nodeName=="PARAM")&&!(ad[Z].nodeType==8)){aa.appendChild(ad[Z].cloneNode(true))}}}}}return aa}function u(ai,ag,Y){var X,aa=c(Y);if(M.wk&&M.wk<312){return X}if(aa){if(typeof ai.id==D){ai.id=Y}if(M.ie&&M.win){var ah="";for(var ae in ai){if(ai[ae]!=Object.prototype[ae]){if(ae.toLowerCase()=="data"){ag.movie=ai[ae]}else{if(ae.toLowerCase()=="styleclass"){ah+=' class="'+ai[ae]+'"'}else{if(ae.toLowerCase()!="classid"){ah+=" "+ae+'="'+ai[ae]+'"'}}}}}var af="";for(var ad in ag){if(ag[ad]!=Object.prototype[ad]){af+='<param name="'+ad+'" value="'+ag[ad]+'" />'}}aa.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+ah+">"+af+"</object>";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab<ac;ab++){I[ab][0].detachEvent(I[ab][1],I[ab][2])}var Z=N.length;for(var aa=0;aa<Z;aa++){y(N[aa])}for(var Y in M){M[Y]=null}M=null;for(var X in swfobject){swfobject[X]=null}swfobject=null})}}();return{registerObject:function(ab,X,aa,Z){if(M.w3&&ab&&X){var Y={};Y.id=ab;Y.swfVersion=X;Y.expressInstall=aa;Y.callbackFn=Z;o[o.length]=Y;w(ab,false)}else{if(Z){Z({success:false,id:ab})}}},getObjectById:function(X){if(M.w3){return z(X)}},embedSWF:function(ab,ah,ae,ag,Y,aa,Z,ad,af,ac){var X={success:false,id:ah};if(M.w3&&!(M.wk&&M.wk<312)&&ab&&ah&&ae&&ag&&Y){w(ah,false);K(function(){ae+="";ag+="";var aj={};if(af&&typeof af===r){for(var al in af){aj[al]=af[al]}}aj.data=ab;aj.width=ae;aj.height=ag;var am={};if(ad&&typeof ad===r){for(var ak in ad){am[ak]=ad[ak]}}if(Z&&typeof Z===r){for(var ai in Z){if(typeof am.flashvars!=D){am.flashvars+="&"+ai+"="+Z[ai]}else{am.flashvars=ai+"="+Z[ai]}}}if(F(Y)){var an=u(aj,am,ah);if(aj.id==ah){w(ah,true)}X.success=true;X.ref=an}else{if(aa&&A()){aj.data=aa;P(aj,am,ah,ac);return}else{w(ah,true)}}if(ac){ac(X)}})}else{if(ac){ac(X)}}},switchOffAutoHideShow:function(){m=false},ua:M,getFlashPlayerVersion:function(){return{major:M.pv[0],minor:M.pv[1],release:M.pv[2]}},hasFlashPlayerVersion:F,createSWF:function(Z,Y,X){if(M.w3){return u(Z,Y,X)}else{return undefined}},showExpressInstall:function(Z,aa,X,Y){if(M.w3&&A()){P(Z,aa,X,Y)}},removeSWF:function(X){if(M.w3){y(X)}},createCSS:function(aa,Z,Y,X){if(M.w3){v(aa,Z,Y,X)}},addDomLoadEvent:K,addLoadEvent:s,getQueryParamValue:function(aa){var Z=j.location.search||j.location.hash;if(Z){if(/\?/.test(Z)){Z=Z.split("?")[1]}if(aa==null){return L(Z)}var Y=Z.split("&");for(var X=0;X<Y.length;X++){if(Y[X].substring(0,Y[X].indexOf("="))==aa){return L(Y[X].substring((Y[X].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(a){var X=c(R);if(X&&l){X.parentNode.replaceChild(l,X);if(Q){w(Q,true);if(M.ie&&M.win){l.style.display="block"}}if(E){E(B)}}a=false}}}}();var lastHash=window.location.hash;function pollHash(){if(lastHash!==window.location.hash){lastHash=window.location.hash;document.fire('hash:changed');}}
Event.observe(window,'beforeunload',function(e)
{if(unsaved_changes){e.stop();}});function hash_changed(page)
{var hash=unescape(decodeURI(window.location.hash.substring(1)));hash=hash.strip();switch(page)
{case'home':switch(hash)
{case'imenik':switch_tab('home_vreme_kursna_lista_imenik',3,3);myScrollTo($('tab_home_vreme_kursna_lista_imenik_li_3'));new Effect.Shake($('tab_home_vreme_kursna_lista_imenik_li_3'),{distance:10,sync:false,duration:1});break;case'kurs':switch_tab('home_vreme_kursna_lista_imenik',2,3);myScrollTo($('tab_home_vreme_kursna_lista_imenik_li_2'));new Effect.Shake($('tab_home_vreme_kursna_lista_imenik_li_2'),{distance:10,sync:false,duration:1});break;}
break;default:}}
function search_check()
{var s=$('search_input').value.strip();if(s.toLowerCase()=='imenik')
{if(userdata['session_page']=='home')
window.location.hash='#imenik';else
window.location='/#imenik';return false;}
if(s.toLowerCase()=='mapa'||s.toLowerCase()=='mapa grada'||s.toLowerCase()=='mapa sombora')
{window.location='sombor/mapa_grada/';return false;}
return true;}
Event.observe(document,"dom:loaded",function(e)
{img_preloader=loadImage('images/pause_1.gif');img_preloader1=loadImage('images/arrow_1_down.gif');img_preloader2=loadImage('images/arrow_1_up.gif');img_preloader3=loadImage('images/arrow_1_right.gif');img_preloader4=loadImage('images/loading_a_15.gif');img_preloader5=loadImage('images/loading_a_32.gif');img_preloader6=loadImage('images/loading_a_60.gif');img_preloader9=loadImage('images/template/bg_popup.png');img_preloader10=loadImage('images/bg_slide.png');img_preloader12=loadImage('images/loading_a_15.png');img_preloader13=loadImage('images/loading_a_32.png');img_preloader14=loadImage('images/loading_a_60.png');img_preloader15=loadImage('favicon_red.png');img_preloader16=loadImage('images/icons/notifications/vest.png');img_preloader17=loadImage('images/icons/notifications/pp.png');setTimeout('ping()',1000);new Draggable('popup',{handle:'popup_handle',starteffect:void(0),endeffect:void(0)});setInterval(pollHash,150);});function playerReady(thePlayer){streamer=document.getElementById(thePlayer.id);streamer.addModelListener("STATE","playerStateTracker");}
function playerStateTracker(obj)
{}
function validateEmail(email)
{var re=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return email.match(re);}
function favicon_alert_start()
{clearTimeout(favicon_alert_tid);if($('favicon').href.match('favicon_red.png'))
var href='favicon.png';else
var href='favicon_red.png';var link=document.createElement("link");link.rel="shortcut icon";link.href=href;link.id='favicon';$('favicon').replace(link);favicon_alert_tid=setTimeout(favicon_alert_start,1000);}
function favicon_alert_stop()
{if(favicon_alert_tid>0)
{clearTimeout(favicon_alert_tid);if($('favicon'))
{var link=document.createElement("link");link.rel="shortcut icon";link.href='favicon.png';link.id='favicon';$('favicon').replace(link);}}}
function addNotification(type)
{switch(type)
{case'vest':notifications['vest']++;$('footer_notification_vest_a').innerHTML=notifications['vest'];if($('footer_notification_pp').style.display!='none')
{new Effect.Morph($('footer_notification_bar'),{duration:0.1,style:"width: 104px;"});}
new Effect.Appear($('footer_notification_bar'),{duration:0.2,afterFinish:function(){setTimeout("if ($('footer_notification_vest').style.display == 'none') { new Effect.Move($('footer_notification_vest'), {x: 0, y: -100, duration: 0.01 }); new Effect.Appear($('footer_notification_vest'), { duration: 0.3 }); setTimeout(\"new Effect.Move($('footer_notification_vest'), {x: 0, y: 100, mode: 'relative', transition: Effect.Transitions.bounce });\", 20); }",50);}});break;case'pp':notifications['pp']++;$('footer_notification_pp_a').innerHTML=notifications['pp'];if($('footer_notification_vest').style.display!='none')
{new Effect.Morph($('footer_notification_bar'),{duration:0.1,style:"width: 104px;"});}
new Effect.Appear($('footer_notification_bar'),{duration:0.2,afterFinish:function(){setTimeout("if ($('footer_notification_pp').style.display == 'none') { new Effect.Move($('footer_notification_pp'), {x: 0, y: -100, duration: 0.01 }); new Effect.Appear($('footer_notification_pp'), { duration: 0.3 }); setTimeout(\"new Effect.Move($('footer_notification_pp'), {x: 0, y: 100, mode: 'relative', transition: Effect.Transitions.bounce });\", 20); }",50);}});break;}}
function checkNewsCount(newscount)
{if(newscount!="")
{if((newscount>ping_news_count)&&(ping_news_count!=0))
{new Ajax.Request("ajax.php?mode=ping&f=get_news&page="+encodeURIComponent(userdata['session_page'])+"&RandomKey="+Math.random()*Date.parse(new Date()),{asynchronous:true,onSuccess:function(xmlhttp){if(xmlhttp.responseText!="")
{$('slide_type').innerHTML='<img src="images/icons/notifications/vest.png" alt="vest" title="Nova vest" />';$('slide_content').innerHTML=xmlhttp.responseText;show_slide(60000,'addNotification("vest");');}}});}
if(newscount>=ping_news_count)
ping_news_count=newscount;}}
function checkPPCount(ppcount)
{if(ppcount!="")
{if((ppcount>ping_pp_count)&&(ping_pp_count!=-1))
{new Ajax.Request("ajax.php?mode=ping&f=get_pp&page="+encodeURIComponent(userdata['session_page'])+"&RandomKey="+Math.random()*Date.parse(new Date()),{asynchronous:true,onSuccess:function(xmlhttp){if(xmlhttp.responseText!="")
{$('slide_type').innerHTML='<img src="images/icons/notifications/pp.png" alt="nova pp" title="Nova privatna poruka" />';$('slide_content').innerHTML=xmlhttp.responseText;show_slide(60000,'addNotification("pp");');}}});}
if(ppcount>=ping_pp_count)
ping_pp_count=ppcount;}}
function nl2br(text){var re_nlchar='';text=escape(text);if(text.indexOf('%0D%0A')>-1){re_nlchar=/%0D%0A/g;}else if(text.indexOf('%0A')>-1){re_nlchar=/%0A/g;}else if(text.indexOf('%0D')>-1){re_nlchar=/%0D/g;}
if(re_nlchar!='')
return unescape(text.replace(re_nlchar,'<br />'));else
return unescape(text);}
function ping()
{new Ajax.Request("ajax.php?mode=ping&f=ping&page="+encodeURIComponent(page_title)+"&RandomKey="+Math.random()*Date.parse(new Date()),{asynchronous:true,onSuccess:function(xmlhttp){if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>1)
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('pp_count')[0].hasChildNodes())
checkPPCount(xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('pp_count')[0].firstChild.data);else
ping_pp_count=0;if(xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('news_count')[0].hasChildNodes())
checkNewsCount(xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('news_count')[0].firstChild.data);else
ping_news_count=0;}}});setTimeout('ping()',60000);}
function swf_callback(e)
{if(!e.success)
{$$('.content')[0].innerHTML='<div class="content_full" style="text-align: center;">Ova stranica koristi Flash plugin. Za instalaciju, posetite <a href="http://get.adobe.com/flashplayer/" class="link" target="_blank">get.adobe.com/flashplayer/</a>.<div class="break_dotted"></div></div>'+$$('.content')[0].innerHTML;}}
function loadImage(arg)
{if(document.images){rslt=new Image();rslt.onload=function(){preload_photo_loaded=true;};rslt.src=arg;return rslt;}};function myScrollTo(el){new Effect.ScrollTo(el,{duration:0.3,offset:-30});}
function banner_popup(url,width,height)
{var winleft=(screen.width-width)/2;var winUp=(screen.height-height)/2;_gaq.push(['_trackEvent','Popup (Banner)','Popup (Banner) - '+url]);window.open(url,'blank','width='+width+',height='+height+',left='+winleft+',top='+winUp+',resizable=yes,scrollbars=yes,toolbar=no,location=no,directories=no,menubar=no,borders=yes,border=yes');}
function typing(e,a)
{clearTimeout(typing_tid);if(e.keyCode==Event.KEY_RETURN)
setTimeout(a,1);else
typing_tid=setTimeout(a,800)}
function typing_1(a,b)
{typing_1_b=b;clearTimeout(typing_tid);typing_tid=setTimeout(a,800);}
function key(e){e=(e)?e:window.event;return((e.which)?e.which:e.keyCode);};function ref(object)
{if(document.getElementById)
{return document.getElementById(object);}
else if(document.all)
{return eval('document.all.'+object);}
else
{return false;}};function toggle_a(object,arrow_type)
{image=$(object+'_arrow');object=$(object);if(!object.style)
{return false;}
if(object.style.display=='none')
{object.style.display='';image.src='images/arrow_'+arrow_type+'_down.gif';}
else
{object.style.display='none';image.src='images/arrow_'+arrow_type+'_right.gif';}};function toggle_b(object,arrow_type)
{if(arrow_type!=0)
image=$(object+'_arrow');object=$(object);if(!object.style)
{return false;}
if(object.style.display=='none')
{new Effect.BlindDown(object,{duration:0.3});if(arrow_type!=0)
{image.src='images/arrow_'+arrow_type+'_up.gif';new Effect.ScrollTo(image,{duration:0.4,offset:-200});}}
else
{new Effect.BlindUp(object,{duration:0.3});if(arrow_type!=0)
{image.src='images/arrow_'+arrow_type+'_down.gif';new Effect.ScrollTo(image,{duration:0.4,offset:-200});}}};function toggle_c(object,value)
{object=$(object);if(!object.style)
{return false;}
if(value!=null)
{if(value==true)
object.style.display='';else
object.style.display='none';}
else
{if(object.style.display=='none')
{object.style.display='';}
else
{object.style.display='none';}}}
function toggle_d(object,arrow_type)
{if(arrow_type!=0)
image=$(object+'_arrow');object=$(object);if(!object.style)
{return false;}
if(object.style.display=='none')
{new Effect.BlindRight(object,{duration:0.3,scaleContent:false,scaleY:false,scaleMode:{originalWidth:200}});if(arrow_type!=0)
image.src='images/arrow_'+arrow_type+'_right.gif';}
else
{new Effect.BlindLeft(object,{duration:0.3,scaleContent:false,scaleY:false,scaleMode:{originalWidth:200}});if(arrow_type!=0)
{image.src='images/arrow_'+arrow_type+'_left.gif';}}}
function toggle_search()
{if(!search_resizing)
{if($('search_button').getAttribute('rel')=='expanded')
{search_resizing=true;new Effect.Scale($('search_box'),20,{scaleX:true,scaleY:false,scaleFrom:100,duration:0.3,afterFinish:function(){$('search_input').blur();search_resizing=false;$('search_input').value='';}});new Effect.Scale($('search_box_bg'),20,{scaleX:true,scaleY:false,scaleFrom:100,duration:0.3});$('search_button').rel='';new Effect.ScrollToY(last_scroll_position[1],{duration:0.3});}
else
{search_resizing=true;last_scroll_position=document.viewport.getScrollOffsets();$('search_input').show();new Effect.ScrollToY(0,{duration:0.3});new Effect.Scale($('search_box'),500,{scaleX:true,scaleY:false,scaleFrom:100,duration:0.3,afterFinish:function(){$('search_input').focus();search_resizing=false;}});new Effect.Scale($('search_box_bg'),500,{scaleX:true,scaleY:false,scaleFrom:100,duration:0.3});$('search_button').rel='expanded';}}}
function show_loading(type,obj_id,size)
{try{if(type==1)
{if(!$(obj_id+'_loading_holder'))
{var loading_holder=document.createElement("DIV");loading_holder.id=obj_id+'_loading_holder';var loading_img=document.createElement("IMG");loading_img.src='images/loading_a_'+size+'.gif';loading_holder.style.width=size+'px';loading_holder.style.height=size+'px';loading_holder.style.position='absolute';loading_holder.style.display='none';loading_holder.style.zIndex='9999999';loading_holder.style.top=Math.round((((findPosY($(obj_id))+($(obj_id).offsetHeight)/2))-(size/2)))+'px';loading_holder.style.left=Math.round((((findPosX($(obj_id))+($(obj_id).offsetWidth)/2))-(size/2)))+'px';loading_holder.appendChild(loading_img);document.body.appendChild(loading_holder);new Effect.Appear($(obj_id+'_loading_holder'),{sync:false,duration:0.12});}}
else if(type==2)
{if(!$(obj_id+'_loading_holder'))
{var loading_holder=document.createElement("DIV");loading_holder.id=obj_id+'_loading_holder';var loading_img=document.createElement("IMG");loading_img.src='images/template/bg_button2_loading.gif';loading_holder.style.width='125px';loading_holder.style.height='24px';loading_holder.style.position='absolute';loading_holder.style.display='none';loading_holder.style.zIndex='9999999';loading_holder.style.top=Math.round((((findPosY($(obj_id))+($(obj_id).offsetHeight)/2))-(24/2)))+'px';loading_holder.style.left=Math.round((((findPosX($(obj_id))+($(obj_id).offsetWidth)/2))-(125/2)))+'px';loading_holder.appendChild(loading_img);document.body.appendChild(loading_holder);new Effect.Appear($(obj_id+'_loading_holder'),{sync:false,duration:0.12});}}
else if(type==3)
{if(!$(obj_id+'_loading_holder'))
{var loading_holder=document.createElement("DIV");loading_holder.id=obj_id+'_loading_holder';var loading_img=document.createElement("IMG");loading_img.src='images/loading_a_'+size+'.gif';loading_img.style.margin='29px';loading_holder.style.width=(size+58)+'px';loading_holder.style.height=(size+58)+'px';loading_holder.style.background="url('images/loading_a_"+size+".png') center center no-repeat";loading_holder.style.position='absolute';loading_holder.style.display='none';loading_holder.style.zIndex='9999999';scrollTop=((window.pageYOffset>document.body.scrollTop)?window.pageYOffset:document.body.scrollTop);scrollLeft=((window.pageXOffset>document.body.scrollLeft)?window.pageXOffset:document.body.scrollLeft);windowHeight=((window.innerHeight)?window.innerHeight:document.body.offsetHeight);windowWidth=((window.innerWidth)?window.innerWidth:document.body.offsetWidth);loading_holder.style.top=Math.floor(Math.round((windowHeight/2)+scrollTop)-230)+'px';loading_holder.style.left=Math.floor(Math.round((windowWidth/2)+scrollLeft)-((size+58)/2))+'px';loading_holder.appendChild(loading_img);document.body.appendChild(loading_holder);new Effect.Appear($(obj_id+'_loading_holder'),{sync:false,duration:0.12});}}}
catch(e){}};function show_popup(a,b,caller)
{clearTimeout(popup_timeout_tid);objh=300;objw=660;scrollTop=document.viewport.getScrollOffsets().top;scrollLeft=document.viewport.getScrollOffsets().left;windowHeight=document.viewport.getHeight();windowWidth=document.viewport.getWidth();$('popup').style.top=Math.floor(Math.round(scrollTop+50))+'px';$('popup').style.left=Math.floor(Math.round((windowWidth/2)+scrollLeft)-(objw/2))+'px';$('popup').style.zIndex='999999';Event.observe($('popup_container'),"keypress",function(e){if(e.keyCode==Event.KEY_ESC){hide_popup();e.stop();}});if(a!=null)
{url=http_host+'ajax.php?mode=popup&f='+a+b+'&RandomKey='+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{if(typeof(_gaq)!=='undefined')
_gaq.push(['_trackEvent','Popup (AJAX)','Popup (AJAX) - '+a]);$('popup_container').innerHTML=xmlhttp.responseText;new Effect.Appear($('popup'),{duration:0.15});hide_loading('popup');$('popup').style.background="transparent";var re=/<script\b.*?>([\s\S]*?)<\//ig;var match;while(match=re.exec($('popup_container').innerHTML)){eval(match[1]);}}};show_loading(3,'popup',32);xmlhttp.open("GET",url,true);xmlhttp.send("");}
catch(e)
{alert(e);}}
else
new Effect.Appear($('popup'),{duration:0.15});};function popup_title(title)
{$('popup_title').innerHTML=title;}
function clear_popup()
{removeChildren('popup_container');$('popup_container').style.maxHeight='none';$('popup_container').style.height='auto';};function confirmation_popup(message,callback,btn1,btn2,btn3,var1)
{var confirmation_div=document.createElement('div');var confirmation_table=document.createElement('table');var confirmation_table_tbody=document.createElement("tbody");var confirmation_table_tr=document.createElement("tr");var confirmation_table_td1=document.createElement("td");var confirmation_table_td2=document.createElement("td");var confirmation_table_td3=document.createElement("td");confirmation_div.innerHTML=message;if(btn1!=null)
{var btn1_a=document.createElement('a');btn1_a.id='confirmation_popup_btn1';btn1_a.className="btn2";btn1_a.innerHTML=btn1;btn1_a.onclick=function(){ callback(1,var1);};confirmation_table_td1.appendChild(btn1_a);confirmation_table_tr.appendChild(confirmation_table_td1);}
if(btn2!=null)
{var btn2_a=document.createElement('a');btn2_a.id='confirmation_popup_btn2';btn2_a.className="btn2";btn2_a.innerHTML=btn2;btn2_a.onclick=function(){ hide_popup();callback(2,var1);};confirmation_table_td2.appendChild(btn2_a);confirmation_table_tr.appendChild(confirmation_table_td2);}
if(btn3!=null)
{var btn3_a=document.createElement('a');btn3_a.id='confirmation_popup_btn3';btn3_a.className="btn2";btn3_a.innerHTML=btn3;btn3_a.onclick=function(){ hide_popup();callback(3,var1);};confirmation_table_td3.appendChild(btn3_a);confirmation_table_tr.appendChild(confirmation_table_td3);}
confirmation_table.style.width='100%';confirmation_table.appendChild(confirmation_table_tr);confirmation_div.appendChild(confirmation_table);clear_popup();$('popup_container').appendChild(confirmation_div);show_popup();}
function removeChildren(obj)
{for(j=0;j<$(obj).childNodes.length;j++)
{$(obj).removeChild($(obj).childNodes[j]);removeChildren(obj);}};function hide_popup()
{new Effect.Fade($('popup'),{sync:false,duration:0.2,afterFinish:function(){clear_popup()}});$('popup_container').style.height='auto';};function hide_loading(obj_id)
{loading_holder=$(obj_id+'_loading_holder');if($(obj_id+'_loading_holder'))
new Effect.Fade(loading_holder,{duration:0.12,afterFinish:function(){if($(obj_id+'_loading_holder'))$(obj_id+'_loading_holder').parentNode.removeChild($(obj_id+'_loading_holder'));}});};function hide(obj_id)
{if($(obj_id))
new Effect.Fade($(obj_id),{duration:0.15});};function appear(obj_id)
{if($(obj_id))
new Effect.Appear($(obj_id),{duration:0.12});};function findPosX(obj)
{var curleft=0;if(obj.offsetParent)
while(1)
{curleft+=obj.offsetLeft;if(!obj.offsetParent)
break;obj=obj.offsetParent;}
else if(obj.x)
curleft+=obj.x;return curleft;};function findPosY(obj)
{var curtop=0;if(obj.offsetParent)
while(1)
{curtop+=obj.offsetTop;if(!obj.offsetParent)
break;obj=obj.offsetParent;}
else if(obj.y)
curtop+=obj.y;return curtop;};function importJS(src,look_for,onload){var s=document.createElement('script');s.setAttribute('type','text/javascript');s.setAttribute('src',src);if(onload)wait_for_script_load(look_for,onload);var head=document.getElementsByTagName('head')[0];if(head){head.appendChild(s);}else{document.body.appendChild(s);}}
function wait_for_script_load(look_for,callback){var interval=setInterval(function(){if(eval("typeof "+look_for)!='undefined'){clearInterval(interval);callback();}},50);}
function toAbsURL(url){if(!/^(file|https|http)\:\/\//.test(url)){var div=document.createElement("div");div.innerHTML='<a href="'+url+'" />';url=div.firstChild?div.firstChild.href:/href\="([^"]+)"/.exec(div.innerHTML)[1];}
return url;}
function switch_tab(a,b,c)
{for(i=1;i<=c;i++)
{if(i!=b)
{$('tab_'+a+'_li_'+i).setAttribute('class','tab');$('tab_'+a+'_li_'+i).className='tab';$('tab_'+a+'_content_'+i).style.display='none';}
else
{$('tab_'+a+'_li_'+i).setAttribute('class','tab_selected');$('tab_'+a+'_li_'+i).className='tab_selected';$('tab_'+a+'_content_'+i).style.display='';}}};function ajax_home_kursna_lista_convert_from()
{var fi=$('home_kursna_lista_from_cur').selectedIndex;var ti=$('home_kursna_lista_to_cur').selectedIndex;if(fi==ti)
$('home_kursna_lista_to_cur').selectedIndex=kursna_list_from_index;ajax_home_kursna_lista_convert();}
function ajax_home_kursna_lista_convert_to()
{var fi=$('home_kursna_lista_from_cur').selectedIndex;var ti=$('home_kursna_lista_to_cur').selectedIndex;if(fi==ti)
$('home_kursna_lista_from_cur').selectedIndex=kursna_list_to_index;ajax_home_kursna_lista_convert();}
function ajax_home_kursna_lista_convert()
{var fv=$('home_kursna_lista_from_val').value;var fc=$('home_kursna_lista_from_cur').value;var tc=$('home_kursna_lista_to_cur').value;url=http_host+'ajax.php?mode=kursna_lista&f=convert&fv='+fv+'&fc='+fc+'&tc='+tc+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{$('home_kursna_lista_to_val').value=xmlhttp.responseXML.documentElement.getElementsByTagName('val')[0].firstChild.nodeValue;hide_loading('home_kursna_lista_to_val');}}
catch(e)
{alert(e);}};if(fv!='')
{_gaq.push(['_trackEvent','Kursna lista (Home)','Konvertovanje - '+fv+' '+fc+' u '+tc]);show_loading(1,'home_kursna_lista_to_val',15);xmlhttp.open("GET",url,true);xmlhttp.send("");}}
catch(e)
{setTimeout('ajax_home_kursna_lista_convert();',2000);}};function home_kursna_lista_switch()
{var a=$('home_kursna_lista_from_cur').selectedIndex;$('home_kursna_lista_from_cur').selectedIndex=$('home_kursna_lista_to_cur').selectedIndex;$('home_kursna_lista_to_cur').selectedIndex=a;home_ajax_kursna_lista_convert();}
function ajax_imenik_get_info()
{imenik_ime=$('home_imenik_pretraga_ime').value;imenik_prezime=$('home_imenik_pretraga_prezime').value;imenik_ulica=$('home_imenik_pretraga_ulica').value;imenik_broj=$('home_imenik_pretraga_broj').value;imenik_telefon=$('home_imenik_pretraga_telefon').value;imenik_mesto=$('home_imenik_pretraga_mesto').value;if($('home_imenik_pretraga_type_f').checked)
imenik_type='f';else
imenik_type='p';url=http_host+'ajax.php?mode=imenik&f=get_info&ime='+encodeURIComponent(imenik_ime)+'&prezime='+encodeURIComponent(imenik_prezime)+'&ulica='+encodeURIComponent(imenik_ulica)+'&broj='+encodeURIComponent(imenik_broj)+'&telefon='+encodeURIComponent(imenik_telefon)+'&mesto='+encodeURIComponent(imenik_mesto)+'&t='+encodeURIComponent(imenik_type)+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{if(xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result').length>0)
{var containerTable=document.createElement("table");for(i=0;i<xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result').length;i++)
{if(xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result')[i].getElementsByTagName('ime')[0].hasChildNodes())
ajax_imenik_get_info_ime=xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result')[i].getElementsByTagName('ime')[0].firstChild.nodeValue;else
ajax_imenik_get_info_ime='';if(xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result')[i].getElementsByTagName('mesto')[0].hasChildNodes())
ajax_imenik_get_info_mesto=xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result')[i].getElementsByTagName('mesto')[0].firstChild.nodeValue;else
ajax_imenik_get_info_mesto='';if(xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result')[i].getElementsByTagName('adresa')[0].hasChildNodes())
ajax_imenik_get_info_adresa=xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result')[i].getElementsByTagName('adresa')[0].firstChild.nodeValue;else
ajax_imenik_get_info_adresa='';if(xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result')[i].getElementsByTagName('telefon')[0].hasChildNodes())
ajax_imenik_get_info_telefon=xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result')[i].getElementsByTagName('telefon')[0].firstChild.nodeValue;else
ajax_imenik_get_info_telefon='';var containerTableTd1Span=document.createElement("span");if(ajax_imenik_get_info_ime.length>55)
{containerTableTd1Span.title=ajax_imenik_get_info_ime;ajax_imenik_get_info_ime=ajax_imenik_get_info_ime.substr(0,55)+'..';}
containerTableTd1Span.style.fontWeight='bold';containerTableTd1Span.innerHTML=ajax_imenik_get_info_ime;var containerTableTbody=document.createElement("tbody");var containerTableTr1=document.createElement("tr");var containerTableTr2=document.createElement("tr");var containerTableTr3=document.createElement("tr");var containerTableTd1=document.createElement("td");var containerTableTd2=document.createElement("td");var containerTableTd3=document.createElement("td");var containerTableTd4=document.createElement("td");var containerTableTd2Img=document.createElement('img');containerTable.style.width='97%';containerTableTd1.appendChild(containerTableTd1Span);containerTableTd2Img.src='images/telefon.gif';containerTableTd2Img.style.marginRight='5px';containerTableTd2.style.width='95px';containerTableTd2.appendChild(containerTableTd2Img);containerTableTd2.innerHTML+='<span class="grey">025</span> '+ajax_imenik_get_info_telefon;containerTableTd3.colSpan=2;containerTableTd4.colSpan=2;if(i+1<xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result').length)
containerTableTd4.className='break_dotted';containerTableTd3.innerHTML='<a href="sombor/mapa_grada/#'+encodeURIComponent(ajax_imenik_get_info_adresa+', '+ajax_imenik_get_info_mesto)+'" class="link">'+ajax_imenik_get_info_adresa+', '+ajax_imenik_get_info_mesto+'</a>';containerTableTr1.appendChild(containerTableTd1);containerTableTr1.appendChild(containerTableTd2);containerTableTr2.appendChild(containerTableTd3);containerTableTr3.appendChild(containerTableTd4);containerTableTbody.appendChild(containerTableTr1);containerTableTbody.appendChild(containerTableTr2);containerTableTbody.appendChild(containerTableTr3);containerTable.appendChild(containerTableTbody);}}
clear_popup();popup_title('Rezultati pretrage imenika');if($('popup_container').style.maxHeight)
$('popup_container').style.maxHeight='500px';if(xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result').length<1)
{var imenikResultsDiv=document.createElement('div');imenikResultsDiv.className="grey";imenikResultsDiv.style.textAlign='center';imenikResultsDiv.style.padding='10px';imenikResultsDiv.appendChild(document.createTextNode('Nema pronađenih rezultata.'));$('popup_container').appendChild(imenikResultsDiv);}
else if(xmlhttp.responseXML.getElementsByTagName('imenik_error')[0].firstChild.nodeValue=='1')
{var imenikResultsDiv=document.createElement('div');imenikResultsDiv.className="grey";imenikResultsDiv.style.textAlign='center';imenikResultsDiv.style.padding='10px';imenikResultsDiv.appendChild(document.createTextNode('Greška. Pokušajte ponovo kasnije..'));$('popup_container').appendChild(imenikResultsDiv);}
else
{$('popup_container').appendChild(containerTable);}
show_popup(null,null,$('home_imenik_pretraga_submit'));hide_loading('home_imenik_pretraga_submit');if(xmlhttp.responseXML.getElementsByTagName('results')[0].getElementsByTagName('result').length<1)
popup_timeout_tid=setTimeout('hide_popup();',5000);}}
catch(e)
{hide_loading('home_imenik_pretraga_submit');alert(e+' - '+i);}};if(imenik_ime!=''||(imenik_prezime!=''&&imenik_type=='f')||imenik_ulica!=''||imenik_broj!=''||imenik_telefon!='')
{_gaq.push(['_trackEvent','Imenik','Pretraga - Ime: '+imenik_ime+', Prezime: '+imenik_prezime+', Ulica: '+imenik_ulica+', Broj: '+imenik_broj+', Telefon: '+imenik_telefon+', Mesto: '+imenik_mesto+', Vrsta: '+imenik_type]);show_loading(1,'home_imenik_pretraga_submit',32);xmlhttp.open("GET",url,true);xmlhttp.send("");}
else
new Effect.Shake($('home_imenik_form_fields'),{distance:10,sync:false});}
catch(e)
{setTimeout('ajax_imenik_get_info();',2000);}};function imenik_update_form_fields()
{if($('home_imenik_pretraga_type_f').checked)
{$('home_imenik_pretraga_prezime_holder').style.display='';}
else
{$('home_imenik_pretraga_prezime_holder').style.display='none';}};function kalendar_switch_dolazim(id,type)
{url=http_host+'ajax.php?mode=kalendar&f=switch_dolazim&id='+encodeURIComponent(id+"")+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue==1)
{if(type==1)
{if(xmlhttp.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue==1)
$('kalendar_dolazim_'+id).className='dolazim';else
$('kalendar_dolazim_'+id).className='ne_dolazim';}
if(type==2)
{if(xmlhttp.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue==1)
{new Effect.Fade($('kalendar_dolazim_'+id),{duration:0.3});new Effect.Appear($('kalendar_ne_dolazim_'+id),{duration:0.3});}
else
{new Effect.Fade($('kalendar_ne_dolazim_'+id),{duration:0.3});new Effect.Appear($('kalendar_dolazim_'+id),{duration:0.3});}}
if(type==1)
hide_loading('kalendar_dolazim_'+id);if(type==2)
{if(xmlhttp.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue==1)
{$('kalendar_dogadjaj_dolaze').innerHTML='<a href="soinfo/profil/'+userdata['id']+'/" id="kalendar_dolazim_user_'+userdata['id']+'" class="friend_link" style="background-image: url(images/avatars/15/'+userdata['avatar']+')">'+userdata['username']+'</a>'+$('kalendar_dogadjaj_dolaze').innerHTML;hide_loading('kalendar_dolazim_'+id);}
else
{new Effect.DropOut($('kalendar_dolazim_user_'+userdata['id']),{duration:0.3});hide_loading('kalendar_ne_dolazim_'+id);}}}
else
{hide_loading('kalendar_dolazim_'+id);hide_loading('kalendar_ne_dolazim_'+id);}}}}
catch(e)
{hide_loading('kalendar_dolazim_'+id);hide_loading('kalendar_ne_dolazim_'+id);alert(e);}};if(id!=''&&userdata['id']>0)
{_gaq.push(['_trackEvent','Kalendar','Dolazim/Ne dolazim, ID: '+id+', User: '+userdata['id']]);if(type==1)
show_loading(1,'kalendar_dolazim_'+id,15);if(type==2)
{if($('kalendar_dolazim_'+id).style.display=='none')
show_loading(1,'kalendar_ne_dolazim_'+id,32);else
show_loading(1,'kalendar_dolazim_'+id,32);}
xmlhttp.open("GET",url,true);xmlhttp.send("");}}
catch(e)
{alert(e);setTimeout('kalendar_switch_dolazim('+id+', '+type+')',2000);}}
function url_encode(string)
{return escape(utf8_encode(string));}
function utf8_encode(string)
{string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;}
function ajax_add_friend()
{url=http_host+'ajax.php?mode=profil&f=add_friend&friend='+url_encode($("add_friend_friend").value)+'&message='+url_encode(($("add_friend_send_message").checked)?$("add_friend_message").value:'')+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{response=xmlhttp.responseXML.documentElement.getElementsByTagName('result')[0].firstChild.nodeValue;var add_friend_div=document.createElement('div');add_friend_div.style.textAlign="center";if(response=='1')
{add_friend_div.innerHTML='Vaš zahtev za prijateljstvom je uspešno poslat!<br />';}
else if(response=='2')
{add_friend_div.innerHTML='Vaš prijatelj je uspešno dodat!<br />';}
else
{add_friend_div.innerHTML='<span class="red">Greška.</span><br /><br />Pokušajte ponovo za par sekundi.';setTimeout("show_popup('add_friend', '&friend="+url_encode($("add_friend_friend").value)+"&message="+url_encode($("add_friend_message").value)+"&send_message="+url_encode(($("add_friend_send_message").checked)?'1':'0')+"');popup_title('Dodavanje prijatelja');",5000);}
clear_popup();popup_title('Dodavanje prijatelja');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(add_friend_div);show_popup();hide_loading('add_friend_submit');}}
catch(e)
{alert(e);}};if($("add_friend_friend").value!='')
{_gaq.push(['_trackEvent','Profil','Dodavanje prijatelja - '+userdata['id']+' dodaje '+$("add_friend_friend").value]);show_loading(1,'add_friend_submit',32);xmlhttp.open("GET",url,true);xmlhttp.send("");clearTimeout(add_friend_tid);}}
catch(e)
{setTimeout('ajax_add_friend();',5000);}}
function ajax_confirm_friend(friend_id,link_id)
{url=http_host+'ajax.php?mode=profil&f=confirm_friend&friend='+encodeURIComponent(friend_id)+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{response=xmlhttp.responseXML.documentElement.getElementsByTagName('result')[0].firstChild.nodeValue;var confirm_friend_div=document.createElement('div');confirm_friend_div.style.textAlign="center";if(response=='1')
{confirm_friend_div.innerHTML='Uspešno ste potvrdili prijateljstvo!<br />';new Effect.Fade($(link_id),{duration:0.3});}
else
{confirm_friend_div.innerHTML='<span class="red">Greška.</span><br /><br />Pokušajte ponovo za par sekundi.';}
clear_popup();popup_title('Potvrda prijateljstva');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(confirm_friend_div);show_popup();}}
catch(e)
{alert(e);}};if(friend_id!='')
{_gaq.push(['_trackEvent','Profil','Potvrda prijateljstva - '+userdata['id']+' potvrđuje prijateljstvo sa '+friend_id]);xmlhttp.open("GET",url,true);xmlhttp.send("");}}
catch(e)
{setTimeout('ajax_confirm_friend('+friend_id+', '+link_id+');',5000);}}
function ajax_ignore_friend(friend_id,link_id)
{url=http_host+'ajax.php?mode=profil&f=ignore_friend&friend='+encodeURIComponent(friend_id)+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{response=xmlhttp.responseXML.documentElement.getElementsByTagName('result')[0].firstChild.nodeValue;var confirm_friend_div=document.createElement('div');confirm_friend_div.style.textAlign="center";if(response!='1')
{confirm_friend_div.innerHTML='<span class="red">Greška.</span><br /><br />Pokušajte ponovo za par sekundi.';clear_popup();popup_title('Ignorisanje prijateljstva');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(confirm_friend_div);show_popup();}
else
new Effect.Fade($(link_id),{duration:0.3});}}
catch(e)
{alert(e);}};if(friend_id!='')
{_gaq.push(['_trackEvent','Profil','Ignorisanje prijateljstva - '+userdata['id']+' ignoriše prijateljstvo sa '+friend_id]);xmlhttp.open("GET",url,true);xmlhttp.send("");}}
catch(e)
{setTimeout('ajax_ignore_friend('+friend_id+');',5000);}}
function ajax_remove_friend(friend_id)
{url=http_host+'ajax.php?mode=profil&f=remove_friend&friend='+encodeURIComponent(friend_id)+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{response=xmlhttp.responseXML.documentElement.getElementsByTagName('result')[0].firstChild.nodeValue;var remove_friend_div=document.createElement('div');remove_friend_div.style.textAlign="center";if(response=='1')
{remove_friend_div.innerHTML='Uspešno ste raskinuli prijateljstvo.<br />';setTimeout('window.location = "'+'soinfo/profil/'+friend_id+'/";',3000);}
else
{remove_friend_div.innerHTML='<span class="red">Greška.</span><br /><br />Pokušajte ponovo za par sekundi.';}
clear_popup();popup_title('Raskid prijateljstva');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(remove_friend_div);show_popup();hide_loading('confirmation_popup_btn1');}}
catch(e)
{alert(e);}};if(friend_id!='')
{_gaq.push(['_trackEvent','Profil','Raskid prijateljstva - '+userdata['id']+' raskida prijateljstvo sa '+friend_id]);show_loading(1,'confirmation_popup_btn1',32);xmlhttp.open("GET",url,true);xmlhttp.send("");}}
catch(e)
{setTimeout('ajax_remove_friend('+friend_id+');',5000);}}
function ajax_remove_pp(in_out,msgs)
{var msgs_object=new Array();msgs.each(function(element){msgs_object.push(element.value);});var msgs_json=Object.toJSON(msgs_object);url=http_host+'ajax.php?mode=pp&f=remove&in_out='+encodeURIComponent(in_out)+'&msgs='+encodeURIComponent(msgs_json)+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{response=xmlhttp.responseXML.documentElement.getElementsByTagName('result')[0].firstChild.nodeValue;var remove_pp_div=document.createElement('div');remove_pp_div.style.textAlign="center";if(response=='1')
{msgs.each(function(element){new Effect.BlindUp($('tr_pp_'+in_out+'_'+element.value),{duration:0.3});});}
else
{remove_pp_div.innerHTML='<span class="red">Greška.</span><br /><br />Pokušajte ponovo za par sekundi.';clear_popup();popup_title('Brisanje privatnih poruka');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(remove_pp_div);show_popup();}
hide_loading('confirmation_popup_btn1');}}
catch(e)
{alert(e);}};if(in_out!=''&&msgs!='')
{_gaq.push(['_trackEvent','Profil','Brisanje privatnih poruka']);show_loading(1,'confirmation_popup_btn1',32);xmlhttp.open("GET",url,true);xmlhttp.send("");}}
catch(e)
{}}
var upload_attachments_saved_count=0;var upload_attachments_errored_count=0;var post_id=0;var swfu;function ajax_os_vest()
{os_vest_text=$('os_vest_text').value;os_vest_kontakt=($('os_vest_kontakt'))?$('os_vest_kontakt').value:'';os_vest_objavi_izvor=($('os_vest_objavi_izvor').checked)?'1':'0';if(os_vest_text==''||os_vest_text=='<br />')
new Effect.Shake($('os_vest_text'),{distance:10,sync:false});if(os_vest_objavi_izvor=='1'&&os_vest_kontakt==''&&$('os_vest_kontakt'))
new Effect.Shake($('os_vest_kontakt'),{distance:10,sync:false});if(swfu.getStats().in_progress)
new Effect.Shake($$('fieldset.attached_files')[0],{distance:10,sync:false});if(os_vest_text==''||os_vest_text=='<br />'||(os_vest_objavi_izvor=='1'&&$('os_vest_kontakt')&&os_vest_kontakt=='')||swfu.getStats().in_progress)
return false;var count_uploaded=0;$$('#swfUploadProgress .progressWrapper').each(function(element){if(element.style.display!='none')
count_uploaded++;});var upload_attachments=new Array();if(count_uploaded>0)
{show_loading(1,'os_vest_submit',32);$$('#swfUploadProgress .progressWrapper').each(function(element){if(element.style.display!='none')
{var attachment_filename=element.getElementsBySelector('input[name="attachment_filename[]"]')[0].value;var attachment_title=element.getElementsBySelector('input[name="attachment_title[]"]')[0].value;upload_attachments[upload_attachments.length+1]=[attachment_filename,attachment_title];}});upload_attachments.each(function(element){new Ajax.Request("ajax.php?mode=os_vest&f=save_attachment&RandomKey="+Math.random()*Date.parse(new Date()),{method:'post',parameters:{attachments:Object.toJSON(element)},onComplete:function(xmlhttp){if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{var attachment_error_message;if(xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue==1)
{_gaq.push(['_trackEvent','OS vest','Upload attachmenta']);upload_attachments_saved_count++;}
else
{upload_attachments_errored_count++;attachment_error_message=(new XMLSerializer()).serializeToString(xmlhttp.responseXML.getElementsByTagName('return')[0])}
var count_uploaded=0;$$('#swfUploadProgress .progressWrapper').each(function(element){if(element.style.display!='none')
count_uploaded++;});if(upload_attachments_saved_count+upload_attachments_errored_count>=count_uploaded)
{if(upload_attachments_errored_count==0)
{ajax_os_vest_submit_post(1);}
else
{var error_div=document.createElement('div');error_div.style.textAlign="center";error_div.innerHTML=attachment_error_message;clear_popup();popup_title('Greška pri slanju prikačenih fajlova');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(error_div);show_popup();}
upload_attachments_errored_count=0;upload_attachments_saved_count=0;}}}});});hide_loading('os_vest_submit');}
else
{ajax_os_vest_submit_post(0);}}
function ajax_os_vest_submit_post(has_attachments)
{var upload_attachments=new Array();if(has_attachments)
{$$('#swfUploadProgress .progressWrapper').each(function(element){if(element.style.display!='none')
{var attachment_filename=element.getElementsBySelector('input[name="attachment_filename[]"]')[0].value;var attachment_title=element.getElementsBySelector('input[name="attachment_title[]"]')[0].value;upload_attachments[upload_attachments.length+1]=[attachment_filename,attachment_title];}});}
upload_attachments=Object.toJSON(upload_attachments);if($("os_vest_kontakt"))
os_vest_params={text:$("os_vest_text").value,kontakt:$("os_vest_kontakt").value,has_attachments:has_attachments,attachments:upload_attachments,objavi_izvor:(($("os_vest_objavi_izvor").checked)?'1':'0')};else
os_vest_params={text:$("os_vest_text").value,has_attachments:has_attachments,attachments:upload_attachments,objavi_izvor:(($("os_vest_objavi_izvor").checked)?'1':'0')};if($("os_vest_text").value!=''&&(!$("os_vest_kontakt")||$("os_vest_kontakt").value!=''||!($("os_vest_objavi_izvor").checked)))
{_gaq.push(['_trackEvent','OS vest','Slanje OS vesti']);show_loading(1,'os_vest_submit',32);new Ajax.Request("ajax.php?mode=os_vest&f=send&RandomKey="+Math.random()*Date.parse(new Date()),{method:'post',parameters:os_vest_params,onComplete:function(xmlhttp){if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{var os_vest_div=document.createElement('div');os_vest_div.style.textAlign="center";if(xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue==1)
{os_vest_div.innerHTML='Vaša vest je uspešno poslata!<br /><br />Hvala na trudu!<br />';}
else
{os_vest_div.innerHTML='<span class="red">Greška.</span><br /><br />Pokušajte ponovo za par sekundi.';setTimeout("show_popup('os_vest', '&text="+url_encode($("os_vest_text").value)+"&kontakt="+(($("os_vest_kontakt"))?url_encode($("os_vest_kontakt").value):"")+"&objavi_izvor="+url_encode(($("os_vest_objavi_izvor").checked)?'1':'0')+"');popup_title('Slanje opensource vesti');",5000);}
clear_popup();popup_title('Slanje opensource vesti');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(os_vest_div);show_popup();}
else
{os_vest_div.innerHTML='<span class="red">Greška.</span><br /><br />Pokušajte ponovo za par sekundi.';setTimeout("show_popup('os_vest', '&text="+url_encode($("os_vest_text").value)+"&kontakt="+(($("os_vest_kontakt"))?url_encode($("os_vest_kontakt").value):"")+"&objavi_izvor="+url_encode(($("os_vest_objavi_izvor").checked)?'1':'0')+"');popup_title('Slanje opensource vesti');",5000);}
clear_popup();popup_title('Slanje opensource vesti');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(os_vest_div);show_popup();hide_loading('os_vest_submit');}});clearTimeout(os_vest_tid);}
else
{hide_loading('os_vest_submit');if($("os_vest_text").value=='')
new Effect.Shake($('os_vest_text'),{distance:10,sync:false});if($("os_vest_kontakt")&&$("os_vest_objavi_izvor").checked&&$("os_vest_kontakt").value=='')
new Effect.Shake($('os_vest_kontakt'),{distance:10,sync:false});}}
function zoom_thumb(img,x,y,obj_id)
{if(!$(obj_id+'_zoom_holder'))
{var zoom_holder=document.createElement("DIV");zoom_holder.id=obj_id+'_zoom_holder';var zoom_img=document.createElement("IMG");zoom_img.src=img;zoom_holder.style.zIndex='99999999';zoom_holder.style.width=x+'px';zoom_holder.style.height=y+'px';zoom_holder.style.position='absolute';if(x>=15&&y>=15)
loading_size=15;if(x>=32&&y>=32)
loading_size=32;zoom_holder.style.background='url("images/loading_a_'+loading_size+'.gif") center center no-repeat';zoom_holder.style.display='none';zoom_holder.style.top=Math.round((((findPosY($(obj_id))+($(obj_id).offsetHeight)/2))-(y/2)))+'px';zoom_holder.style.left=Math.round((((findPosX($(obj_id))+($(obj_id).offsetWidth)/2))-(x/2)))+'px';zoom_holder.onmouseup=function(){zoom_out_thumb(zoom_holder.id);};zoom_holder.appendChild(zoom_img);document.body.appendChild(zoom_holder);}
new Effect.Appear($(obj_id+'_zoom_holder'),{sync:false,duration:0.3});};function zoom_out_thumb(obj_id)
{zoom_holder=$(obj_id);if($(obj_id))
new Effect.Fade(zoom_holder,{duration:0.3,afterFinish:function(){if($(obj_id))$(obj_id).parentNode.removeChild($(obj_id));}});};function show_slide(timeout,action)
{$('slide').style.display='';new Effect.SlideDown($('slide_holder'),{duration:0.6});tid_slide=setTimeout('hide_slide(); '+action,timeout);var arVersion=navigator.appVersion.split("MSIE");var version=parseFloat(arVersion[1]);if((version<7)&&(document.body.filters))
{window.onscroll=reposition_ads;reposition_ads()}}
function hide_slide()
{clearTimeout(tid_slide);new Effect.SlideUp($('slide_holder'),{duration:0.6,afterFinish:function(){$('slide').style.display='none';}});}
function reposition_ads(){var gd=$('slide');var vOffset=0;if(typeof window.pageYOffset=='number')
vOffset=window.pageYOffset;else if(document.body&&document.body.scrollTop)
vOffset=document.body.scrollTop;else if(document.documentElement&&document.documentElement.scrollTop)
vOffset=document.documentElement.scrollTop;var oldpos=gd.style.position;gd.style.position='absolute';gd.style.top=vOffset+'px';}
function foto_show_preview(id,sw,x,y)
{switch(sw){case 0:obj_id='foto_preview_'+id;if($(obj_id))$(obj_id).parentNode.removeChild($(obj_id));break;case-1:foto_preview_tid[id]=setTimeout('foto_show_preview('+id+', 0);',100);break;default:clearTimeout(foto_preview_tid[id]);if(!$('foto_preview_'+id))
{var foto_preview_container=document.createElement("div");var foto_preview_container_img=document.createElement("img");foto_preview_container_img.src=http_host+'images/foto/preview/'+id+'.jpg';foto_preview_container.className='foto_preview';foto_preview_container.id='foto_preview_'+id;foto_preview_container.appendChild(foto_preview_container_img);foto_preview_container.style.zIndex='99999999';foto_preview_container.style.position='absolute';foto_preview_container.style.background='#fff url("images/loading_a_60.gif") center center no-repeat';foto_preview_container.style.display='block';foto_preview_container.style.top=Math.round((((findPosY($('foto_'+id))+($('foto_'+id).offsetHeight)/2))-((y+10)/2)))+'px';foto_preview_container.style.left=Math.round((((findPosX($('foto_'+id))+($('foto_'+id).offsetWidth)/2))-((x+10)/2)))+'px';foto_preview_container.onmouseout=function(){foto_show_preview(id,-1);};document.body.appendChild(foto_preview_container);setTimeout('clearTimeout(foto_preview_tid['+id+']);',100);}}}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');};function gotoProfile()
{new Ajax.Request('ajax.php?mode=suggest&f=get_user_id&n='+encodeURIComponent($('soinfo_profil_pretraga').value),{asynchronous:true,onSuccess:gotoProfile_,onFailure:errFunc()});}
function gotoProfile_(xmlhttp)
{if(xmlhttp.responseXML.getElementsByTagName('ul')[0].childNodes.length>1)
if(xmlhttp.responseXML.getElementsByTagName('ul')[0].getElementsByTagName('li')[0].hasChildNodes())
window.location='soinfo/profil/'+xmlhttp.responseXML.getElementsByTagName('ul')[0].getElementsByTagName('li')[0].firstChild.nodeValue+'/';}
function errFunc(a)
{}
function more_smilies(return_to)
{popup_title('Još smajlija');show_popup('more_smilies','&return_to='+encodeURIComponent(return_to));}
function ajax_home_anketa_show_results(id,show_thanks)
{new Effect.BlindUp($('home_anketa_options'),{duration:0.3,afterFinish:function(){removeChildren($('home_anketa_options'));url=http_host+'ajax.php?mode=anketa&f=show_home_results&id='+id+'&thanks='+show_thanks+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{$('home_anketa_options').innerHTML=xmlhttp.responseText;$('home_anketa_submit').hide();new Effect.BlindDown($('home_anketa_options'),{duration:0.3,afterFinish:function(){var re=/<script\b.*?>(.*?)<\//ig;var match;while(match=re.exec($('home_anketa_options').innerHTML)){eval(match[1]);}}});hide_loading('home_anketa_options');}}
catch(e)
{alert(e);hide_loading('home_anketa_options');}};show_loading(1,'home_anketa_options',32);xmlhttp.open("GET",url,true);xmlhttp.send("");}
catch(e)
{setTimeout('ajax_home_anketa_show_results('+id+');',2000);}}});}
function ajax_home_anketa_submit(id)
{url=http_host+'ajax.php?mode=anketa&f=vote&id='+id+'&option='+$$('input:checked[type="radio"][name="anketa_'+id+'"]').pluck('value')+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue==1)
{hide_popup();clear_popup();_gaq.push(['_trackEvent','Anketa','Glasanje na home anketi']);ajax_home_anketa_show_results(id,1);hide_loading('home_anketa_submit');}
else if(xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue==2)
{var anketa_div=document.createElement('div');anketa_div.style.textAlign="center";anketa_div.innerHTML='Već ste glasali na ovoj anketi.';setTimeout('hide_popup();',6000);clear_popup();popup_title('Greška pri glasanju');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(anketa_div);show_popup();ajax_home_anketa_show_results(id,0);hide_loading('home_anketa_submit');}}}}
catch(e)
{hide_loading('home_anketa_submit');alert(e);}};if(userdata['id']==0)
{popup_title('Login');show_popup('login','&page=home&needed_login=1');return;}
if($$('input:checked[type="radio"][name="anketa_'+id+'"]').pluck('value')!='')
{show_loading(1,'home_anketa_submit',32);xmlhttp.open("GET",url,true);xmlhttp.send("");}
else
new Effect.Shake($('home_anketa_options'),{distance:10,sync:false});}
catch(e)
{alert(e);}}
function confirmed(a,b)
{if(a==undefined)
return confirm(b);else
return a;}
function skim_poslednje_album(e,id)
{width=265;count=5;if(e==0)
xpos=0;else
{var x1=e.pageX||(e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));var x2=findPosX($(id));x=Math.abs(x1-x2);xpos=-((Math.round(x/((width/count)+1)))*width);}
$(id).style.backgroundPosition=xpos+'px 0px';$(id).style.backgroundPositionX=xpos+'px';}
function random_zanimljivost()
{url=http_host+'ajax.php?mode=zanimljivost&f=random&id='+home_zanimljivost_id+"&RandomKey="+Math.random()*Date.parse(new Date());var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}try{xmlhttp.onreadystatechange=function()
{try
{if((xmlhttp.readyState==4)&&(xmlhttp.responseText.length>0))
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{hide_popup();clear_popup();if(xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('id')[0].hasChildNodes())
ajax_zanimljivost_id=xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('id')[0].firstChild.nodeValue;else
ajax_zanimljivost_id='';if(xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('text')[0].hasChildNodes())
ajax_zanimljivost_text=(new XMLSerializer()).serializeToString(xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('text')[0]);else
ajax_zanimljivost_text='';if(xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('source')[0].hasChildNodes())
ajax_zanimljivost_source=xmlhttp.responseXML.getElementsByTagName('result')[0].getElementsByTagName('source')[0].firstChild.nodeValue;else
ajax_zanimljivost_source='';if(ajax_zanimljivost_id!='')
home_zanimljivost_id=ajax_zanimljivost_id;new Effect.Fade($('zanimljivost'),{duration:0.3,afterFinish:function(){removeChildren($('zanimljivost'));var zanimljivost_source_div=document.createElement('div');zanimljivost_source_div.style.textAlign="right";zanimljivost_source_div.innerHTML='<i>'+ajax_zanimljivost_source+'</i>';$('zanimljivost').innerHTML=ajax_zanimljivost_text;if(ajax_zanimljivost_source!='')
$('zanimljivost').appendChild(zanimljivost_source_div);new Effect.Appear($('zanimljivost'),{duration:0.3});}});hide_loading('zanimljivost');}}}
catch(e)
{hide_loading('zanimljivost');alert(e);}};show_loading(1,'zanimljivost',32);xmlhttp.open("GET",url,true);xmlhttp.send("");}
catch(e)
{alert(e);}}
function ajax_nagradna_igra_submit(id)
{var nagradna_igra_type=$('nagradna_igra_type').value;var nagradna_igra_odgovor='';if(nagradna_igra_type=='1')
{nagradna_igra_odgovor=$RF('nagradna_igra_form','nagradna_igra_chk_'+id);}
if(nagradna_igra_type=='2')
{nagradna_igra_odgovor=$('nagradna_igra_odgovor').value;}
if(nagradna_igra_odgovor==''||nagradna_igra_odgovor==null)
{new Effect.Shake($('nagradna_igra_odgovori'),{distance:10,sync:false});return;}
show_loading(1,'nagradna_igra_submit',32);new Ajax.Request("ajax.php?mode=soinfo&f=nagradna_igra_odgovor&RandomKey="+Math.random()*Date.parse(new Date()),{method:'post',parameters:{id:id,odgovor:nagradna_igra_odgovor},onComplete:function(xmlhttp){if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{var result=xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue;if(result=='1')
{var bs_div=document.createElement('div');bs_div.style.textAlign="center";bs_div.innerHTML='<p>Vaš odgovor na nagradnu igru je prihvaćen.<br />Bićete obavešteni privatnom porukom ako budete izvučeni kao dobitnik.</p>';clear_popup();popup_title('Nagradna igra');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(bs_div);show_popup();}
else
{var bs_div=document.createElement('div');bs_div.style.textAlign="center";if(response=='-2')
bs_div.innerHTML='<span class="red">Greška.</span><br />Već ste učestvovali u ovoj nagradnoj igri.';else
bs_div.innerHTML='<span class="red">Greška.</span>';clear_popup();popup_title('Nagradna igra');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(bs_div);show_popup();}}
hide_loading('nagradna_igra_submit');}});_gaq.push(['_trackEvent','Nagradna igra','Odgovor poslat - '+id]);}
RegExp.escape=function(text){if(!arguments.callee.sRE){var specials=['/','.','*','+','?','|','(',')','[',']','{','}','\\'];arguments.callee.sRE=new RegExp('(\\'+specials.join('|\\')+')','g');}
return text.replace(arguments.callee.sRE,'\\$1');};function number_format(number,decimals,dec_point,thousands_sep){var n=number,c=isNaN(decimals=Math.abs(decimals))?2:decimals;var d=dec_point==undefined?",":dec_point;var t=thousands_sep==undefined?".":thousands_sep,s=n<0?"-":"";var i=parseInt(n=Math.abs(+n||0).toFixed(c))+"",j=(j=i.length)>3?j%3:0;return s+(j?i.substr(0,j)+t:"")+i.substr(j).replace(/(\d{3})(?=\d)/g,"$1"+t)+(c?d+Math.abs(n-i).toFixed(c).slice(2):"");}
function size_format(filesize){if(filesize>=1073741824){filesize=number_format(filesize/1073741824,2,'.','')+' GB';}else{if(filesize>=1048576){filesize=number_format(filesize/1048576,2,'.','')+' MB';}else{if(filesize>=1024){filesize=number_format(filesize/1024,0)+' KB';}else{filesize=number_format(filesize,0)+' B';};};};return filesize;}
function filename_no_extension(filename)
{return filename.substring(0,filename.lastIndexOf("."));}
function strtr(str,from,to){var fr='',i=0,j=0,lenStr=0,lenFrom=0;var tmpFrom=[];var tmpTo=[];var ret='';var match=false;if(typeof from==='object'){for(fr in from){tmpFrom.push(fr);tmpTo.push(from[fr]);}
from=tmpFrom;to=tmpTo;}
lenStr=str.length;lenFrom=from.length;for(i=0;i<lenStr;i++){match=false;for(j=0;j<lenFrom;j++){if(str.substr(i,from[j].length)==from[j]){match=true;i=(i+from[j].length)-1;break;}}
if(false!==match){ret+=to[j];}else{ret+=str[i];}}
return ret;}
function mp3stream(id,icon)
{if(!$('streamer'))
{alert('Morate imati instaliran Flash plugin..');return;}
if(preview_playing=='00')
{preview_playing=icon;show_loading(1,icon,15);_gaq.push(['_trackEvent','MP3','Stream - '+id]);streamer.sendEvent('LOAD',{file:id,type:'http'});$(icon).className='pause_1';streamer.sendEvent('PLAY');setTimeout("hide_loading('"+icon+"');",2500);clearTimeout(flash_tid);flash_tid=setTimeout('preview_playing = "00"; document.getElementById("'+icon+'").className = "play_1"; streamer.sendEvent("STOP");',3600000);}
else if(preview_playing!=icon)
{streamer.sendEvent('LOAD',{file:id,type:'http'});$(preview_playing).className='play_1';hide_loading(preview_playing);show_loading(1,icon,15);$(icon).className='pause_1';streamer.sendEvent('PLAY');preview_playing=icon;setTimeout("hide_loading('"+icon+"');",2500);clearTimeout(flash_tid);flash_tid=setTimeout('preview_playing = "00"; document.getElementById("'+icon+'").className = "play_1"; streamer.sendEvent("STOP");',3600000);}
else
{$(icon).className='play_1';streamer.sendEvent('STOP');clearTimeout(flash_tid);hide_loading(icon);preview_playing='00';}};function mp3preview(id,icon)
{if(!$('streamer'))
{alert('Morate imati instaliran Flash plugin..');return;}
file=http_host+'mp3/preview/'+id+'.mp3';if(preview_playing=='00')
{preview_playing=icon;show_loading(1,icon,15);_gaq.push(['_trackEvent','MP3','Preview - '+id]);streamer.sendEvent('LOAD',{file:file,type:'sound'});$(icon).className='pause_1';streamer.sendEvent('PLAY');setTimeout("hide_loading('"+icon+"');",2500);clearTimeout(flash_tid);flash_tid=setTimeout('preview_playing = "00"; document.getElementById("'+icon+'").className = "play_1"; streamer.sendEvent("STOP");',60000);}
else if(preview_playing!=icon)
{streamer.sendEvent('LOAD',{file:file,type:'sound'});$(preview_playing).className='play_1';hide_loading(preview_playing);show_loading(1,icon,15);$(icon).className='pause_1';streamer.sendEvent('PLAY');setTimeout("hide_loading('"+icon+"');",2500);clearTimeout(flash_tid);flash_tid=setTimeout('preview_playing = "00"; document.getElementById("'+icon+'").className = "play_1"; streamer.sendEvent("STOP");',60000);preview_playing=icon;}
else
{$(preview_playing).className='play_1';streamer.sendEvent('STOP');clearTimeout(flash_tid);hide_loading(icon);preview_playing='00';}};function mp3play(id,icon)
{if(!$('streamer'))
{alert('Morate imati instaliran Flash plugin..');return;}
file=http_host+'mp3/'+id+'.mp3';if(mp3_playing=='00')
{mp3_playing=icon;show_loading(1,icon,15);streamer.sendEvent('LOAD',{file:file,type:'sound'});$(icon).className='pause_1';streamer.sendEvent('PLAY');setTimeout("hide_loading('"+icon+"');",2500);clearTimeout(flash_tid);_gaq.push(['_trackEvent','MP3','Play - '+id]);}
else if(mp3_playing!=icon)
{streamer.sendEvent('LOAD',{file:file,type:'sound'});$(mp3_playing).className='play_1';hide_loading(mp3_playing);show_loading(1,icon,15);$(icon).className='pause_1';streamer.sendEvent('PLAY');setTimeout("hide_loading('"+icon+"');",2500);clearTimeout(flash_tid);mp3_playing=icon;}
else
{$(mp3_playing).className='play_1';streamer.sendEvent('STOP');clearTimeout(flash_tid);hide_loading(icon);mp3_playing='00';}};function ajax_foto_promena_naziva()
{var promena_naziva_id=$('foto_promena_naziva_id').value;var promena_naziva_naziv=$('foto_promena_naziva_naziv').value;show_loading(1,'foto_promena_naziva_submit',32);new Ajax.Request("ajax.php?mode=foto&f=promena_naziva&RandomKey="+Math.random()*Date.parse(new Date()),{method:'post',parameters:{naziv:Object.toJSON(promena_naziva_naziv),id:Object.toJSON(promena_naziva_id)},onComplete:function(xmlhttp){if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue==1)
{tema_id=xmlhttp.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;var bs_div=document.createElement('div');bs_div.style.textAlign="center";bs_div.innerHTML='Naziv slike je uspešno promenjen.';clear_popup();popup_title('Promena naziva slike');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(bs_div);show_popup();setTimeout("window.location.reload(true);",3000);}
else
{var bs_div=document.createElement('div');bs_div.style.textAlign="center";bs_div.innerHTML='<span class="red">Greška.</span><br />'+xmlhttp.responseText;clear_popup();popup_title('Promena naziva slike');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(bs_div);show_popup();}}
hide_loading('foto_promena_naziva_submit');}});}
function ajax_foto_premestanje()
{var premestanje_id=$('foto_premestanje_id').value;var premestanje_album=$('foto_premestanje_album').value;show_loading(1,'foto_premestanje_submit',32);new Ajax.Request("ajax.php?mode=foto&f=premestanje&RandomKey="+Math.random()*Date.parse(new Date()),{method:'post',parameters:{album:Object.toJSON(premestanje_album),id:Object.toJSON(premestanje_id)},onComplete:function(xmlhttp){if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue==1)
{tema_id=xmlhttp.responseXML.getElementsByTagName('return')[0].firstChild.nodeValue;var bs_div=document.createElement('div');bs_div.style.textAlign="center";bs_div.innerHTML='Slika je uspešno premeštena.';clear_popup();popup_title('Premeštanje slike');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(bs_div);show_popup();setTimeout("window.location.reload();",3000);}
else
{var bs_div=document.createElement('div');bs_div.style.textAlign="center";bs_div.innerHTML='<span class="red">Greška.</span><br />'+xmlhttp.responseText;clear_popup();popup_title('Premeštanje slike');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(bs_div);show_popup();}}
hide_loading('foto_premestanje_submit');}});}
function ajax_foto_brisanje_confirm(id)
{confirmation_popup('Da li sigurno želite da obrišete ovu sliku?',function(result,var1){if(result==1)ajax_foto_brisanje(var1);else hide_popup();},'Obriši','Odustani',null,id);popup_title('Brisanje slike');}
function ajax_foto_brisanje(id)
{var brisanje_id=id;show_loading(1,'confirmation_popup_btn1',32);new Ajax.Request("ajax.php?mode=foto&f=brisanje&RandomKey="+Math.random()*Date.parse(new Date()),{method:'post',parameters:{id:Object.toJSON(brisanje_id)},onComplete:function(xmlhttp){if(xmlhttp.responseXML.getElementsByTagName('result')[0].childNodes.length>0)
{if(xmlhttp.responseXML.getElementsByTagName('result')[0].firstChild.nodeValue==1)
{var bs_div=document.createElement('div');bs_div.style.textAlign="center";bs_div.innerHTML='Slika je uspešno izbrisana.';clear_popup();popup_title('Brisanje slike');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(bs_div);show_popup();setTimeout("window.location.reload();",3000);}
else
{var bs_div=document.createElement('div');bs_div.style.textAlign="center";bs_div.innerHTML='<span class="red">Greška.</span><br />'+xmlhttp.responseText;clear_popup();popup_title('Brisanje slike');$('popup_container').appendChild(document.createElement('br'));$('popup_container').appendChild(bs_div);show_popup();}}
hide_loading('confirmation_popup_btn1');}});}
var Lightview={Version:'2.5.2.1',options:{backgroundColor:'#ffffff',border:12,buttons:{opacity:{disabled:0.4,normal:0.75,hover:1},side:{display:true},innerPreviousNext:{display:true},slideshow:{display:true},topclose:{side:'right'}},controller:{backgroundColor:'#4d4d4d',border:6,buttons:{innerPreviousNext:true,side:false},margin:18,opacity:0.7,radius:6,setNumberTemplate:'#{position} of #{total}'},cyclic:false,images:'images/lightview/',imgNumberTemplate:'Image #{position} of #{total}',keyboard:false,menubarPadding:6,overlay:{background:'#000',close:true,opacity:0.85,display:true},preloadHover:false,radius:12,removeTitles:true,resizeDuration:0.45,slideshowDelay:6,titleSplit:'::',transition:function(pos){return((pos/=0.5)<1?0.5*Math.pow(pos,4):-0.5*((pos-=2)*Math.pow(pos,3)-2));},viewport:true,zIndex:5000,startDimensions:{width:100,height:100},closeDimensions:{large:{width:77,height:22},small:{width:25,height:22}},sideDimensions:{width:16,height:22},defaultOptions:{image:{menubar:'bottom',closeButton:'large'},gallery:{menubar:'bottom',closeButton:'large'},ajax:{width:400,height:300,menubar:'top',closeButton:'small',overflow:'auto'},iframe:{width:400,height:300,menubar:'top',scrolling:true,closeButton:'small'},inline:{width:400,height:300,menubar:'top',closeButton:'small',overflow:'auto'},flash:{width:640,height:480,menubar:'bottom',closeButton:'large'},quicktime:{width:480,height:220,autoplay:true,controls:true,closeButton:'large'},audio:{width:480,height:20,autoplay:true,controls:true,closeButton:'large'}}},classids:{quicktime:'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',flash:'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'},codebases:{quicktime:'http://www.apple.com/qtactivex/qtplugin.cab#version=7,5,5,0',flash:'http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0'},errors:{requiresPlugin:"<div class='message'> The content your are attempting to view requires the <span class='type'>#{type}</span> plugin.</div><div class='pluginspage'><p>Please download and install the required plugin from:</p><a href='#{pluginspage}' target='_blank'>#{pluginspage}</a></div>"},mimetypes:{quicktime:'video/quicktime',flash:'application/x-shockwave-flash',audio:'application/x-shockwave-flash'},pluginspages:{quicktime:'http://www.apple.com/quicktime/download',flash:'http://www.adobe.com/go/getflashplayer',audio:'http://www.adobe.com/go/getflashplayer'},typeExtensions:{flash:'swf',image:'bmp gif jpeg jpg png',iframe:'asp aspx cgi cfm htm html jsp php pl php3 php4 php5 phtml rb rhtml shtml txt',quicktime:'avi mov mpg mpeg movie',audio:'mp3 wav'}};(function(){var l=!!document.createElement("canvas").getContext,BROWSER_IS_IE_LT7=Prototype.Browser.IE&&(function(a){var b=new RegExp("MSIE ([\\d.]+)").exec(a);return b?parseFloat(b[1]):-1})(navigator.userAgent)<7,BROWSER_IS_WEBKIT_419=(Prototype.Browser.WebKit&&!document.evaluate),BROWSER_IS_FIREFOX_LT3=navigator.userAgent.indexOf("Firefox")>-1&&parseFloat(navigator.userAgent.match(/Firefox[\/\s](\d+)/)[1])<3,FIX_OVERLAY_WITH_PNG=!!navigator.userAgent.match(/mac/i)&&(BROWSER_IS_WEBKIT_419||BROWSER_IS_FIREFOX_LT3);Object.extend(Lightview,{REQUIRED_Prototype:"1.6.1",REQUIRED_Scriptaculous:"1.8.2",queue:{position:"end",scope:"lightview"},require:function(a){if((typeof window[a]=="undefined")||(this.convertVersionString(window[a].Version)<this.convertVersionString(this["REQUIRED_"+a]))){throw("Lightview requires "+a+" >= "+this["REQUIRED_"+a]);}},convertVersionString:function(a){var v=a.replace(/_.*|\./g,"");v=parseInt(v+"0".times(4-v.length));return a.indexOf("_")>-1?v-1:v},load:function(){this.require("Prototype");if(!!window.Effect&&!window.Scriptaculous){this.require("Scriptaculous")}
if(/^(https?:\/\/|\/)/.test(this.options.images)){this.images=this.options.images}else{var b=/lightview(?:-[\w\d.]+)?\.js(.*)/;this.images=(($$("script[src]").find(function(s){return s.src.match(b)})||{}).src||"").replace(b,"")+this.options.images}
if(!l){if(document.documentMode>=8&&!document.namespaces.ns_vml){document.namespaces.add("ns_vml","urn:schemas-microsoft-com:vml","#default#VML")}else{document.observe("dom:loaded",function(){var a=document.createStyleSheet();a.cssText="ns_vml\\:*{behavior:url(#default#VML)}"})}}},start:function(){this.radius=this.options.radius;this.border=(this.radius>this.options.border)?this.radius:this.options.border;this.closeDimensions=this.options.closeDimensions;this.sideDimensions=this.options.sideDimensions;this.build()}});Object.extend(Lightview,{_lightviewLoadedEvents:14,_lightviewLoadedEvent:function(){var a=arguments.callee;a.counter++;if(a.counter==this._lightviewLoadedEvents){$(document.body).fire("lightview:loaded")}}});Lightview._lightviewLoadedEvent.counter=0;Object.extend(Lightview,{build:function(){this.lightview=new Element("div",{id:"lightview"});var d,sideNegativeMargin,sideStyle=pixelClone(this.sideDimensions);if(BROWSER_IS_WEBKIT_419){this.lightview.hide=function(){this.setStyle("left:-9500px;top:-9500px;visibility:hidden;");return this};this.lightview.show=function(){this.setStyle("visibility:visible");return this};this.lightview.visible=function(){return(this.getStyle("visibility")=="visible"&&parseFloat(this.getStyle("top").replace("px",""))>-9500)}}
$(document.body).insert(this.overlay=new Element("div",{id:"lv_overlay"}).setStyle({zIndex:this.options.zIndex-1,position:(!(BROWSER_IS_FIREFOX_LT3||BROWSER_IS_IE_LT7))?"fixed":"absolute",background:FIX_OVERLAY_WITH_PNG?"url("+this.images+"overlay.png) top left repeat":this.options.overlay.background}).setOpacity(FIX_OVERLAY_WITH_PNG?1:this.options.overlay.opacity).hide()).insert(this.lightview.setStyle({zIndex:this.options.zIndex,top:"-9500px",left:"-9500px"}).setOpacity(0).insert(this.container=new Element("div",{className:"lv_Container"}).insert(this.sideButtons=new Element("ul",{className:"lv_Sides"}).insert(this.prevSide=new Element("li",{className:"lv_PrevSide"}).setStyle(sideNegativeMargin=Object.extend({marginLeft:-1*this.sideDimensions.width+"px"},sideStyle)).insert(this.prevButtonImage=new Element("div",{className:"lv_Wrapper"}).setStyle(Object.extend({marginLeft:this.sideDimensions.width+"px"},sideStyle)).insert(new Element("div",{className:"lv_Button"})))).insert(this.nextSide=new Element("li",{className:"lv_NextSide"}).setStyle(Object.extend({marginRight:-1*this.sideDimensions.width+"px"},sideStyle)).insert(this.nextButtonImage=new Element("div",{className:"lv_Wrapper"}).setStyle(sideNegativeMargin).insert(new Element("div",{className:"lv_Button"}))))).insert(this.topButtons=new Element("div",{className:"lv_topButtons"}).insert(this.topcloseButtonImage=new Element("div",{className:"lv_Wrapper lv_topcloseButtonImage"}).insert(this.topcloseButton=new Element("div",{className:"lv_Button"})))).insert(new Element("ul",{className:"lv_Frames"}).insert(new Element("li",{className:"lv_Frame lv_FrameTop"}).insert(d=new Element("div",{className:"lv_Liquid"}).setStyle({height:this.border+"px"}).insert(new Element("ul",{className:"lv_Half lv_HalfLeft"}).insert(new Element("li",{className:"lv_CornerWrapper"}).insert(new Element("div",{className:"lv_Corner"})).insert(new Element("div",{className:"lv_Fill"}).setStyle({left:this.border+"px"})))).insert(new Element("div",{className:"lv_Filler"})).insert(new Element("ul",{className:"lv_Half lv_HalfRight"}).insert(new Element("li",{className:"lv_CornerWrapper"}).setStyle("margin-top: "+(-1*this.border)+"px").insert(new Element("div",{className:"lv_Corner"})).insert(new Element("div",{className:"lv_Fill"}).setStyle("left: "+(-1*this.border)+"px")))))).insert(this.resizeCenter=new Element("li",{className:"lv_Center"}).setStyle("height: "+(150-this.border)+"px").insert(new Element("div",{className:"lv_WrapUp"}).insert(new Element("div",{className:"lv_WrapDown"}).setStyle("margin-top: "+this.border+"px").insert(this.center=new Element("div",{className:"lv_WrapCenter"}).setOpacity(0).setStyle("padding: 0 "+this.border+"px").insert(this.contentTop=new Element("div",{className:"lv_contentTop lv_Fill"})).insert(this.menubar=new Element("div",{className:"lv_MenuBar clearfix"}).insert(this.downloadButton=new Element("a",{className:"lv_Button lv_Download"}).setStyle({background:this.options.backgroundColor}).setOpacity(this.options.buttons.opacity.normal)).insert(this.fotoControl=new Element("div",{className:"lv_FotoControl"}).setStyle({background:this.options.backgroundColor}).setOpacity(this.options.buttons.opacity.normal)).insert(this.closeButton=new Element("div",{className:"lv_Button lv_Close"}).setStyle(pixelClone(this.options.closeDimensions.large)).setStyle({background:this.options.backgroundColor}).setOpacity(this.options.buttons.opacity.normal)).insert(this.data=new Element("ul",{className:"lv_Data"}).insert(this.dataText=new Element("li",{className:"lv_DataText"}).insert(this.title=new Element("div",{className:"lv_Title"})).insert(this.caption=new Element("div",{className:"lv_Caption"}))).insert(this.innerController=new Element("div",{className:"lv_innerController"}).insert(this.imgNumber=new Element("li",{className:"lv_ImgNumber"}).insert(new Element("div"))).insert(this.innerPrevNext=new Element("li",{className:"lv_innerPrevNext"}).insert(this.innerPrevButton=new Element("div",{className:"lv_Button"}).setOpacity(this.options.buttons.opacity.normal).setStyle({backgroundColor:this.options.backgroundColor}).setPngBackground(this.images+"inner_prev.png",{backgroundColor:this.options.backgroundColor})).insert(this.innerNextButton=new Element("div",{className:"lv_Button"}).setOpacity(this.options.buttons.opacity.normal).setStyle({backgroundColor:this.options.backgroundColor}).setPngBackground(this.images+"inner_next.png",{backgroundColor:this.options.backgroundColor}))).insert(this.slideshow=new Element("li",{className:"lv_Slideshow"}).insert(this.slideshowButton=new Element("div",{className:"lv_Button"}).setOpacity(this.options.buttons.opacity.normal).setStyle({backgroundColor:this.options.backgroundColor}).setPngBackground(this.images+"inner_slideshow_play.png",{backgroundColor:this.options.backgroundColor})))))).insert(this.contentBottom=new Element("div",{className:"lv_contentBottom "}))))).insert(this.loading=new Element("div",{className:"lv_Loading"}).insert(this.loadingButton=new Element("div",{className:"lv_Button"}).setStyle("background: url("+this.images+"loading.gif) top left no-repeat")))).insert(new Element("li",{className:"lv_Frame lv_FrameBottom"}).insert(d.cloneNode(true))).insert(this.prevnext=new Element("li",{className:"lv_PrevNext"}).hide().setStyle("margin-top: "+this.border+"px; background: url("+this.images+"blank.gif) top left repeat"))))).insert(new Element("div",{id:"lightviewError"}).hide());var f=new Image();f.onload=function(){f.onload=Prototype.emptyFunction;this.sideDimensions={width:f.width,height:f.height};var a=pixelClone(this.sideDimensions),sideNegativeMargin;this.sideButtons.setStyle({marginTop:0-(f.height/2).round()+"px",height:f.height+"px"});this.prevSide.setStyle(sideNegativeMargin=Object.extend({marginLeft:-1*this.sideDimensions.width+"px"},a));this.prevButtonImage.setStyle(Object.extend({marginLeft:a.width},a));this.nextSide.setStyle(Object.extend({marginRight:-1*this.sideDimensions.width+"px"},a));this.nextButtonImage.setStyle(sideNegativeMargin);this.downloadButton.setPngBackground(this.images+"download.png",{backgroundColor:this.options.backgroundColor});this.downloadButton.setStyle({display:"block",float:"right",width:34+"px",height:22+"px"});this.downloadButton.title=("Download");this._lightviewLoadedEvent();}.bind(this);f.src=this.images+"prev.png";$w("center title caption imgNumber")._each(function(e){this[e].setStyle({backgroundColor:this.options.backgroundColor})}.bind(this));var g=this.container.select(".lv_Corner");$w("tl tr bl br").each(function(a,i){if(this.radius>0){this.createCorner(g[i],a)}else{g[i].insert(new Element("div",{className:"lv_Fill"}))}
g[i].setStyle({width:this.border+"px",height:this.border+"px"}).addClassName("lv_Corner"+a.capitalize());this._lightviewLoadedEvent()}.bind(this));this.lightview.select(".lv_Filler",".lv_Fill",".lv_WrapDown").invoke("setStyle",{backgroundColor:this.options.backgroundColor});var S={};$w("prev next topclose").each(function(s){this[s+"ButtonImage"].side=s;var b=this.images+s+".png";if(s=="topclose"){S[s]=new Image();S[s].onload=function(){S[s].onload=Prototype.emptyFunction;this.closeDimensions[s]={width:S[s].width,height:S[s].height};var a=this.options.buttons.topclose.side,style=Object.extend({"float":a,marginTop:this.closeDimensions[s].height+"px"},pixelClone(this.closeDimensions[s]));style["padding"+a.capitalize()]=this.border+"px";this[s+"ButtonImage"].setStyle(style);this.topButtons.setStyle({height:S[s].height+"px",top:-1*this.closeDimensions[s].height+"px"});this[s+"ButtonImage"].down().setPngBackground(b).setStyle(pixelClone(this.closeDimensions[s]));this._lightviewLoadedEvent()}.bind(this);S[s].src=this.images+s+".png"}else{this[s+"ButtonImage"].setPngBackground(b)}},this);var C={};$w("large small").each(function(a){C[a]=new Image();C[a].onload=function(){C[a].onload=Prototype.emptyFunction;this.closeDimensions[a]={width:C[a].width,height:C[a].height};this._lightviewLoadedEvent()}.bind(this);C[a].src=this.images+"close_"+a+".png"},this);var L=new Image();L.onload=function(){L.onload=Prototype.emptyFunction;this.loading.setStyle({width:L.width+"px",height:L.height+"px",marginTop:-0.5*L.height+0.5*this.border+"px",marginLeft:-0.5*L.width+"px"});this._lightviewLoadedEvent()}.bind(this);L.src=this.images+"loading.gif";var h=new Image();h.onload=function(a){h.onload=Prototype.emptyFunction;var b={width:h.width+"px",height:h.height+"px"};this.slideshow.setStyle(b);this.slideshowButton.setStyle(b);this._lightviewLoadedEvent()}.bind(this);h.src=this.images+"inner_slideshow_stop.png";$w("prev next").each(function(s){var S=s.capitalize(),i=new Image();i.onload=function(){i.onload=Prototype.emptyFunction;this["inner"+S+"Button"].setStyle({width:i.width+"px",height:i.height+"px"});this._lightviewLoadedEvent()}.bind(this);i.src=this.images+"inner_"+s+".png";this["inner"+S+"Button"].prevnext=s},this);$w("slideshow innerPrevNext imgNumber").each(function(c){this[c].hide=this[c].hide.wrap(function(a,b){this.style.position="absolute";a(b);return this});this[c].show=this[c].show.wrap(function(a,b){this.style.position="relative";a(b);return this})},this);this.lightview.select("*").invoke("setStyle",{zIndex:this.options.zIndex+1});this.lightview.hide();this._lightviewLoadedEvent()},prepare:function(){Effect.Queues.get("lightview")._each(function(e){e.cancel()});this.scaledInnerDimensions=null;if(this.view.isSet()){this.controllerHeight=this._controllerHeight;if(this.controller&&!this.controller.visible()){this.controller.setStyle("visibility:hidden").show();this.controllerCenter.setOpacity(0)}}else{this.controllerHeight=null;this.controller.hide()}
if(parseInt(this.topcloseButtonImage.getStyle("marginTop"))<this.closeDimensions.topclose.height){this.toggleTopClose(false)}
this.hideOverlapping();this.hideContent();new Effect.Event({queue:this.queue,afterFinish:function(){$w("top bottom").each(function(a){var b=a.capitalize();this["content"+b].remove();var c={};this["content"+b]=new Element("div",{className:"lv_content"+b}).hide();c[a]=this["content"+b];this.center.insert(c)}.bind(this))}.bind(this)});this.disableKeyboardNavigation();this.views=null},restoreInlineContent:function(){if(!this.inlineContent||!this.inlineMarker){return}
this.inlineMarker.insert({after:this.inlineContent.setStyle({display:this.inlineContent._inlineDisplayRestore})});this.inlineMarker.remove();this.inlineMarker=null},show:function(b){this.element=null;var c=Object.isString(b);if(Object.isElement(b)||c){if(c&&b.startsWith("#")){this.show({href:b,options:Object.extend({autosize:true},arguments[1]||{})});return}
this.element=$(b);if(!this.element){return}
this.element.blur();this.view=this.element._view||new Lightview.View(this.element)}else{if(b.href){this.element=$(document.body);this.view=new Lightview.View(b)}else{if(Object.isNumber(b)){this.element=this.getSet(this.view.rel)[b];this.view=this.element._view}}}
if(!this.view.href){return}
this.prepare();if(this.view.isGallery()||this.view.isSet()){this.extendSet(this.view.rel);this.views=this.getViews(this.view.rel);if(this.view.isSet()){this.controllerOffset=this.views.length>1?this._controllerOffset:0;this.isSetGallery=this.views.all(function(a){return a.isImage()})}}
this.restoreCenter();this.appear();if(this.view.href!="#lightviewError"&&Object.keys(Lightview.Plugin).join(" ").indexOf(this.view.type)>=0){if(!Lightview.Plugin[this.view.type]){$("lightviewError").update(new Template(this.errors.requiresPlugin).evaluate({type:this.view.type.capitalize(),pluginspage:this.pluginspages[this.view.type]}));var d=$("lightviewError").getDimensions();this.show({href:"#lightviewError",title:this.view.type.capitalize()+" plugin required",options:d});return false}}
var e=Object.extend({menubar:"bottom",topclose:true,wmode:"transparent",innerPreviousNext:this.view.isGallery()&&this.options.buttons.innerPreviousNext.display,keyboard:this.options.keyboard,slideshow:(this.view.isGallery()&&this.options.buttons.slideshow.display)||(this.isSetGallery),overflow:"hidden",overlayClose:this.options.overlay.close,viewport:this.options.viewport},this.options.defaultOptions[this.view.type]||{});this.view.options=Object.extend(e,this.view.options);if(this.view.isSet()){this.view.options.topclose=(this.views.length<=1)}
if(!(this.view.title||this.view.caption||(this.views&&this.views.length>1)||this.view.isImage())&&this.view.options.topclose){this.view.options.menubar=false}
this._contentPosition="content"+(this.view.options.menubar=="top"?"Bottom":"Top");if(this.view.isImage()){if(!l&&!this.view._VMLPreloaded){this.view._VMLPreloaded=true;var f=new Element("ns_vml:image",{src:this.view.href,display:"none"}).setStyle("height:1px;width:1px;");$(document.body).insert(f);Element.remove.delay(0.1,f)}
if(this.scaledInnerDimensions){dimensions.height-=20;}
this.downloadButton.style.display='';this.downloadButton.href=this.view.href.replace(/images\/foto\//,"images/foto/download/");this.downloadButton.target='_blank';if(this.view.isGallery()||this.view.isSet()){this.position=this.views.indexOf(this.view);this.preloadSurroundingImages()}
this.innerDimensions=this.view.preloadedDimensions;if(this.innerDimensions){this.afterEffect()}else{this.startLoading();var f=new Image();f.onload=function(){f.onload=Prototype.emptyFunction;this.stopLoading();this.innerDimensions={width:f.width,height:f.height};this.afterEffect()}.bind(this);f.src=this.view.href}}else{if(this.view.isSet()){this.position=this.views.indexOf(this.view)}
this.innerDimensions=this.view.options.fullscreen?document.viewport.getDimensions():{width:this.view.options.width,height:this.view.options.height};this.afterEffect()}},insertContent:(function(){function insertImageUsingHTML(a,b,c){a=$(a);var d=pixelClone(c);a.update(new Element("img",{id:"lightviewContent",src:b,alt:"",galleryimg:"no"}).setStyle(d))}
var k=(function(){function insertImageUsingVML(a,b,c){a=$(a);var d=Object.extend({"float":"left"},pixelClone(c));var e=new Element("ns_vml:image",{src:b,id:"lightviewContent"}).setStyle(d);a.update(e);e.outerHTML=e.outerHTML}
function insertImageUsingCanvas(b,c,d){b=$(b);var f=pixelClone(d),image=new Image();image.onload=function(){canvas=new Element("canvas",f);b.update(canvas);try{var a=canvas.getContext("2d");a.drawImage(image,0,0,d.width,d.height)}catch(e){insertImageUsingHTML(b,c,d)}}.bind(this);image.src=c}
if(Prototype.Browser.IE){return insertImageUsingVML}else{return insertImageUsingCanvas}})();return function(){var c=this.detectExtension(this.view.href),dimensions=this.scaledInnerDimensions||this.innerDimensions;if(this.view.isImage()){var d=pixelClone(dimensions);this[this._contentPosition].setStyle(d);if(this.scaledInnerDimensions){k(this[this._contentPosition],this.view.href,dimensions)}else{insertImageUsingHTML(this[this._contentPosition],this.view.href,dimensions)}}else{if(this.view.isExternal()){switch(this.view.type){case"ajax":var f=Object.clone(this.view.options.ajax)||{};var g=function(){this.stopLoading();if(this.view.options.autosize){this[this._contentPosition].setStyle({width:"auto",height:"auto"});this.innerDimensions=this.getHiddenDimensions(this[this._contentPosition])}
new Effect.Event({queue:this.queue,afterFinish:this.resizeWithinViewport.bind(this)})}.bind(this);if(f.onComplete){f.onComplete=f.onComplete.wrap(function(a,b){g();a(b)})}else{f.onComplete=g}
this.startLoading();new Ajax.Updater(this[this._contentPosition],this.view.href,f);break;case"iframe":if(this.scaledInnerDimensions){dimensions.height-=this.menubarDimensions.height}
this[this._contentPosition].update(this.iframe=new Element("iframe",{frameBorder:0,hspace:0,src:this.view.href,id:"lightviewContent",name:"lightviewContent_"+(Math.random()*99999).round(),scrolling:(this.view.options&&this.view.options.scrolling)?"auto":"no"}).setStyle(Object.extend({border:0,margin:0,padding:0},pixelClone(dimensions))));break;case"inline":var h=this.view.href,target=$(h.substr(h.indexOf("#")+1));if(!target||!target.tagName){return}
var i=target.getDimensions();target.insert({before:this.inlineMarker=new Element(target.tagName).hide()});target._inlineDisplayRestore=target.getStyle("display");this.inlineContent=target.show();this[this._contentPosition].update(this.inlineContent);this[this._contentPosition].select("select, object, embed").each(function(b){this.overlappingRestore.each(function(a){if(a.element==b){b.setStyle({visibility:a.visibility})}})}.bind(this));if(this.view.options.autosize){this.innerDimensions=i;new Effect.Event({queue:this.queue,afterFinish:this.resizeWithinViewport.bind(this)})}
break}}else{var j={tag:"object",id:"lightviewContent",width:dimensions.width,height:dimensions.height};switch(this.view.type){case"quicktime":Object.extend(j,{pluginspage:this.pluginspages[this.view.type],children:[{tag:"param",name:"autoplay",value:this.view.options.autoplay},{tag:"param",name:"scale",value:"tofit"},{tag:"param",name:"controller",value:this.view.options.controls},{tag:"param",name:"enablejavascript",value:true},{tag:"param",name:"src",value:this.view.href},{tag:"param",name:"loop",value:this.view.options.loop||false}]});Object.extend(j,Prototype.Browser.IE?{codebase:this.codebases[this.view.type],classid:this.classids[this.view.type]}:{data:this.view.href,type:this.mimetypes[this.view.type]});break;case"flash":Object.extend(j,{data:this.view.href+"&autoplay=1&fs=1",type:this.mimetypes[this.view.type],quality:"high",wmode:this.view.options.wmode,pluginspage:this.pluginspages[this.view.type],children:[{tag:"param",name:"movie",value:this.view.href},{tag:"param",name:"allowFullScreen",value:"true"},{tag:"param",name:"autoplay",value:"true"}]});if(this.view.options.flashvars){j.children.push({tag:"param",name:"FlashVars",value:this.view.options.flashvars})}
break;case"audio":Object.extend(j,{data:this.view.href,type:this.mimetypes[this.view.type],quality:"high",wmode:this.view.options.wmode,pluginspage:this.pluginspages[this.view.type],children:[{tag:"param",name:"file",value:this.view.href},{tag:"param",name:"allowFullScreen",value:"true"},{tag:"param",name:"autostart",value:this.view.options.autoplay}]});if(this.view.options.flashvars)
this.view.options.flashvars+='&file='+this.view.href+'&autostart='+this.view.options.autoplay;else
this.view.options.flashvars='file='+this.view.href+'&autostart='+this.view.options.autoplay;j.children.push({tag:"param",name:"flashvars",value:this.view.options.flashvars})
Object.extend(j,Prototype.Browser.IE?{codebase:this.codebases[this.view.type],classid:this.classids[this.view.type]}:{data:base_href+'/flash/streamer.swf',type:this.mimetypes[this.view.type]});break;}
this[this._contentPosition].setStyle(pixelClone(dimensions)).update(this.createHTML(j)).setStyle("visibility:hidden").show();if(this.view.isQuicktime()){(function(){try{if("SetControllerVisible"in $("lightviewContent")){$("lightviewContent").SetControllerVisible(this.view.options.controls)}}catch(e){}}.bind(this)).defer()}}}}})(),getHiddenDimensions:function(b){b=$(b);var d=b.ancestors(),restore=[],styles=[];d.push(b);d.each(function(c){if(c!=b&&c.visible()){return}
restore.push(c);styles.push({display:c.getStyle("display"),position:c.getStyle("position"),visibility:c.getStyle("visibility")});c.setStyle({display:"block",position:"absolute",visibility:"visible"})});var e={width:b.clientWidth,height:b.clientHeight};restore.each(function(r,a){r.setStyle(styles[a])});return e},clearContent:function(){var a=$("lightviewContent");if(a){switch(a.tagName.toLowerCase()){case"object":if(Prototype.Browser.WebKit&&this.view.isQuicktime()){try{a.Stop()}catch(e){}
a.innerHTML=""}
if(a.parentNode){a.remove()}else{a=Prototype.emptyFunction}
break;case"iframe":a.remove();if(Prototype.Browser.Gecko&&window.frames.lightviewContent){delete window.frames.lightviewContent}
break;default:a.remove();break}}
$w("Top Bottom").each(function(S){this["content"+S].setStyle("width:auto;height:auto;").update("").hide()},this)},adjustDimensionsToView:Prototype.K,afterEffect:function(){new Effect.Event({queue:this.queue,afterFinish:this.afterShow.bind(this)})},afterShow:function(){this.fillMenuBar();if(!this.view.isAjax()){this.stopLoading()}
if(!((this.view.options.autosize&&this.view.isInline())||this.view.isAjax())){this.resizeWithinViewport()}
if(!this.view.isIframe()){new Effect.Event({queue:this.queue,afterFinish:this.insertContent.bind(this)})}
if(this.view.options.topclose){new Effect.Event({queue:this.queue,afterFinish:this.toggleTopClose.bind(this,true)})}},finishShow:function(){new Effect.Event({queue:this.queue,afterFinish:this.showContent.bind(this)});if(this.view.isIframe()){new Effect.Event({delay:0.2,queue:this.queue,afterFinish:this.insertContent.bind(this)})}
if(this.sliding){new Effect.Event({queue:this.queue,afterFinish:this.nextSlide.bind(this)})}
if(this.view.isQuicktime()||this.view.isFlash()||this.view.isAudio()){new Effect.Event({queue:this.queue,delay:0.1,afterFinish:Element.setStyle.bind(this,this[this._contentPosition],"visibility:visible")})}},previous:function(){if(Effect.Queues.get(Lightview.queue.scope).effects.length){return}
this.show(this.getSurroundingIndexes().previous)},next:function(){if(Effect.Queues.get(Lightview.queue.scope).effects.length){return}
this.show(this.getSurroundingIndexes().next)},resizeWithinViewport:function(){this.adjustDimensionsToView();var a=this.getInnerDimensions(),bounds=this.getBounds();if(this.view.options.viewport&&(a.width>bounds.width||a.height>bounds.height)){if(this.view.options.fullscreen){this.scaledInnerDimensions=bounds;this.fillMenuBar();a=bounds}else{var c=this.getOuterDimensions(),b=bounds;if(this.view.isMedia()){var d=[bounds.height/c.height,bounds.width/c.width,1].min();this.scaledInnerDimensions={width:(this.innerDimensions.width*d).round(),height:(((this.view.isImage())?this.innerDimensions.height:this.innerDimensions.height)*d).round()}}else{this.scaledInnerDimensions={width:c.width>b.width?b.width:c.width,height:c.height>b.height?b.height:c.height}}
this.fillMenuBar();a=Object.clone(this.scaledInnerDimensions);if(this.view.isMedia()){a.height+=this.menubarDimensions.height}}}else{this.fillMenuBar();this.scaledInnerDimensions=null}
this._resize(a)},resize:function(a){this._resize(a,{duration:0})},_resize:(function(){var e,wdiff,hdiff,mleft,mtop,controllerOffset,b;var f=(function(){var w,h;function init(p){w=(e.width+p*wdiff).toFixed(0);h=(e.height+p*hdiff).toFixed(0)}
var a;if(BROWSER_IS_IE_LT7){a=function(p){this.lightview.setStyle({width:(e.width+p*wdiff).toFixed(0)+"px",height:(e.height+p*hdiff).toFixed(0)+"px"});this.resizeCenter.setStyle({height:h-1*this.border+"px"})}}else{if(BROWSER_IS_FIREFOX_LT3){a=function(p){var v=this.getViewportDimensions(),o=document.viewport.getScrollOffsets();this.lightview.setStyle({position:"absolute",marginLeft:0,marginTop:0,width:w+"px",height:h+"px",left:(o[0]+(v.width/2)-(w/2)).floor()+"px",top:(o[1]+(v.height/2)-(h/2)).floor()+"px"});this.resizeCenter.setStyle({height:h-1*this.border+"px"})}}else{a=function(p){this.lightview.setStyle({position:"fixed",width:w+"px",height:h+"px",marginLeft:((0-w)/2).round()+"px",marginTop:((0-h)/2-controllerOffset).round()+"px"});this.resizeCenter.setStyle({height:h-1*this.border+"px"})}}}
return function(p){init.call(this,p);a.call(this,p)}})();return function(a){var c=arguments[1]||{};e=this.lightview.getDimensions();b=2*this.border;width=a.width?a.width+b:e.width;height=a.height?a.height+b:e.height;this.hidePrevNext();if(e.width==width&&e.height==height){new Effect.Event({queue:this.queue,afterFinish:this._afterResize.bind(this,a)});return}
var d={width:width+"px",height:height+"px"};wdiff=width-e.width;hdiff=height-e.height;mleft=parseInt(this.lightview.getStyle("marginLeft").replace("px",""));mtop=parseInt(this.lightview.getStyle("marginTop").replace("px",""));controllerOffset=this.controller.visible()?(this.controllerOffset/2):0;if(!BROWSER_IS_IE_LT7){Object.extend(d,{marginLeft:0-width/2+"px",marginTop:0-height/2+"px"})}
if(c.duration==0){f.call(this,1)}else{this.resizing=new Effect.Tween(this.lightview,0,1,Object.extend({duration:this.options.resizeDuration,queue:this.queue,transition:this.options.transition,afterFinish:this._afterResize.bind(this,a)},c),f.bind(this))}}})(),_afterResize:function(a){if(!this.menubarDimensions){return}
var b=this[this._contentPosition],contentDimensions;if(this.view.options.overflow=="auto"){contentDimensions=b.getDimensions()}
b.setStyle({height:(a.height-this.menubarDimensions.height)+"px",width:a.width+"px"});if(this.view.options.overflow!="hidden"&&(this.view.isAjax()||this.view.isInline())){if(Prototype.Browser.IE){if(this.view.options.overflow=="auto"){var c=b.getDimensions();b.setStyle("overflow:visible");var d={overflowX:"hidden",overflowY:"hidden"},corrected=0,scrollbarWidth=15;if(contentDimensions.height>a.height){d.overflowY="auto";d.width=c.width-scrollbarWidth;d.paddingRight="15px";corrected=scrollbarWidth}
if(contentDimensions.width-corrected>a.width){d.overflowX="auto";d.height=c.height-scrollbarWidth;d.paddingBottom="15px"}
b.setStyle(d)}else{b.setStyle({overflow:this.view.options.overflow})}}else{b.setStyle({overflow:this.view.options.overflow})}}else{b.setStyle("overflow:hidden")}
this.restoreCenter();this.resizing=null;this.finishShow()},showContent:function(){new Effect.Event({queue:this.queue,afterFinish:this.hidePrevNext.bind(this)});new Effect.Event({queue:this.queue,afterFinish:function(){this[this._contentPosition].show();this.fillMenuBar();if(this.menubar.visible()){this.menubar.setStyle("visibility:visible").setOpacity(1)}}.bind(this)});new Effect.Parallel([new Effect.Opacity(this.center,{sync:true,from:0,to:1}),new Effect.Appear(this.sideButtons,{sync:true})],{queue:this.queue,duration:0.15,afterFinish:function(){if(this.element){this.element.fire("lightview:opened")}}.bind(this)});if(this.view.isGallery()||(this.isSetGallery&&this.options.controller.buttons.side)){new Effect.Event({queue:this.queue,afterFinish:this.showPrevNext.bind(this)})}
if(this.view.isImage()){if(toAbsURL(this.view.href).match(new RegExp(RegExp.escape(base_href+'/images/foto'),'i')))
{removeChildren($$('.lv_FotoControl')[0]);$$('.lv_FotoControl')[0].id='lv_foto_control';var foto_id=this.view.href.match(/foto\/([0-9]+)\.jpg/i)[1];show_loading(1,'lv_foto_control',15);new Ajax.Request("ajax.php?mode=foto&f=get_controls&RandomKey="+Math.random()*Date.parse(new Date()),{method:'post',parameters:{id:foto_id},onComplete:function(xmlhttp){$$('.lv_FotoControl')[0].innerHTML=xmlhttp.responseText;hide_loading('lv_foto_control');}});}
else
$$('.lv_FotoControl')[0].innerHTML='';}},hideContent:(function(){function after(){this.clearContent();this.topcloseButtonImage.setStyle({marginTop:this.closeDimensions.topclose.height+"px"});this.restoreInlineContent()}
function tween(p){this.center.setOpacity(p);this.sideButtons.setOpacity(p)}
return function(){if(!this.lightview.visible()){this.center.setOpacity(0);this.sideButtons.setOpacity(0);this.clearContent();return}
new Effect.Tween(this.lightview,1,0,{duration:0.2,queue:this.queue,afterFinish:after.bind(this)},tween.bind(this))}})(),hideData:function(){$w("innerController data dataText title caption imgNumber innerPrevNext slideshow closeButton").each(function(a){Element.hide(this[a])},this);this.menubar.setStyle("visibility:hidden").setOpacity(0)},fillMenuBar:function(){this.hideData();if(!this.view.options.menubar){this.menubarDimensions={width:0,height:0};this.closeButtonWidth=0;this.menubar.hide()}else{this.menubar.show()}
if(this.view.title||this.view.caption){this.dataText.show();this.data.show()}
if(this.view.title){this.title.update(this.view.title).show()}
if(this.view.caption){this.caption.update(this.view.caption).show()}
if(this.views&&this.views.length>1){if(this.view.isSet()){this.setNumber.update(new Template(this.options.controller.setNumberTemplate).evaluate({position:this.position+1,total:this.views.length}));if(this.controller.getStyle("visibility")=="hidden"){this.controller.setStyle("visibility:visible");if(this._controllerCenterEffect){Effect.Queues.get("lightview").remove(this._controllerCenterEffect)}
this._controllerCenterEffect=new Effect.Appear(this.controllerCenter,{queue:this.queue,duration:0.1})}}else{this.data.show();if(this.view.isImage()){this.innerController.show();this.imgNumber.show().down().update(new Template(this.options.imgNumberTemplate).evaluate({position:this.position+1,total:this.views.length}));if(this.view.options.slideshow){this.slideshowButton.show();this.slideshow.show()}}}}
var a=this.view.isSet();if((this.view.options.innerPreviousNext||a)&&this.views.length>1){var b={prev:(this.options.cyclic||this.position!=0),next:(this.options.cyclic||((this.view.isGallery()||a)&&this.getSurroundingIndexes().next!=0))};$w("prev next").each(function(z){var Z=z.capitalize(),cursor=b[z]?"pointer":"auto";if(a){this["controller"+Z].setStyle({cursor:cursor}).setOpacity(b[z]?1:this.options.buttons.opacity.disabled)}else{this["inner"+Z+"Button"].setStyle({cursor:cursor}).setOpacity(b[z]?this.options.buttons.opacity.normal:this.options.buttons.opacity.disabled)}}.bind(this));if(this.view.options.innerPreviousNext||this.options.controller.innerPreviousNext){this.innerPrevNext.show()}}
this.controllerSlideshow.setOpacity(this.isSetGallery?1:this.options.buttons.opacity.disabled).setStyle({cursor:this.isSetGallery?"pointer":"auto"});this.setCloseButtons();if(!this.menubar.childElements().find(Element.visible)){this.menubar.hide();this.view.options.menubar=false}
this.setMenubarDimensions()},setCloseButtons:function(){var a=this.closeDimensions.small.width,large=this.closeDimensions.large.width,imgWidth=this.scaledInnerDimensions?this.scaledInnerDimensions.width:this.innerDimensions.width,minimum=180,width=0,closeButton=this.view.options.closeButton||"large",background=this.options.borderColor;if(this.view.options.topclose||this.view.isSet()||!this.view.options.closeButton){background=null}else{if(imgWidth>=minimum+a&&imgWidth<minimum+large){background="small";width=a}else{if(imgWidth>=minimum+large){background=closeButton;width=this.closeDimensions[closeButton].width}}}
if(width>0){this.data.show();this.closeButton.setStyle({width:width+"px"}).show()}else{this.closeButton.hide()}
if(background){this.closeButton.setPngBackground(this.images+"close_"+background+".png",{backgroundColor:this.options.backgroundColor})}
this.closeButtonWidth=width},startLoading:function(){this.loadingEffect=new Effect.Appear(this.loading,{duration:0.1,from:0,to:1,queue:this.queue})},stopLoading:function(){if(this.loadingEffect){Effect.Queues.get("lightview").remove(this.loadingEffect)}
new Effect.Fade(this.loading,{duration:0.2,queue:this.queue,delay:0.2})},setPrevNext:function(){if(!this.view.isImage()){return}
var a=(this.options.cyclic||this.position!=0),next=(this.options.cyclic||((this.view.isGallery()||this.view.isSet())&&this.getSurroundingIndexes().next!=0));this.prevButtonImage[a?"show":"hide"]();this.nextButtonImage[next?"show":"hide"]();var b=this.scaledInnerDimensions||this.innerDimensions;this.prevnext.setStyle({height:b.height+"px",marginTop:this.border+(this.view.options.menubar=="top"?this.menubar.getHeight():0)+"px"});var c=((b.width/2-1)+this.border).floor();if(a){this.prevnext.insert(this.prevButton=new Element("div",{className:"lv_Button lv_PrevButton"}).setStyle({width:c+"px"}));this.prevButton.side="prev"}
if(next){this.prevnext.insert(this.nextButton=new Element("div",{className:"lv_Button lv_NextButton"}).setStyle({width:c+"px"}));this.nextButton.side="next"}
if(a||next){this.prevnext.show()}},showPrevNext:function(){if(!this.view||!this.options.buttons.side.display||!this.view.isImage()){return}
this.setPrevNext();this.prevnext.show()},hidePrevNext:function(){this.prevnext.update("").hide();this.prevButtonImage.hide().setStyle({marginLeft:this.sideDimensions.width+"px"});this.nextButtonImage.hide().setStyle({marginLeft:-1*this.sideDimensions.width+"px"})},appear:(function(){function after(){this.lightview.setOpacity(1)}
if(!BROWSER_IS_WEBKIT_419){after=after.wrap(function(a,b){a(b);this.lightview.show()})}
return function(){if(this.lightview.getStyle("opacity")!=0){return}
if(this.options.overlay.display){new Effect.Appear(this.overlay,{duration:0.1,from:0,to:FIX_OVERLAY_WITH_PNG?1:this.options.overlay.opacity,queue:this.queue,beforeStart:this.maxOverlay.bind(this),afterFinish:after.bind(this)})}else{after.call(this)}}})(),hide:function(){if(Prototype.Browser.IE&&this.iframe&&this.view.isIframe()){this.iframe.remove()}
if(BROWSER_IS_WEBKIT_419&&this.view.isQuicktime()){var a=$$("object#lightviewContent")[0];if(a){try{a.Stop()}catch(e){}}}
if(this.lightview.getStyle("opacity")==0){return}
this.stopSlideshow();this.prevnext.hide();if(!Prototype.Browser.IE||!this.view.isIframe()){this.center.hide()}
if(Effect.Queues.get("lightview_hide").effects.length>0){return}
Effect.Queues.get("lightview").each(function(e){e.cancel()});new Effect.Event({queue:this.queue,afterFinish:this.restoreInlineContent.bind(this)});new Effect.Opacity(this.lightview,{duration:0.1,from:1,to:0,queue:{position:"end",scope:"lightview_hide"}});new Effect.Fade(this.overlay,{duration:0.16,queue:{position:"end",scope:"lightview_hide"},afterFinish:this.afterHide.bind(this)})},afterHide:function(){this.clearContent();this.lightview.hide();this.center.setOpacity(0).show();this.prevnext.update("").hide();this.contentTop.update("").hide();this.contentBottom.update("").hide();this.disableKeyboardNavigation();this.showOverlapping();new Effect.Event({queue:this.queue,afterFinish:this.resize.bind(this,this.options.startDimensions)});new Effect.Event({queue:this.queue,afterFinish:function(){if(this.element){this.element.fire("lightview:hidden")}
$w("element views view scaledInnerDimensions isSetGallery _openEffect content")._each(function(a){this[a]=null}.bind(this))}.bind(this)})},setMenubarDimensions:function(){this.menubar.setStyle("padding:0;");var a={},imgWidth=this[(this.scaledInnerDimensions?"scaledI":"i")+"nnerDimensions"].width;this.menubar.setStyle({width:imgWidth+"px"});this.data.setStyle({width:imgWidth-this.closeButtonWidth-1+"px"});if(this.view.isImage()){if(toAbsURL(this.view.href).match('soinfo.org'))
this.data.setStyle({width:(imgWidth-this.closeButtonWidth)-150+"px"});}
a=this.getHiddenDimensions(this.menubar);if(this.view.options.menubar){a.height+=this.options.menubarPadding;switch(this.view.options.menubar){case"bottom":this.menubar.setStyle("padding:"+this.options.menubarPadding+"px 0 0 0");break;case"top":this.menubar.setStyle("padding: 0 0 "+this.options.menubarPadding+"px 0");break}}
this.menubar.setStyle({width:"100%"});this.menubarDimensions=this.view.options.menubar?a:{width:a.width,height:0}},restoreCenter:(function(){var a,controllerOffset;function init(){a=this.lightview.getDimensions();controllerOffset=this.controller.visible()?(this.controllerOffset/2):0}
var b;if(BROWSER_IS_IE_LT7){b=function(){this.lightview.setStyle({top:"50%",left:"50%"})}}else{if(BROWSER_IS_WEBKIT_419||BROWSER_IS_FIREFOX_LT3){b=function(){var v=this.getViewportDimensions(),o=document.viewport.getScrollOffsets();this.lightview.setStyle({marginLeft:0,marginTop:0,left:(o[0]+(v.width/2)-(a.width/2)).floor()+"px",top:(o[1]+(v.height/2)-(a.height/2)).floor()+"px"})}}else{b=function(){this.lightview.setStyle({position:"fixed",left:"50%",top:"50%",marginLeft:(0-a.width/2).round()+"px",marginTop:(0-a.height/2-controllerOffset).round()+"px"})}}}
return function(){init.call(this);b.call(this)}})(),startSlideshow:function(){this.stopSlideshow();this.sliding=true;this.next.bind(this).delay(0.25);this.slideshowButton.setPngBackground(this.images+"inner_slideshow_stop.png",{backgroundColor:this.options.backgroundColor}).hide();this.controllerSlideshow.setPngBackground(this.images+"controller_slideshow_stop.png",{backgroundColor:this.options.controller.backgroundColor})},stopSlideshow:function(){if(this.sliding){this.sliding=false}
if(this.slideTimer){clearTimeout(this.slideTimer)}
this.slideshowButton.setPngBackground(this.images+"inner_slideshow_play.png",{backgroundColor:this.options.backgroundColor});this.controllerSlideshow.setPngBackground(this.images+"controller_slideshow_play.png",{backgroundColor:this.options.controller.backgroundColor})},toggleSlideshow:function(){if(this.view.isSet()&&!this.isSetGallery){return}
this[(this.sliding?"stop":"start")+"Slideshow"]()},nextSlide:function(){if(this.sliding){this.slideTimer=this.next.bind(this).delay(this.options.slideshowDelay)}},updateViews:function(){$$("a[class~=lightview], area[class~=lightview]").each(function(a){var b=a._view;if(!b){return}
if(b._title){a.writeAttribute("title",b._title)}
a._view=null})},getSet:function(a){var b=a.indexOf("][");if(b>-1){a=a.substr(0,b+1)}
return $$('a[rel^="'+a+'"], area[rel^="'+a+'"]')},getViews:function(a){return this.getSet(a).pluck("_view")},addObservers:function(){$(document.body).observe("click",this.delegateClose.bindAsEventListener(this));$w("mouseover mouseout").each(function(e){this.prevnext.observe(e,function(a){var b=a.findElement("div");if(!b){return}
if(this.prevButton&&this.prevButton==b||this.nextButton&&this.nextButton==b){this.toggleSideButton(a)}}.bindAsEventListener(this))}.bind(this));this.prevnext.observe("click",function(c){var d=c.findElement("div");if(!d){return}
var e=(this.prevButton&&this.prevButton==d)?"previous":(this.nextButton&&this.nextButton==d)?"next":null;if(e){this[e].wrap(function(a,b){this.stopSlideshow();a(b)}).bind(this)()}}.bindAsEventListener(this));$w("prev next").each(function(s){var S=s.capitalize(),stopSlideshow=function(a,b){this.stopSlideshow();a(b)},blockInnerPrevNext=function(a,b){var c=b.element().prevnext;if((c=="prev"&&(this.options.cyclic||this.position!=0))||(c=="next"&&(this.options.cyclic||((this.view.isGallery()||this.view.isSet())&&this.getSurroundingIndexes().next!=0)))){a(b)}};this[s+"ButtonImage"].observe("mouseover",this.toggleSideButton.bindAsEventListener(this)).observe("mouseout",this.toggleSideButton.bindAsEventListener(this)).observe("click",this[s=="next"?s:"previous"].wrap(stopSlideshow).bindAsEventListener(this));this["inner"+S+"Button"].observe("click",this[s=="next"?s:"previous"].wrap(blockInnerPrevNext).wrap(stopSlideshow).bindAsEventListener(this)).observe("mouseover",Element.setOpacity.curry(this["inner"+S+"Button"],this.options.buttons.opacity.hover).wrap(blockInnerPrevNext).bindAsEventListener(this)).observe("mouseout",Element.setOpacity.curry(this["inner"+S+"Button"],this.options.buttons.opacity.normal).wrap(blockInnerPrevNext).bindAsEventListener(this));this["controller"+S].observe("click",this[s=="next"?s:"previous"].wrap(blockInnerPrevNext).wrap(stopSlideshow).bindAsEventListener(this))},this);var f=[this.closeButton,this.slideshowButton];if(!BROWSER_IS_WEBKIT_419){f.each(function(b){b.observe("mouseover",Element.setOpacity.bind(this,b,this.options.buttons.opacity.hover)).observe("mouseout",Element.setOpacity.bind(this,b,this.options.buttons.opacity.normal))},this)}else{f.invoke("setOpacity",1)}
this.slideshowButton.observe("click",this.toggleSlideshow.bindAsEventListener(this));this.controllerSlideshow.observe("click",this.toggleSlideshow.bindAsEventListener(this));if(BROWSER_IS_WEBKIT_419||BROWSER_IS_FIREFOX_LT3){var g=function(a,b){if(this.lightview.getStyle("top").charAt(0)=="-"){return}
a(b)};Event.observe(window,"scroll",this.restoreCenter.wrap(g).bindAsEventListener(this));Event.observe(window,"resize",this.restoreCenter.wrap(g).bindAsEventListener(this))}
if(BROWSER_IS_FIREFOX_LT3){Event.observe(window,"resize",this.maxOverlay.bindAsEventListener(this))}
if(BROWSER_IS_IE_LT7){function centerControllerIELT7(){if(this.controller){this.controller.setStyle({left:((document.documentElement.scrollLeft||0)+document.viewport.getWidth()/2).round()+"px"})}}
Event.observe(window,"scroll",centerControllerIELT7.bindAsEventListener(this));Event.observe(window,"resize",centerControllerIELT7.bindAsEventListener(this))}
if(this.options.preloadHover){this._preloadImageHover=function(a){var b=a.findElement("a[class~=lightview], area[class~=lightview]");if(!b){return}
a.stop();if(!b._view){new Lightview.View(b)}
this.preloadImageHover(b)}.bindAsEventListener(this);$(document.body).observe("mouseover",this._preloadImageHover)}},toggleTopClose:function(a){if(this._topCloseEffect){Effect.Queues.get("lightview_topCloseEffect").remove(this.topCloseEffect)}
var b={marginTop:(a?0:this.closeDimensions.topclose.height)+"px"};this._topCloseEffect=new Effect.Morph(this.topcloseButtonImage,{style:b,duration:0.16,queue:this.queue,delay:a?0.15:0})},getScrollDimensions:function(){var a={};$w("width height").each(function(d){var D=d.capitalize(),ddE=document.documentElement;a[d]=Prototype.Browser.IE?[ddE["offset"+D],ddE["scroll"+D]].max():Prototype.Browser.WebKit?document.body["scroll"+D]:ddE["scroll"+D]});return a},maxOverlay:function(){if(!BROWSER_IS_FIREFOX_LT3){return}
this.overlay.setStyle(pixelClone(this.getScrollDimensions()))},delegateClose:(function(){var b=".lv_Close, .lv_topButtons .lv_Button, .lv_Loading, .lv_controllerClose";return function(a){if(this.view&&this.view.options&&a.findElement(b+(this.view.options.overlayClose?", #lv_overlay":""))){this.hide()}}})(),toggleSideButton:function(a){var b=a.target,side=b.side,w=this.sideDimensions.width,offset=(a.type=="mouseover")?0:side=="prev"?w:-1*w,style={marginLeft:offset+"px"};if(!this.sideEffect){this.sideEffect={}}
if(this.sideEffect[side]){Effect.Queues.get("lightview_side"+side).remove(this.sideEffect[side])}
this.sideEffect[side]=new Effect.Morph(this[side+"ButtonImage"],{style:style,duration:0.2,queue:{scope:"lightview_side"+side,limit:1},delay:(a.type=="mouseout")?0.1:0})},getSurroundingIndexes:function(){if(!this.views){return}
var a=this.position,length=this.views.length;var b=(a<=0)?length-1:a-1,next=(a>=length-1)?0:a+1;return{previous:b,next:next}},createCorner:function(a,b){var c=arguments[2]||this.options,radius=c.radius,border=c.border;position={top:(b.charAt(0)=="t"),left:(b.charAt(1)=="l")};if(l){var d=new Element("canvas",{className:"cornerCanvas"+b.capitalize(),width:border+"px",height:border+"px"});d.setStyle("float:left");a.insert(d);var e=d.getContext("2d");e.fillStyle=c.backgroundColor;e.arc((position.left?radius:border-radius),(position.top?radius:border-radius),radius,0,Math.PI*2,true);e.fill();e.fillRect((position.left?radius:0),0,border-radius,border);e.fillRect(0,(position.top?radius:0),border,border-radius)}else{var f=new Element("ns_vml:roundrect",{fillcolor:c.backgroundColor,strokeWeight:"1px",strokeColor:c.backgroundColor,arcSize:(radius/border*0.5).toFixed(2)}).setStyle({width:2*border-1+"px",height:2*border-1+"px",position:"absolute",left:(position.left?0:(-1*border))+"px",top:(position.top?0:(-1*border))+"px"});a.insert(f);f.outerHTML=f.outerHTML}},hideOverlapping:(function(){function getOverlappingElements(){return $$("object, embed, select")}
if(Prototype.Browser.IE&&document.documentMode>=8){getOverlappingElements=function(){return document.querySelectorAll("object, embed, select")}}
return function(){if(this.preventingOverlap){return}
var a=getOverlappingElements();this.overlappingRestore=[];for(var i=0,length=a.length;i<length;i++){var b=a[i];this.overlappingRestore.push({element:b,visibility:b.style.visibility});b.style.visibility="hidden"}
this.preventingOverlap=true}})(),showOverlapping:function(){this.overlappingRestore.each(function(a,i){a.element.style.visibility=a.visibility});delete this.overlappingRestore;this.preventingOverlap=false},getInnerDimensions:function(){return{width:this.innerDimensions.width,height:this.innerDimensions.height+this.menubarDimensions.height}},getOuterDimensions:function(){var i=this.getInnerDimensions(),b=2*this.border;return{width:i.width+b,height:i.height+b}},getBounds:function(){var a=80,safety=2*this.sideDimensions.height+a,v=this.getViewportDimensions();return{width:v.width-safety,height:v.height-safety}},getViewportDimensions:function(){var v=document.viewport.getDimensions();if(this.controller&&this.controller.visible()&&this.views&&this.views.length>1){v.height-=this.controllerOffset}
return v}});(function(){function guard(a,b){if(!this.view){return}
a(b)}
$w("fillMenuBar insertContent").each(function(a){this[a]=this[a].wrap(guard)},Lightview)})();function pixelClone(b){var c={};Object.keys(b).each(function(a){c[a]=b[a]+"px"});return c}
Object.extend(Lightview,{enableKeyboardNavigation:function(){if(!this.view.options.keyboard){return}
this.keyboardEvent=this.keyboardDown.bindAsEventListener(this);document.observe("keydown",this.keyboardEvent)},disableKeyboardNavigation:function(){if(this.keyboardEvent){document.stopObserving("keydown",this.keyboardEvent)}},keyboardDown:function(a){var b=String.fromCharCode(a.keyCode).toLowerCase(),keyCode=a.keyCode,staticGallery=(this.view.isGallery()||this.isSetGallery)&&!this.resizing,slideshow=this.view.options.slideshow,action;if(this.view.isMedia()){a.stop();action=(keyCode==Event.KEY_ESC||["x","c"].member(b))?"hide":(keyCode==37&&staticGallery&&(this.options.cyclic||this.position!=0))?"previous":(keyCode==39&&staticGallery&&(this.options.cyclic||this.getSurroundingIndexes().next!=0))?"next":(b=="p"&&slideshow&&staticGallery)?"startSlideshow":(b=="s"&&slideshow&&staticGallery)?"stopSlideshow":null;if(b!="s"){this.stopSlideshow()}}else{action=(keyCode==Event.KEY_ESC)?"hide":null}
if(action){this[action]()}
if(staticGallery){if(keyCode==Event.KEY_HOME&&this.views.first()!=this.view){this.show(0)}
if(keyCode==Event.KEY_END&&this.views.last()!=this.view){this.show(this.views.length-1)}}}});Lightview.afterShow=Lightview.afterShow.wrap(function(a,b){this.enableKeyboardNavigation();a(b)});Object.extend(Lightview,{extendSet:function(a){var b=this.getSet(a);if(!b){return}
b._each(Lightview.Extend)},preloadSurroundingImages:function(){if(this.views.length==0){return}
var a=this.getSurroundingIndexes();this.preloadFromSet([a.next,a.previous])},preloadFromSet:function(c){var d=(this.views&&this.views.member(c)||Object.isArray(c))?this.views:c.rel?this.getViews(c.rel):null;if(!d){return}
var e=$A(Object.isNumber(c)?[c]:c.type?[d.indexOf(c)]:c).uniq();e.each(function(a){var b=d[a];this.preloadImageDimensions(b)},this)},setPreloadedDimensions:function(a,b){a.preloadedDimensions={width:b.width,height:b.height}},preloadImageDimensions:function(a){if(a.preloadedDimensions||a.isPreloading||!a.href){return}
var P=new Image();P.onload=function(){P.onload=Prototype.emptyFunction;a.isPreloading=null;this.setPreloadedDimensions(a,P)}.bind(this);a.isPreloading=true;P.src=a.href},preloadImageHover:function(a){var b=a._view;if(b&&b.preloadedDimensions||b.isPreloading||!b.isImage()){return}
this.preloadImageDimensions(b)}});Element.addMethods({setPngBackground:function(a,b){a=$(a);var c=Object.extend({align:"top left",repeat:"no-repeat",sizingMethod:"scale",backgroundColor:""},arguments[2]||{});a.setStyle(BROWSER_IS_IE_LT7?{filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+b+"'', sizingMethod='"+c.sizingMethod+"')"}:{background:c.backgroundColor+" url("+b+") "+c.align+" "+c.repeat});return a}});Object.extend(Lightview,{detectType:function(a,b){var c;$w("audio flash image iframe quicktime").each(function(t){if(new RegExp("\\.("+this.typeExtensions[t].replace(/\s+/g,"|")+")(\\?.*)?","i").test(a)){c=t}}.bind(this));if(c){return c}
if(a.startsWith("#")){return"inline"}
if(document.domain&&document.domain!=(a).replace(/(^.*\/\/)|(:.*)|(\/.*)/g,"")){return"iframe"}
return"image"},detectExtension:function(a){var b=a.gsub(/\?.*/,"").match(/\.([^.]{3,4})$/);return b?b[1]:null},createHTML:function(b){var c="<"+b.tag;for(var d in b){if(!["children","html","tag"].member(d)){c+=" "+d+'="'+b[d]+'"'}}
if(new RegExp("^(?:area|base|basefont|br|col|frame|hr|img|input|link|isindex|meta|param|range|spacer|wbr)$","i").test(b.tag)){c+="/>"}else{c+=">";if(b.children){b.children.each(function(a){c+=this.createHTML(a)}.bind(this))}
if(b.html){c+=b.html}
c+="</"+b.tag+">"}
return c}});(function(){document.observe("dom:loaded",function(){var c=(navigator.plugins&&navigator.plugins.length);function detectPlugin(a){var b=false;if(c){b=($A(navigator.plugins).pluck("name").join(",").indexOf(a)>=0)}else{try{b=new ActiveXObject(a)}catch(e){}}
return!!b}
if(c){window.Lightview.Plugin={audio:detectPlugin("Shockwave Flash"),flash:detectPlugin("Shockwave Flash"),quicktime:detectPlugin("QuickTime")}}else{window.Lightview.Plugin={audio:detectPlugin("ShockwaveFlash.ShockwaveFlash"),flash:detectPlugin("ShockwaveFlash.ShockwaveFlash"),quicktime:detectPlugin("QuickTime.QuickTime")}}})})();Lightview.View=Class.create({initialize:function(b){if(b._view){return}
var c=Object.isElement(b);if(c&&!b._view){b._view=this;if(b.title){b._view._title=b.title;if(Lightview.options.removeTitles){b.setAttribute("title","")}}}
this.href=c?b.getAttribute("href"):b.href;if(this.href.indexOf("#")>=0){this.href=this.href.substr(this.href.indexOf("#"))}
var d=b.rel;if(d){this.rel=d;if(d.startsWith("gallery")){this.type="gallery"}else{if(d.startsWith("set")){if(d.include("][")){var e=d.split("]["),relType=e[1].match(/([a-zA-Z]*)/)[1];if(relType){this.type=relType;var f=e[0]+"]";b.writeAttribute("rel",f);this.rel=f}}else{this.type=Lightview.detectType(this.href)}}else{this.type=d}}}else{this.type=Lightview.detectType(this.href);this.rel=this.type}
$w("ajax audio flash gallery iframe image inline quicktime external media set")._each(function(a){var T=a.capitalize(),t=a.toLowerCase();if("image gallery media external set".indexOf(a)<0){this["is"+T]=function(){return this.type==t}.bind(this)}}.bind(this));if(c&&b._view._title){var g=b._view._title.split(Lightview.options.titleSplit).invoke("strip");if(g[0]){this.title=g[0]}
if(g[1]){this.caption=g[1]}
var h=g[2];this.options=(h&&Object.isString(h))?eval("({"+h+"})"):{}}else{this.title=b.title;this.caption=b.caption;this.options=b.options||{}}
if(this.options.ajaxOptions){this.options.ajax=Object.clone(this.options.ajaxOptions);delete this.options.ajaxOptions}},isGallery:function(){return this.type.startsWith("gallery")},isSet:function(){return this.rel.startsWith("set")},isImage:function(){return(this.isGallery()||this.type=="image")},isExternal:function(){return"iframe inline ajax".indexOf(this.type)>=0},isMedia:function(){return!this.isExternal()}});Lightview.Extend=function(a){var b=$(a);new Lightview.View(a);return b};(function(){function handleClick(a){var b=a.findElement("a[class~=lightview], area[class~=lightview]");if(!b){return}
a.stop();this.Extend(b);this.show(b)}
function handleMouseOver(a){var b=a.findElement("a[class~=lightview], area[class~=lightview]");if(!b){return}
this.Extend(b)}
function elementIE8(a){var b=a.target,type=a.type,currentTarget=a.currentTarget;if(currentTarget&&currentTarget.tagName){if(type==="load"||type==="error"||(type==="click"&&currentTarget.tagName.toLowerCase()==="input"&&currentTarget.type==="radio")){b=currentTarget}}
if(b.nodeType==Node.TEXT_NODE){b=b.parentNode}
return b}
function hasClassNameIE8(a,b){if(!a){return}
var c=a.className;return(c.length>0&&(c==b||new RegExp("(^|\\s)"+b+"(\\s|$)").test(c)))}
function handleMouseOverIE8(a){var b=elementIE8(a);if(b&&hasClassNameIE8(b,"lightview")){this.Extend(b)}}
document.observe("lightview:loaded",function(){$(document.body).observe("click",handleClick.bindAsEventListener(Lightview));if(Lightview.options.removeTitles&&Prototype.Browser.IE&&document.documentMode>=8){$(document.body).observe("mouseover",handleMouseOverIE8.bindAsEventListener(Lightview))}else{$(document.body).observe("mouseover",handleMouseOver.bindAsEventListener(Lightview))}})})();Object.extend(Lightview,{buildController:function(){var b=this.options.controller,border=b.border;$(document.body).insert(this.controller=new Element("div",{id:"lightviewController"}).setStyle({zIndex:this.options.zIndex+1,marginBottom:b.margin+"px",position:"absolute",visibility:"hidden"}).insert(this.controllerTop=new Element("div",{className:"lv_controllerTop"}).insert(new Element("div",{className:"lv_controllerCornerWrapper lv_controllerCornerWrapperTopLeft"}).setStyle("margin-left: "+border+"px").insert(new Element("div",{className:"lv_Corner"}))).insert(new Element("div",{className:"lv_controllerBetweenCorners"}).setStyle({margin:"0 "+border+"px",height:border+"px"})).insert(new Element("div",{className:"lv_controllerCornerWrapper lv_controllerCornerWrapperTopRight"}).setStyle("margin-left: -"+border+"px").insert(new Element("div",{className:"lv_Corner"})))).insert(this.controllerMiddle=new Element("div",{className:"lv_controllerMiddle clearfix"}).insert(this.controllerCenter=new Element("ul",{className:"lv_controllerCenter"}).setStyle("margin: 0 "+border+"px").insert(new Element("li",{className:"lv_controllerSetNumber"}).insert(this.setNumber=new Element("div"))).insert(new Element("li",{className:"lv_ButtonWrapper lv_controllerPrev"}).insert(this.controllerPrev=new Element("div",{className:"lv_Button"}).setPngBackground(this.images+"controller_prev.png",{backgroundColor:b.backgroundColor}))).insert(new Element("li",{className:"lv_ButtonWrapper lv_controllerNext"}).insert(this.controllerNext=new Element("div",{className:"lv_Button"}).setPngBackground(this.images+"controller_next.png",{backgroundColor:b.backgroundColor}))).insert(new Element("li",{className:"lv_ButtonWrapper lv_controllerSlideshow"}).insert(this.controllerSlideshow=new Element("div",{className:"lv_Button"}).setPngBackground(this.images+"controller_slideshow_play.png",{backgroundColor:b.backgroundColor}))).insert(new Element("li",{className:"lv_ButtonWrapper lv_controllerClose"}).insert(this.controllerClose=new Element("div",{className:"lv_Button"}).setPngBackground(this.images+"controller_close.png",{backgroundColor:b.backgroundColor}))))).insert(this.controllerBottom=new Element("div",{className:"lv_controllerBottom"}).insert(new Element("div",{className:"lv_controllerCornerWrapper lv_controllerCornerWrapperBottomLeft"}).setStyle("margin-left: "+border+"px").insert(new Element("div",{className:"lv_Corner"}))).insert(new Element("div",{className:"lv_controllerBetweenCorners"}).setStyle({margin:"0 "+border+"px",height:border+"px"})).insert(new Element("div",{className:"lv_controllerCornerWrapper lv_controllerCornerWrapperBottomRight"}).setStyle("margin-left: -"+border+"px").insert(new Element("div",{className:"lv_Corner"})))));$w("prev next").each(function(s){var S=s.capitalize();this["controller"+S].prevnext=s},this);if(BROWSER_IS_WEBKIT_419){this.controller.hide=function(){this.setStyle("left:-9500px;top:-9500px;visibility:hidden;");return this};this.controller.show=function(){this.setStyle("visibility:visible");return this};this.controller.visible=function(){return(this.getStyle("visibility")=="visible"&&parseFloat(this.getStyle("top").replace("px",""))>-9500)}}
this.controller.select(".lv_ButtonWrapper div").invoke("setStyle",pixelClone(this.controllerButtonDimensions));var c=this.controller.select(".lv_Corner");$w("tl tr bl br").each(function(a,i){if(b.radius>0){this.createCorner(c[i],a,b)}else{c[i].insert(new Element("div",{className:"lv_Fill"}))}
c[i].setStyle({width:b.border+"px",height:b.border+"px"}).addClassName("lv_Corner"+a.capitalize())},this);this.controller.down(".lv_controllerMiddle").setStyle("width:100%;");this.controller.setStyle(BROWSER_IS_IE_LT7?{position:"absolute",top:"auto",left:""}:{position:"fixed",top:"auto",left:"50%"});this.controller.select(".lv_controllerBetweenCorners",".lv_controllerMiddle",".lv_Button",".lv_Fill").invoke("setStyle",{backgroundColor:b.backgroundColor});this.setNumber.update(new Template(b.setNumberTemplate).evaluate({position:999,total:999}));this.setNumber.setStyle({width:this.setNumber.getWidth()+"px",height:this.controllerCenter.getHeight()+"px"});this._fixateController();this.setNumber.update("");this.controller.hide().setStyle("visibility:visible");this.addObservers();this._lightviewLoadedEvent()},_fixateController:function(){var b,finalWidth,controller=this.options.controller,border=controller.border;if(BROWSER_IS_IE_LT7){b=this.controllerCenter.getDimensions(),finalWidth=b.width+2*border;this.controllerCenter.setStyle({width:b.width+"px",margin:0});this.controllerMiddle.setStyle("width:auto;");this.controllerCenter.setStyle({paddingLeft:border+"px"});this.controllerMiddle.setStyle({width:finalWidth+"px"});$w("top bottom").each(function(a){this["controller"+a.capitalize()].setStyle({width:finalWidth+"px"})},this);this.controller.setStyle("margin-left:-"+(finalWidth/2).round()+"px")}else{this.controllerMiddle.setStyle("width:auto");b=this.controllerMiddle.getDimensions();this.setNumber.up().setStyle({lineHeight:b.height+"px",width:this.setNumber.getDimensions().width+"px"});this.controller.setStyle({width:b.width+"px",marginLeft:(0-(b.width/2).round())+"px"});this.controllerMiddle.setStyle({width:b.width+"px"});$w("top bottom").each(function(a){this["controller"+a.capitalize()].setStyle({width:b.width+"px"})},this)}
this._controllerOffset=controller.margin+b.height+2*border;this._controllerHeight=this.controller.getHeight();this.setNumber.setStyle({lineHeight:b.height+"px"})}});Lightview.buildController=Lightview.buildController.wrap(function(a,b){var c=new Image();c.onload=function(){c.onload=Prototype.emptyFunction;this.controllerButtonDimensions={width:c.width,height:c.height};a(b)}.bind(this);c.src=this.images+"controller_prev.png";var d=(new Image()).src=this.images+"controller_slideshow_stop.png"});Lightview.build=Lightview.build.wrap(function(a,b){a(b);this.buildController()});Lightview.hide=Lightview.hide.wrap(function(a,b){if(this.view&&this.view.isSet()){this.controller.hide();this.setNumber.update("")}
a(b)})})();Lightview.load();document.observe("dom:loaded",Lightview.start.bind(Lightview));var tid_hide_more=Array();var tid_show_more=Array();function show_more(id,timeout,html,x,y,opacity){if(tid_hide_more[id])
clearTimeout(tid_hide_more[id]);if($(id).style.display=='none')
{if(html)
$(id+'_html').innerHTML=html;if(y)
$(id).style.top=y+'px';if(x)
$(id).style.left=x+'px';}
if(timeout)
tid_show_more[id]=setTimeout(function(){if(html)
$(id+'_html').innerHTML=html;if(y)
$(id).style.top=y+'px';if(x)
$(id).style.left=x+'px';new Effect.Appear($(id),{duration:0.15,to:(opacity)?opacity:1});},timeout);else
new Effect.Appear($(id),{duration:0.15,to:(opacity)?opacity:1});}
function hide_more(id){clearTimeout(tid_show_more[id]);tid_hide_more[id]=setTimeout(function(){new Effect.Fade($(id),{duration:0.15});},1000);}
