var ver_main="1.1";var ver_iframe="1.0";var ver_shared="1.0";var menuobj=timeout=broadcast_timer=global_sbox=global_sbox_iframe=last_ad=contacts_active=showlayer_timer=roar=null;var new_stuff=new Array(3);var os=11;var quick_info,contact_win;var uid=sid=notify=is_iframe=live_content=updateNeeded=0;var mute=0;var sounds=[];sounds.messages="/sounds/new_message.mp3";sounds.guestbook="/sounds/new_guestbook.mp3";sounds.friends="/sounds/new_friend.mp3";sounds.notifications="/sounds/notifications.mp3";sounds.chat="/sounds/msg_in.mp3";var timeouts={contacts:{time:10,last:0},broadcast:{time:10,last:0},random_online:{time:180,last:0},new_updates:{time:10,last:0}};window.addEvent("domready",function(){if(document.getElementById("broadcast")){if(document.getElementById("jsMain").innerHTML!=ver_main){updateNeeded=true}else{if(document.getElementById("jsBuddy").innerHTML!=ver_buddy){updateNeeded=true}else{if(document.getElementById("jsShared").innerHTML!=ver_shared){updateNeeded=true}else{if(document.getElementById("jsIframe").innerHTML!=ver_iframe){updateNeeded=true}}}}if(updateNeeded==true){document.getElementById("desktopTitlebar").style.display=""}MochaUI.options.useEffects=false;MochaUI.options.useSpinner=false;MochaUI.dockVisible=true;MochaUI.Desktop=new MochaUI.Desktop({sidebar:"",desktopFooter:"body_bottom"});if(document.getElementById("comm_container")){$("comm_container").makeDraggable({handle:"comm_head",onStart:showModal,onComplete:function(){hideModal(document.getElementById("smilie_box"))}});document.getElementById("comm_container").style.left=(window.getWidth()-document.getElementById("comm_container").clientWidth)/2+"px"}if(!broadcast_obj){broadcast_obj=document.getElementById("broadcast")}if(document.getElementById("menu")){activateMenu("menu")}if(document.getElementById("smilie_box")){roar=new Roar({position:"lowerRight"});MochaUI.Dock=new MochaUI.Dock({useControls:true,dockPosition:"bottom",dockTabColor:[255,255,255],trueButtonColor:[70,245,70],enabledButtonColor:[81,97,115],disabledButtonColor:[170,170,170]});$("smilie_box").makeDraggable({handle:"smilie_box_handle",onStart:showModal,onComplete:function(){hideModal(document.getElementById("smilie_box"))}});Buddylist.create()}else{if(document.getElementById("login")){var A=document.getElementsByTagName("input");for(var B=0;B<A.length;B++){var C=A[B].getAttribute("rel");if(C=="onMe"){A[B].onblur=function(){blured(this);return false};A[B].onfocus=function(){focused(this);return false}}}if(document.getElementById("nick").value.length>0){document.getElementById("pwd").focus();focused(document.getElementById("pwd"))}else{document.getElementById("nick").focus();focused(document.getElementById("nick"))}}}server_sync()}});function iframeUpdate(){if(document.getElementById("jsIframeV").innerHTML==""){document.getElementById("jsIframeButton").style.display=""}}function setOnlineStatus(A){if(typeof (A)=="undefined"){A=document.getElementById("onlineStatus").value;document.getElementById("socket_js").sendJs("!onlineStatus "+A)}else{if(document.getElementById("onlineStatus").value!=A){switch(A){case"1":online_status="online_16";onlineStatusTxt="online";break;case"2":online_status="busy";onlineStatusTxt="busy";break}document.getElementById("onlineStatus").value=A;document.getElementById("myStatus").style.display="none";document.getElementById("myCurrentStatus").innerHTML='<img src="/gfx/icons/png/'+online_status+'.png" align="absmiddle" /> '+onlineStatusTxt;get("/profile/set/onlineStatus/"+A);document.getElementById("socket_js").sendJs("!onlineStatus "+A)}}}function chatConn(){if(fConn!=true){alert("you are not connected to the chat, check the forum for more help");return false}return true}var fConn=null;var fRoar=null;function fGateway(A){switch(A){case"conn":document.getElementById("dockAppNetwork").style.display="none";fConn=true;if(fRoar!=null){roar.remove(fRoar);fRoar=null}break;case"disc":if(fConn!=false){document.getElementById("dockAppNetwork").style.display="";fRoar=roar.alert('<h3 style="color:#CC0000;">network problem</h3><br />you are not able to use the chat, click here for more information',{duration:false,click:function(){kafic_if.document.location.href="/forum/Oko_kafica/pomoc/new_stuff_for_v3-9"}});fConn=false}break}}function rFlash(A){Buddylist.sync_chat(JSON.decode(unescape(A)))}function server_sync(){var D="";var B=new Date();var C=Math.round(B.getTime()/1000);if(document.getElementById("smilie_box")){if((C-timeouts.contacts.last)>timeouts.contacts.time){D+="&contacts=1";if(timeouts.contacts.last==0){D+="&c_init=1"}}if((C-timeouts.new_updates.last)>timeouts.new_updates.time){if(new_stuff_notify.messages==0&&new_stuff_notify.guestbook==0&&new_stuff_notify.friends==0&&new_stuff_notify.notifications==0){D+="&null_updates=1"}D+="&new_updates=1"}}if(document.getElementById("broadcast_container").style.display!="none"&&document.getElementById("live_online").style.display!="none"){if(((C-timeouts.broadcast.last)>timeouts.broadcast.time)&&broadcast_timer==null){timeouts.broadcast.last=C;D+="&broadcast=1"}}if(document.getElementById("online_list").style.display!="none"&&document.getElementById("live_online").style.display!="none"){if((C-timeouts.random_online.last)>timeouts.random_online.time){D+="&random_online=1"}}if(D.length>1){D=D.substr(1,D.length);var A=new Request.JSON({url:"/profile/server_sync/?"+D,onComplete:function(H){if(H!=null){if(H.logout){parent.document.location.href="/site/logout/forced"}if(D.toLowerCase().indexOf("contacts")>=0){timeouts.contacts.last=C;if(H.contacts){Buddylist.sync(H.contacts)}}if(H.new_updates){timeouts.new_updates.last=C;notify_update("messages",H.new_updates.new_messages);notify_update("guestbook",H.new_updates.new_guestbook);notify_update("friends",H.new_updates.new_friends);notify_update("notifications",H.new_updates.new_notifications)}if(H.broadcast){timeouts.broadcast.last=C;var F="";for(var G=0;H.broadcast[G];G++){F+='<a href="/user/'+H.broadcast[G]["uname"]+'/image" onclick="pop(\'1\')" target="image_pop"><img height="20" width="18" border="0" class="bordit" title="'+H.broadcast[G]["uname"]+" "+H.broadcast[G]["info"]+'" alt="'+H.broadcast[G]["uname"]+" "+H.broadcast[G]["info"]+'" src="'+H.broadcast[G]["img"]+'"/></a> <a class="context-menu '+H.broadcast[G]["class"]+'" href="/user/'+H.broadcast[G]["uname"]+'">'+H.broadcast[G]["uname"]+"</a>: "+H.broadcast[G]["msg"]+"       "}broadcast_start(F)}if(H.random_online){timeouts.random_online.last=C;var E="";for(var G=0;H.random_online[G];G++){E+='<a href="/user/'+H.random_online[G]["uname"]+'"><img height="70" width="63" border="0" class="bordit" title="'+H.random_online[G]["uname"]+" "+H.random_online[G]["info"]+'" alt="'+H.random_online[G]["uname"]+" "+H.random_online[G]["info"]+'" src="'+H.random_online[G]["img"]+'"/></a>'}document.getElementById("random_online").innerHTML=E}}}}).get()}window.setTimeout("server_sync();",10000)}function toolbar_check(){if(window.kafic_if!==undefined&&typeof TPI!="undefined"){if(kafic_if.document.getElementById("toolbar")){var B=new TPI.Toolbar("CT1384502");var A=B.IsVisible();if(!A.returnValue){kafic_if.document.getElementById("toolbar").style.display=""}}}}function killtimer(A){if(A){window.clearTimeout(A);A=null}}function showlayer(D){var A=document.getElementById(D);var C=D.split("_");for(var B=1;document.getElementById(C[0]+"_"+B);B++){if(B==C[1]){A.style.display="block"}else{document.getElementById(C[0]+"_"+B).style.display="none"}}}function activateMenu(C){var A=document.getElementById(C);var B=1;for(i=0;i<A.childNodes.length;i++){if(A.childNodes[i].firstChild.className=="nav_arrow"){A.childNodes[i].firstChild.nextSibling.id="sm_"+B;A.childNodes[i].onmouseover=function(){killtimer(showlayer_timer);showlayer_timer=window.setTimeout("showlayer('"+this.firstChild.nextSibling.id+"');",400)};A.childNodes[i].onmouseout=function(){killtimer(showlayer_timer);showlayer_timer=window.setTimeout("showlayer('sm_0')",400)};A.childNodes[i].firstChild.onclick=function(){killtimer(showlayer_timer);showlayer("sm_0")};A.childNodes[i].lastChild.onclick=function(){killtimer(showlayer_timer);showlayer("sm_0")};B++}else{A.childNodes[i].firstChild.onmouseover=function(){killtimer(showlayer_timer);showlayer("sm_0")}}}}function complaint_show(A,B){window.scrollTo(0,0);document.getElementById("complaint_container").style.display="block";document.getElementById("complaint_type").value=A;switch(A){case"homepage":case"blog":case"live":case"videos":case"forum":if(B!=null){document.getElementById("complaint_object_id").value=B}break}}function complaint_send(){switch(document.getElementById("complaint_type").value){case"liveboard":if(!kafic_if.document.getElementById("liveboard")){return false}kafic_if.document.getElementById("liveboard_form").action="/add/complaint";document.getElementById("complaint_accused_info").value="";x=0;while(kafic_if.document.getElementById("liveboard_form").elements[x]){if(kafic_if.document.getElementById("liveboard_form").elements[x].checked!=false){document.getElementById("complaint_accused_info").value+=kafic_if.document.getElementById("liveboard_form").elements[x].value+","}x++}return true;break;case"forum":if(!kafic_if.document.getElementById("forum_post_"+document.getElementById("complaint_object_id").value)){return false}return true;break;case"homepage":case"blog":case"live":case"videos":return true;break}return false}var zIndex_id=200;function showModal(E,B){zIndex_id++;document.getElementById(E.id).style.zIndex=zIndex_id;if(document.getElementById("modalBackdrop")){deleteNode("modalBackdrop")}var A,F;var D=document.body.scrollHeight;var C=document.body.offsetHeight;if(D>C){A=document.body.scrollWidth;F=document.body.scrollHeight}else{A=document.body.offsetWidth;F=document.body.offsetHeight}if(B==1){B='class="modalOverlay"'}else{B=""}modalHTML='<div id="modalBackdrop" '+B+' style="z-index:'+(zIndex_id)+"; width:"+A+"px; height:"+F+'px;"></div>';document.getElementById("body_bottom").innerHTML=modalHTML;modal=document.getElementById("body_bottom").firstChild;document.body.insertBefore(modal,document.body.firstChild)}function hideModal(A){if(A){zIndex_id++;document.getElementById(A.id).style.zIndex=zIndex_id}if(document.getElementById("modalBackdrop")){deleteNode("modalBackdrop")}}function scroll_to(B){if(B=="bottom"){var A=new Fx.Scroll("pageWrapper",{offset:{y:document.getElementById("pageWrapper").scrollHeight}}).toTop()}else{if(B=="top"){var A=new Fx.Scroll("pageWrapper",{offset:{y:0}}).toTop()}else{var A=new Fx.Scroll("pageWrapper",{offset:{y:kafic_if.document.getElementById(B).offsetTop}}).toTop()}}}function toggle_online(){if(document.getElementById("online_list").style.display!="none"){document.getElementById("online_list").style.display="none";get("/profile/set/online_minimized/1")}else{timeouts.random_online.last=0;document.getElementById("online_list").style.display="";get("/profile/set/online_minimized/0")}fix_live_online()}var pop_msg_win=null;function pop_msg(B){var D=Math.floor((screen.width-650)/2);var C=Math.floor((screen.height-400)/2);var A="top="+C+",left="+D+",height=400,width=650,scrollbars=yes,toolbar=no,resizable=no";pop_msg_win=window.open(B,"msg_pop",A);pop_msg_win.focus()}function message_status(A,B){if(A>0){switch(B){case 1:if(document.getElementById("message_status_"+A)){if(document.getElementById("message_status_"+A).src.indexOf("replied")<1){document.getElementById("message_status_"+A).src="/gfx/icons/messages/read.png";document.getElementById("message_row_"+A).className="row_msg"}}break;case 2:if(document.getElementById("message_status_"+A)){document.getElementById("message_status_"+A).src="/gfx/icons/messages/replied.png"}break}}}broadcast_obj=null;function toggle_broadcast(){if(document.getElementById("broadcast_container").style.display=="none"){broadcast_reinit();document.getElementById("broadcast_container").style.display="";get("/profile/set/broadcast_minimized/0")}else{if(broadcast_timer!=null){clearTimeout(broadcast_timer)}broadcast_timer=null;broadcast_obj.style.left=document.getElementById("broadcast_container").offsetWidth+"px";document.getElementById("broadcast_container").style.display="none";get("/profile/set/broadcast_minimized/1")}fix_live_online()}function fix_live_online(){if(document.getElementById("live_online").style.display=="none"){if(document.getElementById("broadcast_container").style.display==""||document.getElementById("online_list").style.display==""){document.getElementById("live_online").style.display=""}}else{if(document.getElementById("broadcast_container").style.display=="none"&&document.getElementById("online_list").style.display=="none"){document.getElementById("live_online").style.display="none"}}}function broadcast_speed(A){live_speed=A}live_speed=50;function broadcast_start(B){if(document.getElementById("broadcast_container").style.display!="none"){broadcast_obj.style.left=document.getElementById("broadcast_container").offsetWidth+"px";var A="<img src='/gfx/spacer.gif' width='300' height='0'>";broadcast_obj.innerHTML=B+A+B+A+B;broadcast_obj.style.display="";if(broadcast_timer!=null){clearTimeout(broadcast_timer)}broadcast_timer=window.setTimeout("broadcast_tick()",live_speed)}}function broadcast_reinit(){broadcast_obj.style.display="none";if(broadcast_timer!=null){clearTimeout(broadcast_timer)}broadcast_timer=null}var timeout_speed=-2;function broadcast_tick(){var A=parseInt(broadcast_obj.style.left);broadcast_obj.style.left=A+timeout_speed+"px";if(A<-1*(document.getElementById("broadcast").offsetWidth)){broadcast_reinit()}else{if(broadcast_timer!=null){broadcast_timer=window.setTimeout("broadcast_tick()",live_speed)}}}function smilie_insert(A){if(global_sbox_iframe){parent.kafic_if.document.getElementById(global_sbox).value=parent.kafic_if.document.getElementById(global_sbox).value+unescape(A)}else{document.getElementById(global_sbox).value=document.getElementById(global_sbox).value+unescape(A)}}function login(){if(document.getElementById("nick").value.length<3||document.getElementById("pwd").value.length<3){return false}else{return true}}function mainSize(){return $(window).height()+$(window).scrollTop()}function iFrameSize(){if_name="kafic_if";if(document.getElementById&&!(document.all)){h=document.getElementById(if_name).contentDocument.body.scrollHeight;if(h>100){document.getElementById(if_name).style.height=h+"px"}}else{if(document.all){h=document.frames(if_name).document.body.scrollHeight;if(h>100){document.all.kafic_if.style.height=h+"px"}}}}var new_stuff_notify=new Array(3);function notify_update(C,B){if(B>0){document.getElementById("icons_"+C).src="/gfx/nav/icons/gif/"+C+".gif";if(new_stuff_notify[C]!=1){new_stuff_notify[C]=1;if(mute==0){var A={};A.soundfile=sounds[C];swfobject.embedSWF("/gfx/flash/sound.swf","body_bottom","1","1","8","/js/swfobject/expressInstall.swf",A)}}}else{B="0";new_stuff_notify[C]=0;document.getElementById("icons_"+C).src="/gfx/nav/icons/gif/empty-"+C+".gif"}document.getElementById("icons_"+C).title=B;document.getElementById("icons_"+C).alt=B}function add_comment(){new_comment=parent.send_if.document.getElementById("new_comment").innerHTML;if(document.getElementById("comments")){document.getElementById("comments").innerHTML=new_comment+document.getElementById("comments").innerHTML;document.getElementById("comment_message").value="";document.getElementById("total_comments").innerHTML=parseInt(document.getElementById("total_comments").innerHTML)+1}else{parent.kafic_if.document.getElementById("comments").innerHTML=new_comment+parent.kafic_if.document.getElementById("comments").innerHTML;parent.kafic_if.document.getElementById("comment_message").value="";parent.kafic_if.document.getElementById("total_comments").innerHTML=parseInt(parent.kafic_if.document.getElementById("total_comments").innerHTML)+1;parent.iFrameSize()}}var notes=null;function photo_container_init(){document.getElementById("PhotoContainer").style.display="";var A=document.getElementById("PhotoContainer");notes=new PhotoNoteContainer(A);photo_note_init()}function get(A,C,D){var B=new Request({method:"get",url:A,onSuccess:function(E){switch(C){case"album_folder_add":result=E.split("::");if(result[0]==0){alert(result[1])}else{kafic_if.document.getElementById("album_folder_add").innerHTML=result[1];kafic_if.document.getElementById("folder_new").value=""}kafic_if.document.getElementById("folder_new_loading").style.display="none";break;case"comment":if(E.length>0){if(D==1){deleteNode("comment_"+E,1);kafic_if.document.getElementById("total_comments").innerHTML=parseInt(kafic_if.document.getElementById("total_comments").innerHTML)-1}else{deleteNode("comment_"+E);document.getElementById("total_comments").innerHTML=parseInt(document.getElementById("total_comments").innerHTML)-1}}break;case"popup_vote":result=E.split("::");if(result[0]==0){alert(result[1])}else{if(D){kafic_if.document.getElementById("popup_total_votes").innerHTML=result[1];kafic_if.document.getElementById("vote").style.display="none";kafic_if.document.getElementById("voted").style.display=""}else{document.getElementById("popup_total_votes").innerHTML=result[1];document.getElementById("vote").style.display="none";document.getElementById("voted").style.display=""}}break;case"popup_vote":result=E.split("::");if(result[0]==0){alert(result[1])}else{parent.kafic_if.document.getElementById("popup_vote").style.width=result[0];parent.kafic_if.document.getElementById("popup_total_votes").innerHTML=result[1];parent.kafic_if.document.getElementById("popup_user_vote").style.width=result[2]}break;case"liveboard":liveboard_obj=parent.kafic_if.document.getElementById("liveboard");if(E.charAt(0)=="1"&&liveboard_obj){not_a_copy=true;message_id=E.substring(1,E.indexOf("<"));for(check_id=0;check_id<7;check_id++){if(message_id==liveboard_obj.childNodes[check_id].id){not_a_copy=false}}if(not_a_copy==true){new_message=E.substring(E.indexOf("<"),E.length);if(parent.kafic_if.document.getElementById("liveboard_smile")){if(parent.kafic_if.document.getElementById("liveboard_smile").checked){new_message=Smile(new_message)}}else{new_message=Smile(new_message)}parent.kafic_if.document.getElementById("tmp").innerHTML=new_message;new_message=parent.kafic_if.document.getElementById("tmp").firstChild;liveboard_obj.insertBefore(new_message,liveboard_obj.firstChild);if(parent.kafic_if.document.getElementById("liveboard").firstChild.lang!="none"){parent.kafic_if.document.getElementById(parent.kafic_if.document.getElementById("liveboard").firstChild.id).style.display="";parent.iFrameSize()}while(parent.kafic_if.document.getElementById("liveboard").childNodes.length>60){deleteNode(parent.kafic_if.document.getElementById("liveboard").lastChild.id,1)}}}break;case"context_menu":context_title=E.substring(0,E.indexOf(","));context_data=E.substring(E.indexOf(",")+1,E.length);if(D){parent.kafic_if.document.getElementById("context_common_title").innerHTML=context_title;parent.kafic_if.document.getElementById("context_common_data").innerHTML=context_data}else{document.getElementById("context_common_title").innerHTML=context_title;document.getElementById("context_common_data").innerHTML=context_data}break;case"forum_topic":if(E.length>0){topic_id=E.substring(0,E.indexOf(","));image_src=E.substring(E.indexOf(",")+1,E.length);parent.kafic_if.document.getElementById("forum_lock_"+topic_id).src=image_src}break;case"poll_vote":if(E.length>0){result=E.split("::");if(result[0]!=0){kafic_if.document.getElementById("poll").innerHTML=result[1]}else{alert(result[1])}}break;case"fade_and_alert":if(E.length>0){result=E.split("::");if(result[0]!=0){if(D==1){parent.kafic_if.document.getElementById(result[0]).style.display="none"}else{document.getElementById(result[0]).style.display="none"}}alert(result[1])}break;case"just_fade":if(E.length>0){if(D==1){parent.kafic_if.document.getElementById(E).style.display="none"}else{document.getElementById(E).style.display="none"}}break;case"just_alert":if(E.length>0){alert(E)}break;case"send_message_history":if(E.length>0){result=E.split("::");if(result[0]==0){alert(result[1])}else{parent.document.getElementById("send_message_history").innerHTML=Smile(E);document.getElementById("send_message_history_container").style.display="block"}parent.document.getElementById("loader_messages").style.display="none"}break}}}).send()}function set_me(A,C,D){if(C=="messagesMore"){parent.kafic_if.document.getElementById("messagesMoreLoad").innerHTML='<img align="absmiddle" src="/gfx/loaders/white_small.gif"/>'}if(C=="blog_panel"||C=="video_panel"||C=="event_panel"){parent.kafic_if.document.getElementById(C+"_load").style.visibility="visible"}if(C=="more_comments"){if(document.getElementById("more_comments")){document.getElementById("more_comments").innerHTML='downloading <img align="absmiddle" src="/gfx/loaders/white_small.gif"/>'}else{kafic_if.document.getElementById("more_comments").innerHTML='downloading <img align="absmiddle" src="/gfx/loaders/white_small.gif"/>'}}if(C=="comments"){if(document.getElementById("paginator_loading")){document.getElementById("paginator_loading").style.display=""}else{kafic_if.document.getElementById("paginator_loading").style.display=""}}var B=new Request({method:"get",url:A,onSuccess:function(E){if(D==1){parent.kafic_if.document.getElementById(C).innerHTML=E;window.setTimeout("parent.iFrameSize();",1000)}else{document.getElementById(C).innerHTML=E}switch(C){case"blog_panel":case"video_panel":case"event_panel":parent.kafic_if.document.getElementById(C+"_load").style.visibility="hidden";break;case"check_nick":if(E.length>3){if(E.indexOf("information")>0){parent.kafic_if.document.getElementById("reg_img1").src="/gfx/icons/png/pass.png"}else{parent.kafic_if.document.getElementById("reg_img1").src="/gfx/icons/png/delete.png"}}else{parent.kafic_if.document.getElementById("reg_img1").src="/gfx/icons/png/delete.png"}break;case"comments":if(D==1){kafic_if.document.getElementById("paginator_loading").style.display="none"}else{document.getElementById("paginator_loading").style.display="none"}break;case"send_message_history":document.getElementById("loader_messages").style.display="none";document.getElementById("send_message_history").style.display="";parent.document.getElementById("send_message_history").innerHTML=Smile(parent.document.getElementById("send_message_history").innerHTML);break}}}).send()};