/*
HTTP Host: static.ak.fbcdn.net
Generated: March 19th 2010 7:52:40 PM PDT
Machine: 10.16.140.107
Locale: nu_ll
Path: js/daaf69u2r9ws0gko.pkg.js
*/

if (window.CavalryLogger) { CavalryLogger.start_js(["js\/daaf69u2r9ws0gko.pkg.js"]); }

function removeSection(c,a){hide(c+'_'+a);$(c+'_'+a+'_remove').value='true';$('num_'+c+'_entries').value--;$(c+'add_link').style.display='block';var b=ge(c+'last_divider');if(b)b.style.display='';}function addSection(d,b){var c=parseInt($('num_'+d+'_entries').value);show(d+'_'+(c+1));$('num_'+d+'_entries').value=c+1;if(c+1>=b){$(d+'add_link').style.display='none';var a=ge(d+'last_divider');if(a)a.style.display='none';}}function schoolChangeStatus(a,b){a=ge(a);var c=a.options[a.selectedIndex].value;concentrate_name=b+'_concentration';concentrate_adder=b+'_concentration_adder';concentrate_degree=b+'_degree';concentrate_value_count=b+'_concentration_value_count';switch(c){case '3':case '1':case '2':showTableRow(getParentRow(concentrate_name+'1'));if($(concentrate_value_count).value>=2){showTableRow(getParentRow(concentrate_name+'2'));}else hide(getParentRow(concentrate_name+'2'));if($(concentrate_value_count).value>=3){showTableRow(getParentRow(concentrate_name+'3'));}else{hide(getParentRow(concentrate_name+'3'));showTableRow(getParentRow(concentrate_adder));}hide(getParentRow(concentrate_degree));$(concentrate_degree).value='';if(c=='2')showTableRow(getParentRow(concentrate_degree));break;default:hide(getParentRow(concentrate_degree));break;}}function addConcentration(a){concentrate_adder=a+'_adder';concentrate_value_count=a+'_value_count';if($(concentrate_value_count).value==2){$(concentrate_value_count).value=3;showTableRow(getParentRow(a+'3_name'));hide(getParentRow(concentrate_adder));}else{$(concentrate_value_count).value=2;showTableRow(getParentRow(a+'2_name'));}}function education_autocomplete_onselect(c){var d=function(){var e=new concentration_source(this.network);e.text_placeholder=_tx("Napi\u0161 sv\u016fj obor");e.text_nomatch=e.text_noinput=false;var f=new typeaheadpro(this,e);};$(this.custom_prefix+'_school_nk').value=c?c.i:-1;for(var b=1;b<=3;b++){var a=ge(this.custom_prefix+'_concentration'+b+'_name');if(a){typeaheadpro.kill_typeahead(a);if(c){a.network=c.i;a.onfocus=d.bind(a);}else{CSS.setClass(a,a.className.replace(/typeahead_[^\s]+/g,''));a.onfocus=null;}}}return false;}function education_autocomplete_onfound(a){if(!a)$(this.custom_prefix+'_school_nk').value=-1;}function workplace_autocomplete_onselect(a){$(this.custom_prefix+'_company_nk').value=a?a.i:-1;return false;}function workplace_autocomplete_onfound(a){if(!a)$(this.custom_prefix+'_company_nk').value=-1;}function checkNameLegit(){if($('i_swear').checked){$('name_change_form').submit();}else $('error').style.display='';}function on_work_history_city_selected(){}function education_remove_school(c,b){var a=new Dialog().setTitle(_tx("Odstra\u0148 tuto \u0161kolu")).setBody(_tx("Opravdu chcete odebrat tuto \u0161kolu? Ztrat\u00edte tak ve\u0161ker\u00e9 informace o n\u00ed ulo\u017een\u00e9.")).setButtons([Dialog.newButton('remove',_tx("Odstranit")),Dialog.CANCEL]).setHandler(function(){removeSection(c,b);a.hide();}).show();return false;}function workhistory_remove_entry(b){var a=new Dialog().setTitle(_tx("Odstranit toto zam\u011bstn\u00e1n\u00ed")).setBody(_tx("Jste si jist\u00ed, \u017ee chcete odstranit tuto pr\u00e1ci? Ztrat\u00edte v\u0161echna dosud ulo\u017een\u00e1 data.")).setButtons([Dialog.newButton('remove',_tx("Odstranit")),Dialog.CANCEL]).setHandler(function(){removeSection('work_history',b);a.hide();}).show();return false;}function FamilyInfoController(e,d,f,a){this.root=$(e);this.new_family_field_markup=d;this.typeahead_param=f;this.cur_index=a;this.addNewLink=$('add_more_family');this.only_node=null;var c=DOM.scry(this.root,'div.family_member');if(c.length==1)this.only_node=c[0];for(var b=0;b<c.length;b++)this.setUpHandlers(c[b]);this.checkHideAddNewLink();Event.listen(this.addNewLink,'click',this.addFamilyField.bind(this));}FamilyInfoController.CHILD_CONSTANTS={'104':1,'105':1};FamilyInfoController.MAX_FIELDS=100;FamilyInfoController.prototype.setUpHandlers=function(d){var i=DOM.find(d,'select.family_member_selector');var c=DOM.scry(d,'input[type="hidden"]')[0];var b=DOM.find(d,'input[type="text"].name_typeahead');var h=DOM.scry(d,'a.remove_link')[0];var e=c.value;var f=get_form_select_value(i);var g=b.value;var j=this.typeahead_param;var a=DOM.find(d,'input[type="text"].email_input');Event.listen(b,'focus',function(){var k=new friend_source(j);k.text_nomatch='';k.text_noinput='';k.text_placeholder=_tx("Zadejte jm\u00e9no");new typeaheadpro(this,k,{max_results:5,onselect:FamilyInfoController.familyIdSelect,auto_select:false,_node:d,_select:i,_original_id:e,_original_relation:f,_hidden_input:c,_email_elem:a});});Event.listen(i,'change',function(){this.checkShowTextData(d,i,c,b);var k=get_form_select_value(i);if(c.value&&k!=0&&k!=f){FamilyInfoController.constructNotifMessage(d,c,b.value,b,a);}else FamilyInfoController.removeNotifMessage(d);}.bind(this));Event.listen(b,'blur',function(){setTimeout(function(){if(!CSS.hasClass(b,'typeahead_found')&&g!=b.value){c.value='';FamilyInfoController.removeNotifMessage(d);}this.checkShowTextData(d,i,c,b);}.bind(this),5);}.bind(this));if(h)Event.listen(h,'click',function(){c.value='';b.value='';i.selectedIndex=0;if(!CSS.hasClass(d,'family_member_first')){CSS.addClass(d,'hidden_elem');}else CSS.addClass(h,'hidden_elem');return false;}.bind(this));};FamilyInfoController.prototype.checkShowTextData=function(f,g,c,b){var e=((c.value=='')&&b.value);var d=FamilyInfoController.CHILD_CONSTANTS[get_form_select_value(g)];var h=(e&&!d);if(h){var a=DOM.find(f,'div.email_explanation');DOM.setContent(a,HTML(_tx("Zadej email u\u017eivatele <b>{name}<\/b>. {name} obdr\u017e\u00ed pozv\u00e1nku aby se stal\/a Tv\u00fdm\/Tvou p\u0159\u00edtelem\/p\u0159\u00edtelkyn\u00ed na Facebooku a potvrd\u00ed Tvou \u017e\u00e1dost z rodiny.",{name:htmlize(b.value)})));}CSS.conditionClass(f,'with_child_metadata',(e&&d));CSS.conditionClass(f,'with_email',h);};FamilyInfoController.prototype.addFamilyField=function(){var a=HTML(this.new_family_field_markup).getRootNode();this.root.appendContent(a);this.setUpHandlers(a);if(this.only_node){CSS.removeClass(this.only_node,'family_member_only');this.only_node=null;}this.new_family_field_markup=this.new_family_field_markup.replace(new RegExp('\\['+this.cur_index+'\\]','g'),'['+(this.cur_index+1)+']');this.cur_index++;this.checkHideAddNewLink();};FamilyInfoController.prototype.checkHideAddNewLink=function(){if(this.cur_index>=FamilyInfoController.MAX_FIELDS)CSS.addClass(this.addNewLink,'hidden_elem');};FamilyInfoController.familyIdSelect=function(b){if(b){if(b.i!=this._hidden_input.value){this._hidden_input.value=b.i;var a=get_form_select_value(this._select);if(a!=0&&((b.i!=this._original_id)||(a!=this._original_relation))){FamilyInfoController.constructNotifMessage(this._node,this._hidden_input,b.t,this.obj,this._email_elem);}else FamilyInfoController.removeNotifMessage(this._node);}CSS.removeClass(this._node,'with_child_metadata');CSS.removeClass(this._node,'with_email');this._email_elem.value='';}};FamilyInfoController.removeNotifMessage=function(a){var b=DOM.scry(a,'div.notif_message');if(b[0])DOM.remove(b[0]);};FamilyInfoController.constructNotifMessage=function(g,d,f,c,b){FamilyInfoController.removeNotifMessage(g);var e=$N('div',{className:'notif_message'});e.setContent(_tx("Je\u0161t\u011b p\u0159ed vytvo\u0159en\u00edm odkazu z va\u0161eho Profilu d\u00e1me v\u011bd\u011bt u\u017eivateli {name}, kter\u00fd mus\u00ed potvrdit, \u017ee je sou\u010d\u00e1st\u00ed va\u0161\u00ed rodiny.",{name:f}));var a=HTML('<span> (<a>'+_tx("Storno")+'</a>)</span>').getRootNode();e.appendContent(a);Event.listen(e.find('a'),'click',function(){DOM.remove(e);d.value='';c.value='';b.value='';}.bind(this));DOM.appendContent(g,e);};
function Scroller(a){this.canvas=a;this.scrollZone=50;this.velocity=100;this.coefficient=1;}Scroller.findScrollParent=function(a){var b;a=a.parentNode;while(a){if(a.scrollHeight!=a.offsetTop){b=CSS.getStyle(a,'overflowY');if(b=='scroll'||b=='auto')return a;}a=a.parentNode;}return document.body;};Scroller.prototype.activate=function(){this.activate=bagofholding;this.event=Event.listen(document,'mousemove',this._onmousemove.bind(this));this.interval=this._intervalHandler.bind(this).recur(50);this.cursor=null;};Scroller.prototype.deactivate=function(){delete this.activate;this.event&&this.event.remove();this.event=null;clearInterval(this.interval);};Scroller.prototype._onmousemove=function(event){this.cursor=new Vector2.getEventPosition(event);};Scroller.prototype._intervalHandler=function(){if(!this.cursor)return;var c=this.canvas==document.body?Rect.getViewportBounds():Rect(this.canvas);var a=new Rect(this.cursor.y-c.t,c.r-this.cursor.x,c.b-this.cursor.y,this.cursor.x-c.l);var b=new Vector2(0,0);if(a.t<a.b&&a.t<this.scrollZone){b.y=-this.scrollZone+a.t;}else if(a.b<this.scrollZone)b.y=this.scrollZone-a.b;b.y=this._doMath(b.y);if(a.l<a.r&&a.l<this.scrollZone){b.x=-this.scrollZone+a.l;}else if(a.r<this.scrollZone)b.x=this.scrollZone-a.r;b.x=this._doMath(b.x);if(b.x||b.y){b.scrollElementBy(this.canvas);if(document.body==this.canvas)this.cursor=this.cursor.add(b);Arbiter.inform('scroller/scroll',this.cursor);}};Scroller.prototype._doMath=function(a){return Math.floor(Math.pow((a>=0?Math.min(a,this.scrollZone):Math.max(a,-this.scrollZone))/this.scrollZone*this.velocity,this.coefficient));};
var Drag={};Drag.currentDraggable=null;Drag.grab=function(a){if(Drag.currentDraggable)Drag._onmouseup();a.lastDragOver=null;Drag.attachDragEvents();Drag.currentDraggable=a;};Drag.attachDragEvents=function(){document.onselectstart=function(){document.onselectstart=null;return false;};if(Drag.dragEventsAttached)return;Drag.dragEventsAttached=true;Arbiter.subscribe('scroller/scroll',Drag._onmousemove);Event.listen(document,{mousemove:Drag._onmousemove,mouseup:Drag._onmouseup});};Drag.droppables={};Drag.addDroppable=function(b,a){(Drag.droppables[b]=Drag.droppables[b]||[]).push(a);};Drag.removeDroppable=function(b,a){Drag.droppables[b]=Drag.droppables[b].filter(function(c){return c!=a;});};Drag._onmousemove=function(event,c){if(!Drag.currentDraggable)return;var d=c||Vector2.getEventPosition(event),b=Drag.currentDraggable,e=Drag.droppables[b.namespace];if(b.namespace&&b.active&&e){var j={};e.each(function(k){j[k.zIndex]=k.zIndex;});var i=[];for(var f in j)i.push(j[f]);i.sort();var g=b.lastDragOver,a=null;for(var h=i.length;h>=0;h--)if(g&&g.dom!=null&&g.zIndex==i[h]&&g.pointInside(d)){a=g;break;}else for(var f=0;f<e.length;f++){if(i[h]!=e[f].zIndex)continue;if(g!=e[f]&&b.dom!=e[f].dom&&e[f].pointInside(d)){a=e[f];h=-1;break;}}if(a&&a!=g)a.ondragover(b);if(a)a.ondragmove(b,d.sub(Vector2.getElementPosition(a.dom)));b.lastDragOver=a;}Drag.currentDraggable._onmousemove(d);};Drag._onmouseup=function(a){document.onselectstart=null;if(Drag.currentDraggable){Drag.currentDraggable._ondrop();Drag.currentDraggable=null;}};function Draggable(b){if(!b)throw new Error('Element should be a DOM node');if(this==window){if(b instanceof Array){var a=[];b.each(function(c){a.push(new Draggable(c));});return new Collection(Draggable,a);}else return new Draggable(b);}else{this.data={};this.handles=[];this.dom=b;this.boundingBox=null;this.addHandle(this.dom);}}Draggable.prototype.destroy=function(){this.handles.each(function(a){this.removeHandle(a.obj);}.bind(this));this.data=this.dom=null;};Draggable.prototype._onclick=function(event){if(this.active)return Event.kill(event);};Draggable.prototype._ongrab=function(a){this.ongrab();if(!this.scroller)this.scroller=new Scroller(Scroller.findScrollParent(this.dom));this.scroller.activate();if(this.active){if(!this.oldPosition)this.oldPosition=this.dom.style.position;this.dom.style.position=this.absolute?'absolute':'relative';a.sub(this.cursorPositionVector).setElementPosition(this.dom);}};Draggable.prototype._onmousedown=function(event){var a=$E(event).getTarget();if(DOM.isNode(a,['input','select','textarea','object','embed']))return true;var b=Vector2.getEventPosition(event);this.draggableInitialVector=Vector2.getElementPosition(this.dom);this.cursorPositionVector=b.sub(this.draggableInitialVector);Drag.grab(this,event);if(this.gutter){this.cursorInitialVector=b;}else{this._setActive(true);this._ongrab(b);}return Event.kill(event);};Draggable.prototype._onmousemove=function(d){if(!this.active)if(d.distanceTo(this.cursorInitialVector)>=this.gutter){this._setActive(true);this._ongrab(d);}if(this.active){var c=Vector2.getElementPosition(this.dom).sub(new Vector2(parseInt(this.dom.style.left?this.dom.style.left:CSS.getStyle(this.dom,'left'),10)||0,parseInt(this.dom.style.top?this.dom.style.top:CSS.getStyle(this.dom,'top'),10)||0));var e=d.sub(c).sub(this.cursorPositionVector);if(this.boundingBox){var a=Rect.newFromVectors(e,Vector2.getElementDimensions(this.dom));a=a.boundWithin(this.boundingBox);e=a.getPositionVector(a);if(this.boundingBox.w()==0){var b=new Vector2(this.draggableInitialVector.x,e.y,'document');}else if(this.boundingBox.h()==0){var b=new Vector2(e.x,this.draggableInitialVector.y,'document');}else var b=e;}else var b=e;b.setElementPosition(this.dom);this.ondrag(d);}};Draggable.prototype._ondrop=function(){this.scroller&&this.scroller.deactivate();if(this.active){(function(){this._setActive(false);}).bind(this).defer();this.ondrop();if(this.lastDragOver)this.lastDragOver.ondrop(this);}};Draggable.prototype.killDrag=function(){this._setActive(false);Drag._onmouseup();};Draggable.prototype.setBoundingBox=function(a){this.boundingBox=a;return this;};Draggable.prototype.resetPosition=function(){this.dom.style.position=this.oldPosition;this.oldPosition=null;this.dom.style.left=null;this.dom.style.top=null;return this;};Draggable.prototype.setUseAbsolute=function(a){this.absolute=a;return this;};Draggable.prototype.ondrag=bagofholding;Draggable.prototype.setDragHandler=function(a){this.ondrag=a;return this;};Draggable.prototype.ongrab=bagofholding;Draggable.prototype.setGrabHandler=function(a){this.ongrab=a;return this;};Draggable.prototype.ondrop=bagofholding;Draggable.prototype.setDropHandler=function(a){this.ondrop=a;return this;};Draggable.prototype.gutter=0;Draggable.prototype.setGutter=function(a){this.gutter=a;return this;};Draggable.prototype.setNamespace=function(a){this.namespace=a;return this;};Draggable.prototype.handles=null;Draggable.prototype.addHandle=function(a){if(this.handles.length==1&&this.handles[0].obj==this.dom)this.removeHandle(this.dom);this.handles.push({obj:a,evt:[Event.listen(a,'mousedown',this._onmousedown.bind(this)),Event.listen(a,'click',this._onclick.bind(this)),Event.listen(a,'drag',Event.kill),Event.listen(a,'selectstart',Event.kill)]});return this;};Draggable.prototype.removeHandle=function(a){this.handles=this.handles.filter(function(b){if(b.obj!=a){return true;}else{b.evt.each(function(c){c.remove();});return false;}});};Draggable.prototype.getDOM=function(){return this.dom;};Draggable.prototype.setKey=function(a,b){this.data[a]=b;return this;};Draggable.prototype.getKey=function(a){return this.data[a];};Draggable.prototype._setActive=function(b){this.dom.activeDrag=this.active=b;for(var a=0;a<this.handles.length;a++)this.handles[a].obj.activeDrag=b;};function Droppable(b){if(!b)throw new Error('Element should be a DOM node');if(this==window){if(b instanceof Array){var a=[];b.each(function(c){a.push(new Droppable(c));});return new Collection(Droppable,a);}else return new Droppable(b);}else{this.data={};this.dom=b;this.namespace=null;}}Droppable.prototype.destroy=function(){if(this.namespace)Drag.removeDroppable(this.namespace,this);this.data=this.dom=null;};Droppable.prototype.setNamespace=function(a){if(this.namespace)Drag.removeDroppable(a,this);this.namespace=a;Drag.addDroppable(a,this);return this;};Droppable.prototype.zIndex=0;Droppable.prototype.setZIndex=function(a){this.zIndex=a;return this;};Droppable.prototype.pointInside=function(b){var a=Vector2.getElementPosition(this.dom);return a.x<=b.x&&this.dom.offsetWidth+a.x>b.x&&a.y<=b.y&&this.dom.offsetHeight+a.y>b.y;};Droppable.prototype.ondragover=bagofholding;Droppable.prototype.setDragOverHandler=function(a){this.ondragover=a;return this;};Droppable.prototype.ondragmove=bagofholding;Droppable.prototype.setDragMoveHandler=function(a){this.ondragmove=a;return this;};Droppable.prototype.ondrop=bagofholding;Droppable.prototype.setDropHandler=function(a){this.ondrop=a;return this;};Droppable.prototype.getDOM=Draggable.prototype.getDOM;Droppable.prototype.setKey=Draggable.prototype.setKey;Droppable.prototype.getKey=Draggable.prototype.getKey;
function SortableGroup(){this.namespace='sortable'+(++SortableGroup.instanceCount);this.draggables={};this.droppables={};this.sortables={};this.linkedGroups=[];this.linkedGroups.onlinkjump=bagofholding;this.rootNode=null;this.boundingBox=null;this.neverEmpty=false;this.hasEmptyMessage=false;this.isDroppable=true;this.anchor=null;}SortableGroup.instanceCount=0;SortableGroup.prototype.gutter=15;SortableGroup.prototype.setBoundingBox=function(a){this.boundingBox=a;for(var b in this.draggables)this.draggables[b].setBoundingBox(this.boundingBox);return this;};SortableGroup.prototype.setDroppable=function(a){this.isDroppable=a;return this;};SortableGroup.prototype._initializeAdded=function(a,b){if(this.rootNode===null){this.rootNode=b.parentNode;if(!this.linkedGroups.placeholder){this.linkedGroups.placeholder=this.placeholder=$N(b.tagName,{className:'dragPlaceholder',style:{padding:'0px'}});}else this.placeholder=this.linkedGroups.placeholder;}else if(this.rootNode!=b.parentNode)throw new Error('All sortables of a collection must share the same parentNode');if(a in this.draggables)throw new Error('All sortables must have a unique key');};SortableGroup.prototype.addSortable=function(b,c,a){this._initializeAdded(b,c);this.sortables[b]=c;this.draggables[b]=(new Draggable(c)).setNamespace(this.namespace).setGutter(this.gutter).setUseAbsolute(true).setGrabHandler(this.grabHandler.bind(this,b)).setDropHandler(this.dropHandler.bind(this,b)).setKey('key',b).setBoundingBox(this.boundingBox);if(a)this.draggables[b].addHandle(a);this.droppables[b]=(new Droppable(c)).setNamespace(this.namespace).setDragOverHandler(this._dragOverHandlerShim.bind(null,this,b));return this;};SortableGroup.prototype.addEmptyMessage=function(b,c){var a='placeholder';if(b.parentNode!=c)c.appendContent(b);this._initializeAdded(a,b);this.hasEmptyMessage=true;this.sortables[a]=b;this.droppables[a]=(new Droppable(b)).setNamespace(this.namespace).setDragOverHandler(this._dragOverHandlerShim.bind(null,this,a));return this;};SortableGroup.prototype.setNeverEmpty=function(a){this.neverEmpty=a;};SortableGroup.prototype.link=function(c){c.linkedGroups=this.linkedGroups;if(!this.linkedGroups.length)this.linkedGroups.push(this);this.linkedGroups.push(c);for(var a=0;a<this.linkedGroups.length;a++)if(this.linkedGroups[a].namespace!=this.namespace){this.linkedGroups[a].namespace=this.namespace;for(var b in this.linkedGroups[a].droppables){this.linkedGroups[a].droppables[b].setNamespace(this.namespace);this.linkedGroups[a].draggables[b].setNamespace(this.namespace);}}return this;};SortableGroup.prototype.getOrder=function(){if(!this.rootNode)return [];var d=[],a=this.rootNode.childNodes;for(var b=0;b<a.length;b++)for(var c in this.sortables)if(this.sortables[c]==a[b]){d.push(c);break;}return d;};SortableGroup.prototype.migrateLinkedSortable=function(b){for(var a=0;a<this.linkedGroups.length;a++)if(b in this.linkedGroups[a].draggables){this.sortables[b]=this.linkedGroups[a].sortables[b];this.draggables[b]=this.linkedGroups[a].draggables[b];this.draggables[b].setGrabHandler(this.grabHandler.bind(this,b)).setDropHandler(this.dropHandler.bind(this,b));this.droppables[b]=this.linkedGroups[a].droppables[b];this.droppables[b].setDragOverHandler(this._dragOverHandlerShim.bind(null,this,b));delete this.linkedGroups[a].sortables[b];delete this.linkedGroups[a].draggables[b];delete this.linkedGroups[a].droppables[b];return true;}return false;};SortableGroup.prototype.setLinkJumpHandler=function(a){this.linkedGroups.onlinkjump=a;return this;};SortableGroup.prototype.onorderchange=bagofholding;SortableGroup.prototype.setOrderChangeHandler=function(a){this.onorderchange=a;return this;};SortableGroup.prototype.ongrabcallback=bagofholding;SortableGroup.prototype.setGrabCallback=function(a){this.ongrabcallback=a;return this;};SortableGroup.prototype._checkLastRemaining=function(a){var b=this.hasEmptyMessage?2:1;return this.neverEmpty&&this.rootNode.childNodes.length==b;};SortableGroup.prototype.grabHandler=function(a){if(this._checkLastRemaining()){this.draggables[a].killDrag();return;}CSS.setClass(this.placeholder,this.sortables[a].className);CSS.addClass(this.placeholder,'droppable_placeholder');CSS.addClass(this.sortables[a],'drag');Vector2.getElementDimensions(this.sortables[a]).setElementDimensions(this.placeholder);this.rootNode.insertBefore(this.placeholder,this.sortables[a]);this.ongrabcallback(a);if(!this.isDroppable){var b=this.sortables[a];this.anchor=b.nextSibling;if(!this.anchor){this.anchor=$N('div');b.parentNode.appendChild(this.anchor);}}};SortableGroup.prototype.ondropcallback=bagofholding;SortableGroup.prototype.setDropCallback=function(a){this.ondropcallback=a;return this;};SortableGroup.prototype.dropHandler=function(a){if(this._checkLastRemaining()){this.draggables[a].resetPosition();return;}CSS.removeClass(this.sortables[a],'drag');this.draggables[a].resetPosition();this.rootNode.insertBefore(this.sortables[a],this.placeholder);this.rootNode.removeChild(this.placeholder);for(var b=0;b<this.linkedGroups.length;b++)if(this.linkedGroups[b].anchor)delete this.linkedGroups[b].anchor;this.ondropcallback(a);this.onorderchange();};SortableGroup.prototype._dragOverHandlerShim=function(c,b,a){c.dragOverHandler(b,a.getKey('key'));};SortableGroup.prototype.dragOverHandler=function(f,d){if(!this.isDroppable&&!this.anchor)return;var h=false;if(!(d in this.draggables)){if(!this.migrateLinkedSortable(d))throw new Error('Draggable dropped onto a foreign droppable!');h=true;}var a=true,b=this.rootNode.childNodes,c=this.sortables[d],e=this.sortables[f];if(!this.anchor){var i=b.length;for(var g=0;g<i;g++)if(b[g]==e){break;}else if(b[g]==c){a=false;break;}}else e=this.anchor;if(a||this.anchor){this.rootNode.insertBefore(this.placeholder,e);}else this.rootNode.insertBefore(this.placeholder,e.nextSibling);this.rootNode.insertBefore(c,this.placeholder);this.ondragover(c,e);if(h)this.linkedGroups.onlinkjump.call(this,d);};SortableGroup.prototype.ondragover=bagofholding;SortableGroup.prototype.setDragOverCallback=function(a){this.ondragover=a;return this;};SortableGroup.prototype.destroy=function(){for(var b in this.droppables)this.droppables[b].destroy();for(var b in this.draggables)this.draggables[b].destroy();this.droppables=this.draggables=this.rootNode=null;this.linkedGroups.remove(this);for(var a=0;a<this.linkedGroups.length;a++)this.linkedGroups[a].linkedGroups=this.linkedGroups;};SortableGroup.prototype.removeSortable=function(a){if(a in this.sortables){this.draggables[a].destroy();this.droppables[a].destroy();delete this.draggables[a];delete this.droppables[a];delete this.sortables[a];}};SortableGroup.prototype.keyExists=function(a){return this.sortables[a];};
function custom_source(b){this.parent.construct(this);if(b.length&&typeof(b[0])=="string")for(var a=0;a<b.length;a++)b[a]={t:b[a],i:b[a]};this.values=b;this.build_index();}custom_source.extend('static_source');custom_source.prototype.text_placeholder=custom_source.prototype.text_noinput=false;custom_source.prototype.gen_html=function(c,a){var b=['<div>',typeahead_source.highlight_found(c.t,a),'</div>'];if(c.s)b.push('<div><small>',htmlspecialchars(c.s),'</small></div>');return b.join('');};
function newBoxAdded(f,b,g,e){if(!ge(e+b))return;var a=$(e+b);var c=document.createElement('div');var d='<div class="popcontent_advanced border_frame">'+'<div class="pop_content popcontent_old" id="pop_content"></div>'+'<div class="dialog_buttons">'+'<input type="submit" class="inputsubmit inputbutton" value="Keep"/>'+'<input type="submit" class="inputaux inputbutton" value="Remove">'+'</div></div>';set_inner_html(c,d);c.getElementsByTagName('input')[0].onclick=function(){animation(a.previousSibling).to('opacity',0).duration(200).hide().go();return false;};c.getElementsByTagName('input')[1].onclick=function(){removeAppBox(f,b,g,e);DOM.remove(a.previousSibling);};CSS.addClass(c,'add_new_box_border');c.childNodes[0].style.width=a.offsetWidth+20+'px';c.childNodes[0].style.position='absolute';c.childNodes[0].childNodes[0].style.height=a.offsetHeight+9+'px';a.parentNode.insertBefore(c,a);animation(DOMScroll.getScrollRoot()).to('scrollTop',elementY(a)-40).ease(animation.ease.end).duration(800).go();}function removeAppBox(d,b,e,c){if(!ge(c+b))return false;new AsyncRequest().setURI('/ajax/profile/box.php').setData({profile_id:d,app_id:b,action:'remove',tab_id:e}).send();var a=$(c+b);animation(a).to('opacity',0).duration(200).hide().ondone(DOM.remove.bind(null,c+b)).go();return false;}function moveToTab(d,a,b,e,f,c){new AsyncRequest().setURI('/ajax/profile/box.php').setData({to_tab:e,profile_id:d,app_id:a,action:'move_to_tab',from_tab:b}).setHandler(function(g){tab_controller.dirtyCachedView(f);if(f=='feed'||f=='wall')tab_controller.dirtyCachedView('box_3');DOM.remove('box_app_'+a);goURI(c);DOMScroll.scrollTo(new Vector2(0,0,'document'),false);}).send();return false;}
function search_selector_onfound(b){var a;if(!(a=ge('n')))return;a.value=b?b.i:-1;}function search_result_selector_onsubmit(a){$('search').init.value=ge('filter_init')?$('filter_init').value:'';$('search').sf.value=ge('filter_sf')?$('filter_sf').value:'';$('search').submit();this.hide();this.advance_focus();}function search_logged_ajax(a){new AsyncSignal('/ajax/search_log.php',a).send();}function search_log_2nd_action(a){new AsyncRequest().setURI('/ajax/search_log_2nd_action.php').setMethod('POST').setReadOnly(true).setContextData('clicktype',a).setContextData('source','profile_from_search').setHandler(function(){}).send();}function search_typeahead_log(a,b,d){if(!a)return;var c=a;if(b)c.evt=b;c.t=(new Date()).getTime();if(d)c.dt=c.t-d;new AsyncSignal('/ajax/typeahead_log.php',c).send();}var SearchDashboardKeyboardHandler=function(){return {right_arrow_key_handler:function(event,a){if(event.ctrlKey){if($('search_dashboard_next_session').href)goURI($('search_dashboard_next_session').href);}else if($('search_dashboard_next_query').href)goURI($('search_dashboard_next_query').href);return false;},left_arrow_key_handler:function(event,a){if(event.ctrlKey){if($('search_dashboard_prev_session').href)goURI($('search_dashboard_prev_session').href);}else if($('search_dashboard_prev_query').href)goURI($('search_dashboard_prev_query').href);return false;},right_arrow_key_filter:function(event,a){return true;}};}();
function ProfileTabController(j,u,e,s,m,f,n,r,p,b,k,a,l,g){this.tabs={};this.addTabLink=null;this.moreLink=null;this.topBar=s;this.numTabs=0;addEventBase($('top_bar_pic'),'click',function(v,event){v.onselect('wall');return Event.kill(event);}.bind(null,this));var q=m.getElementsByTagName('li');for(var i=0;i<q.length;i++){var d=q[i].getAttributeNode('view');if(d?d.specified:false){var t=q[i].getAttribute('view');if(CSS.hasClass(q[i],'selected'))this.currentView=t;this._hookUpTab(q[i],t);this.tabs[t]=q[i];var c=q[i].getElementsByTagName('a')[0];$(c).listen('click',function(event){if(this.activeDrag)return event.kill();});if(q[i].getElementsByTagName('a').length>1){var h=q[i].getElementsByTagName('a')[1];this._hookUpEdit(h,t,c.innerHTML);}this.numTabs++;}}if(ge(r)){this.tab_more=$(r);this.moreDropMenu=dropmenu(this.tab_more.childNodes[0]).registerHTMLMenu('menu_tab_more').setPosition(dropmenu.ALIGN_LEFT).addHook('show',function(){CSS.addClass(this.tab_more,'selected_tab_more');}.bind(this)).addHook('hide',function(){CSS.removeClass(this.tab_more,'selected_tab_more');}.bind(this));}if(ge(p)){this.add_tab=$(p);CSS.removeClass(this.add_tab,'hidden_elem');this.addMenu=flyout_menu(this.add_tab.childNodes[0]).registerHTMLMenu('flyout_menu_profile_add_tab').setMenuClickArea(DOM.find($('profile_tab_add'),'div.add_tab_app_typeahead')).setPosition(dropmenu.ALIGN_LEFT).addHook('show',function(){CSS.addClass(this.add_tab,'selected_menu_icon');}.bind(this)).addHook('hide',function(){CSS.removeClass(this.add_tab,'selected_menu_icon');}.bind(this));}this.id=j;this.viewer=u;this.is_impersonated=k;this.can_edit=e;this.root=m;this.canvas=f;this.leftColumn=f.firstChild;this.href='';this.cachedTabs={};this.ads_wanted=a;this.rightColumn=$('tab_canvas');if(!b){this.cachedTabs[n]=this.rightColumn.childNodes[0];}else onloadRegister(this.selectView.bind(this,n));this.nonSortables=l;this.maxSortableTabs=ProfileTabController.MAX_TABS-this.nonSortables.length;this.composerTab=g;if(e){this.sortableMainRoot=$('profile_tabs');this.sortableMoreRoot=this.tab_more&&this.tab_more.getElementsByTagName('ul')[0];this.sortableMain=new SortableGroup();if(this.sortableMore=this.sortableMoreRoot&&new SortableGroup())this.sortableMain.link(this.sortableMore);this.sortableMain.setLinkJumpHandler(this.onSortableLinkJump.bind(this));for(t in this.tabs){var o=this.tabs[t];if(!this.nonSortables.contains(o.getAttribute('view')))(o.parentNode==this.sortableMainRoot?this.sortableMain:this.sortableMore).addSortable(t,o,o.getElementsByTagName('a')[0]);}this.sortableMain.setOrderChangeHandler(this.saveTabOrder.bind(this));this.sortableMore.setOrderChangeHandler(this.saveTabOrder.bind(this));}PageTransitions.registerHandler(bind(this,'handleNavigation',n));tab_controller=this;}ProfileTabController.MAX_TABS=6;ProfileTabController.twoColumnViews={posts:true,info:true,wall:true};ProfileTabController.facebookTabs=['wall','posts','info','photos','box_3','app_2347471856','app_2392950137','app_2344061033','app_2373072738','app_6261817190'];ProfileTabController.prototype.getLastDisplayedView=function(){var a=this.sortableMain.getOrder();if(!a.length)return null;return a[a.length-1];};ProfileTabController.prototype.getFirstOverflowView=function(){var a=this.sortableMore.getOrder();if(!a.length)return null;return a[0];};ProfileTabController.prototype.onSortableLinkJump=function(b){var d=this.sortableMain.getOrder(),c=null;if(d.length>this.maxSortableTabs){for(var a=d.length-1;a>=0;a--)if(d[a]!=b&&d[a]!=this.currentView){c=d[a];break;}this.sortableMoreRoot.insertBefore(this.tabs[c],this.sortableMoreRoot.firstChild);this.sortableMore.migrateLinkedSortable(c);}else if(d.length<this.maxSortableTabs){d=this.sortableMore.getOrder();for(var a=0;a<d.length;a++)if(d[a]!=b){c=d[a];break;}this.sortableMainRoot.insertBefore(this.tabs[c],this.tab_more);this.sortableMain.migrateLinkedSortable(c);}if(this.moreDropMenu)this.moreDropMenu._positionMenu();};ProfileTabController.prototype._hookUpTab=function(d,e,a){var c=null;if(this.numTabs>=ProfileTabController.MAX_TABS){if(a){var b=$('tabs_more_menu').firstChild;b.appendChild(d);this.numTabs++;CSS.removeClass(this.tab_more,'hidden_elem');c=this.sortableMore;}}else if(a){if(this.tab_more){this.root.insertBefore(d,this.tab_more);}else this.root.insertBefore(d,this.add_tab);this.numTabs++;c=this.sortableMain;}if(c)c.addSortable(e,d,d.getElementsByTagName('a')[0]);};ProfileTabController.prototype.onselect=function(a){if(this.currentView==a||this.waitingForAjax)return;goURI(URI.getRequestURI().addQueryData({v:a}));};ProfileTabController.prototype._hookUpEdit=function(e,d,a){var c=document.createElement('div');var b=document.createElement('a');b.innerHTML=_tx("Odstranit z\u00e1lo\u017eku");b.setAttribute('href','#');b.onclick=this.deleteTab.bind(this,d);c.appendChild(b);flyout_menu(e).setMarkupContent('edit_menu_'+d,'link_menu flyout_menu_18',_tx("Mo\u017enosti z\u00e1lo\u017eky"),c).addHook('show',function(){CSS.addClass(e,'selected');}.bind(this)).addHook('hide',function(){CSS.removeClass(e,'selected');}.bind(this));return false;};ProfileTabController.prototype.handleNavigation=function(a,h){var e=h.getQueryData();var f=e.viewas||this.viewer;var c=function(i){if(this.ads_wanted&&parseInt(this.viewer)>0)ads_refresh(this.currentView,new URI(h).getPath(),false,false,false,i);PageTransitions.transitionComplete();}.bind(this);if(e.app_page){this.selectPage(e.fbhref,c);return true;}if(e.story_fbid)return false;if(!(ProfileURIController.isDestinationURIProfilePage(h)&&f==this.viewer))return false;if(!e.v&&this.currentView==a)return false;if(window.ProfilePhotosTabController){var g=ProfilePhotosTabController.transitionHandler(this.currentView,h,a);if(g!==null)return g;}var b={v:1,id:1,viewas:1,ref:1};for(var d in e)if(!b[d])return false;if(e.ref=='search')search_log_2nd_action('Select tab:'+e.v);this.selectView(e.v||a,c);return true;};ProfileTabController.prototype.selectView=function(b,a){if(this.addMenu)this.addMenu.hide();if(!this.tabs[b]){new URI('/profile.php').addQueryData({v:b}).go();return false;}this.selectTab(b);if(!ProfileTabController.twoColumnViews[b]&&ProfileTabController.twoColumnViews[this.currentView]){CSS.removeClass(document.body,'profile_two_columns');}else if(ProfileTabController.twoColumnViews[b]&&!ProfileTabController.twoColumnViews[this.currentView])CSS.addClass(document.body,'profile_two_columns');this.changePage(b,'',a);};ProfileTabController.prototype.selectTab=function(h){if(intl_locale_is_rtl()){var g='padding-left';}else var g='padding-right';for(var c in this.tabs)if(c==h){if(this.sortableMore&&this.sortableMore.getOrder().contains(h)){var e=this.getLastDisplayedView();var d=this.tabs[e];var b=this.getFirstOverflowView();var a=this.tabs[b];var f=d.previousSibling;DOM.insertBefore(d,a);DOM.insertAfter(f,this.tabs[c]);this.sortableMore.migrateLinkedSortable(e);this.sortableMain.migrateLinkedSortable(h);}if(this.tabs[c].childNodes[1]){animation(this.tabs[c].childNodes[0]).from(g,'11px').to(g,'25px').duration(100).go();animation(this.tabs[c].childNodes[1]).from('width','0').to('width','19px').duration(100).go();}CSS.addClass(this.tabs[c],'selected');}else if(CSS.hasClass(this.tabs[c],'selected')){CSS.removeClass(this.tabs[c],'selected');if(this.tabs[c].childNodes[1])animation(this.tabs[c].childNodes[0]).from(g,'25px').to(g,'11px').duration(100).go();}};ProfileTabController.prototype.selectPage=function(a,b){this.changePage(this.currentView,a,b);};ProfileTabController.prototype.fetchPage=function(e,b,a,c,d){c=c||'';subdomain=ProfileTabController.facebookTabs.contains(e)?'www':'apps';var f={id:this.id,v:e,href:b,iframe:true};if(this.is_impersonated&&this.viewer)f.viewas=this.viewer;new AsyncRequest().setOption('useIframeTransport',true).setReadOnly(true).setMethod('GET').setURI(new URI('/ajax/profile/tab.php').setSubdomain(subdomain)).setData(f).setContextData('src_tab_name',c).setContextData('dst_tab_name',e).setNectarActionData().setHandler(function(h){var g=h.getPayload();if(g.redirect){goURI(g.redirect);}else{var i=!b;a(HTML(g.tab_content),e,i,g.additional_content);}}.bind(this)).setFinallyHandler(function(g){this.waitingForAjax=false;d&&d(0);}.bind(this)).send();this.waitingForAjax=true;};ProfileTabController.prototype.changePage=function(f,a,d){var e=this.rightColumn;while(this.rightColumn.childNodes.length)this.rightColumn.removeChild(this.rightColumn.childNodes[0]);CSS.addClass(this.rightColumn,'loading');var b=this.currentView;this.currentView=f;this.href=a;var c=function(k,m,l,g){if(g)for(var j=0;j<g.length;++j){var h=g[j];DOM.setContent($(h.div_id),HTML(h.html));}CSS.removeClass(e,'loading');var n;if(k instanceof HTML){var i=$N('div');e.appendChild(i);DOM.setContent(i,k);if(l)this.cachedTabs[m]=i;n=false;}else{e.appendChild(k);n=true;}}.bind(this);if(this.cachedTabs[f]&&!a&&(b!=f)){c(this.cachedTabs[f],f,true);d&&d(1);}else this.fetchPage(f,a,c,b,d);};ProfileTabController.prototype.dirtyCachedView=function(a){if(this.cachedTabs[a])delete this.cachedTabs[a];};ProfileTabController.prototype.addNewTab=function(g,a,f,b){if(this.addMenu)this.addMenu.hide();var e=document.createElement('li');var d=document.createElement('a');CSS.setClass(d,'tab_link');d.innerHTML=f;var c=document.createElement('a');CSS.setClass(c,'edit');e.appendChild(d);e.appendChild(c);if(b){new AsyncRequest().setURI('/ajax/profile/tab.php').setData({id:this.id,action:'add_app_tab'}).setHandler(function(h){var i='box_'+h.payload.tab_id;e.setAttribute('view',i);this._hookUpTab(e,i,true);this._hookUpView(e,d,c,f,i);if(g)CSS.addClass(g,'hidden_elem');}.bind(this)).send();}else new AsyncRequest().setURI('/ajax/profile/tab.php').setData({id:this.id,action:'add_tab',tab_id:a}).setHandler(function(h){var i=(f=="Photos"?'photos':'app_'+a);e.setAttribute('view',i);this._hookUpTab(e,i,true);this._hookUpView(e,d,c,f,i);if(g)CSS.addClass(g,'hidden_elem');}.bind(this)).send();};ProfileTabController.prototype._hookUpView=function(e,d,c,a,g){var b=ProfileURIController.getCurrentProfileBaseURI();var f={v:g};if(this.is_impersonated&&this.viewer)f.viewas=this.viewer;d.href=b.addQueryData(f).toString();this._hookUpEdit(c,g,a);this.tabs[g]=e;this.onselect(g);};ProfileTabController.prototype.editTabName=function(j,d){var i=j.split('_')[1];var h=this.tabs[j];h.style.width=h.offsetWidth-2+'px';h.style.height=h.offsetheight+'px';var c=h.firstChild.offsetWidth-16;for(var e=0;e<h.childNodes.length;e++)hide(h.childNodes[e]);var f=document.createElement('form');var g=DOM.find(h,'.app_tab_title').innerHTML;f.innerHTML='<input type="text" id="tab_name_edit" class="inputtext" style="width:'+c+'px" value="'+g+'">';h.appendChild(f);$('tab_name_edit').focus();function b(k){f.onsubmit();}function a(k){Event.kill(k);}f.onsubmit=function(){var l=f.firstChild.value;var m=DOM.find(h,'.app_tab_title');m.innerHTML=l;h.removeChild(f);for(var k=0;k<h.childNodes.length;k++)show(h.childNodes[k]);document.body.removeEventListener('click',b,false);h.removeEventListener('click',a,true);new AsyncRequest().setURI('/ajax/profile/tab.php').setData({id:this.id,action:'rename_tab',tab_id:i,tab_name:l}).send();h.style.width=null;return false;}.bind(this);document.body.addEventListener('click',b,false);h.addEventListener('click',a,true);Event.kill(d);};ProfileTabController.prototype.deleteTab=function(h){var g;if(h=='photos'){g=2305272732;}else g=h.split('_')[1];new AsyncRequest().setURI('/ajax/profile/tab.php').setData({id:this.id,action:'delete_tab',tab_id:g}).send();var b=this.getFirstOverflowView();var a=this.tabs[b];var d=this.getLastDisplayedView();var c=this.tabs[d];if(b)DOM.insertAfter(c,a);this.sortableMain.migrateLinkedSortable(b);this.sortableMain.removeSortable(h);this.root.removeChild(this.tabs[h]);delete this.tabs[h];this.numTabs--;var e=ge('new_tab_'+g);if(e)CSS.removeClass(e,'hidden_elem');var f=this.getFirstOverflowView();if(!f)CSS.addClass(this.tab_more,'hidden_elem');this.onselect('wall');return false;};ProfileTabController.prototype.saveTabOrder=function(){var a=this.sortableMain.getOrder();if(this.sortableMore)a=a.concat(this.sortableMore.getOrder());new AsyncRequest().setURI('/ajax/profile/tab.php').setData({id:this.id,action:'reorder_tabs',tab_order:a}).send();};var ProfileURIController={_profileId:0,_profilePage:false,init:function(a){this._profileId=a;this._profileURI=URI.getRequestURI();this._setProfilePage(true);onunloadRegister(this._setProfilePage.bind(this,false));},_setProfilePage:function(a){this._profilePage=a;},isProfilePage:function(){return this._profilePage;},isDestinationURIProfilePage:function(b){if(!this.isProfilePage())return false;var a=b.getQueryData().id;if(b.getPath()=='/profile.php')return a==this._profileId;return this._profileURI.getPath()==b.getPath();},getCurrentProfileBaseURI:function(){var b=URI.getMostRecentURI();var a=b.getQueryData().id;var c={};if(a)c.id=a;return b.setQueryData(c);}};
function ProfileBoxController(g,a,h,b){this.profileId=g;this.applications={};this.columns=b;this.tabId=h;var e=null;var f;this.placeholderBox=document.createElement('div');CSS.setClass(this.placeholderBox,'box_placeholder');for(var d=0;d<a.length;d++)if(f=ge('box_app_'+a[d])){e=f.parentNode;var c={box:f,id:a[d]};this.applications[c.id]=c;f.addClass('moveable');(new Draggable(f)).addHandle(f.getElementsByTagName('h5')[0]).setNamespace('ProfileBoxController').setGutter(15).setUseAbsolute(true).setGrabHandler(function(i,j){i.expandColumns();i.placeholderBox.style.height=j.offsetHeight-6+'px';i.placeholderBox.style.width=j.offsetWidth+'px';CSS.addClass(j,'drag');j.style.width=j.offsetWidth+'px';j.parentNode.insertBefore(i.placeholderBox,j);j.style.zIndex=100;}.bind(null,this,f)).setDropHandler(function(i,j){this.resetPosition();i.placeholderBox.parentNode.insertBefore(this.getDOM(),i.placeholderBox);i.placeholderBox.parentNode.removeChild(i.placeholderBox);i.resetColumns();i.saveChanges(j);j.style.width=null;j.style.zIndex=null;}.bind(null,this,f)).setKey('app_id',c.id);(new Droppable(f)).setNamespace('ProfileBoxController').setZIndex(1).setDragMoveHandler(function(k,i,l,m){if(l.getDOM().offsetHeight>=m.y){var j=ProfileBoxController.insertElement(k.placeholderBox,this.getDOM());k.placeholderBox.style.width=this.getDOM().offsetWidth+'px';}}.bind(null,this,c.id));}if(this.columns.length>1)for(var d=0;d<this.columns.length;d++)(new Droppable(this.columns[d].dom)).setNamespace('ProfileBoxController').setZIndex(0).setDragOverHandler(function(j,i,k){if(j.placeholderBox.parentNode!=i){j.placeholderBox.style.width=i.offsetWidth+'px';i.appendChild(j.placeholderBox,this.getDOM());}}.bind(null,this,this.columns[d].dom));}ProfileBoxController.insertElement=function(d,e){var a=true,c=e.parentNode.childNodes;for(var b=0;b<c.length;b++)if(c[b]==e){break;}else if(c[b]==d){a=false;break;}if(a){e.parentNode.insertBefore(d,e);}else e.parentNode.insertBefore(e,d);return a;};ProfileBoxController.prototype.getAppFromId=function(a){return (/box_app_([0-9]+)/.exec(a)||[]).pop();};ProfileBoxController.prototype.getOrderFromDOM=function(){var a=[];this.columns.each(function(c){var d={column:c.column,order:[]};var b;var e=DOM.scry(c.dom,'div.box');for(var f=0;f<e.length;f++)if(e[f].id&&(b=this.getAppFromId(e[f].id)))d.order.push(parseInt(b,10));a.push(d);}.bind(this));return a;};ProfileBoxController.prototype.saveChanges=function(c){var a=this.getAppFromId(c.id);var b=DOM.find(c,'div.app_custom_content');b.style.visibility='hidden';CSS.addClass(c,'loading');new AsyncRequest().setURI('/ajax/profile/box.php').setData({action:'reorder',tab_id:this.tabId,order:this.getOrderFromDOM(),profile_id:this.profileId,app_id:a}).setHandler(function(d){DOM.replace(b,HTML(d.getPayload().box));CSS.removeClass(c,'drag');CSS.removeClass(c,'loading');}).send();};ProfileBoxController.prototype.expandColumns=function(){if(this.columns<2)return;var a=null;this.resetColumns();this.columns.each(function(b){a=Math.max(b.dom.offsetHeight,a);});this.columns.each(function(b){if(b.dom.offsetHeight!=a)b.dom.style.height=a+'px';});};ProfileBoxController.prototype.resetColumns=function(){this.columns.each(function(a){a.dom.style.height=null;});};var KEY_VAL=1;var VERTICAL_THUMBS=5;var EDIT_APP_THUMBS=6;var EDIT_REMOVE_APP_SECTION=7;var NO_INLINE_EDITOR={2361831622:1,2530096808:1};function ProfileInfoEdit(b,e,c){this.section_objs={};this.remember_edited=c;for(var a in e){var d=e[a];if(d.app_id){if(!NO_INLINE_EDITOR[d.app_id]){this.section_objs[d.section]=new ProfileInfoAppEditSection(d,this);ProfileInfoEdit.editors[d.section]=this.section_objs[d.section];}}else this.section_objs[d.section]=new ProfileInfoEditSection(d,this);}this.profile_id=b;this.info_tab=$('info_tab');this.info_sections=$('info_edit_sections');this.edit_all=$('info_edit_all');this.done_editing_all=$('info_done_editing_all');this.edit_all.onclick=this.onEditAll.bind(this,true);this.done_editing_all.onclick=this.onDoneEditingAll.bind(this);}ProfileInfoEdit.editors={};ProfileInfoEdit.uri='/ajax/profile/editinfo.php';ProfileInfoEdit.prototype.onEditAll=function(c){this.edit_all_mode=true;for(var a in this.section_objs){var d=this.section_objs[a];if(d.canEdit()){d.has_editor=false;d.closeEditor();}}CSS.addClass(this.info_tab,'edit_all_mode');var b=true;for(var a in this.section_objs){var d=this.section_objs[a];if(!d.canEdit())continue;d.getHeaderElem().onclick=this.editAllSetActiveSection.bind(this,d);if(b){d.populateEditor();d.openEditor(false);CSS.addClass(d.getSectionElem(),'edit_mode');if(c)ProfileInfoEdit.scrollToSection($('info_edits_div'));}b=false;}return false;};ProfileInfoEdit.prototype.editAllSetActiveSectionNext=function(a){var b=false;for(var c in this.section_objs){var d=this.section_objs[c];if(!d.canEdit())continue;if(b){if(!d.is_open&&!d.has_editor){CSS.addClass(d.getSectionElem(),'edit_mode');d.populateEditor();}d.toggleEditor(true);b=false;}else if(d.section!=a.section)d.closeEditor();if(d.section==a.section)b=true;}};ProfileInfoEdit.prototype.editAllSetActiveSection=function(a){for(var b in this.section_objs){var c=this.section_objs[b];if(!c.canEdit())continue;if(c.section==a.section){if(!c.is_open&&!c.has_editor){CSS.addClass(c.getSectionElem(),'edit_mode');c.populateEditor();}c.toggleEditor(true);}else c.closeEditor();}};ProfileInfoEdit.prototype.onDoneEditingAll=function(){for(var a in this.section_objs){var c=this.section_objs[a];if(c.canEdit()){var b=c.getSectionElem();c.cancelEditor();c.closeEditor();c.has_editor=false;CSS.removeClass(c.getSectionElem(),'edit_mode');c.getHeaderElem().onclick=null;}}if(this.remember_edited)new AsyncSignal('/ajax/nux_highlight.php',{action:"edit_info_tab"}).send();CSS.removeClass(this.info_tab,'edit_all_mode');this.edit_all_mode=false;return false;};ProfileInfoEdit.scrollToSection=function(a){animation(DOMScroll.getScrollRoot()).to('scrollTop',elementY(a)-40).ease(animation.ease.end).duration(400).go();};function ProfileInfoEditSectionBase(e,b){this.type=0;this.is_open=false;this.has_editor=false;this.app_id=0;this.controller=b;copy_properties(this,e);var c=e.section;copy_properties(this,{section_id:('info_section_'+c),header_id:('info_section_header_'+c),info_id:('info_section_info_'+c),editor_id:('info_section_editor_'+c),edit_id:('info_section_edit_'+c),edit_jaws_id:('info_section_edit_jaws_'+c),save_id:('info_section_save_'+c),cancel_id:('info_section_cancel_'+c)});var a=DOM.scry(this.getHeaderElem(),'a.close_edit');this.header_cancel_link=(a.length?a[0]:null);var d=this.getSectionElem();d.onmouseover=function(){CSS.addClass(this,'hover');};d.onmouseout=function(){CSS.removeClass(this,'hover');};}copy_properties(ProfileInfoEditSectionBase.prototype,{getSectionElem:function(){return $(this.section_id);},getHeaderElem:function(){return $(this.header_id);},getInfoElem:function(){return $(this.info_id);},getEditorElem:function(){return $(this.editor_id);},getEditElem:function(){return $(this.edit_id);},getEditJawsElem:function(){return $(this.edit_jaws_id);},getSaveElem:function(){return $(this.save_id);},getForm:function(){var a=this.getSaveElem();return a?a.form:null;},getCancelElem:function(){return $(this.cancel_id);},getAppId:function(){return this.app_id;},canEdit:function(){return true;}});ProfileInfoEditSectionBase.prototype.onClickEdit=function(){var b=this.getSectionElem();var a=this.getSectionElem();this.populateEditor();CSS.addClass(b,'edit_mode');CSS.removeClass(b,'empty');ProfileInfoEdit.scrollToSection(b);return false;};ProfileInfoEditSectionBase.prototype.populateEditor=function(){var d=this.getSectionElem();var b=this.getEditorElem();var c='<div class="fbloading"><span>'+_tx("Nahr\u00e1v\u00e1n\u00ed...")+'</span></div>';set_inner_html(b,c);var a={profile_id:this.controller.profile_id,section:this.section,type:6,app_id:this.getAppId(),edit_mode:true};new AsyncRequest().setURI(ProfileInfoEdit.uri).setReadOnly(true).setData(a).setHandler(this.replaceEditor.bind(this)).send();return false;};ProfileInfoEditSectionBase.prototype.replaceEditor=function(d){var f=this.getSectionElem();var b=this.getEditorElem();var c=d.getPayload();b.style.height='100px';DOM.setContent(b,HTML(c.editor));animation(b).to('height','auto').from('height','100px').duration(200).go();var e=this.getSaveElem();var a=this.getCancelElem();e.onclick=this.onSaveEditor.bind(this);a.onclick=this.onCancelEditor.bind(this);this.header_cancel_link&&(this.header_cancel_link.onclick=this.onCancelEditor.bind(this));this.has_editor=true;return false;};ProfileInfoEditSectionBase.prototype.onSaveEditor=function(){var a=this.getEditorElem();form=serialize_form(a);form.section=this.section;if(this.app_id)form.app_id=this.app_id;form.save=1;var b='<div class="fbloading"><span>'+'Saving...'+'</span></div>';set_inner_html(a,b);new AsyncRequest().setURI(ProfileInfoEdit.uri).setData(form).setHandler(function(e){var d=e.getPayload();var f=this.getSectionElem();if(d.editor){this.replaceEditor(e);return false;}this.has_editor=false;if(d.display){CSS.removeClass(f,'empty');}else CSS.addClass(f,'empty');var c=this.getInfoElem();set_inner_html(c,d.display);if(this.controller.edit_all_mode){this.closeEditor(true);this.controller.editAllSetActiveSectionNext(this);}else{CSS.removeClass(f,'edit_mode');ProfileInfoEdit.scrollToSection(f);}if(d.basic_info_summary)profile_basic_info_summary_refresh(d.basic_info_summary);}.bind(this)).send();return false;};ProfileInfoEditSectionBase.prototype.onCancelEditor=function(){var a=this.getSectionElem();CSS.removeClass(a,'edit_mode');if(!this.controller.edit_all_mode){this.cancelEditor();}else{this.closeEditor(true);this.has_editor=false;}ProfileInfoEdit.scrollToSection(a);return false;};ProfileInfoEditSectionBase.prototype.cancelEditor=function(){var b=this.getSectionElem();var a=this.getForm();if(a)a.is_inactive=true;this.has_editor=false;return false;};ProfileInfoEditSectionBase.prototype.toggleEditor=function(a){var b=this.getSectionElem();if(!this.is_open){this.openEditor(a);}else this.closeEditor();};ProfileInfoEditSectionBase.prototype.warnIfUnsaved=function(){if(!this.is_open)return false;var b=this.getForm();if(b&&b.original_state&&!are_equal(b.original_state,serialize_form(b))){var d=this.getSaveElem();var a=[];var c=function(){d.click();this.closeEditor(true);};a.push({name:'save',label:_tx("Ulo\u017eit"),handler:c.bind(this)});a.push({name:'dont_save',label:_tx("Neukl\u00e1dej"),className:'inputaux',handler:this.closeEditor.bind(this,true)});a.push(Dialog.CANCEL);new Dialog().setTitle(_tx("Neulo\u017een\u00e9 zm\u011bny")).setBody(_tx("N\u011bkter\u00e9 ze zm\u011bn nebyly ulo\u017eeny. Chce\u0161 je ulo\u017eit nyn\u00ed?")).setButtons(a).setModal().show();return true;}return false;};ProfileInfoEditSectionBase.prototype.closeEditor=function(c){if(!c)if(this.warnIfUnsaved())return null;var b=this.getSectionElem();var a;if(this.has_editor&&(a=this.getForm()))a.is_inactive=true;CSS.addClass(b,'shut');CSS.removeClass(b,'open');this.is_open=false;};ProfileInfoEditSectionBase.prototype.openEditor=function(b){var c=this.getSectionElem();var a=this.getForm();if(a)a.is_inactive=false;CSS.addClass(c,'open');CSS.removeClass(c,'shut');this.is_open=true;if(b)ProfileInfoEdit.scrollToSection(c);};function ProfileInfoEditSection(e,a){this.parent.construct(this,e,a);var b=[this.edit_id,this.edit_jaws_id];for(var c in b){var d=ge(b[c]);if(d)d.onclick=this.onClickEdit.bind(this);}}ProfileInfoEditSection.extend('ProfileInfoEditSectionBase');function ProfileInfoAppEditSection(d,a){this.parent.construct(this,d,a);this.app_id=d.app_id;if(ge('flyout_menu_info_section_'+this.app_id)){var b=this.getEditElem();var c=DOM.scry($('flyout_menu_info_section_'+this.app_id),'a');c[0].onclick=this.onClickEdit.bind(this);c[1].onclick=this.deleteBox.bind(this);flyout_menu(b).registerHTMLMenu('flyout_menu_info_section_'+this.app_id).setPosition(dropmenu.ALIGN_RIGHT).addHook('show',function(){CSS.addClass(b,'selected');}.bind(this)).addHook('hide',function(){CSS.removeClass(b,'selected');}.bind(this));}this.items={};this.order={};this.on=true;}ProfileInfoAppEditSection.extend('ProfileInfoEditSectionBase');ProfileInfoAppEditSection.prototype.deleteBox=function(){var a=this.getSectionElem();var c='/ajax/profile/editinfo.php';var b={profile_id:this.controller.profile_id,section:this.app_id,type:EDIT_REMOVE_APP_SECTION,app_id:this.app_id};new AsyncRequest().setURI(c).setData(b).setHandler(function(e){var d=elementY(a);animation(a).to('height',0).blind().duration(200).hide().go();animation(DOMScroll.getScrollRoot()).to('scrollTop',d-150).ease(animation.ease.end).duration(200).go();}).send();return false;};ProfileInfoAppEditSection.editors={};ProfileInfoAppEditSection.prototype.newAdd=function(c){var d='/ajax/profile/editinfo.php';var a={profile_id:this.controller.profile_id,section:this.app_id,type:EDIT_APP_THUMBS,new_add:true,new_index:c.i,app_id:this.app_id};var b=function(g){var f=$('info_section_info_'+this.app_id);var e=document.createElement('div');set_inner_html(e,g.payload.item);f.childNodes[0].childNodes[1].appendChild(e);}.bind(this);new AsyncRequest().setURI(d).setData(a).setHandler(b).send();};ProfileInfoAppEditSection.prototype.onSaveEditor=function(){var g=this;var f=g.getSectionElem();var c=g.getEditorElem();var e={};var b=f.getElementsByTagName('li');for(var d=0;d<b.length;d++)e[d]=b[d].getAttribute('item');var h='/ajax/profile/editinfo.php';var a={profile_id:this.controller.profile_id,section:this.app_id,type:EDIT_APP_THUMBS,save:true,items:e,app_id:this.app_id};if(this.controller.edit_all_mode){this.closeEditor(true);this.controller.editAllSetActiveSectionNext(this);}else{CSS.removeClass(f,'edit_mode');ProfileInfoEdit.scrollToSection(f);}new AsyncRequest().setURI(h).setData(a).send();return false;};function ProfileBoxesEdit(j,t,s,p){p=p||{};for(var k=0;k<s.length;k++){var c=$(s[k]);var b=DOM.scry(c,'div.box');for(var i=0;i<b.length;++i){var d=b[i];var h=DOM.scry(d,'a.box_editor');if(h.length>0){var g=h[0];var f=g.childNodes.length?g.firstChild:'';var a=d.id.replace('box_app_','');var m=document.createElement('div');if(f){m.appendChild(f);CSS.removeClass(f,'hidden_elem');}if(!ProfileBoxesEdit.NON_MOVEABLE[a]){if(p.name&&p.moveable_to_section[a]){var o=document.createElement('a');o.href='#';o.innerHTML=_tx("P\u0159esunout na z\u00e1lo\u017eku {tab_name}",{tab_name:p.name});o.onclick=moveToTab.bind(this,j,a,p.from,p.to,p.to_tab_name,new URI(p.next_uri));m.appendChild(o);}else{var q=document.createElement('span');CSS.addClass(q,'unmovable');DOM.setContent(q,_tx("Toto pole nem\u016f\u017ee b\u00fdt p\u0159id\u00e1no na kartu Ze\u010f"));m.appendChild(q);}if(!ProfileBoxesEdit.NON_REMOVEABLE[a]){var r=document.createElement('a');r.href='#';r.innerHTML=_tx("Odstranit r\u00e1me\u010dek.");r.onclick=removeAppBox.bind(this,j,a,t,'box_app_');m.appendChild(r);}}var e=ProfileBoxesEdit.flymenuStyle[a]||'flyout_menu_18 link_menu';var n='box_edit_menu_'+a;var l=dropmenu.getExistingInstance(n);if(l)l.destroy();(new flyout_menu(g)).setMarkupContent(n,e,_tx("Upravit pole"),m).addHook('show',function(u){CSS.addClass(u,'selected');}.bind(null,g)).addHook('hide',function(u){CSS.removeClass(u,'selected');}.bind(null,g));CSS.removeClass(g,'hidden_elem');}}}}ProfileBoxesEdit.NON_MOVEABLE={2356318349:1};ProfileBoxesEdit.NON_REMOVEABLE={2530096808:1,8152663228:1,7919256574:1,70004827638:1};ProfileBoxesEdit.flymenuStyle={2356318349:'flyout_menu_18'};function profile_insert_loading_layer(b){var a=$N('div');CSS.addClass(a,'loading_layer');b.parentNode.style.position='relative';a.style.position='absolute';b.parentNode.appendChild(a);return a;}function profile_basic_info_summary_refresh(a){$('flyout_menu_profile_basic_info_editor').remove();DOM.replace($('basic_info_summary_box'),HTML(a));}function profile_basic_info_summary_editor_onclick(){var d=$('basic_info_summary_box');var c=profile_insert_loading_layer(this);var a=this.value;var b=DOM.find(d,'div.'+a);var e=!this.checked?animation(b).to('height','0px').to('opacity',0).duration(200).hide():animation(b).to('height','auto').from('0px').to('opacity',1).from(0).duration(200).show();new AsyncRequest().setURI('/ajax/profile/basic_info.php').setData(this.checked?{show:a}:{hide:a}).setHandler(function(j){var i=DOM.find(d,'div.no_info');var f=true;var g=DOM.scry(this.form,'input[type="checkbox"]');for(var h=0;h<g.length&&f;h++)f&=!shown(g[h])||!g[h].checked;f?show(i):hide(i);e.go();}.bind(this)).setErrorHandler(function(f){this.checked=!this.checked;ErrorDialog.showAsyncError(f);}.bind(this)).setFinallyHandler(DOM.remove.bind(null,c)).send();}var FriendsBoxEditor={_submit:function(b){var a=$('app_content_2356318349');var d=DOM.find(a,'div.loading_placeholder');var c=$('profile_friends_box_inner_content');Vector2.getElementDimensions(c).setElementHeight(d);CSS.addClass(a,'is_loading');new AsyncRequest().setURI('/ajax/profile/friends_box.php').setData(b).setHandler(function(e){payload=e.getPayload();DOM.replace(c,HTML(payload.friendsBox));}).setFinallyHandler(CSS.removeClass.bind(null,a,'is_loading')).send();},setNumToShow:function(a){FriendsBoxEditor._submit({max_num_to_show:a.value});},toggleNetwork:function(a){var c=serialize_form(a.form).networks;var b={};var d=DOM.scry($('content_box_edit_menu_2356318349'),'div.networks_error')[0];if(c){b.networks=c;hide(d);}else{show(d);a.checked=true;return false;}FriendsBoxEditor._submit(b);return true;},addFriendOrList:function(b){var a;if(b.flid){a={add_friend_list:b.flid};}else if(b.i)a={add_friend:b.i};FriendsBoxEditor._submit(a);},removeFriendOrList:function(b){var a;if(b.flid){a={remove_friend_list:b.flid};}else if(b.i)a={remove_friend:b.i};FriendsBoxEditor._submit(a);},toggleShowNetworks:function(a){FriendsBoxEditor._submit({show_networks:a.checked});},toggleShowFriendsBox:function(a){FriendsBoxEditor._submit({hide_friendsbox:!a.checked});}};var ConnectionsBoxEditor={_submit:function(b){var a=$('app_content_70004827638');var d=DOM.find(a,'div.loading_placeholder');var c=$('profile_connections_box_inner_content');Vector2.getElementDimensions(c).setElementHeight(d);CSS.addClass(a,'is_loading');new AsyncRequest().setURI('/ajax/profile/connections_box.php').setData(b).setHandler(function(e){DOM.replace(c,HTML(e.getPayload()));}).setFinallyHandler(CSS.removeClass.bind(null,a,'is_loading')).send();},setNumToShow:function(a){ConnectionsBoxEditor._submit({max_num_to_show:a.value});}};function BlurbEditor(b,c,a){this.root=b;this.text=c;this.profileId=a;this.textElem=DOM.find(this.root,'div.text_wrapper');this.editLink=DOM.find(this.root,'a.edit_link');this.promptElem=DOM.find(this.root,'div.prompt');this.editorElem=DOM.find(this.root,'div.edit');this.inputBox=DOM.find(this.editorElem,'textarea');this.needCursorHack=ua.firefox()<3;this.cursorHacked=false;this.editLink.onmousedown=chain(this.editLink.onmousedown,this.toggleEditor.bind(this));this.promptElem.onmousedown=chain(this.promptElem.onmousedown,this.toggleEditor.bind(this));this.inputBox.onfocus=chain(this.inputBox.onfocus,DOM.setCaretPosition.bind(null,this.inputBox,0,Number.POSITIVE_INFINITY));this.inputBox.onkeypress=chain(this.inputBox.onkeypress,this.onkeypress.bind(this));if(!this.needCursorHack)this.inputBox.onblur=chain(this.inputBox.onblur,this.blur.bind(this));this.mode=BlurbEditor.READ;CSS.removeClass(this.editLink,'hidden_elem');}BlurbEditor.EDIT=1;BlurbEditor.READ=2;BlurbEditor.UPDATING=3;copy_properties(BlurbEditor.prototype,{_updateView:function(a){this.mode=a;if(this.mode==BlurbEditor.READ){CSS.removeClass(this.root,'blurb_editing');this.editLink.title=_tx("Upravit");hide(this.editorElem);if(!this.text){hide(this.textElem);hide(this.editLink);show(this.promptElem);}else{hide(this.promptElem);show(this.textElem);show(this.editLink);}}else if(this.mode==BlurbEditor.EDIT){CSS.addClass(this.root,'blurb_editing');this.editLink.title=_tx("Ulo\u017eit");this.inputBox.value=this.text;hide(this.textElem);hide(this.promptElem);show(this.editLink);show(this.editorElem);if(this.needCursorHack&&!this.cursorHacked){this.inputBox.focus();this.inputBox.blur();this.inputBox.onblur=chain(this.inputBox.onblur,this.blur.bind(this));this.cursorHacked=true;}this.inputBox.focus();}},toggleEditor:function(){if(this.mode==BlurbEditor.EDIT){this.blur();}else if(this.mode==BlurbEditor.READ){this._updateView(BlurbEditor.EDIT);}else this.mode==BlurbEditor.UPDATING;return false;},blur:function(a){if(this.mode!=BlurbEditor.EDIT)return;if(this.text==this.inputBox.value){this._updateView(BlurbEditor.READ);return;}this.mode=BlurbEditor.UPDATING;this.inputBox.disabled=true;CSS.addClass(this.inputBox,'updating');this._syncText(this.inputBox.value);new AsyncRequest().setURI('/ajax/profile/blurb.php').setData({blurb:this.text,profile_id:this.profileId}).setHandler(function(b){DOM.setContent(this.textElem,HTML(b.getPayload()));}.bind(this)).setFinallyHandler(function(){this._updateView(BlurbEditor.READ);CSS.removeClass(this.inputBox,'updating');this.inputBox.disabled=false;}.bind(this)).send();},_syncText:function(a){this.text=trim(a);this.inputBox.value=this.text;},onkeypress:function(a){var b=Event.getKeyCode(a);if(b==KEYS.TAB){this.blur();return false;}if(b==KEYS.ESC){this._syncText(this.text);this.blur();return false;}return true;}});function profilePictureEditorCreateFlyout(){var a=$('edit_profilepicture');var b=$('edit_profilepicture_icon');return flyout_menu(a).registerHTMLMenu($('profile_picture_flyout')).setPosition(dropmenu.ALIGN_LEFT).setIconPosition(b).addHook('show',function(c){CSS.addClass(c,'edit_profilepicture_icon_disabled');}.bind(null,a)).addHook('hide',function(c){CSS.removeClass(c,'edit_profilepicture_icon_disabled');}.bind(null,a));}function basicProfileEditorSetup(c,b){var a=DOM.find($(c),'a.box_editor');flyout_menu(a).registerHTMLMenu(b).setMenuClickArea(DOM.find($(b),'div.menu_custom')).setPosition(dropmenu.ALIGN_LEFT).addHook('show',CSS.addClass.bind(null,a,'selected')).addHook('hide',CSS.removeClass.bind(null,a,'selected'));CSS.removeClass(a,'hidden_elem');}

if (window.Bootloader) { Bootloader.done(["js\/daaf69u2r9ws0gko.pkg.js"]); }