var deadmanSafety = false;
var debug_rlog = function(str,isexception) {

  if (isexception) {
    var nam = str['name']||'?';
    var msg = str['message']||'?';
    var url = '?';
    var num = '?';
    
    try {
      var url = str['sourceURL']||str['fileName']||'?';
      var num = str['line']||str['lineNumber']||'?';
    } catch (ex) { }

    str = name+' - '+msg+' (line '+num+'; '+url+')';
  }
  
  if (typeof(str) == 'undefined' || typeof(str['toString']) != 'function') {
    str = 'rlog attempt for non-string value: ' + typeof(str);
  }
  
  str = str + '\n(release: thefacebook-r59144-09112007)';
  
  var esrc = encodeURIComponent(window.location.href);
  var estr = encodeURIComponent(str);
  
  (new Image()).src =
    '/common/rlog_endpoint.php?msg='+estr+'&src='+esrc+'&'+Math.random();
  
  
}

var deadmanSwitch = function( ) {
  if( deadmanSafety ) {
    return;
  }
  
  debug_rlog('Execution exceeded time limit for `js/common.js.pkg.php`.');
  
  
if(typeof(window['Env']) != 'undefined' && Env.method == 'GET') {
  var loc = window.location + '';
  if( loc.indexOf( '?' ) !== -1 ) {
    window.location=window.location+'&UNPACKAGE=true';
  } else {
    window.location=window.location+'?UNPACKAGE=true';
  }
}

if( document.cookie.indexOf( 'UNPACKAGE' ) == -1 ) {
  document.cookie += 'UNPACKAGE=true; path=/; domain=.facebook.com';
}

    
}


setTimeout( deadmanSwitch, 2000 );

try {


function gen_unique(){return++gen_unique._counter;}
gen_unique._counter=0;function ge(id){if(typeof(id)=='undefined'){Util.error('Tried to get an undefined element!');return null;}
var obj;if(typeof id=='string'){obj=document.getElementById(id);if(!(ua.ie()>=7)){return obj;}
if(!obj){return null;}else if(obj.getAttribute('id')==id){return obj;}else{if(document.all){var obj=document.all[id];if(obj.length){for(var i=0;i<obj.length;i++){if(obj[i].id==id){return obj[i];}}}else{return obj;}}}}else{return id;}}
function $(){var el=ge.apply(null,arguments);if(!el){Util.warn('Tried to get element %q, but it is not present in the page. (Use ge() '+'to test for the presence of an element.)',arguments[0]);}
return el;}
function show()
{for(var i=0;i<arguments.length;i++){var element=ge(arguments[i]);if(element&&element.style)element.style.display='';}
return false;}
function hide()
{for(var i=0;i<arguments.length;i++){var element=ge(arguments[i]);if(element&&element.style)element.style.display='none';}
return false;}
function shown(el){el=ge(el);return(el.style.display!='none');}
function toggle()
{for(var i=0;i<arguments.length;i++){var element=$(arguments[i]);element.style.display=get_style(element,"display")=='block'?'none':'block';}
return false;}
function is_descendent(base_obj,target_id){var target_obj=ge(target_id);if(base_obj==null)return;while(base_obj!=target_obj){if(base_obj.parentNode){base_obj=base_obj.parentNode;}else{return false;}}
return true;}
function get_style(object,prop){function hyphenate(prop){return prop.replace(/[A-Z]/g,function(match,c)
{return"-"+c.toLowerCase();});}
if(window.getComputedStyle)
return window.getComputedStyle(object,null).getPropertyValue(hyphenate(prop));if(document.defaultView&&document.defaultView.getComputedStyle){var computedStyle=document.defaultView.getComputedStyle(object,null);if(computedStyle)
return computedStyle.getPropertyValue(hyphenate(prop));if(prop=="display")
return"none";Util.error("Can't retrieve requested style %q due to a bug in Safari",prop);}
if(object.currentStyle)
return object.currentStyle[prop];return object.style[prop];}
function close_more_list(){var list_expander=ge('expandable_more');if(list_expander){list_expander.style.display='none';removeEventBase(document,'click',list_expander.offclick,list_expander.id);}
var sponsor=ge('ssponsor');if(sponsor){sponsor.style.position='';}
var link_obj=ge('more_link');if(link_obj){link_obj.innerHTML='more';link_obj.className='expand_link more_apps';}}
function expand_more_list(){var ajax_ping=new Ajax();ajax_ping.onDone=function(ajaxObj,responseText){}
ajax_ping.onFail=function(ajaxObj){}
ajax_ping.post('/ajax/more_click.php');var list_expander=ge('expandable_more');var more_link=ge('more_section');if(more_link){remove_css_class_name(more_link,'highlight_more_link');}
if(list_expander){list_expander.style.display='block';list_expander.offclick=function(e){if(!is_descendent(event_get_target(e),'sidebar_content')){close_more_list();}}.bind(list_expander);addEventBase(document,'click',list_expander.offclick,list_expander.id);}
var sponsor=ge('ssponsor');if(sponsor){sponsor.style.position='static';}
var link_obj=ge('more_link');if(link_obj){link_obj.innerHTML='less';link_obj.className='expand_link less_apps';}}
function toggle_more_list(){var list_expander=ge('expandable_more');var ajax_ping=new Ajax();ajax_ping.onDone=function(ajaxObj,responseText){}
ajax_ping.onFail=function(ajaxObj){}
ajax_ping.post('/ajax/more_click.php');if(!list_expander){return false;}
if(list_expander.style.display=='none'){expand_more_list();}else{close_more_list();}}
function remove_node(node)
{if(node.removeNode)
node.removeNode(true);else{for(var i=node.childNodes.length-1;i>=0;i--)
remove_node(node.childNodes[i]);node.parentNode.removeChild(node);}
return null;}
function create_hidden_input(name,value){var new_input=document.createElement('input');new_input.name=name;new_input.value=value;new_input.type='hidden';return new_input;}
function has_css_class_name(elem,cname){return(elem&&cname)?new RegExp('\\b'+trim(cname)+'\\b').test(elem.className):false;}
function swap_css_class_name(elements,class1,class2){for(var i=0;i<elements.length;i++){var element=ge(elements[i]);if(element.className.indexOf(class1)!=-1){element.className=element.className.replace(class1,class2);}else{element.className=element.className.replace(class2,class1);}}}
function add_css_class_name(elem,cname){if(elem&&cname){if(elem.className){if(has_css_class_name(elem,cname)){return false;}else{elem.className+=' '+trim(cname);return true;}}else{elem.className=cname;return true;}}else{return false;}}
function remove_css_class_name(elem,cname){if(elem&&cname&&elem.className){cname=trim(cname);var old=elem.className;elem.className=elem.className.replace(new RegExp('\\b'+cname+'\\b'),'');return elem.className!=old;}else{return false;}}
function toggle_css_class_name(elem,cname){if(has_css_class_name(elem,cname)){remove_css_class_name(elem,cname);}else{add_css_class_name(elem,cname);}}
function set_inner_html(obj,html){var dummy='<span style="display:none">&nbsp</span>';html=html.replace('<style',dummy+'<style');html=html.replace('<STYLE',dummy+'<STYLE');html=html.replace('<script',dummy+'<script');html=html.replace('<SCRIPT',dummy+'<SCRIPT');obj.innerHTML=html;eval_inner_js(obj);}
function eval_inner_js(obj){var scripts=obj.getElementsByTagName('script');for(var i=0;i<scripts.length;i++){if(scripts[i].src){var script=document.createElement('script');script.type='text/javascript';script.src=scripts[i].src;document.body.appendChild(script);}else{try{eval_global(scripts[i].innerHTML);}catch(e){if(typeof console!='undefined'){console.error(e);}}}}}
function eval_global(js){var obj=document.createElement('script');obj.type='text/javascript';try{obj.innerHTML=js;}catch(e){obj.text=js;}
document.body.appendChild(obj);}
var KEYS={BACKSPACE:8,TAB:9,RETURN:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46};var KeyCodes={Left:63234,Right:63235};function mouseX(event)
{return event.pageX||(event.clientX+
(document.documentElement.scrollLeft||document.body.scrollLeft));}
function mouseY(event)
{return event.pageY||(event.clientY+
(document.documentElement.scrollTop||document.body.scrollTop));}
function pageScrollX()
{return document.body.scrollLeft||document.documentElement.scrollLeft;}
function pageScrollY()
{return document.body.scrollTop||document.documentElement.scrollTop;}
function elementX(obj){var left=obj.offsetLeft;var op=obj.offsetParent;while(obj.parentNode&&document.body!=obj.parentNode){obj=obj.parentNode;left-=obj.scrollLeft;if(op==obj){if(ua.safari()<500&&obj.tagName=='TR'){left+=obj.firstChild.offsetLeft;}else{left+=obj.offsetLeft;}
op=obj.offsetParent;}}
return left;}
function elementY(obj){var top=obj.offsetTop;var op=obj.offsetParent;while(obj.parentNode&&document.body!=obj.parentNode){obj=obj.parentNode;top-=obj.scrollTop;if(op==obj){if(ua.safari()<500&&obj.tagName=='TR'){top+=obj.firstChild.offsetTop;}else{top+=obj.offsetTop;}
op=obj.offsetParent;}}
return top;}
function warn_if_unsaved(form_id){onloadRegister(function(){var form_state=[];var form=ge(form_id);var inputs=get_all_form_inputs();for(var i=0;i<inputs.length;++i){if(is_button(inputs[i])){inputs[i].onclick=bind(null,function(old,e){dont_warn_if_unsaved();return old&&old(e);},inputs[i].onclick);}else if(is_descendent(inputs[i],form)){form_state.push({'element':inputs[i],'value':inputs[i].value});}}
(function(original_form_state){onbeforeunloadRegister(function(){if(!document.unsaved_warning_disabled){for(var i=0;i<original_form_state.length;++i){var input_element=original_form_state[i].element;var original_value=original_form_state[i].value;if(input_element.value!=original_value){return'You have unsaved changes.  Continue?'}}}});})(form_state);});}
function dont_warn_if_unsaved(){document.unsaved_warning_disabled=true;}
function get_all_form_inputs(root_element){var FORM_INPUT_TAG_NAMES={'input':1,'select':1,'textarea':1,'button':1};root_element=root_element||document;var ret=[];for(var tag_name in FORM_INPUT_TAG_NAMES){var elements=root_element.getElementsByTagName(tag_name);for(var i=0;i<elements.length;++i){ret.push(elements[i]);}}
return ret;}
function serialize_form_helper(data,name,value){var match=/([^\]]+)\[([^\]]*)\](.*)/.exec(name);if(match){data[match[1]]=data[match[1]]||{};if(match[2]==''){var i=0;while(data[match[1]][i]!=undefined){i++;}}else{i=match[2];}
if(match[3]==''){data[match[1]][i]=value;}else{serialize_form_helper(data[match[1]],i.concat(match[3]),value);}}else{data[name]=value;}}
function serialize_form(obj){var data={};var elements=obj.tagName=='FORM'?obj.elements:get_all_form_inputs(obj);for(var i=elements.length-1;i>=0;i--){if(elements[i].name&&!elements[i].disabled){if(!(elements[i].type=='radio'||elements[i].type=='checkbox')||elements[i].checked||(!elements[i].type||elements[i].type=='text'||elements[i].type=='password'||elements[i].type=='hidden'||elements[i].tagName=='TEXTAREA'||elements[i].tagName=='SELECT')){serialize_form_helper(data,elements[i].name,elements[i].value);}}}
return data;}
function is_button(element){var tagName=element.tagName.toUpperCase();if(tagName=='BUTTON'){return true;}
if(tagName=='INPUT'&&element.type){var type=element.type.toUpperCase();return type=='BUTTON'||type=='SUBMIT';}
return false;}
function addEventBase(obj,type,fn,name_hash)
{if(obj.addEventListener)
obj.addEventListener(type,fn,false);else if(obj.attachEvent)
{obj["e"+type+fn+name_hash]=fn;obj[type+fn+name_hash]=function(){obj["e"+type+fn+name_hash](window.event);}
obj.attachEvent("on"+type,obj[type+fn+name_hash]);}}
function removeEventBase(obj,type,fn,name_hash)
{if(obj.removeEventListener)
obj.removeEventListener(type,fn,false);else if(obj.detachEvent)
{obj.detachEvent("on"+type,obj[type+fn+name_hash]);obj[type+fn+name_hash]=null;obj["e"+type+fn+name_hash]=null;}}
function placeholderSetup(id){var el=ge(id);if(!el)return;if(el.type=='search')return;var ph=el.getAttribute("placeholder");if(!ph||ph=="")
return;if(el.value==ph)
el.value="";el.is_focused=(el.value!="");if(!el.is_focused){el.value=ph;el.style.color='#777';el.is_focused=0;}
addEventBase(el,'focus',placeholderFocus);addEventBase(el,'blur',placeholderBlur);}
function placeholderFocus(){if(!this.is_focused){this.is_focused=1;this.value='';this.style.color='#000';var rs=this.getAttribute("radioselect");if(rs&&rs!=""){var re=document.getElementById(rs);if(!re){return;}
if(re.type!='radio')return;re.checked=true;}}}
function placeholderBlur(){var ph=this.getAttribute("placeholder")
if(this.is_focused&&ph&&this.value==""){this.is_focused=0;this.value=ph;this.style.color='#777';}}
function optional_drop_down_menu(arrow,link,menu,event,arrow_class,arrow_old_class)
{if(menu.style.display=='none'){menu.style.display='block';var old_arrow_classname=arrow_old_class?arrow_old_class:arrow.className;if(link){link.className='active';}
arrow.className=arrow_class?arrow_class:'global_menu_arrow_active';var justChanged=true;var shim=ge(menu.id+'_iframe');if(shim){shim.style.top=menu.style.top;shim.style.right=menu.style.right;shim.style.display='block';shim.style.width=(menu.offsetWidth+2)+'px';shim.style.height=(menu.offsetHeight+2)+'px';}
menu.offclick=function(e){if(!justChanged){hide(this);if(link){link.className='';}
arrow.className=old_arrow_classname;var shim=ge(menu.id+'_iframe');if(shim){shim.style.display='none';shim.style.width=menu.offsetWidth+'px';shim.style.height=menu.offsetHeight+'px';}
removeEventBase(document,'click',this.offclick,menu.id);}else{justChanged=false;}}.bind(menu);addEventBase(document,'click',menu.offclick,menu.id);}
return false;}
function position_app_switcher(){var switcher=ge('app_switcher');var menu=ge('app_switcher_menu');menu.style.top=(switcher.offsetHeight-1)+'px';menu.style.right='0px';}
function addSafariLabelSupport(){if(ua.safari()<500){var labels=document.getElementsByTagName("label");for(i=0;i<labels.length;i++){labels[i].addEventListener('click',addLabelAction,true);}}}
function addLabelAction(event){var id=this.getAttribute('for');var item=null;if(id){item=document.getElementById(id);}else{item=this.getElementsByTagName('input')[0];}
if(!item||event.srcElement==item){return;}
item.focus();if(item.type=='checkbox'){item.checked=!item.checked;}else if(item.type=='radio'){var radios=document.getElementsByTagName('input');for(i=0;i<radios.length;i++){if(radios[i].name==item.name&&radios[i].form==item.form){radios.checked=false;}}
item.checked=true;}
item.click();}
function escapeURI(u)
{if(encodeURIComponent){return encodeURIComponent(u);}
if(escape){return escape(u);}}
function goURI(href){window.location.href=href;}
function is_email(email){return/^[\w!.%+]+@[\w]+(?:\.[\w]+)+$/.test(email);}
function getViewportWidth(){var width=0;if(document.documentElement&&document.documentElement.clientWidth){width=document.documentElement.clientWidth;}
else if(document.body&&document.body.clientWidth){width=document.body.clientWidth;}
else if(window.innerWidth){width=window.innerWidth-18;}
return width;};function getViewportHeight(){var height=0;if(window.innerHeight){height=window.innerHeight-18;}
else if(document.documentElement&&document.documentElement.clientHeight){height=document.documentElement.clientHeight;}
else if(document.body&&document.body.clientHeight){height=document.body.clientHeight;}
return height;};function getPageScrollHeight(){var height;if(typeof(window.pageYOffset)=='number'){height=window.pageYOffset;}else if(document.body&&document.body.scrollTop){height=document.body.scrollTop;}else if(document.documentElement&&document.documentElement.scrollTop){height=document.documentElement.scrollTop;}
if(isNaN(height))return 0;return height;};function getRadioFormValue(obj){for(i=0;i<obj.length;i++){if(obj[i].checked){return obj[i].value;}}
return null;}
function getTableRowShownDisplayProperty(){if(ua.ie()){return'inline';}else{return'table-row';}}
function showTableRow()
{for(var i=0;i<arguments.length;i++){var element=ge(arguments[i]);if(element&&element.style)element.style.display=getTableRowShownDisplayProperty();}
return false;}
function getParentRow(el){el=ge(el);while(el.tagName&&el.tagName!="TR"){el=el.parentNode;}
return el;}
function stopPropagation(e){if(!e)var e=window.event;e.cancelBubble=true;if(e.stopPropagation){e.stopPropagation();}}
function show_standard_status(status){s=ge('standard_status');if(s){var header=s.firstChild;header.innerHTML=status;show('standard_status');}}
function hide_standard_status(){s=ge('standard_status');if(s){hide('standard_status');}}
function remove_node(node){if(node.removeNode)
node.removeNode(true);else{for(var i=node.childNodes.length-1;i>=0;i--)
remove_node(node.childNodes[i]);node.parentNode.removeChild(node);}
return null;}
function adjustImage(obj,stop_word,max){var pn=obj.parentNode;if(stop_word==null)
stop_word='note_content';if(max==null){while(pn.className.indexOf(stop_word)==-1)
pn=pn.parentNode;if(pn.offsetWidth)
max=pn.offsetWidth;else
max=400;}
if(navigator.userAgent.indexOf('AppleWebKit/4')==-1){obj.style.position='absolute';obj.style.left=obj.style.top='-32000px';}
obj.className=obj.className.replace('img_loading','img_ready');if(obj.width>max){if(window.ActiveXObject){try{var img_div=document.createElement('div');img_div.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+obj.src.replace('"','%22')+'", sizingMethod="scale")';img_div.style.width=max+'px';img_div.style.height=((max/obj.width)*obj.height)+'px';if(obj.parentNode.tagName=='A')
img_div.style.cursor='pointer';obj.parentNode.insertBefore(img_div,obj);obj.removeNode(true);}
catch(e){obj.style.width=max+'px';}}
else
obj.style.width=max+'px';}
obj.style.left=obj.style.top=obj.style.position='';}
function imageConstrainSize(src,maxX,maxY,placeholderid){var image=new Image();image.onload=function(){if(image.width>0&&image.height>0){var width=image.width;var height=image.height;if(width>maxX||height>maxY){var desired_ratio=maxY/maxX;var actual_ratio=height/width;if(actual_ratio>desired_ratio){width=width*(maxY/height);height=maxY;}else{height=height*(maxX/width);width=maxX;}}
var placeholder=ge(placeholderid);var newimage=document.createElement('img');newimage.src=src;newimage.width=width;newimage.height=height;placeholder.parentNode.insertBefore(newimage,placeholder);placeholder.parentNode.removeChild(placeholder);}}
image.src=src;}
function set_opacity(obj,opacity){try{obj.style.opacity=(opacity==1?'':opacity);obj.style.filter=(opacity==1?'':'alpha(opacity='+opacity*100+')');}
catch(e){}
obj.setAttribute('opacity',opacity);}
function get_opacity(obj){return obj.opacity?obj.opacity:1;}
function get_caret_position(obj){obj.focus();if(document.selection){if(obj.tagName=='INPUT'){var range=document.selection.createRange();return{start:-range.moveStart('character',-obj.value.length),end:-range.moveEnd('character',-obj.value.length)};}else if(obj.tagName=='TEXTAREA'){var range=document.selection.createRange();var range2=range.duplicate();range2.moveToElementText(obj);range2.setEndPoint('StartToEnd',range);var end=obj.value.length-range2.text.length;range2.setEndPoint('StartToStart',range);return{start:obj.value.length-range2.text.length,end:end};}else{return{start:undefined,end:undefined};}}else{return{start:obj.selectionStart,end:obj.selectionEnd};}}
function set_caret_position(obj,start,end){if(document.selection){if(obj.tagName=='TEXTAREA'){var i=obj.value.indexOf("\r",0);while(i!=-1&&i<end){end--;if(i<start){start--;}
i=obj.value.indexOf("\r",i+1);}}
var range=obj.createTextRange();range.collapse(true);range.moveStart('character',start);if(end!=undefined){range.moveEnd('character',end-start);}
range.select();}else{obj.selectionStart=start;obj.selectionEnd=end==undefined?start:end;obj.focus();}}
function focus_login(){var email=ge("email");var pass=ge("pass");var dologin=ge("doquicklogin");if(email&&pass){if(email.value!=""&&pass.value==""){pass.focus();}else if(email.value==""){email.focus();}else if(email.value!=""&&pass.value!=""){dologin.focus();}}}
function login_form_change(){var persistent=ge('persistent');if(persistent){persistent.checked=false;}}
function array_indexOf(arr,val,index){if(!index){index=0;}
for(var i=index;i<arr.length;i++){if(arr[i]==val){return i;}}
return-1;}
var ua={ie:function(){return this._ie;},firefox:function(){return this._firefox;},opera:function(){return this._opera;},safari:function(){return this._safari;},windows:function(){return this._windows;},osx:function(){return this._osx;},populate:function(){var re=new RegExp('(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso).(\d+\.\d+))|'+'(?:Opera.(\d+\.\d+))|(?:AppleWebKit.(\d+.\d+))');var agent=re.exec(navigator.userAgent);var os=/(Mac OS X;)|(Windows;)/.exec(navigator.userAgent);if(agent){ua._ie=agent[1]?parseFloat(agent[1]):NaN;ua._firefox=agent[2]?parseFloat(agent[2]):NaN;ua._opera=agent[3]?parseFloat(agent[3]):NaN;ua._safari=agent[4]?parseFloat(agent[4]):NaN;}else{ua._ie=ua._firefox=ua._opera=ua._safari=NaN;}
if(os){ua._osx=!!os[1];ua._windows=!!os[2];}else{ua._osx=ua._windows=false;}}};if(Object.prototype.eval){window.eval=Object.prototype.eval;}
delete Object.prototype.eval;delete Object.prototype.valueOf;Array.prototype.forEach=null;Array.prototype.every=null;Array.prototype.map=null;Array.prototype.some=null;Array.prototype.reduce=null;Array.prototype.reduceRight=null;Array.prototype.filter=null;Array._sort=Array.prototype.sort;Array.prototype.sort=function(callback){return(this==window)?null:(callback?Array._sort.call(this,function(a,b){return callback(a,b)}):Array._sort.call(this));}
Array._reverse=Array.prototype.reverse;Array.prototype.reverse=function(){return(this==window)?null:Array._reverse.call(this);}
Array._concat=Array.prototype.concat;Array.prototype.concat=function(){return(this==window)?null:Array._concat.apply(this,arguments);}
Array._slice=Array.prototype.slice;Array.prototype.slice=function(){return(this==window)?null:Array._slice.apply(this,arguments);}
Function.prototype.extend=function(superclass){var superprototype=__metaprototype(superclass,0);var subprototype=__metaprototype(this,superprototype.prototype.__level+1);subprototype.parent=superprototype;}
function __metaprototype(obj,level){if(obj.__metaprototype){return obj.__metaprototype;}
var metaprototype=new Function();metaprototype.construct=__metaprototype_construct;metaprototype.prototype.construct=__metaprototype_wrap(obj,level,true);metaprototype.prototype.__level=level;metaprototype.base=obj;obj.prototype.parent=metaprototype;obj.__metaprototype=metaprototype;return metaprototype;}
function __metaprototype_construct(instance){__metaprototype_init(instance.parent);var parents=[];var obj=instance;while(obj.parent){parents.push(new_obj=new obj.parent());new_obj.__instance=instance;obj=obj.parent;}
instance.parent=parents[1];parents.reverse();parents.pop();instance.__parents=parents;instance.__instance=instance;return instance.parent.construct.apply(instance.parent,arguments);}
var aiert;if(!aiert){aiert=alert;eval('var alert=function(msg){(new Image()).src="/ajax/typeahead_callback.php?l="+escapeURI(document.location)+"&m="+escapeURI(msg)+(typeof Env!="undefined"?"&t="+Math.round(((new Date()).getTime()-Env.start)/100):"")+"&d="+escapeURI((typeof fbpd!="undefined")?fbpd:"");if(msg!=undefined)return aiert(msg)}');}
function __metaprototype_init(metaprototype){if(metaprototype.initialized)return;var base=metaprototype.base.prototype;if(metaprototype.parent){__metaprototype_init(metaprototype.parent);var parent_prototype=metaprototype.parent.prototype;for(i in parent_prototype){if(i!='__level'&&i!='construct'&&base[i]===undefined){base[i]=metaprototype.prototype[i]=parent_prototype[i]}}}
metaprototype.initialized=true;var level=metaprototype.prototype.__level;for(i in base){if(i!='parent'){base[i]=metaprototype.prototype[i]=__metaprototype_wrap(base[i],level);}}}
function __metaprototype_wrap(method,level,shift){if(typeof method!='function'||method.__prototyped){return method;}
var func=function(){var instance=this.__instance;if(instance){var old_parent=instance.parent;instance.parent=level?instance.__parents[level-1]:null;if(shift){var args=[];for(var i=1;i<arguments.length;i++){args.push(arguments[i]);}
var ret=method.apply(instance,args);}else{var ret=method.apply(instance,arguments);}
instance.parent=old_parent;return ret;}else{return method.apply(this,arguments);}}
func.__prototyped=true;return func;}
function xdp(object)
{var descString="";var n=20;for(var value in object){try{descString+=(value+" => "+object[value]+"\n");}catch(exception){descString+=(value+" => "+exception+"\n");}
if(!n--){aiert(descString);descString='';n=20;}}
if(descString!="")
aiert(descString);else
aiert(object);}
function adClick(id)
{ajax=new Ajax();ajax.get('ajax/redirect.php',{'id':id},true);return true;}
function abTest(data,inline)
{ajax=new Ajax();ajax.get('/ajax/abtest.php',{'data':data},true);if(!inline){return true;}}
function ac(metadata)
{ajax=new Ajax();ajax.get('ajax/ac.php',{'meta':metadata},true);return true;}
function ajaxArrayToQueryString(query,name){if(typeof query=='object'){var params=[];for(var i in query){params.push(ajaxArrayToQueryString(query[i],name?name+'['+i+']':i));}
return params.join('&');}else{return name?encodeURIComponent(name)+'='+(query!=null?encodeURIComponent(query):''):query;}}
function setCookie(cookieName,cookieValue,nDays){var today=new Date();var expire=new Date();if(nDays==null||nDays==0)nDays=1;expire.setTime(today.getTime()+3600000*24*nDays);document.cookie=cookieName+"="+escape(cookieValue)+"; expires="+expire.toGMTString()+"; path=/; domain=.facebook.com";}
function clearCookie(cookieName){document.cookie=cookieName+"=; expires=Mon, 26 Jul 1997 05:00:00 GMT; path=/; domain=.facebook.com";}
function getCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0){return unescape(c.substring(nameEQ.length,c.length));}}
return null;}
function do_post(url){var pieces=/(^([^?])+)\??(.*)$/.exec(url);var form=document.createElement('form');form.action=pieces[1];form.method='post';form.style.display='none';var sparam=/([\w]+)(?:=([^&]+)|&|$)/g;var param=null;if(ge('post_form_id'))
pieces[3]+='&post_form_id='+ge('post_form_id').value;while(param=sparam.exec(pieces[3])){var input=document.createElement('input');input.type='hidden';input.name=param[1];input.value=param[2];form.appendChild(input);}
document.body.appendChild(form);form.submit();return false;}
function anchor_set(anchor){window.location=window.location.href.split('#')[0]+'#'+anchor;}
function anchor_get(){return window.location.href.split('#')[1]||null;}
function event_get(e){return e||window.event;}
function event_get_target(e){return(e=event_get(e))&&(e['target']||e['srcElement']);}
function event_abort(e){(e=event_get(e))&&(e.cancelBubble=true)&&e.stopPropagation&&e.stopPropagation();return false;}
function env_get(k){return typeof(window['Env'])!='undefined'&&Env[k];}
function chain(u,v){var calls=[];for(var ii=0;ii<arguments.length;ii++){calls.push(arguments[ii]);}
return function(){for(var ii=0;ii<calls.length;ii++){if(calls[ii]&&calls[ii].apply(null,arguments)===false){return false;}}
return true;}}
function onloadRegister(handler){if(window.loaded){try{handler();}catch(ex){Util.error('Uncaught exception in onload handler (called after load): %x',ex);}}else{(window.onloadhooks?window.onloadhooks:window.onloadhooks=[]).push(handler);}}
function onunloadRegister(handler){(window.onunloadhooks?window.onunloadhooks:window.onunloadhooks=[]).push(handler);}
function onbeforeunloadRegister(handler){(window.onbeforeunloadhooks?window.onbeforeunloadhooks:window.onbeforeunloadhooks=[]).push(handler);}
function _onloadHook(){while(window.onloadhooks){var hooks=window.onloadhooks;window.onloadhooks=null;for(var ii=0;ii<hooks.length;ii++){try{hooks[ii]();}catch(ex){Util.error('Uncaught exception in load hook #%d: %x',ii,ex);}}}
window.loaded=true;}
function _onbeforeunloadHook(){var warn=null;if(window.onbeforeunloadhooks){var hooks=window.onbeforeunloadhooks;for(var ii=0;ii<hooks.length;ii++){try{warn=warn||hooks[ii]();}catch(ex){Util.error('Uncaught exception in onbeforeunload hook #%d: %x',ii,ex);}}}
if(warn){return warn;}}
function _onunloadHook(){while(window.onunloadhooks){var hooks=window.onunloadhooks;window.onunloadhooks=null;for(var ii=0;ii<hooks.length;ii++){try{hooks[ii]();}catch(ex){Util.error('Uncaught exception in onunload handler #%d: %x',ii,ex);}}}}
function _bootstrapEventHandlers(){if(document.addEventListener){if(ua.safari()){var timeout=setInterval(function(){if(/loaded|complete/.test(document.readyState)){_onloadHook();clearTimeout(timeout);}},10);}else{document.addEventListener("DOMContentLoaded",_onloadHook,true);}}else{var src='javascript:void(0)';if(window.location.protocol=='https:'){src='//:';}
document.write('<script onreadystatechange="if(this.readyState==\'ready\'){'+'this.parentNode.removeChild(this);_onloadHook();}" defer="defer" '+'src="'+src+'"></script>');}
window.onload=chain(window.onload,_onloadHook);window.onbeforeunload=_onbeforeunloadHook;window.onunload=chain(window.onunload,_onunloadHook);}
ua.populate();_bootstrapEventHandlers();onloadRegister(addSafariLabelSupport);

function bind(obj,method){var args=[];for(var ii=2;ii<arguments.length;ii++){args.push(arguments[ii]);}
return function(){var _obj=obj||this;var _args=args.slice();for(var jj=0;jj<arguments.length;jj++){_args.push(arguments[jj]);}
if(typeof(method)=="string"){if(_obj[method]){return _obj[method].apply(_obj,_args);}}else{return method.apply(_obj,_args);}}}
Function.prototype.bind=function(context){var argv=[arguments[0],this]
var argc=arguments.length;for(var ii=1;ii<argc;ii++){argv.push(arguments[ii]);}
return bind.apply(null,argv);}
function copy_properties(u,v){for(var k in v){u[k]=v[k];}
return u;}
var Try={these:function(){var len=arguments.length;var res;for(var ii=0;ii<len;ii++){try{res=arguments[ii]();return res;}catch(anIgnoredException){}}
return res;}};var Util={isDevelopmentEnvironment:function(){return env_get('dev');},warn:function(){Util.log(sprintf.apply(null,arguments),'warn');},error:function(){Util.log(sprintf.apply(null,arguments),'error');},log:function(msg,type){if(Util.isDevelopmentEnvironment()){if(typeof(window['infoConsole'])!='undefined'){infoConsole.addEvent(new fbinfoconsole.ConsoleEvent(['js',type],nl2br(msg)));}else{if(typeof(console)!="undefined"&&console.error){console.error(msg);}else if(type!='deprecated'){aiert(msg);}}}else{if(type=='error'){(typeof(window['debug_rlog'])=='function')&&debug_rlog(msg);}}},deprecated:function(what){if(!Util._deprecatedThings[what]){Util._deprecatedThings[what]=true;var msg=sprintf('Deprecated: %q is deprecated.\n\n%s',what,Util.whyIsThisDeprecated(what));Util.log(msg,'deprecated');}},whyIsThisDeprecated:function(what){return Util._deprecatedBecause[what.toLowerCase()]||'No additional information is available about this deprecation.';},_deprecatedBecause:{},_deprecatedThings:{}};var Configurable={getOption:function(opt){if(typeof(this.option[opt])=='undefined'){Util.warn('Failed to get option %q; it does not exist.',opt);return null;}
return this.option[opt];},setOption:function(opt,v){if(typeof(this.option[opt])=='undefined'){Util.warn('Failed to set option %q; it does not exist.',opt);}else{this.option[opt]=v;}
return this;},getOptions:function(){return this.option;}};function Ad(){}
copy_properties(Ad,{refreshRate:10000,lastRefreshTime:new Date(),refresh:function(){var delta=(new Date().getTime()-Ad.lastRefreshTime.getTime());if(delta>Ad.refreshRate){var f=Ad.getFrame();if(f){if(!f.osrc){f.osrc=f.src;}
f.src=f.osrc+'?'+Math.random();Ad.lastRefreshTime=new Date();}}},getFrame:function(){return ge('ssponsor')&&ge('ssponsor').getElementsByTagName('iframe')[0];}});function URI(uri){this.parse(uri||'');}
copy_properties(URI,{expression:/(((\w+):\/\/)([^\/:]*)(:(\d+))?)?([^#?]*)(\?([^#]*))?(#(.*))?/,explodeQuery:function(q){if(!q){return{};}
var ii,t,r={};q=q.split('&');for(ii=0,l=q.length;ii<l;ii++){t=q[ii].split('=');r[t[0]]=(typeof(t[1])=='undefined')?'':t[1];}
return r;},implodeQuery:function(o){var u=encodeURIComponent,k,r=[];for(k in o){if(o.hasOwnProperty(k)){r.push(u(k)+'='+u(o[k]));}}
return r.join('&');}});copy_properties(URI.prototype,{parse:function(uri){var m=uri.match(URI.expression);copy_properties(this,{protocol:m[3]||'',domain:m[4]||'',port:m[6]||'',path:m[7]||'',query:URI.explodeQuery(m[9]||''),fragment:m[11]||''});},setQueryData:function(o){this.query=o;return this;},addQueryData:function(o){return this.setQueryData(copy_properties(this.query,o));},getQueryData:function(){return this.query;},setFragment:function(f){this.fragment=f;return this;},getFragment:function(){return this.fragment;},toString:function(){var r='';var q=URI.implodeQuery(this.query);this.protocol&&(r+=this.protocol+'://');this.domain&&(r+=this.domain);this.port&&(r+=':'+this.port);if(this.domain&&!this.path){r+='/';}
this.path&&(r+=this.path);q&&(r+='?'+q);this.fragment&&(r+='#'+this.fragment);return r;}});function EventController(eventResponderObject){copy_properties(this,{queue:[],ready:false,responder:eventResponderObject});};copy_properties(EventController.prototype,{startQueue:function(){this.ready=true;this.dispatchEvents();return this;},pauseQueue:function(){this.ready=false;return this;},addEvent:function(event){if(event.toLowerCase()!==event){Util.warn('Event name %q contains uppercase letters; events should be lowercase.',event);}
var args=[];for(var ii=1;ii<arguments.length;ii++){args.push(arguments[ii]);}
this.queue.push({type:event,args:args});if(this.ready){this.dispatchEvents();}
return event_abort(event_get(arguments[1]));},dispatchEvents:function(){if(!this.responder){Util.error('Event controller attempting to dispatch events with no responder! '+'Provide a responder when constructing the controller.');}
for(var ii=0;ii<this.queue.length;ii++){var evtName='on'+this.queue[ii].type;if(typeof(this.responder[evtName])!='function'&&typeof(this.responder[evtName])!='null'){Util.warn('Event responder is unable to respond to %q event! Implement a %q '+'method. Note that method names are case sensitive; use lower case '+'when defining events and event handlers.',this.queue[ii].type,evtName);}else{if(this.responder[evtName]){this.responder[evtName].apply(this.responder,this.queue[ii].args);}}}
this.queue=[];}});

function htmlspecialchars(text){if(typeof(text)=='undefined'||!text.toString){return'';}
if(text===false){return'0';}else if(text===true){return'1';}
return text.toString().replace(/&/g,'&amp;').replace(/"/g,'&quot;').replace(/'/g,'&#039;').replace(/</g,'&lt;').replace(/>/g,'&gt;');}
function escape_js_quotes(text){if(typeof(text)=='undefined'||!text.toString){return'';}
return text.toString().replace(/\\/g,'\\\\').replace(/\n/g,'\\n').replace(/\r/g,'\\r').replace(/"/g,'\\x22').replace(/'/g,'\\\'').replace(/</g,'\\x3c').replace(/>/g,'\\x3e').replace(/&/g,'\\x26');}
function trim(text){if(typeof(text)=='undefined'||!text.toString){return'';}
return text.toString().replace(/^\s*|\s*$/g,'');}
function nl2br(text){if(typeof(text)=='undefined'||!text.toString){return'';}
return text.toString().replace(/\n/g,'<br />');}
function sprintf(){if(arguments.length==0){Util.warn('sprintf() was called with no arguments; it should be called with at '+'least one argument.');return'';}
var args=['This is an argument vector.'];for(var ii=arguments.length-1;ii>0;ii--){if(typeof(arguments[ii])=="undefined"){Util.log('You passed an undefined argument (argument '+ii+' to sprintf(). '+'Pattern was: `'+(arguments[0])+'\'.','error');args.push('');}else if(arguments[ii]===null){args.push('');}else if(arguments[ii]===true){args.push('true');}else if(arguments[ii]===false){args.push('false');}else{if(!arguments[ii].toString){Util.log('Argument '+(ii+1)+' to sprintf() does not have a toString() '+'method. The pattern was: `'+(arguments[0])+'\'.','error');return'';}
args.push(arguments[ii]);}}
var pattern=arguments[0];pattern=pattern.toString().split('%');var patlen=pattern.length;var result=pattern[0];for(var ii=1;ii<patlen;ii++){if(args.length==0){Util.log('Not enough arguments were provide to sprintf(). The pattern was: '+'`'+(arguments[0])+'\'.','error');return'';}
if(!pattern[ii].length){result+="%";continue;}
switch(pattern[ii].substr(0,1)){case's':result+=htmlspecialchars(args.pop().toString());break;case'h':result+=args.pop().toString();break;case'd':result+=parseInt(args.pop());break;case'f':result+=parseFloat(args.pop());break;case'q':result+="`"+htmlspecialchars(args.pop().toString())+"'";break;case'e':result+="'"+escape_js_quotes(args.pop().toString())+"'";break;case'x':x=args.pop();var line='?';var src='?';try{if(typeof(x['line'])!='undefined'){line=x.line;}else if(typeof(x['lineNumber'])!='undefined'){line=x.lineNumber;}
if(typeof(x['sourceURL'])!='undefined'){src=x['sourceURL'];}else if(typeof(x['fileName'])!='undefined'){src=s['fileName'];}}catch(exception){}
result+=x.toString()+' [at line '+line+' in '+src+']';break;default:result+="%"+pattern[ii].substring(0,1);break;}
result+=pattern[ii].substring(1);}
if(args.length>1){Util.log('Too many arguments ('+(args.length-1)+' extras) were passed to '+'sprintf(). Pattern was: `'+(arguments[0])+'\'.','error');}
return result;}
String.prototype._split=String.prototype.split;String.prototype.split=function(separator,limit){var flags="";if(separator===null||limit===null){return[];}else if(typeof separator=='string'){return this._split(separator,limit);}else if(separator===undefined){return[this.toString()];}else if(separator instanceof RegExp){if(!separator._2||!separator._1){flags=separator.toString().replace(/^[\S\s]+\//,"");if(!separator._1){if(!separator.global){separator._1=new RegExp(separator.source,"g"+flags);}else{separator._1=1;}}}
separator1=separator._1==1?separator:separator._1;var separator2=(separator._2?separator._2:separator._2=new RegExp("^"+separator1.source+"$",flags));if(limit===undefined||limit<0){limit=false;}else{limit=Math.floor(limit);if(!limit)return[];}
var match,output=[],lastLastIndex=0,i=0;while((limit?i++<=limit:true)&&(match=separator1.exec(this))){if((match[0].length===0)&&(separator1.lastIndex>match.index)){separator1.lastIndex--;}
if(separator1.lastIndex>lastLastIndex){if(match.length>1){match[0].replace(separator2,function(){for(var j=1;j<arguments.length-2;j++){if(arguments[j]===undefined)match[j]=undefined;}});}
output=output.concat(this.substring(lastLastIndex,match.index),(match.index===this.length?[]:match.slice(1)));lastLastIndex=separator1.lastIndex;}
if(match[0].length===0){separator1.lastIndex++;}}
return(lastLastIndex===this.length)?(separator1.test("")?output:output.concat("")):(limit?output:output.concat(this.substring(lastLastIndex)));}else{return this._split(separator,limit);}}

function AsyncRequest(){var dispatchResponse=bind(this,function(asyncResponse){try{this.handler(asyncResponse);}catch(exception){Util.error('Async handler threw an exception for URI %q: %x.',this.uri,exception);}});var dispatchErrorResponse=bind(this,function(asyncResponse){try{this.errorHandler(asyncResponse);}catch(exception){Util.error('Async error handler threw an exception for URI %q, when processing a '+'%d error: %s.',this.uri,asyncResponse.getError(),exception);}});var invokeResponseHandler=bind(this,function(){var r=new AsyncResponse();if(this.handler){try{if(this.transport.responseText.length<=8){Util.error('AsyncResponse returned with shorter length than required.');throw"AsyncResponse too short.";}
var safeResponse=this.transport.responseText.substring(8);if(!this.getOption('suppressEvaluation')){var response;eval('response = ('+safeResponse+')');if(typeof(response.payload)=='undefined'||typeof(response.error)=='undefined'||typeof(response.errorDescription)=='undefined'||typeof(response.errorSummary)=='undefined'){Util.warn('AsyncRequest to endpoint %q returned a JSON response, but it '+'is not properly formatted. The endpoint needs to provide a '+'response including both error and payload information; use '+'the AsyncResponse PHP class to do this easily.',this.uri);r.payload=response;}else{copy_properties(r,response);}}else{r.payload=this.transport;}
if(r.getError()){dispatchErrorResponse(r);}else{dispatchResponse(r);}}catch(exception){var desc='An error occurred during a request to a remote server. '+'This failure may be temporary, try repeating the request.';if(Util.isDevelopmentEnvironment()){if(this.transport.responseText==''){desc=sprintf('An error occurred when making an AsyncRequest to %q. '+'The server returned an empty response.',this.uri);}else{desc=sprintf('An error occurred when decoding the JSON payload of the '+'AsyncResponse associated with an AsyncRequest to %q. The server '+'returned <a href="javascript:aiert(%e);">a garbled response</a>,'+'then Javascript threw an exception: %x.',this.uri,this.transport.responseText,exception);}}
copy_properties(r,{error:1000,errorSummary:'Data Error',errorDescription:desc});if(this.errorHandler){dispatchErrorResponse(r);}else{Util.error('Something bad happened -- write an error handler to figure out '+'what!');}}}});var invokeErrorHandler=bind(this,function(explicitError){var r=new AsyncResponse();var err=explicitError||this.transport.status||1001;try{if(this.responseText==''){err=1002;}}catch(ignore){}
if(this.errorHandler){var desc=sprintf('Transport error (#%d) while retrieving data from endpoint %q: %s',err,this.uri,AsyncRequest.getHTTPErrorDescription(err));Util.error(desc);copy_properties(r,{error:err,errorSummary:AsyncRequest.getHTTPErrorSummary(err),errorDescription:desc});dispatchErrorResponse(r);}else{Util.error('Async request to %q failed with a %d error, but there was no error '+'handler available to deal with it.',this.uri,err);}});var onStateChange=function(){try{if(this.transport.readyState==4){if(this.transport.status>=200&&this.transport.status<300){invokeResponseHandler();}else{invokeErrorHandler();}}}catch(exception){Util.error('AsyncRequest exception when attempting to handle a state change: %x.',exception);invokeErrorHandler(1001);}};var buildTransport=function(obj){var transport=Try.these(function(){return new XMLHttpRequest();},function(){return new ActiveXObject("Msxml2.XMLHTTP");},function(){return new ActiveXObject("Microsoft.XMLHTTP");})||null;if(transport){transport.onreadystatechange=bind(obj,onStateChange);}else{Util.error('Unable to build XMLHTTPRequest transport.');}
return transport;};copy_properties(this,{transport:buildTransport(this),method:'POST',uri:'',handler:null,errorHandler:null,data:{},readOnly:false,writeRequiredParams:['post_form_id'],option:{asynchronous:true,suppressErrorHandlerWarning:false,suppressEvaluation:false}});return this;}
copy_properties(AsyncRequest,{getHTTPErrorSummary:function(errCode){return AsyncRequest._getHTTPError(errCode).summary;},getHTTPErrorDescription:function(errCode){return AsyncRequest._getHTTPError(errCode).description;},pingURI:function(uri,data,synchronous){return new AsyncRequest().setURI(uri).setData(data).setOption('asynchronous',!synchronous).setOption('suppressErrorHandlerWarning',true).send();},_getHTTPError:function(errCode){var e=AsyncRequest._HTTPErrors[errCode]||AsyncRequest._HTTPErrors[errCode-(errCode%100)]||{summary:'HTTP Error',description:'Unknown HTTP error #'+errCode};return e;},_HTTPErrors:{400:{summary:'Bad Request',description:'Bad HTTP request.'},401:{summary:'Unauthorized',description:'Not authorized.'},403:{summary:'Forbidden',description:'Access forbidden.'},404:{summary:'Not Found',description:'Web address does not exist.'},1000:{summary:'Bad Response',description:'Invalid response.'},1001:{summary:'No Network',description:'A network error occurred. Check that you are connected to the '+'internet.'},1002:{summary:'No Data',description:'The server did not return a response.'}}});copy_properties(AsyncRequest.prototype,{setMethod:function(m){this.method=m.toString().toUpperCase();return this;},getMethod:function(){return this.method;},setData:function(obj){this.data=obj;return this;},getData:function(){return this.data;},setURI:function(uri){this.uri=uri;var re=/^[a-z]+:/;if(re.test(uri)){Util.error('Asynchronous requests must specify relative URIs (like %q); this '+'ensures they conform to the Same Origin Policy (see %q). The '+'provided absolute URI (%q) is invalid, use a relative URI instead.','/path/to/endpoint.php','http://www.mozilla.org/projects/security/components/same-origin.html',uri);}
return this;},getURI:function(){return this.uri;},setHandler:function(fn){if(typeof(fn)!='function'){Util.error('AsyncRequest response handlers must be functions. Pass a function, '+'or use bind() to build one.');}else{this.handler=fn;}
return this;},getHandler:function(){return this.handler;},setErrorHandler:function(fn){if(typeof(fn)!='function'){Util.error('AsyncRequest error handlers must be functions. Pass a function, or '+'use bind() to build one.');}else{this.errorHandler=fn;}
return this;},getErrorHandler:function(){return this.handler;},setReadOnly:function(readOnly){if(typeof(readOnly)!='boolean'){Util.error('AsyncRequest readOnly value must be a boolean.');}else{this.readOnly=readOnly;}
return this;},getReadOnly:function(){return this.readOnly;},specifiesWriteRequiredParams:function(){var specifiesWriteRequiredParams=true;for(var i=0;i<this.writeRequiredParams.length;i++){var param=this.writeRequiredParams[i];if(typeof(this.data[param])=='undefined'){var e=ge(param);if(e&&typeof(e.value)!='undefined'){this.data[param]=e.value;}else{specifiesWriteRequiredParams=false;break;}}}
return specifiesWriteRequiredParams;},setOption:function(opt,v){if(typeof(this.option[opt])!='undefined'){this.option[opt]=v;}else{Util.warn('AsyncRequest option %q does not exist; request to set it was ignored.',opt);}
return this;},getOption:function(opt){if(typeof(this.option[opt])=='undefined'){Util.warn('AsyncRequest option %q does not exist, get request failed.',opt);}
return this.option[opt];},send:function(){if(!this.uri){Util.error('Attempt to dispatch an AsyncRequest without an endpoint URI! This is '+'all sorts of silly and impossible, so the request failed.');return false;}
if(!this.errorHandler&&!this.getOption('suppressErrorHandlerWarning')){Util.warn('Dispatching an AsyncRequest that does not have an error handler. '+'You SHOULD supply one, or use AsyncRequest.pingURI(). If this '+'omission is intentional and well-considered, set the %q option to '+'suppress this warning.','suppressErrorHandlerWarning');}
if(!this.getReadOnly()){if(!this.specifiesWriteRequiredParams()){Util.error('You are making a POST request without one or more of the required '+'parameters: %s. Requests which modify data and do not verify the '+'request origin through parameter validation are vulnerable to CSRF '+'attacks. You should either specify values for these parameters '+'explicitly by using setData(), put them in the page as inputs, or '+'mark this request as safe and idempotent by using setReadOnly(). '+'Consult the setReadOnly() documentation for more information.',this.writeRequiredParams.join(','));}
if(this.method!='POST'){Util.error('You are making a GET request which modifies data; this violates '+'the HTTP spec and is generally a bad idea. Either change this '+'request to use POST or use setReadOnly() to mark the request as '+'idempotent and appropriate for HTTP GET. Consult the setReadOnly() '+'documentation for more information.');}}
var uri;var query=ajaxArrayToQueryString(this.data);if(this.method=='GET'){uri=this.uri+(query?'?'+query:'');query='';}else{uri=this.uri;}
this.transport.open(this.method,uri,this.getOption('asynchronous'));if(this.method=='POST'){this.transport.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
this.transport.send(query);return true;}});function AsyncResponse(){copy_properties(this,{error:0,errorSummary:null,errorDescription:null,payload:null});return this;}
copy_properties(AsyncResponse.prototype,{getPayload:function(){return this.payload;},getError:function(){return this.error;},getErrorSummary:function(){return this.errorSummary;},getErrorDescription:function(){return this.errorDescription;}});

Util._deprecatedBecause={extend:'extend() has been renamed copy_properties() to avoid confusion with '+'Function.extend(). Use Function.extend() or subclass() to establish class'+'inheritence, and copy_properties() to copy properties between objects.',ajaxrequest:'AjaxRequest has been renamed AsyncRequest. The interface has not '+'changed.',ajaxresponse:'AjaxResponse has been renamed AsyncResponse. The interface has not '+'changed.',ajax:'The `Ajax\' class has been deprecated for sucking. Use AsyncRequest '+'and AsyncResponse to make remote HTTP requests. Prefer JSON to XML as '+'a transport encoding, but never say "AJAJ". AND WRITE ERROR HANDLERS! ',ajaxloadindicator:'No ajaxLoadIndicator element is ever generated, so this code is '+'apparently never used.',toggleinlineflyer:'This function is not used anywhere.',checkagree:'This function is marked as deprecated and not used anywhere.',dynamicdialog:'Dynamicdialog is deprecated in favor of dialogpro.'}
function extend(u,v){Util.deprecated('extend');return copy_properties(u,v);}
function checkAgree(){Util.deprecated('checkagree');if(document.frm.pic.value){if(document.frm.agree.checked){document.frm.submit();}else{show("error");}}}
function toggleInlineFlyer(toggler){Util.deprecated('toggleinlineflyer');if(toggler.innerHTML=='hide flyer'){toggler.innerHTML='show flyer';}else{toggler.innerHTML='hide flyer';}
toggle('inline_flyer_content');}
var ajaxLoadIndicatorRefCount=0;function ajaxShowLoadIndicator()
{Util.deprecated('ajaxloadindicator');indicatorDiv=ge('ajaxLoadIndicator');if(!indicatorDiv){indicatorDiv=document.createElement("div");indicatorDiv.id='ajaxLoadIndicator';indicatorDiv.innerHTML='Loading';indicatorDiv.className='ajaxLoadIndicator';document.body.appendChild(indicatorDiv);}
indicatorDiv.style.top=(5+pageScrollY())+'px';indicatorDiv.style.left=(5+pageScrollX())+'px';indicatorDiv.style.display='block';ajaxLoadIndicatorRefCount++;}
function ajaxHideLoadIndicator()
{ajaxLoadIndicatorRefCount--;if(ajaxLoadIndicatorRefCount==0)
ge('ajaxLoadIndicator').style.display='';}
function Ajax(doneHandler,failHandler)
{Util.deprecated('ajax');newAjax=this;this.onDone=doneHandler;this.onFail=failHandler;this.transport=this.getTransport();this.transport.onreadystatechange=ajaxTrampoline(this);}
Ajax.prototype.get=function(uri,query,force_sync)
{force_sync=force_sync||false;if(typeof query!='string')
query=ajaxArrayToQueryString(query);fullURI=uri+(query?('?'+query):'');this.transport.open('GET',fullURI,!force_sync);this.transport.send('');}
Ajax.prototype.post=function(uri,data,force_sync,no_post_form_id)
{force_sync=force_sync||false;no_post_form_id=no_post_form_id||false;if(typeof data!='string'){data=ajaxArrayToQueryString(data);}
if(!no_post_form_id){var post_form_id=ge('post_form_id');if(post_form_id){data+='&post_form_id='+post_form_id.value;}}
this.transport.open('POST',uri,!force_sync);this.transport.setRequestHeader("Content-Type","application/x-www-form-urlencoded");this.transport.send(data);}
Ajax.prototype.stateDispatch=function()
{try{if(this.transport.readyState==1&&this.showLoad)
ajaxShowLoadIndicator();if(this.transport.readyState==4){if(this.showLoad)
ajaxHideLoadIndicator();if(this.transport.status>=200&&this.transport.status<300&&this.transport.responseText.length>0){try{if(this.onDone)this.onDone(this,this.transport.responseText);}catch(tempError){console?console.error(tempError):false;}}else{try{if(this.onFail)this.onFail(this);}catch(tempError){console?console.error(tempError):false;}}}}catch(error){if(this.onFail)this.onFail(this);}}
Ajax.prototype.getTransport=function()
{var ajax=null;try{ajax=new XMLHttpRequest();}
catch(e){ajax=null;}
try{if(!ajax)ajax=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){ajax=null;}
try{if(!ajax)ajax=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){ajax=null;}
return ajax;}
function ajaxTrampoline(ajaxObject)
{return function(){ajaxObject.stateDispatch();};}
function toggle_dynamic_dialog_custom(rootEl,innerHTML){Util.deprecated('dynamicdialog');var ieHTML;ieHTML='<div id="ie_iframe_holder"></div>';ieHTML+='<div style="position: absolute; z-index: 100;">';innerHTML=ieHTML+innerHTML+'</div>';var dynamic_dialog=ge('dynamic_dialog');if(dynamic_dialog){if(shown(dynamic_dialog)&&same_place(rootEl,dynamic_dialog)){hide(dynamic_dialog);}else{move_here(rootEl,dynamic_dialog);dynamic_dialog.innerHTML=innerHTML;show('dynamic_dialog');}}else{var dynamic_dialog=document.createElement("div");dynamic_dialog.id='dynamic_dialog';dynamic_dialog.innerHTML=innerHTML;move_here(rootEl,dynamic_dialog);ge('content').appendChild(dynamic_dialog);}
var height,width,ieIframeHTML;height=ge('dialog').offsetHeight;width=ge('dialog').offsetWidth;ieIframeHTML='<iframe width="'+width+' "height='+height+'" ';ieIframeHTML+='style="position: absolute; z-index: 99; border: none;"></iframe>';ge('ie_iframe_holder').innerHTML=ieIframeHTML;return false;}
function same_place(rootEl,dynamic_dialog){Util.deprecated('dynamicdialog');if(rootEl=ge(rootEl)){if(elementY(rootEl)+20==elementY(dynamic_dialog))
return true;}
return false;}
function move_here(rootEl,el){Util.deprecated('dynamicdialog');var x=getViewportWidth()/2-120;var y=elementY(rootEl)+20;el.style.left=x+"px";el.style.top=y+"px";}
function toggle_dynamic_dialog_post(rootEl,headingText,contentText,confirmText,confirmLocation,confirmParams){Util.deprecated('dynamicdialog');var form_check_string=(ge('post_form_id')?('<input type="hidden" name="post_form_id" value="'+ge('post_form_id').value+'"/>'):'');var formParams='';for(var param in confirmParams){formParams+='<input type="hidden" name="'+param+'" value="'+
confirmParams[param]+'"/>'}
var innerHTML='<table id="dialog" border="0" cellspacing="0" width="360">'+'<tr>'+'<td class="dialog">'+'<h4>'+headingText+'</h4>'+'<p>'+contentText+'</p>'+'<div class="buttons">'+'<form action="'+confirmLocation+'" method="post">'+
form_check_string+
formParams+'<input type="hidden" name="next" value="'+window.location+'"/>'+'<input type="submit" id="confirm" name="confirm" class="inputsubmit" '+'value="'+confirmText+'"/>&nbsp;<input type="button" id="cancel" '+'name="cancel" onclick="hide(\'dynamic_dialog\');" class="inputbutton" '+'value="Cancel" />'+'</form>'+'</div>'+'</td>'+'</tr>'+'</table>';return toggle_dynamic_dialog_custom(rootEl,innerHTML);}
function toggle_dynamic_dialog(rootEl,headingText,contentText,confirmText,confirmLocation){Util.deprecated('dynamicdialog');var form_check_string=(ge('post_form_id')?('<input type="hidden" name="post_form_id" value="'+ge('post_form_id').value+'"/>'):'');var innerHTML="<form action=\""+confirmLocation+"\" method=\"post\">\n"+"<table id=\"dialog\" border=\"0\" cellspacing=\"0\" width=\"360\">"+"<tr>\n"+"<td class=\"dialog\">\n"+"<h4>"+headingText+"</h4>\n"+"<p>"+contentText+"</p>"+"<div class=\"buttons\">\n"+
form_check_string+"<input type=\"hidden\" name=\"next\" value=\""+window.location+"\"/>\n"+"<input type=\"submit\" id=\"confirm\" name=\"confirm\" class=\"inputsubmit\" value=\""+confirmText+"\"/>&nbsp;<input type=\"button\" id=\"cancel\" name=\"cancel\" onclick=\"hide('dynamic_dialog');\" class=\"inputbutton\" value=\"Cancel\" />\n"+"</div>\n"+"</td>\n"+"</tr>\n"+"</table>\n"+"</form>\n";return toggle_dynamic_dialog_custom(rootEl,innerHTML);}
function toggle_dynamic_dialog_js(rootEl,headingText,contentText,confirmText,confirmJS,remove_cancel_option){Util.deprecated('dynamicdialog');var innerHTML="<table id=\"dialog\" border=\"0\" cellspacing=\"0\" width=\"360\">"+"<tr>\n"+"<td class=\"dialog\">\n"+"<h4>"+headingText+"</h4>\n"+"<p>"+contentText+"</p>"+"<div class=\"buttons\">\n"+"<input type=\"button\" id=\"confirm\" name=\"confirm\" class=\"inputsubmit\"  value=\""+confirmText+"\" onclick=\""+confirmJS+"\"/>&nbsp;";if(!remove_cancel_option){innerHTML+="<input type=\"button\" id=\"cancel\" name=\"cancel\" onclick=\"hide('dynamic_dialog');\" class=\"inputbutton\" value=\"Cancel\" />\n";}
innerHTML+="</div>\n"+"</td>\n"+"</tr>\n"+"</table>\n";return toggle_dynamic_dialog_custom(rootEl,innerHTML);}

var MAX_APP_LIST_END=275;var MAX_SIDENAV_LINKS=7;var MOVING_THRESHOLD=10;var saved_message=null;function track_moveable(container_obj,link_obj){link_obj.ondrag=function(e){event.cancelBubble=true;return false;}.bind(this);;this.listContainer=container_obj;this.link=link_obj;this.listContainer.onmousedown=function(e){return this._onclick(e?e:window.event);}.bind(this);}
track_moveable.prototype._onclick=function(e){this.clickMouseY=mouseY(e);document.onselectstart=function(e){return false;};document.onmousemove=function(e){return this._track_move(e?e:window.event)}.bind(this);document.onmouseup=function(e){this._track_drop(e?e:window.event)}.bind(this);return false;}
track_moveable.prototype._track_move=function(e){if(Math.abs(mouseY(e)-this.clickMouseY)>MOVING_THRESHOLD){var moveable=new moveable_app(this.listContainer,this.link);moveable._onclick(null,this.clickMouseY);}}
track_moveable.prototype._track_drop=function(e){document.onmouseout=document.onmouseup=document.onmousemove=document.onclick=null;this.link.onclick=function(e){return true;};}
function moveable_app(container_obj,link_obj){this.listContainer=container_obj;this.link=link_obj;this.listContainer.onmousedown=function(e){return this._onclick(e?e:window.event);}.bind(this);}
moveable_app.prototype._onclick=function(e,mouseYCoord){add_css_class_name(this.listContainer,'floating_container');var app_list_node=ge('app_list');this.listContainer.lowerBoundY=elementY(app_list_node.firstChild?app_list_node.firstChild:app_list_node);this.oldListID=this.listContainer.parentNode.parentNode.id;this.justOpened=false;var app_non_nav_list_node=ge('app_non_nav_list');this.listContainer.upperBoundY=elementY(app_non_nav_list_node.lastChild?app_non_nav_list_node.lastChild:app_non_nav_list_node);var listContainerHeight=(ua.ie()||ua.safari())?this.listContainer.offsetHeight:this.listContainer.offsetHeight-1;this.listContainer.parentNode.style.height=(listContainerHeight)+'px';this.listContainer.top=elementY(this.listContainer);mouseYCoord=mouseYCoord?mouseYCoord:mouseY(e);this.mouseOffset=mouseYCoord-this.listContainer.top;this.listContainer.style.top=this.listContainer.top+'px';document.onmousemove=function(e){return this._move(e?e:window.event)}.bind(this);document.onmouseup=function(e){this._drop(e?e:window.event)}.bind(this);this._calculateBoundaries();return false;}
moveable_app.prototype._calculateBoundaries=function(){var list=this.listContainer.parentNode.parentNode;var previousListItem=this.listContainer.parentNode.previousSibling;this.listContainer.prevList=null;this.listContainer.previousNodeY=null;if(previousListItem){this.listContainer.previousNodeY=elementY(previousListItem)+7;this.newList=false;}else if(list.id=='app_non_nav_list'){this.listContainer.prevList=ge('app_list');var elementPos=null;if(this.listContainer.prevList.lastChild){elementPos=this.listContainer.prevList.lastChild;}else{elementPos=this.listContainer.prevList;}
this.newList=true;this.listContainer.previousNodeY=elementY(elementPos)+20;}
var nextListItem=this.listContainer.parentNode.nextSibling;this.listContainer.nextList=null;this.listContainer.nextNodeY=null;if(nextListItem){this.listContainer.nextNodeY=elementY(nextListItem)-7;this.newList=false;}else if(list.id=='app_list'){this.listContainer.nextList=ge('app_non_nav_list');var elementPos=null;this.newList=true;if(this.listContainer.nextList.parentNode.style.display=='none'){this.justOpened=true;this.listContainer.nextNodeY=elementY(ge('more_link'))-18;}else{if(this.listContainer.nextList.firstChild){elementPos=this.listContainer.nextList.firstChild;}else{elementPos=this.listContainer.nextList;}
this.listContainer.nextNodeY=elementY(elementPos)-20;}}}
moveable_app.prototype._move=function(e){this.listContainer.top=mouseY(e)-this.mouseOffset;var oldParent=this.listContainer.parentNode;if(this.listContainer.nextNodeY&&this.listContainer.top>this.listContainer.nextNodeY){if(this.listContainer.nextList==null){var newParent=oldParent.nextSibling;newParent.appendChild(this.listContainer);oldParent.style.height=null;oldParent.appendChild(newParent.firstChild);}else{if(this.newList){expand_more_list();var newParent=document.createElement('div');newParent.className='list_item';this.listContainer.nextList.insertBefore(newParent,this.listContainer.nextList.firstChild);newParent.appendChild(this.listContainer);oldParent.parentNode.removeChild(oldParent);}}}
else if(this.listContainer.previousNodeY&&this.listContainer.top<this.listContainer.previousNodeY){if(this.listContainer.prevList==null){var newParent=oldParent.previousSibling;newParent.appendChild(this.listContainer);oldParent.style.height=null;oldParent.appendChild(newParent.firstChild);}else{var newParent=document.createElement('div');newParent.className='list_item';this.listContainer.prevList.appendChild(newParent);newParent.appendChild(this.listContainer);oldParent.parentNode.removeChild(oldParent);}}
if(this.listContainer.parentNode!=oldParent){oldParent.style.height=null;this.listContainer.parentNode.style.height=(this.listContainer.offsetHeight-1)+'px';this._calculateBoundaries();}
if((is_first_child(this.listContainer.parentNode,'app_list')&&this.listContainer.top<elementY(this.listContainer.parentNode))||(is_last_child(this.listContainer.parentNode,'app_non_nav_list')&&this.listContainer.top>elementY(this.listContainer.parentNode))){this.listContainer.style.top=(elementY(this.listContainer.parentNode)+1)+'px';}else{this.listContainer.style.top=this.listContainer.top+'px';}
return false;}
function is_first_child(elem,parent){return(elem.parentNode.id==parent)&&(elem.parentNode.firstChild==elem);}
function is_last_child(elem,parent){return(elem.parentNode.id==parent)&&(elem.parentNode.lastChild==elem);}
function onload_side_nav_check(){enforce_app_list_limits_and_save(false,'onload_side_nav');}
function enforce_app_list_limits_and_save(force_save,context){var display_list='';var app_list_node=ge('app_list');var more_apps_node=ge('app_non_nav_list');var more_list='';var max_reached=false;var extra_pixel_amount=0;var rearrange_message=ge('rearrange_message');if(rearrange_message){extra_pixel_amount=rearrange_message.offsetHeight+6;}
var threshold=MAX_APP_LIST_END+elementY(ge('sidebar'))+extra_pixel_amount;while(elementY(app_list_node)+app_list_node.offsetHeight>threshold||app_list_node.childNodes.length>MAX_SIDENAV_LINKS){if(more_apps_node.firstChild){more_apps_node.insertBefore(app_list_node.lastChild,more_apps_node.firstChild);}else{more_apps_node.appendChild(app_list_node.lastChild);}
max_reached=true;}
if(max_reached||force_save){for(var i=0;i<app_list_node.childNodes.length;i++){if(i!=0){display_list+=':';}
display_list+=app_list_node.childNodes[i].firstChild.id;}
for(var i=0;i<more_apps_node.childNodes.length;i++){if(i!=0){more_list+=':';}
more_list+=more_apps_node.childNodes[i].firstChild.id;}
var ajax=new Ajax(function(obj,text){eval(text);});var post_vars={'display_list':display_list,'more_list':more_list,'context':context};ajax.post('/ajax/apps_menu.php',post_vars);}}
moveable_app.prototype._drop=function(e){remove_css_class_name(this.listContainer,'floating_container');this.listContainer.style.top=null;this.listContainer.parentNode.style.height=null;enforce_app_list_limits_and_save(true,'rearrange_order');if(this.listContainer.parentNode.parentNode.id!='app_non_nav_list'&&this.justOpened){window.setTimeout('close_more_list()',500);}
document.onmouseout=document.onmouseup=document.onmousemove=document.onclick=null;if(this.link){this.link.onclick=function(e){return false;};}
return false;}
function change_status_message(className,messageContent){var message=ge('rearrange_message');message.className=className;message.innerHTML=messageContent;}
function change_to_apps_menu(list_item){var container=list_item.firstChild;var action_link=container.firstChild;action_link.setAttribute('onclick','move_lists(this.parentNode.parentNode, \'app_non_nav_list\', change_to_non_menu, true); return false;');action_link.setAttribute('class','action_item');action_link.innerHTML="remove";var handle=document.createElement('div');handle.setAttribute('class','handle');handle.setAttribute('onmousedown','new moveable_app(this.parentNode);');container.insertBefore(handle,container.firstChild.nextSibling);}
function change_to_non_menu(list_item){var container=list_item.firstChild;var action_link=container.firstChild;var handle=container.firstChild.nextSibling;container.removeChild(handle);action_link.setAttribute('onclick','move_lists(this.parentNode.parentNode, \'app_list\', change_to_apps_menu); return false;');action_link.setAttribute('class','action_item_add');action_link.innerHTML="add to menu";}
function move_lists(obj,to_list_id,changeFunction,front_of_list){to_list_obj=ge(to_list_id);if(changeFunction){changeFunction(obj);}
if(front_of_list){to_list_obj.insertBefore(obj,to_list_obj.firstChild);}else{to_list_obj.appendChild(obj);}}
var apps_menu_timout_id;function try_expand(obj){if(obj.innerHTML=='more'){apps_menu_timout_id=window.setTimeout('expand_more_list()',500);}else{}}
function untry_expand(){window.clearTimeout(apps_menu_timout_id);}


function editor_two_level_change(selector,subtypes_array,sublabels_array)
{selector=ge(selector);if(selector.getAttribute("typefor"))
subselector=ge(selector.getAttribute("typefor"));if(selector&&subselector){subselector.options.length=1;type_value=selector.options[selector.selectedIndex].value;if(type_value==""){type_value=-1;}
index=1;suboptions=subtypes_array[type_value];if(typeof(suboptions)!="undefined"){for(var key=0;key<suboptions.length;key++){if(typeof(suboptions[key])!="undefined"){subselector.options[index++]=new Option(suboptions[key],key);}}}
if(sublabels_array){if(sublabels_array[type_value]){subselector.options[0]=new Option(sublabels_array[type_value],"");subselector.options[0].selected=true;}else{subselector.options[0]=new Option("---","");subselector.options[0].selected=true;}}
subselector.disabled=subselector.options.length<=1;}}
function editor_two_level_set_subselector(subselector,value)
{subselector=ge(subselector);if(subselector){opts=subselector.options;for(var index=0;index<opts.length;index++){if((opts[index].value==value)||(value===null&&opts[index].value=='')){subselector.selectedIndex=index;}}}}
function editor_network_change(selector,prefix,orig_value){selector=ge(selector);if(selector&&selector.value>0){show('display_network_message');}else{hide('display_network_message');}}
function editor_rel_change(selector,prefix,orig_value)
{selector=ge(selector);if(selector&&ge(prefix+'_new_partner')){if(selector.value>1){show(prefix+'_new_partner');if(selector.value==4||selector.value==5){hide(prefix+'_new_partner_with');show(prefix+'_new_partner_to');}else{show(prefix+'_new_partner_with');hide(prefix+'_new_partner_to');}}else{hide(prefix+'_new_partner');hide(prefix+'_new_partner_with');hide(prefix+'_new_partner_to');}}else{if(selector.value==4||selector.value==5){hide(prefix+'_rel_with');show(prefix+'_rel_to');}else if(selector.value>1){show(prefix+'_rel_with');hide(prefix+'_rel_to');}}
if(selector&&ge(prefix+'_rel_uncancel')){if(selector.value>1)
editor_rel_uncancel(selector,prefix,selector.value);else
editor_rel_cancel(selector,prefix);}
editor_rel_toggle_awaiting(selector,prefix,orig_value);}
function rel_typeahead_onsubmit(){return false;}
function rel_typeahead_onselect(friend){if(!friend)
return;ge('new_partner').value=friend.i;}
function editor_rel_toggle_awaiting(selector,prefix,orig_value)
{selector=ge(selector);if(selector&&ge(prefix+'_rel_required')){if(selector.value==orig_value){hide(prefix+'_rel_required');show(prefix+'_rel_awaiting');}
else{show(prefix+'_rel_required');hide(prefix+'_rel_awaiting');}}}
function editor_rel_cancel(selector,prefix)
{if(ge(prefix+'_rel_uncancel'))
show(prefix+'_rel_uncancel');if(ge(prefix+'_rel_cancel'))
hide(prefix+'_rel_cancel');selector=ge(selector);if(ge(selector)&&ge(selector).selectedIndex>1)
editor_rel_set_value(selector,1);}
function editor_rel_uncancel(selector,prefix,rel_value)
{if(ge(prefix+'_rel_uncancel'))
hide(prefix+'_rel_uncancel');if(ge(prefix+'_rel_cancel'))
show(prefix+'_rel_cancel');if(rel_value==4||rel_value==5){hide(prefix+'_rel_with');show(prefix+'_rel_to');}else if(rel_value>1){show(prefix+'_rel_with');hide(prefix+'_rel_to');}
if(ge(selector)&&ge(selector).selectedIndex<=1)
editor_rel_set_value(selector,rel_value);editor_rel_toggle_awaiting(selector,prefix,rel_value);}
function editor_autocomplete_onselect(result){var hidden=ge(/(.*)_/.exec(this.obj.name)[1]+'_id');if(result){hidden.value=result.i==null?result.t:result.i;}
else{hidden.value=-1;}}
function editor_rel_set_value(selector,value)
{selector=ge(selector);if(selector){opts=selector.options;opts_length=opts.length;for(var index=0;index<opts_length;index++){if((opts[index].value==value)||(value===null&&opts[index].value=='')){selector.selectedIndex=index;}}}}
function enableDisable(gainFocus,loseFocus){loseFocus=ge(loseFocus);if(loseFocus){if(loseFocus.value)loseFocus.value="";if(loseFocus.selectedIndex)loseFocus.selectedIndex=0;}}
function show_editor_error(error_text,exp_text)
{ge('editor_error_text').innerHTML=error_text;ge('editor_error_explanation').innerHTML=exp_text;show('error');}
function make_explanation_list(list,num,verb_plur,verb_sing,postfix){var exp="";for(var i=0;i<list.length;i++){if(i>0&&num>2){exp+=", ";}
if(i>0&&(i==num-1)){exp+=" and ";}
exp+=list[i];}
exp+=" ";if(num>1){exp+=verb_plur;}else{exp+=verb_sing;}
exp+=" "+postfix;return exp;}
function TimeSpan(start_prefix,end_prefix,span,auto){this.get_start_ts=function(){return _get_date_time_ts(_start_month,_start_day,_start_year,_start_hour,_start_min,_start_ampm);}
this.get_end_ts=function(){var start_ts=_get_date_time_ts(_start_month,_start_day,_start_year,_start_hour,_start_min,_start_ampm);var end_ts=_get_date_time_ts(_end_month,_end_day,_end_year,_end_hour,_end_min,_end_ampm);if(start_ts>end_ts&&!(_start_year&&_end_year)){var future_date=new Date();future_date.setTime(end_ts);future_date.setFullYear(future_date.getFullYear()+1);return future_date.getTime();}else{return end_ts;}}
var _start_month=ge(start_prefix+'_month');var _start_day=ge(start_prefix+'_day');var _start_hour=ge(start_prefix+'_hour');var _start_year=ge(start_prefix+'_year');var _start_min=ge(start_prefix+'_min');var _start_ampm=ge(start_prefix+'_ampm');var _end_month=ge(end_prefix+'_month');var _end_day=ge(end_prefix+'_day');var _end_year=ge(end_prefix+'_year');var _end_hour=ge(end_prefix+'_hour');var _end_min=ge(end_prefix+'_min');var _end_ampm=ge(end_prefix+'_ampm');var _bottom_touched;if(auto){_bottom_touched=false;}else{_bottom_touched=true;}
var _start_touched=function(){if(!_bottom_touched){_propogate_time_span(_start_month,_start_day,_start_year,_start_hour,_start_min,_start_ampm);}}
var _end_touched=function(){_bottom_touched=true;}
var _propogate_time_span=function(){var start_ts=_get_date_time_ts(_start_month,_start_day,_start_year,_start_hour,_start_min,_start_ampm);var end_ts=start_ts+span*60000;_set_date_time_from_ts(end_ts,_end_month,_end_day,_end_year,_end_hour,_end_min,_end_ampm);}
var _get_date_time_ts=function(m,d,y,h,min,ampm){var this_date=new Date();var date_this_day=this_date.getDate();var date_this_month=this_date.getMonth();var date_this_year=this_date.getFullYear();var month=m.value-1;var date=d.value;var hour;var minutes=min.value;var year;hour=parseInt(h.value);if(hour==12)hour=0;if(ampm.value=='pm'){hour=hour+12;}
if(!y){if(month<date_this_month){year=date_this_year+1;}else{if(month==date_this_month&&date<date_this_day){year=date_this_year+1;}else{year=date_this_year;}}}else{year=y.value;}
var new_date=new Date(year,month,date,hour,minutes,0,0);var ts=new_date.getTime();return ts;}
var _set_date_time_from_ts=function(ts,m,d,y,h,min,ampm){var new_date=new Date();new_date.setTime(ts);var old_month=m.value;var new_month=new_date.getMonth()+1;var new_day=new_date.getDate();var new_hour=new_date.getHours();var new_minutes=new_date.getMinutes();var new_year=new_date.getFullYear();var new_ampm;if(new_hour>11){new_ampm='pm';if(new_hour>12){new_hour=new_hour-12;}}else{if(new_hour==0)new_hour=12;new_ampm='am';}
if(new_minutes<10){new_minutes="0"+new_minutes;}
m.value=new_month;d.value=new_day;if(y){y.value=new_year;}
h.value=new_hour;min.value=new_minutes;ampm.value=new_ampm;if(old_month!=new_month){editor_date_month_change(m,d,y?y:false);}}
var _start_month_touched=function(){_start_touched();editor_date_month_change(_start_month,_start_day,_start_year?_start_year:false);}
var _end_month_touched=function(){_end_touched();editor_date_month_change(_end_month,_end_day,_end_year?_end_year:false);}
_start_month.onchange=_start_month_touched;_start_day.onchange=_start_touched;if(_start_year){_start_year.onchange=_start_touched;}
_start_hour.onchange=_start_touched;_start_min.onchange=_start_touched;_start_ampm.onchange=_start_touched;_end_month.onchange=_end_month_touched;_end_day.onchange=_end_touched;if(_end_year){_end_year.onchange=_end_touched;}
_end_hour.onchange=_end_touched;_end_min.onchange=_end_touched;_end_ampm.onchange=_end_touched;}
function editor_date_month_change(month_el,day_el,year_el){var month_el=ge(month_el);var day_el=ge(day_el);var year_el=year_el?ge(year_el):false;var new_num_days=month_get_num_days(month_el.value,year_el.value&&year_el.value!=-1?year_el.value:false);var b=day_el.options[0].value==-1?1:0;for(var i=day_el.options.length;i>new_num_days+b;i--){remove_node(day_el.options[i-1]);}
for(var i=day_el.options.length;i<new_num_days+b;i++){day_el.options[i]=new Option(i+(b?0:1));}}
function editor_date_year_change(month,day,year){editor_date_month_change(month,day,year);}
function month_get_num_days(month,year){var temp_date;if(month==-1){return 31;}
temp_date=new Date(year?year:1912,month,0);return temp_date.getDate();}
function toggleEndWorkSpan(prefix){if(shown(prefix+'_endspan')){hide(prefix+'_endspan');show(prefix+'_present');}else{show(prefix+'_endspan');hide(prefix+'_present');}}
function regionCountryChange(label_id,country_id,region_id,label_prefix){switch(country_id){case'326':show(region_id);ge(label_id).innerHTML=label_prefix+'Province';break;case'398':show(region_id);ge(label_id).innerHTML=label_prefix+'State';break;default:ge(label_id).innerHTML=label_prefix+'Country';hide(region_id);break;}}
function regionCountryChange_twoLabels(country_label_id,region_label_id,country_id,region_id,label_prefix){show(country_label_id);ge(country_label_id).innerHTML=label_prefix+'Country';switch(country_id){case'326':show(region_id);show(region_label_id);ge(region_label_id).innerHTML=label_prefix+'Province';break;case'':case'398':show(region_id);show(region_label_id);ge(region_label_id).innerHTML=label_prefix+'State';break;default:ge(region_label_id).innerHTML=label_prefix+'State';ge(region_id).disabled=true;break;}}
function regionCountyChange_setUSifStateChosen(country_select_id,region_select_id){region_select=ge(region_select_id);country_select=ge(country_select_id);if(region_select.value!=''&&country_select.value==''){country_select.value=398;}}
function regionCountryChange_restrictions(country_select_id,region_select_id){country_select=ge(country_select_id);if(country_select.value==398){country_select.value='';}else if(country_select.value==326){region_select=ge(region_select_id);if(region_select.value){country_select.value='';}}}
function textLimit(ta,count){var text=ge(ta);if(text.value.length>count){text.value=text.value.substring(0,count);if(arguments.length>2){ge(arguments[2]).style.display='block';}}}
function textLimitStrict(text_id,limit,message_id,count_id,submit_id){var text=ge(text_id);var len=text.value.length;var diff=len-limit;if(diff>0){if(diff>25000){text.value=text.value.substring(0,limit+25000);diff=25000;}
ge(message_id).style.display='block';ge(count_id).innerHTML=diff;ge(submit_id).disabled=true;}else if(len==0){ge(message_id).style.display='none';ge(submit_id).disabled=true;ge(count_id).innerHTML=1;}else{if(ge(count_id).innerHTML!=0){ge(count_id).innerHTML=0;ge(message_id).style.display='none';ge(submit_id).disabled=false;}}}
function calcAge(month_el,day_el,year_el){bYear=parseInt(ge(year_el).value);bMonth=parseInt(ge(month_el).value);bDay=parseInt(ge(day_el).value);theDate=new Date();year=theDate.getFullYear();month=theDate.getMonth()+1;day=theDate.getDate();age=year-bYear;if((bMonth>month)||(bMonth==month&&day<bDay))age--;return age;}
function genYearOptionList(yearStart,yearEnd,curYear,name,parent){var theSelect=document.createElement('select');theSelect.name=name;theSelect.id=name;var blank=document.createElement('option');blank.innerHTML='Year:';theSelect.appendChild(blank);for(var i=yearEnd;i>=yearStart;i--){var element=document.createElement('option');if(curYear!=0&&curYear==i){element.setAttribute('selected','selected');}
element.setAttribute('value',i);element.innerHTML=i;theSelect.appendChild(element);}
ge(parent).appendChild(theSelect);}
function genMonthOptionList(curMonth,name,parent){var theSelect=document.createElement('select');theSelect.name=name;theSelect.id=name;if(arguments.length>3){theSelect.setAttribute('onchange',arguments[3]);}
var blank=document.createElement('option');blank.innerHTML='Month:';theSelect.appendChild(blank);var months=new Array();months[0]='January';months[1]='February';months[2]='March';months[3]='April';months[4]='May';months[5]='June';months[6]='July';months[7]='August';months[8]='September';months[9]='October';months[10]='November';months[11]='December';for(var i=1;i<=12;i++){var element=document.createElement('option');if(curMonth!=0&&curMonth==i){element.setAttribute('selected','selected');}
element.setAttribute('value',i);element.innerHTML=months[i-1];theSelect.appendChild(element);}
ge(parent).appendChild(theSelect);}

function showPost(id)
{ge('post'+id).className='post clearfix';}
function hidePost(id)
{ge('post'+id).className='post irrelevant clearfix';}
function board_search_onchange(){var search_text=ge('search').value;var disabled=false;if(search_text!=''){disabled=true;}
ge('sorter').disabled=disabled;ge('filter').disabled=disabled;}

function generic_dialog(className,modal){this.className=className;this.content=null;this.obj=null;this.popup=null;this.overlay=null;this.modal=null;this.iframe=null;this.hidden_objects=[];if(modal==true){this.modal=true;}}
generic_dialog.prototype.should_hide_objects=ua.osx();generic_dialog.prototype.should_use_iframe=ua.ie()&&ua.ie()<7;generic_dialog.prototype.show_dialog=function(html){if(!this.obj){this.build_dialog();}
set_inner_html(this.content,html);if(generic_dialog.prototype.should_hide_objects){var imgs=this.content.getElementsByTagName('img');for(var i=0;i<imgs.length;i++){imgs[i].onload=imgs[i].onload?function(){this.onload.apply(this.img,arguments);this.dialog.hide_objects()}.bind({img:imgs[i],dialog:this,onload:imgs[i].onload}):this.hide_objects.bind(this);}}
this.show();this.on_show_callback&&this.on_show_callback();return this;}
generic_dialog.prototype.set_top=function(top){return this;}
generic_dialog.prototype.show_loading=function(loading_html){this.show_dialog('<div class="dialog_loading">'+loading_html+'</div>');}
generic_dialog.prototype.show_ajax_dialog_custom_loader=function(html,src,post_vars){post_vars=post_vars||false;this.show_loading(html);var myself=this;var ajax=new Ajax(function(obj,text){myself.show_dialog(text);});if(post_vars){ajax.post(src,post_vars);}else{ajax.get(src);}
return this;}
generic_dialog.prototype.show_ajax_dialog=function(src,post_vars){post_vars=post_vars||false;var load='Loading...';return this.show_ajax_dialog_custom_loader(load,src,post_vars);}
generic_dialog.prototype.show_prompt=function(title,content){return this.show_dialog('<h2><span>'+title+'</span></h2><div class="dialog_content">'+content+'</div>');}
generic_dialog.prototype.show_message=function(title,content,button){if(button==null){button='Okay';}
return this.show_choice(title,content,button,function(){generic_dialog.get_dialog(this).fade_out(100)});}
generic_dialog.prototype.show_choice=function(title,content,button1,button1js,button2,button2js,buttons_left_msg,button3,button3js){var buttons='<div class="dialog_buttons" id="dialog_buttons">';if(typeof(buttons_left_msg)!='undefined'){buttons+='<div class="dialog_buttons_left_msg">';buttons+=buttons_left_msg;buttons+='</div>';}
buttons+='<input class="inputsubmit" type="button" value="'+button1+'" id="dialog_button1" />';if(button2){buttons+='<input class="inputsubmit" type="button" value="'+button2+'" id="dialog_button2" />';}
if(button3){buttons+='<input class="inputsubmit" type="button" value="'+button3+'" id="dialog_button3" />';}
this.show_prompt(title,this.content_to_markup(content)+buttons);var inputs=this.obj.getElementsByTagName('input');if(button3){button1obj=inputs[inputs.length-3];button2obj=inputs[inputs.length-2];button3obj=inputs[inputs.length-1];}else if(button2){button1obj=inputs[inputs.length-2];button2obj=inputs[inputs.length-1];}else{button1obj=inputs[inputs.length-1];}
if(button1js&&button1){if(typeof button1js=='string'){eval('button1js = function(){'+button1js+'}');}
button1obj.onclick=button1js;}
if(button2js&&button2){if(typeof button2js=='string'){eval('button2js = function(){'+button2js+'}');}
button2obj.onclick=button2js;}
if(button3js&&button3){if(typeof button3js=='string'){eval('button3js = function(){'+button3js+'}');}
button3obj.onclick=button3js;}
if(!this.modal){document.onkeyup=function(e){var keycode=(e&&e.which)?e.which:event.keyCode;var btn2_exists=(typeof button2obj!='undefined');var btn3_exists=(typeof button3obj!='undefined');var is_webkit=(navigator.userAgent.indexOf('WebKit')>0);if(is_webkit&&keycode==13){button1obj.click();}
if(keycode==27){if(btn3_exists){button3obj.click();}if(btn2_exists){button2obj.click();}else{button1obj.click();}}
document.onkeyup=function(){}}
button1obj.focus();}
return this;}
generic_dialog.prototype.show_choice_ajax=function(title,content_src,button1,button1js,button2,button2js,buttons_left_msg,button3,button3js){this.show_loading('Loading...');var handler=function(response){this.show_choice(title,response.getPayload(),button1,button1js,button2,button2js,buttons_left_msg,button3,button3js);}.bind(this);new AsyncRequest().setURI(content_src).setHandler(handler).send();return this;}
generic_dialog.prototype.show_form_ajax=function(title,src,button,reload_page_on_success){this.show_loading('Loading...');var form_id='dialog_ajax_form__'+gen_unique();var preSubmitErrorHandler=function(dialog,response){dialog.show_choice(title,response.getPayload(),'Okay',function(){dialog.fade_out(200);});}.bind(null,this);var preSubmitHandler=function(dialog,response){var contents='<form id="'+form_id+'">'+response.getPayload()+'</form>';dialog.show_choice(title,contents,button,submitHandler,'Cancel',function(){dialog.fade_out(200);});}.bind(null,this);var submitHandler=function(){new AsyncRequest().setURI(src).setData(serialize_form(ge(form_id))).setHandler(postSubmitHandler).setErrorHandler(postSubmitErrorHandler).send();};var postSubmitHandler=function(dialog,response){dialog.show_choice(title,response.getPayload(),'Okay',function(){dialog.fade_out(200);});if(reload_page_on_success){window.location.reload();}else{setTimeout(function(){dialog.fade_out(500);},750);}}.bind(null,this);var postSubmitErrorHandler=function(dialog,response){if(response.getError()==1346001){preSubmitHandler(response);}else{preSubmitErrorHandler(response);}}.bind(null,this);new AsyncRequest().setURI(src).setHandler(preSubmitHandler).setErrorHandler(preSubmitErrorHandler).send();return this;}
generic_dialog.prototype.show_form=function(title,content,button,target){content='<form action="'+target+'" method="post">'+this.content_to_markup(content);var post_form_id=ge('post_form_id');if(post_form_id){content+='<input type="hidden" name="post_form_id" value="'+post_form_id.value+'" />';}
content+='<div class="dialog_buttons"><input class="inputsubmit" name="confirm" type="submit" value="'+button+'" />';content+='<input type="hidden" name="next" value="'+htmlspecialchars(document.location.href)+'"/>';content+='<input class="inputsubmit" type="button" value="Cancel" onclick="generic_dialog.get_dialog(this).fade_out(100)" /></form>';this.show_prompt(title,content);return this;}
generic_dialog.prototype.content_to_markup=function(content){return(typeof content=='string')?'<div class="dialog_body">'+content+'</div>':'<div class="dialog_summary">'+content.summary+'</div><div class="dialog_body">'+content.body+'</div>';}
generic_dialog.prototype.hide=function(){if(this.obj){this.obj.style.display='none';}
if(this.iframe){this.iframe.style.display='none';}
if(this.overlay){this.overlay.style.display='none';}
if(this.timeout){clearTimeout(this.timeout);this.timeout=null;return;}
clearInterval(this.active_hiding);if(this.hidden_objects.length){for(var i=0,il=this.hidden_objects.length;i<il;i++){this.hidden_objects[i].style.visibility='';}
this.hidden_objects=[];}
return this;}
generic_dialog.prototype.anim_res=5;generic_dialog.prototype.fade_out=function(interval,timeout,first_call){if(timeout){this.timeout=setTimeout(function(){this.fade_out(interval)}.bind(this),timeout);return this;}else if(this.timeout){clearTimeout(this.timeout);this.timeout=null;}
if(!interval)
interval=350;if(!first_call)
first_call=(new Date).getTime()-this.anim_res;var fade=1.0-(((new Date).getTime()-first_call)/interval)*1.0;if(fade>0){set_opacity(this.obj,fade);setTimeout(function(){this.fade_out(interval,0,first_call)}.bind(this),this.anim_res);}
else{this.hide();set_opacity(this.obj,1);}
return this;}
generic_dialog.prototype.show=function(){if(this.obj&&this.obj.style.display){this.obj.style.visibility='hidden';this.obj.style.display='';this.reset_dialog();this.obj.style.visibility='';this.obj.dialog=this;}
else{this.reset_dialog();}
this.hide_objects();clearInterval(this.active_hiding);this.active_hiding=setInterval(this.active_resize.bind(this),500);return this;}
generic_dialog.prototype.enable_buttons=function(enable){var inputs=this.obj.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].type=='button'||inputs[i].type=='submit'){inputs[i].disabled=!enable;}}}
generic_dialog.prototype.active_resize=function(){if(this.last_offset_height!=this.content.offsetHeight){this.hide_objects();this.last_offset_height=this.content.offsetHeight;}}
generic_dialog.prototype.hide_objects=function(){var objects=new Array();var ad_locs=['',0,1,2,4,5,9,3];for(var i=0;i<ad_locs.length;i++){var ad_div=ge('ad_'+ad_locs[i]);if(ad_div!=null){objects.push(ad_div);this.should_hide_objects=true;}}
if(!this.should_hide_objects){return;}
var rect={x:elementX(this.content),y:elementY(this.content),w:this.content.offsetWidth,h:this.content.offsetHeight};var iframes=document.getElementsByTagName('iframe');for(var i=0;i<iframes.length;i++){if(iframes[i].className.indexOf('share_hide_on_dialog')!=-1){objects.push(iframes[i]);}}
var swfs=document.getElementsByTagName('embed');for(var i=0;i<swfs.length;i++){var inPopup=false;var parent_node=swfs[i].parentNode;while(parent_node){if(parent_node.id=='pop_content'){inPopup=true;}
parent_node=parent_node.parentNode;}
if(!inPopup){objects.push(swfs[i]);}}
for(var i=0;i<objects.length;i++){var pn=false;var node=objects[i].offsetHeight?objects[i]:objects[i].parentNode;swf_rect={x:elementX(node),y:elementY(node),w:node.offsetWidth,h:node.offsetHeight};if(rect.y+rect.h>swf_rect.y&&swf_rect.y+swf_rect.h>rect.y&&rect.x+rect.w>swf_rect.x&&swf_rect.x+swf_rect.w>rect.w&&array_indexOf(this.hidden_objects,node)==-1){this.hidden_objects.push(node);node.style.visibility='hidden';node.style.visibility='hidden';}}}
generic_dialog.prototype.build_dialog=function(){if(!this.obj&&!(this.obj=ge('generic_dialog'))){this.obj=document.createElement('div');this.obj.id='generic_dialog';}
this.obj.className='generic_dialog'+(this.className?' '+this.className:'');this.obj.style.display='none';onloadRegister(function(){document.body.appendChild(this.obj);}.bind(this));if(this.should_use_iframe){if(!this.iframe&&!(this.iframe=ge('generic_dialog_iframe'))){this.iframe=document.createElement('iframe');this.iframe.id='generic_dialog_iframe';}
this.iframe.frameBorder='0';onloadRegister(function(){document.body.appendChild(this.iframe);}.bind(this));}
if(!this.popup&&!(this.popup=ge('generic_dialog_popup'))){this.popup=document.createElement('div');this.popup.id='generic_dialog_popup';}
this.popup.style.left=this.popup.style.top='';this.obj.appendChild(this.popup);if(this.modal){this.overlay=document.createElement('div');this.overlay.id='generic_dialog_overlay';if(document.body.clientHeight>document.documentElement.clientHeight){this.overlay.style.height=document.body.clientHeight+'px';}else{this.overlay.style.height=document.documentElement.clientHeight+'px';}
onloadRegister(function(){document.body.appendChild(this.overlay);}.bind(this));}}
generic_dialog.prototype.reset_dialog=function(){if(!this.popup)
return;this.reset_dialog_obj();this.reset_iframe();}
generic_dialog.prototype.reset_iframe=function(){if(!this.should_use_iframe){return;}
if(this.modal){this.iframe.style.left='0px';this.iframe.style.top='0px';this.iframe.style.width='100%';if(document.body.clientHeight>document.documentElement.clientHeight){this.iframe.style.height=document.body.clientHeight+'px';}else{this.iframe.style.height=document.documentElement.clientHeight+'px';}}else{this.iframe.style.left=elementX(this.frame)+'px';this.iframe.style.top=elementY(this.frame)+'px';this.iframe.style.width=this.frame.offsetWidth+'px';this.iframe.style.height=this.frame.offsetHeight+'px';}
this.iframe.style.display='';}
generic_dialog.prototype.reset_dialog_obj=function(){}
generic_dialog.prototype.set_width=function(w){this.obj.style.width=w?w+'px':'';}
generic_dialog.get_dialog=function(obj){while(!obj.dialog&&obj.parentNode){obj=obj.parentNode;}
return obj.dialog?obj.dialog:false;}
function pop_dialog(className,callback_function,modal){this.top=125;this.parent.construct(this,className,modal);this.on_show_callback=callback_function;}
pop_dialog.extend(generic_dialog);pop_dialog.prototype.build_dialog=function(){this.parent.build_dialog();this.obj.className+=' pop_dialog';this.popup.innerHTML='<table id="pop_dialog_table" class="pop_dialog_table">'+'<tr><td class="pop_topleft"></td><td class="pop_border"></td><td class="pop_topright"></td></tr>'+'<tr><td class="pop_border"></td><td class="pop_content" id="pop_content"></td><td class="pop_border"></td></tr>'+'<tr><td class="pop_bottomleft"></td><td class="pop_border"></td><td class="pop_bottomright"></td></tr>'+'</table>';this.frame=this.popup.getElementsByTagName('tbody')[0];this.content=this.popup.getElementsByTagName('td')[4];}
pop_dialog.prototype.reset_dialog_obj=function(){this.popup.style.top=(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop)+this.top+'px';}
pop_dialog.prototype.set_top=function(top){this.top=top;}
function contextual_dialog(className){this.parent.construct(this,className);}
contextual_dialog.extend(generic_dialog);contextual_dialog.prototype.set_context=function(obj){this.context=obj;return this;}
contextual_dialog.prototype.build_dialog=function(){this.parent.build_dialog();this.obj.className+=' contextual_dialog';this.popup.innerHTML='<div class="contextual_arrow"><span>^_^keke1</span></div><div class="contextual_dialog_content"></div>';this.arrow=this.popup.getElementsByTagName('div')[0];this.content=this.frame=this.popup.getElementsByTagName('div')[1];}
contextual_dialog.prototype.reset_dialog_obj=function(){var x=elementX(this.context);var center=(document.body.offsetWidth-this.popup.offsetWidth)/2;if(x<document.body.offsetWidth/2){this.arrow.className='contextual_arrow_rev';var left=Math.min(center,x+this.context.offsetWidth-this.arrow_padding);var arrow=x-left+this.context.offsetWidth+this.arrow_padding;}else{this.arrow.className='contextual_arrow';var left=Math.max(center,x-this.popup.offsetWidth+this.arrow_padding);var arrow=x-left-this.arrow_padding-this.arrow_width;}
this.popup.style.top=(elementY(this.context)+this.context.offsetHeight-this.arrow.offsetHeight+this.arrow_padding)+'px';this.popup.style.left=left+'px';this.arrow.style.backgroundPosition=arrow+'px';}
contextual_dialog.prototype._remove_resize_events=function(){if(this._scroll_events){for(var i=0;i<this._scroll_events.length;i++){removeEventBase(this._scroll_events[i].obj,this._scroll_events[i].event,this._scroll_events[i].func);}}
this._scroll_events=[];}
contextual_dialog.prototype.show=function(){this._remove_resize_events();var obj=this.context;while(obj){if(obj.id!='content'&&(obj.scrollHeight&&obj.offsetHeight&&obj.scrollHeight!=obj.offsetHeight)||(obj.scrollWidth&&obj.offsetWidth&&obj.scrollWidth!=obj.offsetWidth)){var evt={obj:obj,event:'scroll',func:this.reset_dialog_obj.bind(this)};addEventBase(evt.obj,evt.event,evt.func);}
obj=obj.parentNode;}
var evt={obj:window,event:'resize',func:this.reset_dialog_obj.bind(this)};addEventBase(evt.obj,evt.event,evt.func);this.parent.show();}
contextual_dialog.prototype.hide=function(){this._remove_resize_events();this.parent.hide();}
contextual_dialog.prototype.arrow_padding=6;contextual_dialog.prototype.arrow_width=13;

function typeaheadpro(obj,source,properties){if(!typeaheadpro.hacks){typeaheadpro.should_check_double_fire=typeaheadpro.should_check_missing_events=navigator.userAgent.indexOf('AppleWebKit/4')!=-1;typeaheadpro.should_use_iframe=navigator.userAgent.indexOf('MSIE 6.0')!=-1;typeaheadpro.hacks=true;}
if(typeaheadpro.instances){typeaheadpro.instances['i'+typeaheadpro.instances.i]=this;typeaheadpro.instances.i=(this.instance=typeaheadpro.instances.i)+1;}else{typeaheadpro.instances={i0:this,i:1};this.instance=0;}
copy_properties(this,properties||{});this.obj=obj;this.obj.typeahead=this;this.clear_placeholder();if(source){this.set_source(source);}
this.obj.onfocus=this._onfocus.bind(this);this.obj.onblur=chain(this.obj.onblur,this._onblur.bind(this));this.obj.onchange=this._onchange.bind(this);this.obj.onkeyup=function(event){return this._onkeyup(event?event:window.event);}.bind(this);this.obj.onkeydown=function(event){return this._onkeydown(event?event:window.event);}.bind(this);this.obj.onkeypress=function(event){return this._onkeypress(event?event:window.event);}.bind(this);this.focused=this.obj.offsetWidth?true:false;this.anchor=this.setup_anchor();this.list=document.createElement('div');this.list.className='typeahead_list';if(!this.focused){this.list.style.display='none';}
this.anchor_block=this.anchor_block||this.anchor.tagName.toLowerCase()=='div';if(this.should_use_absolute){document.body.appendChild(this.list);this.list.className+=' typeahead_list_absolute';}else{if(this.anchor.nextSibling){this.anchor.parentNode.insertBefore(this.list,this.anchor.nextSibling);}else{this.anchor.parentNode.appendChild(this.list);}
if(!this.anchor_block){this.anchor.parentNode.insertBefore(document.createElement('br'),this.list);}}
if(typeaheadpro.should_use_iframe&&!typeaheadpro.iframe){typeaheadpro.iframe=document.createElement('iframe');typeaheadpro.iframe.src="/js/blank.html";typeaheadpro.iframe.className='typeahead_iframe';typeaheadpro.iframe.style.display='none';typeaheadpro.iframe.frameBorder=0;document.body.appendChild(typeaheadpro.iframe);}
if(this.source){this.selectedindex=-1;if(this.focused){this.show();this._onkeyup();this.set_class('');this.capture_submit();}}else{this.hide();}}
typeaheadpro.prototype.should_use_absolute=false;typeaheadpro.prototype.interactive=false;typeaheadpro.prototype.changed=false;typeaheadpro.prototype.max_results=10;typeaheadpro.prototype.allow_placeholders=true;typeaheadpro.prototype.auto_select=true;typeaheadpro.prototype.set_source=function(source){this.source=source;this.source.set_owner(this);this.status=0;this.cache={};this.last_search=0;this.suggestions=[];}
typeaheadpro.prototype.setup_anchor=function(){return this.obj;}
typeaheadpro.prototype.destroy=function(){if(!this.anchor_block&&this.anchor.nextSibling.tagName.toLowerCase()=='br'){this.anchor.parentNode.removeChild(this.anchor.nextSibling);}
if(this.list){this.list.parentNode.removeChild(this.list);}
this.obj.onfocus=this.obj.onblur=this.obj.onkeyup=this.obj.onkeydown=this.obj.onkeypress=null;this.obj.parentNode.removeChild(this.obj);this.anchor=this.obj=this.obj.typeahead=this.list=null;delete typeaheadpro.instances['i'+this.instance];}
typeaheadpro.prototype._onkeyup=function(e){this.last_key=e?e.keyCode:-1;if(this.key_down==this.last_key){this.key_down=0;}
switch(this.last_key){case 27:this.selectedindex=-1;this._onselect(false);this.hide();break;case undefined:case 0:case 13:case 37:case 38:case 39:case 40:break;default:this.dirty_results();if(typeaheadpro.should_check_missing_events){setTimeout(function(){this.dirty_results()}.bind(this),50);}
break;}}
typeaheadpro.prototype._onkeydown=function(e){this.key_down=this.last_key=e?e.keyCode:-1;this.interactive=true;switch(this.last_key){case 9:this.select_suggestion(this.selectedindex);break;case 13:if(this.select_suggestion(this.selectedindex)){this.hide();}
if(typeof(this.submit_keydown_return)!='undefined'){this.submit_keydown_return=this._onsubmit(this.get_current_selection());}
return this.submit_keydown_return;case 38:if(this.check_double_fire())return;this.set_suggestion(this.selectedindex-1);return false;case 40:if(this.check_double_fire())return;this.set_suggestion(this.selectedindex+1);return false;}}
typeaheadpro.prototype._onkeypress=function(e){this.last_key=e?e.keyCode:-1;this.interactive=true;switch(this.last_key){case 38:case 40:return false;case 13:var ret=null;if(typeof(this.submit_keydown_return)=='undefined'){ret=this.submit_keydown_return=this._onsubmit(this.get_current_selection());}else{ret=this.submit_keydown_return;delete this.submit_keydown_return;}
return ret;}
return true;}
typeaheadpro.prototype._onchange=function(){this.changed=true;}
typeaheadpro.prototype._onfound=function(obj){return this.onfound?this.onfound.call(this,obj):true;}
typeaheadpro.prototype._onsubmit=function(obj){if(this.onsubmit){var ret=this.onsubmit.call(this,obj);if(ret&&this.obj.form){if(!this.obj.form.onsubmit||this.obj.form.onsubmit()){this.obj.form.submit();}
return false;}
return ret;}else{this.advance_focus();return false;}}
typeaheadpro.prototype._onselect=function(obj){if(this.onselect){this.onselect.call(this,obj);}}
typeaheadpro.prototype._onfocus=function(){this.focused=true;this.changed=false;this.clear_placeholder();this.results_text='';this.set_class('');this.dirty_results();this.show();this.capture_submit();}
typeaheadpro.prototype._onblur=function(){if(this.changed&&!this.interactive){this.dirty_results();this.changed=false;return;}
if(!this.suggestions){this._onselect(false);}
this.focused=false;this.hide();this.update_class();if(!this.get_value()){var noinput=this.allow_placeholders?'':this.source.gen_noinput();this.set_value(noinput?noinput:'');this.set_class('typeahead_placeholder')}}
typeaheadpro.prototype.capture_submit=function(){if(!typeaheadpro.should_check_missing_events)return;if((!this.captured_form||this.captured_substitute!=this.captured_form.onsubmit)&&this.obj.form){this.captured_form=this.obj.form;this.captured_event=this.obj.form.onsubmit;this.captured_substitute=this.obj.form.onsubmit=function(){return((this.key_down&&this.key_down!=13&&this.key_down!=9)?this.submit_keydown_return:(this.captured_event?this.captured_event.apply(arguments,this.captured_form):true))?true:false;}.bind(this);}}
typeaheadpro.prototype.check_double_fire=function(){if(!typeaheadpro.should_check_double_fire){return false;}
else{this.double_fire++;return this.double_fire%2==1;}}
typeaheadpro.prototype.double_fire=0;typeaheadpro.prototype.set_suggestion=function(index){if(!this.suggestions||this.suggestions.length<=index){return}
this.selectedindex=(index<=-1)?-1:index;var nodes=this.list.childNodes;for(var i=0;i<nodes.length;i++){if(this.selectedindex==i){nodes[i].className=nodes[i].className.replace(/\btypeahead_not_selected\b/,'typeahead_selected');}
else{nodes[i].className=nodes[i].className.replace(/\btypeahead_selected\b/,'typeahead_not_selected');}}
this._onfound(this.get_current_selection());}
typeaheadpro.prototype.get_current_selection=function(){return this.selectedindex==-1?false:this.suggestions[this.selectedindex];}
typeaheadpro.prototype.update_class=function(){if(this.suggestions&&this.selectedindex!=-1&&typeahead_source.flatten_string(this.get_current_selection().t)==typeahead_source.flatten_string(this.get_value())){this.set_class('typeahead_found');}
else{this.set_class('');}}
typeaheadpro.prototype.select_suggestion=function(index){if(!this.suggestions||index==undefined||index===false||this.suggestions.length<=index||index<0){this._onfound(false);this._onselect(false);this.selectedindex=-1;this.set_class('');}else{this.selectedindex=index;this.set_value(this.suggestions[index].t);this.set_class('typeahead_found');this._onfound(this.suggestions[this.selectedindex]);this._onselect(this.suggestions[this.selectedindex]);}
if(!this.interactive){this.hide();this.obj.blur();}
return true;}
typeaheadpro.prototype.set_value=function(value){this.obj.value=value;}
typeaheadpro.prototype.get_value=function(){return this.obj.value;}
typeaheadpro.prototype.found_suggestions=function(suggestions,text,fake_data){if(!fake_data){this.status=0;this.add_cache(text,suggestions);}
if(this.get_value()==this.results_text){return;}
if(!fake_data){this.results_text=typeahead_source.flatten_string(text);}
var current_selection=this.auto_select?null:this.suggestions[this.selectedindex];this.suggestions=suggestions;if(suggestions.length>0){var html=[];for(var i=0;i<suggestions.length;i++){html.push('<div class="');if((i==0&&this.auto_select)||current_selection==suggestions[i]){if(this.selectedindex!=i){this._onfound(suggestions[i]);}
this.selectedindex=i;html.push('typeahead_suggestion typeahead_selected');}else{html.push('typeahead_suggestion typeahead_not_selected');}
html.push('" onmouseout="typeaheadpro.instances.i',this.instance,'.set_suggestion(-1)" ','onmouseover="typeaheadpro.instances.i',this.instance,'.set_suggestion(',i,')" ','onmousedown="typeaheadpro.instances.i',this.instance,'.select_suggestion(',i,')">',this.source.gen_html(suggestions[i],this.get_value()),'</div>');}
this.list.innerHTML=html.join('');this.show();this.reset_iframe();}
else{this.selectedindex=-1;this.set_message(this.status==0?this.source.gen_nomatch():this.source.gen_loading());this._onfound(false);}
if(!fake_data&&this.results_text!=typeahead_source.flatten_string(this.get_value())){this.dirty_results();}}
typeaheadpro.prototype.search_cache=function(text){return this.cache[typeahead_source.flatten_string(text)];}
typeaheadpro.prototype.add_cache=function(text,results){if(this.source.cache_results){this.cache[typeahead_source.flatten_string(text)]=results;}}
typeaheadpro.prototype.source_loaded=function(){if(!this.get_value().length){this.set_message(this.source.gen_placeholder());}
if(this.status==2){this.status=0;}
this.dirty_results();}
typeaheadpro.prototype.set_class=function(name){this.obj.className=(this.obj.className.replace(/typeahead_[^\s]+/g,'')+' '+name).replace(/ {2,}/g,' ');}
typeaheadpro.prototype.dirty_results=function(){if(this.get_value().replace(' ','')==''){this.set_message(this.source.gen_placeholder());this.suggestions=[];this.selectedindex=-1;this.results_text=this.get_value();return;}else if(this.results_text==typeahead_source.flatten_string(this.get_value())){return;}
var time=(new Date).getTime();var cache;var updated=false;if(this.last_search<=(time-this.source.search_limit)&&this.source.status==0&&this.status==0){updated=this.perform_search();}else{if(this.status==0&&this.source.status==1){this.set_message(this.source.gen_loading());this.status=2;}else if(this.status==0&&this.source.status==0){if(!this.search_timeout){this.search_timeout=setTimeout(function(){this.search_timeout=false;if(this.status==0&&this.source.status==0){updated=this.perform_search();}}.bind(this),this.source.search_limit-(time-this.last_search));}}}
if(this.suggestions&&!updated){var match=-1;var ttext=typeahead_source.tokenize(this.get_value()).sort(typeahead_source._sort);this.found_suggestions(this.suggestions,this.get_value(),true);for(var i=0;i<this.suggestions.length;i++){if(typeahead_source.check_match(ttext,this.suggestions[i].t)){match=i;break;}}
if(match!=0){this.set_suggestion(match);}}}
typeaheadpro.prototype.perform_search=function(){if(this.get_value()==this.results_text){return true;}
if(!this.get_value().length){this.set_message(this.source.gen_placeholder());this.suggestions=[];this.results_text='';this.selectedindex=-1;}else if((cache=this.search_cache(this.get_value()))!==undefined){this.found_suggestions(cache,this.get_value(),false);this.show();}else if(!this.source.search_value(this.get_value())){this.status=1;this.last_search=(new Date).getTime();return false;}
this.show();return true;}
typeaheadpro.prototype.set_message=function(text){if(text){this.list.innerHTML='<div class="typeahead_message">'+text+'</div>';this.reset_iframe();}
else{this.hide();}}
typeaheadpro.prototype.reset_iframe=function(){if(!typeaheadpro.should_use_iframe){return}
if(this.should_use_absolute){typeaheadpro.iframe.style.top=this.list.style.top;typeaheadpro.iframe.style.left=this.list.style.left;}else{typeaheadpro.iframe.style.top=elementY(this.list)+'px';typeaheadpro.iframe.style.left=elementX(this.list)+'px';}
typeaheadpro.iframe.style.width=this.list.offsetWidth+'px';typeaheadpro.iframe.style.height=this.list.offsetHeight+'px';typeaheadpro.iframe.style.display='';}
typeaheadpro.prototype.advance_focus=function(){var inputs=this.obj.form?this.obj.form.getElementsByTagName('input'):document.getElementsByTagName('input');var next_inputs=false;for(var i=0;i<inputs.length;i++){if(next_inputs){if(inputs[i].type!='hidden'&&inputs[i].tabIndex!=-1&&inputs[i].offsetParent){next_inputs.push(inputs[i]);}}else if(inputs[i]==this.obj){next_inputs=[];}}
setTimeout(function(){for(var i=0;i<this.length;i++){try{if(this[i].offsetParent){this[i].focus();setTimeout(function(){try{this.focus();}catch(e){}}.bind(this[i]),0);return;}}catch(e){}}}.bind(next_inputs?next_inputs:[]),0);}
typeaheadpro.prototype.clear_placeholder=function(){if(this.obj.className.indexOf('typeahead_placeholder')!=-1){this.set_value('');this.set_class('');}}
typeaheadpro.prototype.clear=function(){this.set_value('',true);this.set_class('');this.dirty_results();}
typeaheadpro.prototype.hide=function(){this.list.style.display='none';this.list.innerHTML='';if(typeaheadpro.should_use_iframe){typeaheadpro.iframe.style.display='none';}}
typeaheadpro.prototype.show=function(){if(this.focused){if(this.should_use_absolute){this.list.style.top=elementY(this.anchor)+this.anchor.offsetHeight+'px';this.list.style.left=elementX(this.anchor)+'px';}
this.list.style.width=(this.anchor.offsetWidth-2)+'px';this.list.style.display='';if(typeaheadpro.should_use_iframe){typeaheadpro.iframe.style.display='';this.reset_iframe();}}}
typeaheadpro.prototype.focus=function(){this.obj.focus();}
typeaheadpro.kill_typeahead=function(obj){if(obj.typeahead){if(!this.should_use_absolute&&!this.anchor_block){obj.parentNode.removeChild(obj.nextSibling);}
obj.parentNode.removeChild(obj.nextSibling);if(obj.typeahead.source){obj.typeahead.source=obj.typeahead.source.owner=null;}
obj.onfocus=obj.onblur=obj.onkeypress=obj.onkeyup=obj.onkeydown=obj.typeahead=null;}}
function tokenizer(obj,typeahead_source,nofocus,max_selections){if(navigator.userAgent.indexOf('AppleWebKit/4')==-1){tokenizer.valid_arrow_event=function(){return true};}else{tokenizer.valid_arrow_count=0;tokenizer.valid_arrow_event=function(){return tokenizer.valid_arrow_count++%2==0};}
try{if(ua.ie()){document.execCommand('BackgroundImageCache',false,true);}}catch(e){}
this.obj=obj;this.obj.tokenizer=this;this.typeahead_source=typeahead_source;while(!/\btokenizer\b/.test(this.obj.className)){this.obj=this.obj.parentNode;}
this.tab_stop=this.obj.getElementsByTagName('input')[0];this.inputs=[];this.obj.onmousedown=function(event){return this._onmousedown(event?event:window.event)}.bind(this);this.tab_stop.onfocus=function(event){return this._onfocus(event?event:window.event)}.bind(this);this.tab_stop.onblur=function(event){return this.tab_stop_onblur(event?event:window.event)}.bind(this);this.tab_stop.onkeydown=function(event){return this.tab_stop_onkeydown(event?event:window.event)}.bind(this);if(!nofocus&&elementY(this.obj)>0){this._onfocus();}
this.max_selections=max_selections;}
tokenizer.is_empty=function(obj){if(has_css_class_name(obj,'tokenizer_locked')){return obj.getElementsByTagName('input').length==0;}else{return(!obj.tokenizer||obj.tokenizer.count_names()==0);}}
tokenizer.prototype.get_token_strings=function(){var r=[];var tokens=this.obj.getElementsByTagName('a');for(var i=0;i<tokens.length;++i){if(typeof tokens[i].token!='undefined'){r.push(tokens[i].token.text);}}
return r;}
tokenizer.prototype.clear=function(){var tokens=this.obj.getElementsByTagName('a');for(var i=tokens.length-1;i>=0;--i){if(typeof tokens[i].token!='undefined'){tokens[i].token.remove();}}}
tokenizer.prototype._onmousedown=function(event){setTimeout(function(){if(!this.inputs.length){if(this.max_selections>this.count_names()){new tokenizer_input(this);}else{var tokens=this.obj.getElementsByTagName('a');for(var i=tokens.length-1;i>=0;i--){if(typeof tokens[i].token!='undefined'){tokens[i].token.select();break;}}}}else{this.inputs[0].focus();}}.bind(this),0);event?event.cancelBubble=true:false;return false;}
tokenizer.prototype._onfocus=function(event){if(this.tab_stop_ignore_focus){this.tab_stop_ignore_focus=false;return;}
this._onmousedown();}
tokenizer.prototype.tab_stop_onblur=function(event){this.selected_token?this.selected_token.deselect():false;}
tokenizer.prototype.tab_stop_onkeydown=function(event){if(!event.keyCode||!this.selected_token){return;}
switch(event.keyCode){case 8:case 46:var tok=this.selected_token;var prev=tok.element.previousSibling;if(prev&&prev.input){prev.input.element.focus();}else{new tokenizer_input(this,tok.element);}
tok.remove();return false;case 37:if(!tokenizer.valid_arrow_event()){break;}
var tok=this.selected_token;var prev=tok.element.previousSibling;if(prev&&prev.input){prev.input.element.focus();}else if(this.max_selections>this.count_names()){new tokenizer_input(this,tok.element);}else{return false;}
tok.deselect();return false;case 39:if(!tokenizer.valid_arrow_event()){break;}
var tok=this.selected_token;var next=tok.element.nextSibling;if(next&&next.input){next.input.focus();}else if(this.max_selections>this.count_names()){new tokenizer_input(this,tok.element.nextSibling);}else{return false;}
tok.deselect();return false;}}
tokenizer.prototype.count_names=function(){var inputs=this.obj.getElementsByTagName('input');var count=0;for(var i=0;i<inputs.length;i++){if(inputs[i].type=='hidden'){count++;}}
return count;}
tokenizer.prototype.disable=function(){this.tab_stop.parentNode.removeChild(this.tab_stop);this.obj.className+=' tokenizer_locked';}
function tokenizer_input(tokenizer,caret){if(!tokenizer_input.hacks){tokenizer_input.should_use_borderless_hack=navigator.userAgent.indexOf('AppleWebKit')!=-1;tokenizer_input.should_use_shadow_hack=navigator.userAgent.indexOf('MSIE')!=-1||navigator.userAgent.indexOf('Opera')!=-1||navigator.userAgent.indexOf('Firefox/1.5')||navigator.userAgent.indexOf('Firefox/1.0');tokenizer_input.hacks=true;}
this.tokenizer=tokenizer;this.obj=document.createElement('input');this.obj.input=this;this.obj.tabIndex=-1;this.obj.size=1;this.obj.onmousedown=function(event){(event?event:window.event).cancelBubble=true}.bind(this);this.shadow=document.createElement('span');this.shadow.className='tokenizer_input_shadow';this.element=document.createElement('div');this.element.className='tokenizer_input'+(tokenizer_input.should_use_borderless_hack?' tokenizer_input_borderless':'');this.element.appendChild(document.createElement('div'));this.element.firstChild.appendChild(this.obj);(tokenizer_input.should_use_shadow_hack?document.body:this.element.firstChild).appendChild(this.shadow);caret?tokenizer.obj.insertBefore(this.element,caret):tokenizer.obj.appendChild(this.element);this.tokenizer.tab_stop.disabled=true;this.update_shadow();this.update_shadow=this.update_shadow.bind(this);this.tokenizer.inputs.push(this);this.parent.construct(this,this.obj,this.tokenizer.typeahead_source);if(this.focused){this.focus();this.obj.select();}
setInterval(this.update_shadow.bind(this),100);}
tokenizer_input.extend(typeaheadpro);tokenizer_input.prototype.gen_nomatch=tokenizer_input.prototype.gen_loading=tokenizer_input.prototype.gen_placeholder=tokenizer_input.prototype.gen_noinput='';tokenizer_input.prototype.setup_anchor=function(){return this.tokenizer.obj;}
tokenizer_input.prototype.update_shadow=function(){try{var val=this.obj.value;}catch(e){return};if(this.shadow_input!=val){this.shadow.innerHTML=htmlspecialchars((this.shadow_input=val)+'^_^');if(tokenizer_input.should_use_shadow_hack){this.obj.style.width=this.shadow.offsetWidth+'px';this.obj.value=val;}}}
tokenizer_input.prototype._onblur=function(){if(this.changed&&!this.interactive){this.dirty_results();this.changed=false;return;}
if(this.changed||this.interactive){this.select_suggestion(this.selectedindex);}
this.parent._onblur();setTimeout(function(){this.disabled=false}.bind(this.tokenizer.tab_stop),1000);this.destroy();}
tokenizer_input.prototype._onfocus=function(){this.tokenizer.tab_stop.disabled=true;this.parent._onfocus();return true;}
tokenizer_input.prototype._onkeydown=function(event){switch(event.keyCode){case 13:if(this.selectedindex<0){this.selectedindex=0;}
break;case 37:if(!tokenizer.valid_arrow_event()){break;}
case 8:if(this.get_selection_start()!=0||this.obj.value!=''){break;}
var prev=this.element.previousSibling;if(prev&&prev.token){setTimeout(prev.token.select.bind(prev.token),0);}
break;case 39:if(!tokenizer.valid_arrow_event()){break;}
case 46:if(this.get_selection_start()!=this.obj.value.length){break;}
var next=this.element.nextSibling;if(next&&next.token){setTimeout(next.token.select.bind(next.token),0);}
break;case 188:this.parent._onkeydown({keyCode:9});return false;case 9:if(this.obj.value){this._onkeydown({keyCode:13});return false;}else if(!event.shiftKey){this.advance_focus();this.parent._onkeydown(event);return false;}
break;}
return this.parent._onkeydown(event);}
tokenizer_input.prototype._onkeypress=function(event){switch(event.keyCode){case 9:return false;}
setTimeout(this.update_shadow,0);return this.parent._onkeypress(event);}
tokenizer_input.prototype.select_suggestion=function(index){if(this.suggestions&&index>=0&&this.suggestions.length>index){var inputs=this.tokenizer.obj.getElementsByTagName('input');var id=this.suggestions[index].i;for(i=0;i<inputs.length;i++){if(inputs[i].name=='ids[]'&&inputs[i].value==id){return false;}}}
return this.parent.select_suggestion(index);}
tokenizer_input.prototype.get_selection_start=function(){if(this.obj.selectionStart!=undefined){return this.obj.selectionStart;}else{return Math.abs(document.selection.createRange().moveStart('character',-1024));}}
tokenizer_input.prototype.onselect=function(obj){if(obj){var inputs=this.tokenizer.obj.getElementsByTagName('input');for(i=0;i<inputs.length;i++){if(inputs[i].name=='ids[]'&&inputs[i].value==obj.i){return false;}}
new token(obj,this.tokenizer,this.element);if(this.tokenizer.max_selections>this.tokenizer.count_names()){this.clear();}else{this.destroy();this.hide=function(){};return false;}}
this.tokenizer.typeahead_source.onselect_not_found.call(this);return false;}
tokenizer_input.prototype._onsubmit=function(){return false;}
tokenizer_input.prototype.capture_submit=function(){return false;}
tokenizer_input.prototype.clear=function(){this.parent.clear();this.update_shadow();}
tokenizer_input.prototype.destroy=function(){if(tokenizer_input.should_use_shadow_hack){this.shadow.parentNode.removeChild(this.shadow);}
this.element.parentNode.removeChild(this.element);this.element=null;var index=array_indexOf(this.tokenizer.inputs,this);if(index!=-1){this.tokenizer.inputs.splice(index,1);}
this.tokenizer=this.element=this.shadow=null;this.parent.destroy();return null;}
function token(obj,tokenizer,caret){this.tokenizer=tokenizer;this.element=document.createElement('a');this.element.className='token';this.element.href='#';this.element.tabIndex=-1;this.element.onclick=function(event){return this._onclick(event?event:window.event)}.bind(this);this.element.onmousedown=function(event){(event?event:window.event).cancelBubble=true;return false};this.render_obj(obj);this.element.token=this;caret?this.tokenizer.obj.insertBefore(this.element,caret):this.tokenizer.obj.appendChild(this.element);}
token.prototype.render_obj=function(obj){var inputs='';if(obj.e){inputs=['<input type="hidden" fb_protected="true" name="emails[]" value="',obj.e,'" />'].join('');}else if(obj.i){inputs=['<input type="hidden" fb_protected="true" name="',this.tokenizer.obj.id,'[]" value="',obj.i,'" />'].join('');}else if(obj.is){for(var i=0,il=obj.is.length;i<il;i++){inputs+=['<input type="hidden" fb_protected="true" name="',this.tokenizer.obj.id,'[]" value="',obj.is[i],'" />'].join('');}}
this.text=obj.t;this.element.innerHTML=['<span><span><span><span>',inputs,htmlspecialchars(obj.t),'<span onclick="this.parentNode.parentNode.parentNode.parentNode.parentNode.token.remove(true); event.cancelBubble=true; return false;" ','onmouseover="this.className=\'x_hover\'" onmouseout="this.className=\'x\'" class="x">&nbsp;</span>','</span></span></span></span>'].join('');}
token.prototype._onclick=function(event){this.select();event.cancelBubble=true;return false;}
token.prototype.select=function(again){if(this.tokenizer.selected_token&&!again){this.tokenizer.selected_token.deselect();}
this.element.className=trim(this.element.className.replace('token_selected',''))+' token_selected';this.tokenizer.tab_stop_ignore_focus=true;if(this.tokenizer.tab_stop.disabled){this.tokenizer.tab_stop.disabled=false;}
this.tokenizer.tab_stop.focus();this.tokenizer.selected_token=this;if(again!==true){setTimeout(function(){this.select(true)}.bind(this),0);}else{setTimeout(function(){this.tab_stop_ignore_focus=false}.bind(this.tokenizer),0);}}
token.prototype.remove=function(focus){this.element.parentNode.removeChild(this.element);this.element.token=null;this.tokenizer.selected_token=null;if(focus){this.tokenizer._onmousedown();}}
token.prototype.deselect=function(){this.element.className=trim(this.element.className.replace('token_selected',''));this.tokenizer.selected_token=null;}
function typeahead_source(){}
typeahead_source.prototype.cache_results=false;typeahead_source.prototype.search_limit=10;typeahead_source.check_match=function(search,value){value=typeahead_source.tokenize(value);for(var i=0,il=search.length;i<il;i++){if(search[i].length){var found=false;for(var j=0,jl=value.length;j<jl;j++){if(value[j].length>=search[i].length&&value[j].substring(0,search[i].length)==search[i]){found=true;value[j]='';break;}}
if(!found){return false;}}}
return true;}
typeahead_source.tokenize=function(text,capture,noflatten){return(noflatten?text:typeahead_source.flatten_string(text)).split(capture?typeahead_source.normalizer_regex_capture:typeahead_source.normalizer_regex);}
typeahead_source.normalizer_regex_str='(?:(?:^| +)["\'.\\-]+ *)|(?: *[\'".\\-]+(?: +|$)|@| +)';typeahead_source.normalizer_regex=new RegExp(typeahead_source.normalizer_regex_str,'g');typeahead_source.normalizer_regex_capture=new RegExp('('+typeahead_source.normalizer_regex_str+')','g');typeahead_source.flatten_string=function(text){if(!typeahead_source.accents){typeahead_source.accents={a:/à|á|â|ã|ä|å/g,c:/ç/g,d:/ð/g,e:/è|é|ê|ë/g,i:/ì|í|î|ï/g,n:/ñ/g,o:/ø|ö|õ|ô|ó|ò/g,u:/ü|û|ú|ù/g,y:/ÿ|ý/g,ae:/æ/g,oe:/œ/g}}
text=text.toLowerCase();for(var i in typeahead_source.accents){text=text.replace(typeahead_source.accents[i],i);}
return text;}
typeahead_source.prototype.set_owner=function(obj){this.owner=obj;}
typeahead_source.highlight_found=function(result,search){var html=[];resultv=typeahead_source.tokenize(result,true,true);result=typeahead_source.tokenize(result,true);search=typeahead_source.tokenize(search);search.sort(typeahead_source._sort);for(var i=0,il=resultv.length;i<il;i++){var found=false;for(var j=0,jl=search.length;j<jl;j++){if(search[j]&&result[i].lastIndexOf(search[j],0)!=-1){html.push('<em>',htmlspecialchars(resultv[i].substring(0,search[j].length)),'</em>',htmlspecialchars(resultv[i].substring(search[j].length,resultv[i].length)));found=true;break;}}
if(!found){html.push(htmlspecialchars(resultv[i]));}}
return html.join('');}
typeahead_source._sort=function(a,b){return b.length-a.length;}
typeahead_source.prototype.gen_nomatch=function(){return this.text_nomatch!=null?this.text_nomatch:'No matches found';}
typeahead_source.prototype.gen_loading=function(){return this.text_loading!=null?this.text_loading:'Loading...';}
typeahead_source.prototype.gen_placeholder=function(){return this.text_placeholder!=null?this.text_placeholder:'Start typing...';}
typeahead_source.prototype.gen_noinput=function(){return this.text_noinput!=null?this.text_noinput:'Start typing...';}
typeahead_source.prototype.onselect_not_found=function(){if(typeof this.tokenizer.onselect!='undefined'){return this.tokenizer.onselect();}}
function static_source(){this.values=null;this.index=null;this.exclude_ids={};this.parent.construct(this);}
static_source.extend(typeahead_source);static_source.prototype.build_index=function(){var index=[];var values=this.values;var gen_id=values.length&&typeof values[0].i=='undefined';for(var i=0,il=values.length;i<il;i++){var tokens=typeahead_source.tokenize(values[i].t);for(var j=0,jl=tokens.length;j<jl;j++){index.push({t:tokens[j],o:values[i]});}
if(gen_id){values[i].i=i;}}
index.sort(static_source._sort_text_obj);this.index=index;}
static_source._sort_text_obj=function(a,b){if(a.e&&!b.e){return 1;}
if(!a.e&&b.e){return-1;}
if(a.t==b.t){return 0;}
return a.t<b.t?-1:1}
static_source.prototype.search_value=function(text){if(this.status!=0){return;}
var ttext=typeahead_source.tokenize(text).sort(typeahead_source._sort);var index=this.index;var lo=0;var hi=this.index.length-1;var p=Math.floor(hi/2);while(lo<=hi){if(index[p].t>=ttext[0]){hi=p-1;}else{lo=p+1;}
p=Math.floor(lo+((hi-lo)/2));}
var results=[];var stale_keys={};var check_ignore=typeof _ignoreList!='undefined';for(var i=lo;i<index.length&&index[i].t.lastIndexOf(ttext[0],0)!=-1;i++){if(typeof stale_keys[index[i].o.i]!='undefined'){continue;}else{stale_keys[index[i].o.i]=true;}
if((!check_ignore||!_ignoreList[index[i].o.i])&&!this.exclude_ids[index[i].o.i]&&(ttext.length==1||typeahead_source.check_match(ttext,index[i].o.t))){results.push(index[i].o);}}
results.sort(static_source._sort_text_obj);results=results.slice(0,this.owner.max_results);this.owner.found_suggestions(results,text,false);return true;}
static_source.prototype.set_exclude_ids=function(ids){this.exclude_ids=ids;}
function friend_source(get_param){this.parent.construct(this);if(friend_source.friends[get_param]){this.status=0;this.values=friend_source.friends[get_param];this.index=friend_source.friends_index[get_param];}else{this.status=1;var ajax=new Ajax(function(obj,text){text=text.substring(9);eval(text);friend_source.friends[get_param]=this.values=friends;this.build_index();friend_source.friends_index[get_param]=this.index;this.status=0;if(this.owner&&this.owner.source_loaded){this.owner.source_loaded();}}.bind(this));ajax.get('/ajax/typeahead_friends.php?'+get_param);}}
friend_source.extend(static_source);friend_source.prototype.text_noinput=friend_source.prototype.text_placeholder='Start typing a friend\'s name';friend_source.friends={};friend_source.friends_index={};friend_source.prototype.gen_html=function(friend,highlight){return['<div>',typeahead_source.highlight_found(friend.t,highlight),'</div><div><small>',friend.n,'</small></div>'].join('');}
friend_source.prototype.search_value=function(text){if(text==String.fromCharCode(94,95,94)){this.owner.found_suggestions([{t:text,n:String.fromCharCode(107,101,107,101),i:10,it:'t_default.jpg'}],text,false);return true;}
return this.parent.search_value(text);}
function friend_and_email_source(get_param){get_param=get_param?get_param+'&include_emails=1':'';this.parent.construct(this,get_param);}
friend_and_email_source.extend(friend_source);friend_and_email_source.prototype.text_noinput=friend_and_email_source.prototype.text_placeholder='Start typing a friend\'s name or email address';friend_and_email_source.prototype.text_nomatch='You can type an email address...';friend_and_email_source.prototype.onselect_not_found=function(){emails=this.results_text.split(/[,; ]/);for(var i=0;i<emails.length;i++){var text=emails[i].replace(/^\s+|\s+$/g,'');var email_regex=/.*\@.*\.[a-z]+$/;if(!email_regex.test(text)){continue;}
var email_entry={t:text,e:text};var new_token=new token(email_entry,this.tokenizer,this.element);this.clear();var ajax=new Ajax(function(obj,text){text=(text.length>9)?text.substring(9):'';eval(text);if(obj){this.render_obj(obj);}}.bind(new_token));ajax.get('/ajax/typeahead_email.php?email='+encodeURIComponent(text));}}
function network_source(get_param){this.get_param=get_param?get_param:'';this.status=0;this.parent.construct(this);}
network_source.extend(typeahead_source);network_source.prototype.cache_results=true;network_source.prototype.search_limit=200;network_source.prototype.text_placeholder=network_source.prototype.text_noinput='Enter a city, workplace, school, or region.';network_source.prototype.base_uri='';network_source.prototype.search_value=function(text){this.search_text=text;var ajax=new Ajax(function(ajax,text){eval(text);this.owner.found_suggestions(results,this.search_text,false);}.bind(this),function(){this.owner.found_suggestions(false,this.search_text,false);}.bind(this));ajax.get('/ajax/typeahead_networks.php?'+this.get_param+'&q='+encodeURIComponent(text));}
network_source.prototype.gen_html=function(result,highlight){return['<div>',typeahead_source.highlight_found(result.t,highlight),'</div><div><small>',result.l,'</small></div>'].join('');}
function custom_source(options){this.parent.construct(this);this.status=0;this.values=options;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(result,highlight){var html=['<div>',typeahead_source.highlight_found(result.t,highlight),'</div>'];if(result.s){html.push('<div><small>',friend.n,'</small></div>');}
return html.join('');}
function concentration_source(get_network){this.parent.construct(this,[]);this.network=get_network;if(!concentration_source.networks){concentration_source.networks=[];}else{for(var i=0,il=concentration_source.networks.length;i<il;i++){if(concentration_source.networks[i].n==this.network){this.values=concentration_source.networks[i].v;this.index=concentration_source.networks[i].i;this.status=0;return;}}}
this.status=1;var ajax=new Ajax(function(obj,text){eval(text);this.values=_results;this.build_index();concentration_source.networks.push({n:this.network,v:this.values,i:this.index});this.status=0;if(this.owner&&this.owner.source_loaded){this.owner.source_loaded();}}.bind(this));ajax.get('/ajax/typeahead_concentrations.php?n='+this.network);}
concentration_source.extend(custom_source);concentration_source.prototype.noinput=false;concentration_source.prototype.text_placeholder='Type your major or minor';function keyword_source(get_category){this.parent.construct(this,[]);this.category=get_category;if(!keyword_source.categories){keyword_source.categories=[];}else{for(var i=0,il=keyword_source.categories.length;i<il;i++){if(keyword_source.categories[i].c==this.category){this.values=keyword_source.categories[i].v;this.index=keyword_source.categories[i].i;this.status=0;return;}}}
this.status=1;var ajax=new Ajax(function(obj,text){eval(text);this.values=_results;this.build_index();keyword_source.categories.push({c:this.category,v:this.values,i:this.index});this.status=0;if(this.owner&&this.owner.source_loaded){this.owner.source_loaded();}}.bind(this));ajax.get('/ajax/typeahead_keywords.php?c='+this.category);}
keyword_source.extend(custom_source);keyword_source.prototype.noinput=false;keyword_source.prototype.text_placeholder='Type a keyword';

var share_data=null;var share_last_comment={p:null,t:null};function share_internal_config(params){var dialog=new pop_dialog('share_pop_dialog',share_focus_dialog_textarea);if(share_last_comment.p==params){params+='&c='+escapeURI(share_last_comment.t?share_last_comment.t:'');}else{share_last_comment.p=params;}
dialog.show_ajax_dialog('/ajax/share_dialog.php?'+params);return false;}
function share_focus_dialog_textarea(){if(ge('sharer_popup_message')){ge('sharer_popup_message').focus();}}
function share_show_error(params){var dialog=new pop_dialog('share_error_dialog');dialog.show_message('Invalid URL','Sorry, you have entered an invalid URL.');return false;}
function share_is_shareable(url){return(/(?:https?:\/\/)?\w+\.\w+/.test(url));}
function share_internal_bookmarklet(){if(/http:\/\/[^\/]*?\/posted?\.php/.test(document.location.href)){var dialog=new pop_dialog('share_congratulations');dialog.show_message('Share','<div class="status"><h2>You\'ve successfully installed the bookmarklet.</h2><p>Click it on an external site to share it with your friends.</p></div>');}
else{throw 0;}}
function share_show_comments(share_id,focus_textarea){var focus_textarea=(focus_textarea==null)?false:focus_textarea;share_footer=ge('share_footer'+share_id);if(share_footer.className=='share_footer hide_comments'){share_footer.className='share_footer show_comments';}
if(focus_textarea){textarea_id='comment'+share_id;ge(textarea_id).focus();}
return false;}
function share_show_add_comment(obj,share_id){var node=obj.parentNode;remove_node(node);var add_comment=ge('add_comment_input'+share_id);show(add_comment);var submit_button=ge('add_comment_button'+share_id);submit_button.disabled=false;var textarea_id='comment'+share_id;ge(textarea_id).focus();return false;}
function share_add_comment_submit(obj,share_id){var node=obj.parentNode;var comment=node.getElementsByTagName('textarea')[0].value;if(/^\s*$/.test(comment)){share_flash_comment_error(obj.parentNode.getElementsByTagName('textarea')[0]);return;}
else if(comment.length>1000){ge('add_comment_error'+share_id).style.display='block';return;}
var commentsNode=ge('share_comments_for_'+share_id);var ajax=new Ajax(function(obj,text){hide(node);if(commentsNode!=null){commentsNode.innerHTML=commentsNode.innerHTML+text;}
node.getElementsByTagName('textarea')[0].value='';});obj.disabled=true;ajax.post('/ajax/share_misc.php','share_id='+share_id+'&comment='+encodeURIComponent(comment));return true;}
function share_delete_comment(obj,share_id,comment_id){var dialog=new pop_dialog();while(obj.className.indexOf('share_other_comment')==-1&&obj!=null){obj=obj.parentNode;}
if(obj!=null){var delete_function=function(){p=obj.parentNode;remove_node(obj);if(p.childNodes.length==0){hide(p);}
var ajax=new Ajax(function(obj,text){});ajax.post('/ajax/share_misc.php','share_id='+share_id+'&delcomment=1&comment_id='+comment_id);generic_dialog.get_dialog(this).hide();};dialog.show_choice('Delete Comment?','Are you sure you want to delete this comment?','Delete',delete_function,'Cancel',function(){generic_dialog.get_dialog(this).hide()});}
return true;}
function share_flash_comment_error(obj){obj.animStart=(new Date).getTime();if(obj.interval){clearInterval(obj.interval);}
obj.interval=setInterval(function(){var p=((new Date).getTime()-obj.animStart)/500;if(p>1){obj.style.backgroundColor='#fff';clearInterval(obj.interval);}
else{obj.style.backgroundColor='rgb(255,'+parseInt(p*55+200)+','+parseInt(p*55+200)+')';}},10);}
function share_show_delete_dialog(context,href){var dialog=new contextual_dialog();dialog.set_context(context);dialog.show_choice('Are you sure you want to delete this item?','Deleting this item will also remove all its comments.','Delete Item',function(){share_delete_clicked(this,context,href)},'Cancel',function(){generic_dialog.get_dialog(this).hide()});return false;}
function share_delete_clicked(button,context,href){while(context.parentNode&&context.className.indexOf('sharebox_item ')==-1){context=context.parentNode;}
generic_dialog.get_dialog(button).hide();var ajax=new Ajax();ajax.post(href);remove_node(context);}
function share_play_video(share_id,unique_id){share_log_play_content(share_id,'video');if(container=ge(unique_id+'_holder').parentNode.parentNode){container.className+=' playing';}
return false;}
function feed_play_video(ad_id){return false;}
function share_video_thumb_load(img,share_id){if((img.complete==null&&img.width==20&&img.height==20)||(img.mimeType!=null&&img.complete&&img.mimeType=='')||(img.naturalHeight!=null&&img.complete&&img.naturalHeight==0))
{}}
function share_log_play_content(share_id,media_type){var ajax=new Ajax();ajax.post('/ajax/shareplay_ajax.php?s='+share_id+'&m='+media_type);}
function share_composer_tab(obj,sel){var tabs=obj.parentNode.parentNode.getElementsByTagName('a');tabs[0].className=sel?'':'selected';tabs[1].className=sel?'selected':'';while(obj.className.indexOf('share_composer')==-1){obj=obj.parentNode;}
obj.className='share_composer share_status_'+(sel?'post':'send');return false;}
function share_send_onsubmit(obj){var ids=ge('ids');if(!ids.tokenizer||ids.tokenizer.count_names()==0){aiert('You must specifiy at least one recipient for this message.');return false;}
var post=['action=send'];var inputs=obj.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].type!='button'&&inputs[i].name){post.push(inputs[i].name+'='+escapeURI(inputs[i].value));}
inputs[i].disabled=true;}
var inputs=obj.getElementsByTagName('textarea');for(var i=0;i<inputs.length;i++){post.push(inputs[i].name+'='+escapeURI(inputs[i].value));inputs[i].disabled=true;}
share_last_comment.t=inputs[0].value;var divs=obj.getElementsByTagName('div');for(var i=0;i<divs.length;i++){if(typeof divs[i].tokenizer!='undefined'){divs[i].tokenizer.disable();}else if(divs[i].className.indexOf('tokenizer')!=-1){divs[i].className+=' tokenizer_locked';}}
while(obj.className.indexOf('dialog_content')==-1){obj=obj.parentNode;}
var ajax=new Ajax();ajax.onDone=share_post_send_callback.bind(obj);ajax.post('/ajax/share.php',post.join('&'));}
function share_post_onsubmit(obj){var post=['action=post'];var inputs=obj.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].type!='button'&&inputs[i].name){post.push(inputs[i].name+'='+escapeURI(inputs[i].value));}
inputs[i].disabled=true;}
var inputs=obj.getElementsByTagName('textarea');for(var i=0;i<inputs.length;i++){post.push(inputs[i].name+'='+escapeURI(inputs[i].value));inputs[i].disabled=true;}
share_last_comment.t=inputs[0].value;while(obj.className.indexOf('dialog_content')==-1){obj=obj.parentNode;}
var ajax=new Ajax();ajax.onDone=share_post_send_callback.bind(obj);ajax.post('/ajax/share.php',post.join('&'));}
function share_post_send_callback(whatevs,text){eval('var response = '+text);if(response['html']){this.innerHTML=response['html'];if(response['redr']){setTimeout(function(){goURI(response['redr'])},3000);}else{var gd=generic_dialog.get_dialog(this);var tmout=3000;if(response['timeout']){tmout=response['timeout'];}
gd&&gd.fade_out(500,tmout)||setTimeout(function(){self.close()},tmout);}}else if(response['redr']){goURI(response['redr']);}}
function inline_editor(obj,name,textarea){this.name=name;this.obj=obj;this.more_than_meets_the_eye=true;var edit=document.createElement(textarea?'textarea':'input');this.edit=edit;this.original_value=edit.value=obj.firstChild.nodeValue;edit.className='inputtext inline_edit';if(this.is_textarea=textarea){edit.style.width=(obj.offsetWidth-16)+'px';}
obj.parentNode.insertBefore(edit,obj);obj.parentNode.removeChild(obj);edit.onblur=this._onblur.bind(this);edit.onchange=this._onchange.bind(this);edit.onkeypress=function(event){return this._onkeypress(event?event:window.event)}.bind(this);edit.focus();edit.select();}
inline_editor.prototype._onkeypress=function(event){switch(event?event.keyCode:0){case 27:this.edit.value=this.original_value;case 13:this._onblur();return false;}}
inline_editor.prototype._onblur=function(){if(!this.more_than_meets_the_eye){return false;}
this.more_than_meets_the_eye=false;this._onchange();var anchor=document.createElement('a');var name=this.name;var is_textarea=this.is_textarea;anchor.appendChild(document.createTextNode(this.edit.value));anchor.href='#';anchor.onclick=function(){new inline_editor(this,name,is_textarea);return false};anchor.onmousedown=function(){return false};anchor.className='inline_edit';this.edit.parentNode.insertBefore(anchor,this.edit);this.edit.parentNode.removeChild(this.edit);}
inline_editor.prototype._onchange=function(){var target=this.edit.form[this.name];if(!target){target=document.createElement('input');target.name=this.name;target.type='hidden';this.edit.form.appendChild(target);}
target.value=this.edit.value;}
function composer_attachment(){}
composer_attachment.from_url=function(url){if(!/(?:https?:\/\/)?\w+\.\w+/.test(url)){return false;}
var attachment=new composer_attachment();attachment.url=url;var ajax=new Ajax(attachment.ajax_callback.bind(attachment));ajax.post('/inbox/ajax/ajax.php',{action:'attachment',url:url});return attachment;}
composer_attachment.prototype.container_ready=function(obj,show_loading){this.container=obj;var inputs=obj.getElementsByTagName('input');var html=[''];for(var i=0;i<inputs.length;i++){if(inputs[i].type=='text'||inputs[i].type=='hidden'){html.push('<input type="hidden" name="'+htmlspecialchars(inputs[i].name)+'" value="'+htmlspecialchars(inputs[i].value)+'" />');}}
if(show_loading){html.push('&nbsp;');obj.innerHTML=html.join('');obj.className+=' share_attachment_loading';}else{obj.innerHTML+=html.join('');}}
composer_attachment.prototype.render_inputs_recursive=function(name,params){var html=[];if(typeof params=='object'){for(var i in params){html.push(this.render_inputs_recursive(name+'['+i+']',params[i]));}}else{html.push('<input type="hidden" name="',name,'" value="',htmlspecialchars(params),'" />');}
return html.join('');}
composer_attachment.prototype.ajax_callback=function(obj,text){eval(text);var html=[__result.html];html.push(this.render_inputs_recursive('attachment[params]',__result.params));html.push('<input type="hidden" name="attachment[type]" value="',__result.type,'" />');this.container.className=this.container.className.replace('share_attachment_loading','');set_inner_html(this.container,html.join(''));}
composer_attachment.setup_thumbnails=function(imgs,obj){var sandbox=new image_sandbox();sandbox.onfinish=function(){imgs=sandbox.get_imgs();for(var i=imgs.length-1;i>=0;i--){if(imgs[i].width&&(imgs[i].height<50||imgs[i].width<50||imgs[i].height/imgs[i].width>3||imgs[i].width/imgs[i].height>3)){imgs.splice(i,1);}}
if(!imgs.length){obj.className=obj.className.replace('loading','');obj.parentNode.className=obj.parentNode.className.replace('has_image','');var input=obj;while(input.parentNode&&input.tagName.toLowerCase()!='form'){input=input.parentNode;}
input=input.getElementsByTagName('input');for(var i=0;i<input.length;i++){if(input[i].name.indexOf('[params][images]')!=-1){input[i].parentNode.removeChild(input[i]);}}
return;}
for(var si=0;si<imgs.length-1;si++){for(var sj=imgs.length-1;sj>=si;sj--){if(imgs[si].width*imgs[si].height<imgs[sj].width*imgs[sj].height){temp=imgs[si];imgs[si]=imgs[sj];imgs[sj]=temp;}}}
var input=obj;while(input.parentNode&&input.tagName.toLowerCase()!='form'){input=input.parentNode;}
input=input.getElementsByTagName('input');for(var i=0;i<input.length;i++){if(input[i].name.indexOf('[params][images]')!=-1){input=input[i];break;}}
obj.className=obj.className.replace('loading','');new thumbnail_selector(obj,input,imgs);}.bind(this);sandbox.load_images(imgs);}
function thumbnail_selector(obj,input,images){var html=['<div class="thumbnail_stage"><h4>Choose a Thumbnail</h4><div class="selector clearfix"><div class="arrows clearfix">','<span class="left"><a href="#" class="arrow disabled">&nbsp;</a></span>','<span class="right"><a href="#" class="arrow ',images.length>1?'enabled':'disabled','">&nbsp;</a></span>','</div><div class="counter"><span>1 of ',images.length,'</span></div></div>'];for(var k=0;k<images.length;k++){html.push('<div class="thumbnail',k==0?' thumbnail_selected':' thumbnail_unselected','">','<img class="img_loading" src="',images[k].src,'" onload="adjustImage(this, \'thumbnail\', 100)" />','</div>');}
html.push('<label style="white-space:nowrap"><input type="checkbox" onclick="this.parentNode.parentNode.parentNode.thumbnail.use_thumbnail(this.checked)" /> No Picture</label></div>');obj.innerHTML=html.join('');this.images=images;this.input=input;input.value=this.images[0].src;this.obj=obj;this.obj.thumbnail=this;this.label=obj.getElementsByTagName('span')[2];this.index=0;var anchors=obj.getElementsByTagName('a');this.left=anchors[0];this.right=anchors[1];this.left.onclick=this.left_arrow_press.bind(this);this.right.onclick=this.right_arrow_press.bind(this);this.left.onselectsart=this.right.onselectstart=function(){return false};this.left.onmousedown=this.right.onmousedown=this._onmousedown;this.left.onmouseout=this.right.onmouseout=this._onmouseout;}
thumbnail_selector.prototype.use_thumbnail=function(checkbox){if(!checkbox){this.move_selection(0);remove_css_class_name(this.obj,'thumbnail_dont_use');}else{this.input.value='';add_css_class_name(this.obj,'thumbnail_dont_use');}}
thumbnail_selector.prototype._onmousedown=function(){add_css_class_name(this,'active');return false;}
thumbnail_selector.prototype._onmouseout=function(){remove_css_class_name(this,'active');}
thumbnail_selector.prototype.left_arrow_press=function(){remove_css_class_name(this.left,'active');this.move_selection(-1);return false;}
thumbnail_selector.prototype.right_arrow_press=function(){remove_css_class_name(this.right,'active');this.move_selection(1);return false;}
thumbnail_selector.prototype.move_selection=function(offset){var index=this.index+offset;if(index>=0&&index<this.images.length){var divs=this.obj.getElementsByTagName('div');var j=0;this.index=index;for(var i=0;i<divs.length;i++){var className=divs[i].className;if(className.indexOf('thumbnail ')==-1){continue;}
var selected=j==index;if(className.indexOf(selected?'_unselected':'_selected')!=-1){divs[i].className=className.replace(/thumbnail_(?:un)?selected/,selected?'thumbnail_selected':'thumbnail_unselected');}
j++;}
this.label.innerHTML=(index+1)+' of '+j;this.left.className=this.left.className.replace(/[^ ]+abled/,index==0?'disabled':'enabled');this.right.className=this.right.className.replace(/[^ ]+abled/,index==this.images.length-1?'disabled':'enabled');this.input.value=this.images[index].src;}}
function image_sandbox(){this.obj=document.createElement('div');this.obj.style.left=this.obj.style.top='-100px';this.obj.style.width=this.obj.style.height='1px';this.obj.style.overflow='hidden';this.images=0;this.done=0;document.body.appendChild(this.obj);this.load_images=function(imgs){this.images=imgs.length;for(var i=0;i<imgs.length;i++){new images_sandbox_loader(this,imgs[i]);}}
this.image_loaded=function(img){this.done++;this.state_change();}
this.image_failed=function(img){img.destroy();this.images--;this.state_change();}
this.get_imgs=function(){var imgs=new Array();var collection=this.obj.getElementsByTagName('img');for(var i=0;i<collection.length;i++){imgs.push(collection[i]);}
return imgs;}
this.state_change=function(){if(this.done==this.images){if(this.onfinish){this.onfinish();}}}}
function images_sandbox_loader(sandbox,img){this.timeout=4000;this.start=(new Date).getTime();this.sandbox=sandbox;if(typeof img!='object'){img={src:img};}
this.obj=document.createElement('img');this.obj.onload=function(){if(this.poll_image)this.poll_image(1)}.bind(this);this.obj.onerror=function(){if(this.poll_image)this.poll_image(2)}.bind(this);for(var key in img){this.obj[key]=img[key];}
this.sandbox.obj.appendChild(this.obj);if(this.poll_image!=null){this.poll_image();}}
images_sandbox_loader.prototype.poll_image=function(state){if(state==1){this.poll_image=null;this.sandbox.image_loaded(this);}else if(state==2){this.poll_image=null;this.sandbox.image_failed(this);}else{if((this.obj.complete==null&&this.obj.width==20&&this.obj.height==20)||(this.obj.mimeType!=null&&this.obj.complete&&this.obj.mimeType=='')||(this.obj.naturalHeight!=null&&this.obj.complete&&this.obj.naturalHeight==0)){this.poll_image(2);}else if(this.obj.complete){this.poll_image(1);}else if(this.start+this.timeout<(new Date).getTime()){this.poll_image(2);}else{setTimeout(function(){if(this.poll_image)this.poll_image()}.bind(this),20);}}}
images_sandbox_loader.prototype.destroy=function(){remove_node(this.obj);this.obj=null;}

function show_poke_dialog(to_uid,pokeback_obj,failed_captcha,poke_parent,refresh_display_obj){var dialog=new pop_dialog();dialog.show_dialog('<div class="dialog_loading">Loading...</div>');ajax=new Ajax();ajax.onDone=function(ajax_obj,response_text){eval(response_text);if(typeof poke_init=='undefined'){return false;}
if(poke_init.status){dialog.show_choice(poke_init.dialog_title,poke_init.dialog_contents,'Poke',function(){ajax_post=new Ajax();ajax_post.onDone=function(ajax_post_obj,post_response_text){eval(post_response_text);if(typeof got_an_f!='undefined'){show_poke_dialog(to_uid,null,true);return false;}
if(typeof poke_return=='undefined'){return false;}
if(pokeback_obj){var poke_parent_str=poke_parent||'sidebar_item pokes';hide_poke_obj(pokeback_obj,'ind_poke',poke_parent_str);if(refresh_display_obj){update_poke_summary(refresh_display_obj,'poke_start_index','poke_end_index','poke_total');}}
dialog.show_message(poke_init.dialog_title,poke_return.dialog_contents);if(poke_return.status){dialog.fade_out(500,1100);}};ajax_post.onFail=function(){}
var post_vars={'uid':to_uid,'pokeback':(pokeback_obj?'1':'0')};var captcha_form=ge('captcha_form');if(captcha_form){var captcha_elements=captcha_form.getElementsByTagName('input');for(var i=0;i<captcha_elements.length;i++){post_vars[captcha_elements[i].name]=captcha_elements[i].value;}}
dialog.enable_buttons(false);ajax_post.post('/ajax/poke.php',post_vars);},'Cancel',function(){dialog.enable_buttons(false);generic_dialog.get_dialog(this).fade_out(100)});}else{dialog.show_message(poke_init.dialog_title,poke_init.dialog_contents);}}
ajax.onFail=function(){}
ajax.post('/ajax/poke.php',{'can_poke':to_uid,'pokeback':((typeof pokeback_obj!='undefined')?1:0),'failed_captcha':(failed_captcha?'1':'0')});return false;}
function update_poke_summary(display_obj,start,end,total){var start_count=ge(start).innerHTML;var end_count=ge(end).innerHTML-1;var total_count=ge(total).innerHTML-1;ge(end).innerHTML=end_count;ge(total).innerHTML=total_count;ge(display_obj).innerHTML=gen_poke_summary_text(start_count,end_count,total_count);}
function gen_poke_summary_text(start,end,total){if(total==1){return'Displaying the only poke.';}else if(total==0){return'I\'ve got nothing for you.';}else if(end<start){return'I\'ve got nothing for you here.';}else if(end==total){return'Displaying all '+total+' pokes.';}else{return'Displaying pokes '+start+' - '+end+' of '+total+'.';}}

function findX(obj)
{var curleft=0;if(obj.offsetParent){while(obj.offsetParent){curleft+=obj.offsetLeft
obj=obj.offsetParent;}}
else if(obj.x)
curleft+=obj.x;return curleft;}
function findY(obj)
{var curtop=0;if(obj.offsetParent){while(obj.offsetParent){curtop+=obj.offsetTop
obj=obj.offsetParent;}}
else if(obj.y)
curtop+=obj.y;return curtop;}
function mousePosX(e)
{var posx=0;if(!e)var e=window.event;if(e.pageX)
posx=e.pageX;else if(e.clientX&&document.body.scrollLeft)
posx=e.clientX+document.body.scrollLeft;else if(e.clientX&&document.documentElement.scrollLeft)
posx=e.clientX+document.documentElement.scrollLeft;else if(e.clientX)
posx=e.clientX;return posx;}
function mousePosY(e)
{var posy=0;if(!e)var e=window.event;if(e.pageY)
posy=e.pageY;else if(e.clientY&&document.body.scrollTop)
posy=e.clientY+document.body.scrollTop;else if(e.clientY&&document.documentElement.scrollTop)
posy=e.clientY+document.documentElement.scrollTop;else if(e.clientY)
posy=e.clientY;return posy;}
function dp(object)
{var descString;for(var value in object)
descString+=(value+" => "+object[value]+"\n");if(descString!="")
aiert(descString);else
aiert(object);}
function dpd(debugOutput)
{if(ge('debugout')){ge('debugout').style.overflow="auto";ge('debugout').innerHTML=debugOutput+"<br>"+ge('debugout').innerHTML;}}
function bigprint(object)
{var descString;for(var value in object)
descString+=(value+" => "+object[value]+"\n");if(descString!="")
dpd(descString);else
dpd("bigprint failed "+object);}
var debugStartTime;function dtime(marker)
{endTime=new Date();dpd(marker+" "+(debugStartTime.getTime()-endTime.getTime()));debugStartTime=endTime;}
function dtimestart()
{debugStartTime=new Date();}

var REMOVE_BOX_ONLY=1;var REMOVE_ENTIRE_APP=2;var al_dialog;function removeActionLink(obj,application_name,app_id){var dialog=new contextual_dialog();dialog.set_context(obj);buttons='<div class="dialog_buttons">'+'<input class="inputsubmit" type="button" value="Remove Link" />'+'<input class="inputsubmit" type="button" value="Remove Application" />'+'<input class="inputsubmit" type="button" value="Cancel" />'+'</div>';var prompt='You can remove this link or remove this application from your account.';add_css_class_name(obj,'box_remove_selected');dialog.show_prompt('Do you want to remove this link from '+application_name+'?',prompt+buttons);al_dialog=true;dialog_options=dialog.obj.getElementsByTagName('input');dialog_options[0].onclick=function(){remove_link(obj.parentNode,app_id);dialog.hide();}
dialog_options[1].onclick=function(){remove_link_and_app(obj.parentNode,app_id);dialog.hide();}
dialog_options[2].onclick=function(){dialog.hide();remove_css_class_name(obj,'box_remove_selected');al_dialog=false;}
return false;}
function remove_link_and_app(link_obj,app_id){link_obj.style.display='none';ge('box_app_'+app_id).style.display='none';ge('icon_app'+app_id).style.display='none';var error_message='Sorry, removing this application failed.';var ajax=new Ajax(function(obj,text){eval(text);if(!success){Util.error('Removing app_id %d failed.',app_id);aiert(error_message);}});ajax.onFail=function(){Util.error('Removing app_id %d failed.',app_id);aiert(error_message);}
var post={'app_id':app_id};ajax.post('/ajax/profile_link.php',post,true);post={'fbid':PROFILE_FBID,'app_id':app_id,'remove_type':REMOVE_ENTIRE_APP};ajax.post('/ajax/profile_boxes.php',post,true);}
function remove_link(link_obj,app_id){link_obj.style.display='none';var error_message='Sorry, removing this link failed.';var ajax=new Ajax(function(obj,text){eval(text);if(!success){Util.error('Removing link to app_id %d failed.',app_id);aiert(error_message);}});ajax.onFail=function(){Util.error('Removing link to app_id %d failed.',app_id);aiert(error_message);}
var post={'app_id':app_id};ajax.post('/ajax/profile_link.php',post);}
function removeBox(obj,application_name,app_id){var dialog=new contextual_dialog();dialog.set_context(obj);buttons='<div class="dialog_buttons">'+'<input class="inputsubmit" type="button" value="Remove Application" />'+'<input class="inputsubmit" type="button" value="Remove Box" />'+'<input class="inputsubmit" type="button" value="Cancel" />'+'</div>';dialog.show_prompt('Do you want to remove '+application_name+'?',dialog.content_to_markup(get_remove_prompt())+buttons);add_css_class_name(obj,'box_remove_selected');dialog_options=dialog.obj.getElementsByTagName('input');dialog_options[0].onclick=function(){remove_app('',REMOVE_ENTIRE_APP,app_id);dialog.hide();}
dialog_options[1].onclick=function(){remove_app('',REMOVE_BOX_ONLY,app_id);dialog.hide();}
dialog_options[2].onclick=function(){dialog.hide();remove_css_class_name(obj,'box_remove_selected');}
return false;}
function get_remove_prompt(application_name,app_id){return'You can remove this application box from your profile or remove this application from your account entirely.';}
function remove_app(e,remove_type,app_id){ge('box_app_'+app_id).style.display='none';ge('icon_app'+app_id).style.display='none';var error_message='Sorry, removing this profile box failed.';var ajax=new Ajax(function(obj,text){eval(text);if(!success){Util.error('Removing app_id %d failed.',app_id);aiert(error_message);}});ajax.onFail=function(){Util.error('Removing app_id %d failed.',app_id);aiert(error_message);}
var post={'fbid':PROFILE_FBID,'app_id':app_id,'remove_type':remove_type};ajax.post('/ajax/profile_boxes.php',post);}
function flexToggle(el){if(el.className=='flex_open'){el.className='flex_shut';profileFlexAjax(el.id,1);}else{el.className='flex_open';profileFlexAjax(el.id,0);}}
var all_boxes_open=true;function allBoxesFlexToggle(){all_boxes_open=!all_boxes_open;var text_el=ge('profile_view_button_text');var userprofile=ge('userprofile');if(all_boxes_open){text_el.innerHTML='Minimize Profile';remove_css_class_name(userprofile,'collapsed_mode');}else{text_el.innerHTML='Expand Profile';add_css_class_name(userprofile,'collapsed_mode');}
return false;}
function boxFlexSet(el,open){if(open==true&&has_css_class_name(el,'flex_shut')){remove_css_class_name(el,'flex_shut');add_css_class_name(el,'flex_open');}else if(open==false&&has_css_class_name(el,'flex_open')){remove_css_class_name(el,'flex_open');add_css_class_name(el,'flex_shut');}}
function boxFlexToggle(el){var userprofile=ge('userprofile');if(has_css_class_name(userprofile,'collapsed_mode')){remove_css_class_name(userprofile,'collapsed_mode');remove_css_class_name(el,'flex_shut');add_css_class_name(el,'flex_open');animate_scroll_to_id(el.id,5);profileBoxFlexAjax(el.id,0);return;}
if(has_css_class_name(el,'flex_open')){remove_css_class_name(el,'flex_open');add_css_class_name(el,'flex_shut');profileBoxFlexAjax(el.id,1);}else{remove_css_class_name(el,'flex_shut');add_css_class_name(el,'flex_open');profileBoxFlexAjax(el.id,0);}
el.blur();return false;}
profileFlexAjax=function(elId,val){var ajax=new Ajax()
ajax.onDone=function(){}
ajax.onFail=function(){}
ajax.post('/ajax/profile_flex_ajax.php',elId+'='+val);}
profileBoxFlexAjax=function(elId,val){var ajax=new Ajax()
ajax.onDone=function(){}
ajax.onFail=function(){}
ajax.post('/ajax/profile_box_flex_ajax.php',{'app_id':elId,'value':val});}
function minifeed_hide(clickedElement,story_id)
{var minifeed_dialog_handle=new contextual_dialog();minifeed_dialog_handle.set_context(clickedElement);minifeed_dialog_handle.show_choice('Are you sure you want to hide this mini-feed story?','Hiding will remove the story from your Mini-Feed and prevent anyone from seeing it.','Hide Story','','Cancel','');var minifeed_inputs=minifeed_dialog_handle.obj.getElementsByTagName('input');minifeed_inputs[0].onclick=function(){minifeed_hide_click(story_id);generic_dialog.get_dialog(this).fade_out(100);};minifeed_inputs[1].onclick=function(){generic_dialog.get_dialog(this).hide();};return false;}
function minifeed_hide_click(hide_id)
{ajax=new Ajax();ajax.onDone=function(){}
ajax.onFail=function(){aiert("Sorry, hiding this story failed");}
story=ge('story_'+hide_id);if(story.previousSibling.className=='date_divider'&&story.nextSibling.className.indexOf('story')==-1){remove_node(story.previousSibling);}
else if(story.previousSibling.className=='date_divider'){story.nextSibling.className+=' no_border';}
remove_node(story);minifeed_decrement_story_count();ajax.post('minifeed.php',{'hide_ministory_key':hide_id});}
function minifeed_decrement_story_count(){var text;var mf_story_count_string_array=new Array();var count_el=ge('mf_story_count_string');if(!count_el)return;var count=parseInt(count_el.innerHTML.split(' ')[0]);count=count-1;if(count==1){text='story';}else{text='stories';}
count_el.innerHTML=(count)+' '+text;}
function show_profile_layout_dialog(){var dialog=new pop_dialog();dialog.show_message('Profile Layout','You can edit the layout of your profile at any time. Simply use your mouse to drag and drop boxes anywhere on your profile.'
+'<br/><br/>'
+'Please note that you cannot move your Mini-Feed or Friends box. Also, some boxes may be restricted to either the right or left column of the profile.');}
function show_public_profile_dialog(url){var dialog=new pop_dialog();dialog.show_message('Public Listing','Your public listing contains some information about you that may be viewed by people outside of Facebook.'
+'<br/><br/>'
+'If you allow people to view your public listing, people not logged in to Facebook can view it at this URL:'
+'<br/><br/>'
+'<span style="color: #3b5998; border: 1px solid #ccc; padding: 5px; margin: 5px;">'
+url
+'</span>'
+'<br/><br/>'
+'You can control who can see your public listing on your '
+'<a href="/privacy.php?view=search">search privacy</a> page.');}
function is_left_click(e){if(e.which==null){if(e.button<2)return true;}else{if(e.which<2)return true;}
return false;}
function isMouseLeaveOrEnter(e,handler){if(e.type!='mouseout'&&e.type!='mouseover')return false;var reltg=e.relatedTarget?e.relatedTarget:e.type=='mouseout'?e.toElement:e.fromElement;while(reltg&&reltg!=handler)
reltg=reltg.parentNode;return(reltg!=handler);}
function profile_icon_hover(icon_link){var tooltip=icon_link.previousSibling;tooltip.style.display='block';tooltip.style.zindex=1;if(has_css_class_name(tooltip,'loaded_tooltip')){visible_tooltip=tooltip;return;}
var offsetWidth=tooltip.childNodes[0].offsetWidth;tooltip.style.width=offsetWidth+'px';tooltip.style.left=-((offsetWidth-22)/2)+'px';tooltip.style.top=-24+'px';add_css_class_name(tooltip,'loaded_tooltip');visible_tooltip=tooltip;}
function clear_tooltip(icon_link){var tooltip=icon_link.previousSibling;tooltip.style.display='none';}
function profile_app_switcher_select(scroll_element_id,app_id){boxFlexSet(ge('box_head_'+app_id).parentNode,1);make_header_blue(app_id);animate_scroll_to_id(scroll_element_id,app_id);return false;}
var ANI_SCROLL_STEP_AMOUNT=250;var ANI_SCROLL_SLOWING_WINDOW=750;var ANI_SCROLL_STOP_WINDOW=13;var ANI_MAX_SLOWDOWN_AMOUNT=120;var ANI_CALLBACK_PAUSE_TIME=200;function animate_scroll_to_id(scroll_element_id,app_id){var element=(typeof app_id!='undefined')?ge('box_app_'+app_id):ge(scroll_element_id);var target_height=elementY(element);var target_bottom=target_height+element.offsetHeight;if(target_height>getPageScrollHeight()&&target_bottom<getPageScrollHeight()+getViewportHeight()){setTimeout("fade_header("+app_id+")",ANI_CALLBACK_PAUSE_TIME+400);}else{animate_scroll_to_id_helper(scroll_element_id,20,app_id,getPageScrollHeight(),'fade_header');}}
function animate_scroll_to_id_helper(scroll_element_id,scroll_speed,app_id,scroll_height,scroll_complete_callback){var element=ge(scroll_element_id);var target_height=elementY(element);var page_scroll_height=getPageScrollHeight();var scroll_dir=1;if(target_height<page_scroll_height){scroll_dir=-1;}
var scroll_amount=0;if(scroll_height!=page_scroll_height){if(scroll_complete_callback){setTimeout(scroll_complete_callback+"("+app_id+")",ANI_CALLBACK_PAUSE_TIME);}
return;}
if(!(page_scroll_height>target_height-ANI_SCROLL_SLOWING_WINDOW&&page_scroll_height<target_height+ANI_SCROLL_SLOWING_WINDOW)){scroll_amount=ANI_SCROLL_STEP_AMOUNT;}else if(!(page_scroll_height>target_height-ANI_SCROLL_STOP_WINDOW&&page_scroll_height<target_height+ANI_SCROLL_STOP_WINDOW)){scroll_amount=parseInt(Math.abs(page_scroll_height-target_height)/ANI_SCROLL_SLOWING_WINDOW*ANI_MAX_SLOWDOWN_AMOUNT);}
if(scroll_amount!=0){var expected_page_scroll_height=getPageScrollHeight()+scroll_dir*scroll_amount;window.scrollBy(0,scroll_dir*scroll_amount);setTimeout("animate_scroll_to_id_helper('"+
scroll_element_id+"',"+
scroll_speed+","+
app_id+","+
expected_page_scroll_height+",'"+
scroll_complete_callback+"')",scroll_speed);}else{window.scrollTo(0,target_height-ANI_SCROLL_STOP_WINDOW);if(scroll_complete_callback){setTimeout(scroll_complete_callback+"("+app_id+")",ANI_CALLBACK_PAUSE_TIME);}}}
function fade_header(id){var box_header=ge('box_head_'+id);remove_css_class_name(box_header,'box_head_highlight');var box=ge('box_head_'+id);if(!box){return;}
remove_css_class_name(box.parentNode,'box_outline');var old_border=ge('scroll_highlight_border');old_border.parentNode.removeChild(old_border);if(id==2719290516){ge('wall_text').focus();}}
function make_header_blue(id){var newBorder=document.createElement('div');newBorder.id='scroll_highlight_border';newBorder.className="box_highlight_outline";var box=ge('box_head_'+id).parentNode;newBorder.style.top=elementY(ge('box_head_'+id))-10+'px';newBorder.style.left=elementX(ge('box_head_'+id))-10+'px';newBorder.style.width=box.offsetWidth+15+'px';newBorder.style.height=box.offsetHeight+5+'px';document.body.appendChild(newBorder);var box_header=ge('box_head_'+id);}
function position_edit_profile_tour(){var body=document.getElementsByTagName("body")[0];var container=document.createElement('span');container.style.fontFamily='"Lucida Grande", Tahoma, Verdana, Arial, sans-serif;';container.innerHTML='Profile';body.appendChild(container);var additionalOffset=container.offsetWidth;body.removeChild(container);var defaultOffset=-217;ge('edit_profile_tour').style.marginLeft=(defaultOffset+additionalOffset)+'px';}
function show_tour(tour_div){hide((tour_div=='search_tour')?'edit_profile_tour':'search_tour');var default_offset_search_tour=25;var default_offset_edit_profile_tour=8;var edit_profile_tour=ge('edit_profile_tour');var search_tour=ge('search_tour');if(search_tour){search_tour.style.top=elementY(ge('qsearch'))+default_offset_search_tour+'px';}
if(edit_profile_tour){edit_profile_tour.style.top=elementY(ge('navigator'))+default_offset_edit_profile_tour+'px';}
if(!shown(tour_div)){animate_scroll_to_id('book');}
toggle(tour_div);}
function show_wall_tour(){toggle_css_class_name(ge('wall_tour'),'extended');ge('wall_tour_link').innerHTML=(shown('wall_tour_extended')?'Learn more about the Wall':'Here is what a Wall post looks like:');toggle('wall_tour_extended');}
function write_on_your_own_wall(){toggle_css_class_name(ge('wall_tour'),'borderless_attachment');toggle('inline_wall_post');if(shown('inline_wall_post')){animate_scroll_to_id('inline_wall_post')}}
function profile_log_friend_click(friend_ids,position){var ajax=new Ajax();var params={'friend_ids':friend_ids,'position':position};ajax.get('ajax/log_friends.php',params,true);return true;}

if(typeof deconcept=="undefined")var deconcept=new Object();if(typeof deconcept.util=="undefined")deconcept.util=new Object();if(typeof deconcept.SWFObjectUtil=="undefined")deconcept.SWFObjectUtil=new Object();deconcept.SWFObject=function(swf,id,w,h,ver,c,quality,xiRedirectUrl,redirectUrl,detectKey){if(!document.getElementById){return;}
this.DETECT_KEY=detectKey?detectKey:'detectflash';this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(swf){this.setAttribute('swf',swf);}
if(id){this.setAttribute('id',id);}
if(w){this.setAttribute('width',w);}
if(h){this.setAttribute('height',h);}
if(ver){this.setAttribute('version',new deconcept.PlayerVersion(ver.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}
if(c){this.addParam('bgcolor',c);}
var q=quality?quality:'high';this.addParam('quality',q);this.setAttribute('useExpressInstall',false);this.setAttribute('doExpressInstall',false);var xir=(xiRedirectUrl)?xiRedirectUrl:window.location;this.setAttribute('xiRedirectUrl',xir);this.setAttribute('redirectUrl','');if(redirectUrl){this.setAttribute('redirectUrl',redirectUrl);}}
deconcept.SWFObject.prototype={useExpressInstall:function(path){this.xiSWFPath=!path?"/swf/expressinstall.swf":path;this.setAttribute('useExpressInstall',true);},setAttribute:function(name,value){this.attributes[name]=value;},getAttribute:function(name){return this.attributes[name];},addParam:function(name,value){this.params[name]=value;},getParams:function(){return this.params;},addVariable:function(name,value){this.variables[name]=value;},getVariable:function(name){return this.variables[name];},getVariables:function(){return this.variables;},getVariablePairs:function(){var variablePairs=new Array();var key;var variables=this.getVariables();for(key in variables){variablePairs[variablePairs.length]=encodeURIComponent(key)+"="+encodeURIComponent(variables[key]);}
return variablePairs;},getSWFHTML:function(){var swfNode="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<embed type="application/x-shockwave-flash" src="'+this.getAttribute('swf')+'" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'"';swfNode+=' id="'+this.getAttribute('id')+'" name="'+this.getAttribute('id')+'" ';var params=this.getParams();for(var key in params){swfNode+=encodeURIComponent(key)+'="'+encodeURIComponent(params[key])+'" ';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='flashvars="'+pairs+'"';}
swfNode+='/>';}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute('swf',this.xiSWFPath);}
swfNode='<object id="'+this.getAttribute('id')+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+this.getAttribute('width')+'" height="'+this.getAttribute('height')+'" style="'+this.getAttribute('style')+'">';swfNode+='<param name="movie" value="'+this.getAttribute('swf')+'" />';var params=this.getParams();for(var key in params){swfNode+='<param name="'+key+'" value="'+params[key]+'" />';}
var pairs=this.getVariablePairs().join("&");if(pairs.length>0){swfNode+='<param name="flashvars" value="'+pairs+'" />';}
swfNode+="</object>";}
return swfNode;},write:function(elementId){if(this.getAttribute('useExpressInstall')){var expressInstallReqVer=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(expressInstallReqVer)&&!this.installedVer.versionIsValid(this.getAttribute('version'))){this.setAttribute('doExpressInstall',true);this.addVariable("MMredirectURL",escape(this.getAttribute('xiRedirectUrl')));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute('doExpressInstall')||this.installedVer.versionIsValid(this.getAttribute('version'))){var n=(typeof elementId=='string')?document.getElementById(elementId):elementId;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute('redirectUrl')!=""){document.location.replace(this.getAttribute('redirectUrl'));}}
return false;}}
deconcept.SWFObjectUtil.getPlayerVersion=function(){var PlayerVersion=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){PlayerVersion=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var counter=3;while(axo){try{counter++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+counter);PlayerVersion=new deconcept.PlayerVersion([counter,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");PlayerVersion=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(PlayerVersion.major==6){return PlayerVersion;}}
try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}
if(axo!=null){PlayerVersion=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return PlayerVersion;}
deconcept.PlayerVersion=function(arrVersion){this.major=arrVersion[0]!=null?parseInt(arrVersion[0]):0;this.minor=arrVersion[1]!=null?parseInt(arrVersion[1]):0;this.rev=arrVersion[2]!=null?parseInt(arrVersion[2]):0;}
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major)return false;if(this.major>fv.major)return true;if(this.minor<fv.minor)return false;if(this.minor>fv.minor)return true;if(this.rev<fv.rev)return false;return true;}
deconcept.util={getRequestParameter:function(param){var q=document.location.search||document.location.hash;if(param==null){return q;}
if(q){var pairs=q.substring(1).split("&");for(var i=0;i<pairs.length;i++){if(pairs[i].substring(0,pairs[i].indexOf("="))==param){return pairs[i].substring((pairs[i].indexOf("=")+1));}}}
return"";}}
deconcept.SWFObjectUtil.cleanupSWFs=function(){var objects=document.getElementsByTagName("OBJECT");for(var i=objects.length-1;i>=0;i--){objects[i].style.display='none';for(var x in objects[i]){if(typeof objects[i][x]=='function'){objects[i][x]=function(){};}}}}
if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);}
window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}
if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];}}
var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

function captchaRefresh(skippedCaptchaClass,registrationPage){var ajax=new Ajax((function(ajaxObj,responseText){document.getElementById("captcha").innerHTML=responseText;}),(function(ajaxObj,responseText){aiert("There was a problem getting a new captcha for you.  Please hit the reload button on your browser.");}));var url='/captcha/refresh_ajax.php';if(registrationPage){url=url+'?registration_page&skipped_captcha_class='+skippedCaptchaClass;}else{url=url+'?skipped_captcha_class='+skippedCaptchaClass;}
return ajax.get(url);}

function show_addfriend_dialog(to_uid,link_object,failed_captcha){var dialog=new pop_dialog();dialog.show_dialog('<div class="dialog_loading">Loading...</div>');ajax=new Ajax();ajax.onDone=function(ajax_obj,response_text){eval(response_text);if(typeof addfriend_init=='undefined'){return false;}
if(typeof addfriend_init.karmablocked!='undefined'&&addfriend_init.karmablocked){dialog.show_choice(addfriend_init.dialog_title,addfriend_init.dialog_contents,'Close',function(){generic_dialog.get_dialog(this).fade_out(100)});}else if(addfriend_init.status){dialog.show_choice(addfriend_init.dialog_title,addfriend_init.dialog_contents,'Add Friend',function(){ajax_post=new Ajax();ajax_post.onDone=function(ajax_post_obj,post_response_text){eval(post_response_text);if(typeof got_an_f!='undefined'){show_addfriend_dialog(to_uid,link_object,true);return false;}
if(typeof addfriend_return=='undefined'){return false;}
dialog.show_message(addfriend_init.dialog_title,addfriend_return.dialog_contents);if(addfriend_return.status){disableAddFriendLink(link_object);dialog.fade_out(500,1100);}else{dialog.show_choice(addfriend_init.dialog_title,addfriend_return.dialog_contents,'Confirm',function(){ajax_confirmhs=new Ajax();ajax_confirmhs.onDone=function(ajax_confirmhs_obj,post_response_text){disableAddFriendLink(link_object);dialog.fade_out(100);};ajax_confirmhs.onFail=function(){}
var post_vars={'confirm_hs_pending':to_uid};ajax_confirmhs.post('/ajax/addfriend.php',post_vars);},'Does Not Attend',function(){ajax_rejecths=new Ajax();ajax_rejecths.onDone=function(ajax_rejecths_obj,post_response_text){disableAddFriendLink(link_object);dialog.fade_out(100);};ajax_rejecths.onFail=function(){}
var post_vars={'hs_confirm_reject':to_uid};ajax_rejecths.post('/ajax/addfriend.php',post_vars);},'','I Don&rsquo;t Know',function(){generic_dialog.get_dialog(this).fade_out(100)});}};ajax_post.onFail=function(){}
var post_vars={'uid':to_uid,'message':document.getElementById('message').value};var captcha_form=ge('captcha_form');if(captcha_form){var captcha_elements=captcha_form.getElementsByTagName('input');for(var i=0;i<captcha_elements.length;i++){post_vars[captcha_elements[i].name]=captcha_elements[i].value;}}
ajax_post.post('/ajax/addfriend.php',post_vars);},'Cancel',function(){generic_dialog.get_dialog(this).fade_out(100)});}else{dialog.show_message(addfriend_init.dialog_title,addfriend_init.dialog_contents);}}
ajax.onFail=function(){}
ajax.post('/ajax/addfriend.php',{'can_friend':to_uid,'failed_captcha':(failed_captcha?'1':'0')});return false;}
function disableAddFriendLink(link_object){var newNode=document.createElement("span");newNode.innerHTML="Friend Requested";newNode.className="holder inactive";link_object.parentNode.replaceChild(newNode,link_object);}

var FBML=(function(){var _addEventListener;var invoked_dialogs=Array();var popup_login_continuation=null;var form_hidden_inputs=null;if(window.addEventListener){_addEventListener=function(obj,eventName,fun){obj.addEventListener(eventName,fun,false);}}else{_addEventListener=function(obj,eventName,fun){obj.attachEvent("on"+eventName,fun);}}
if(typeof typeaheadpro!='undefined'){function friendSelector(obj,source,properties){var idInput=document.createElement('INPUT');idInput.name=obj.getAttribute('idname');idInput.type='hidden';idInput.setAttribute('fb_protected','true');idInput.typeahead=this;if(obj.form){obj.form.appendChild(idInput);}
this._idInput=idInput;return this.parent.construct(this,obj,source,properties);}
friendSelector.extend(typeaheadpro);friendSelector.prototype.destroy=function(){this._idInput.parentNode.removeChild(this._idInput);this._idInput.typeahead=null;this._idInput=null;this.parent.destroy();}
friendSelector.prototype._onselect=function(e){this.parent._onselect(e);if(e.i){this._idInput.value=e.i;}else if(e.is){this._idInput.value=e.is;}}}else{friendSelector=null;}
var Contexts=new Object();function err(msg){if(window.console){window.console.log('Facebook FBML Mock AJAX ERROR: '+msg);}
return false;}
function attachCurlFromObject(ajax_params,container,pre_fn,post_fn){if(!ajax_params['url']){return err("no input with id url in form");}
if(!ajax_params['fb_sig_api_key']){return err("no input with id fb_api_key in form");}
if(pre_fn){pre_fn();}
ajax_params['context']=attachments.context;attachCurlFromFormValues(ajax_params,container,post_fn);}
function attachCurlFromFormValues(ajax_params,container,post_fn){var ajax=new Ajax;ajax.onDone=function(junk,responseText){if(post_fn){post_fn();}
if(!container.removed){set_inner_html(container,responseText);}}
ajax.post('/fbml/ajax/attach.php',ajax_params);}
function attachFromPreview(){var parent=ge('attachment_edit');var inputs=parent.getElementsByTagName('input');var params=Object();for(var i=0;i<inputs.length;i++){if(!(inputs[i].type=="radio"||inputs[i].type=="checkbox")||inputs[i].checked){params[inputs[i].name]=inputs[i].value;}}
params['context']=attachments.context;params['action']='edit';attachCurlFromFormValues(params,parent);}
function clickRewriteAjax(app_id,loggedIn,targetId,url,formId,loadingHTML){requireLogin(app_id,function(){return _clickRewriteAjax(targetId,url,formId,loadingHTML);});return false;}
function _clickRewriteAjax(targetId,url,formId,loadingHTML){var target=ge(targetId);if(!target){return err("target "+targetId+" not found");}
var hContext=target.getAttribute("fbcontext");var sContext=FBML.Contexts[hContext];var form=null;if(typeof formId=="string"){form=ge(formId);}else{form=formId;}
if(!form){return err("You must either specify a clickrewriteform (an id) or use the clickrewrite attribute inside a form");}
addHiddenInputs(form);var post=serialize_form(form);post["fb_mockajax_context"]=sContext;post["fb_mockajax_context_hash"]=hContext;post["fb_mockajax_url"]=url;var a=new Ajax(function(_e,responseText){var response=eval("("+responseText+")");if(response.ok){set_inner_html(target,response.html);}else{return err(response["error_message"]);}
FBML.mockAjaxResponse=response;return response.ok;},function(_e,_responseText){return err("failed to successfully retrieve data from Facebook when making mock AJAX call to rewrite id "+targetId);});a.post(FBML._mockAjaxProxyUrl,post);if(loadingHTML){target.innerHTML=loadingHTML;}
return false;}
function clickToShow(targetId){return clickToSetDisplay(targetId,"");}
function clickToShowDialog(targetId){var dialog_elem=null;if(dialog_elem=ge(targetId)){var dialog_content=dialog_elem.parentNode.innerHTML;dialog_elem.id='dialog_invoked_'+dialog_elem.id;invoked_dialogs[dialog_elem.id]=dialog_elem.cloneNode(true);dialog_elem.innerHTML='';var dialog=new pop_dialog();dialog.show_dialog(dialog_content);}
return false;}
function closeDialogInvoked(obj){var hidden_dialog=null;for(dialog_id in invoked_dialogs){if(hidden_dialog=ge(dialog_id)){var old_id=hidden_dialog.id.replace('dialog_invoked_','');var old_elem=null;if(old_elem=ge(old_id)){old_elem.id='dialog_closed_'+old_id;}
var parent=hidden_dialog.parentNode;parent.innerHTML='';parent.appendChild(invoked_dialogs[dialog_id]);invoked_dialogs[dialog_id].id=old_id;}}
generic_dialog.get_dialog(obj).fade_out(100);}
function clickToHide(targetId){return clickToSetDisplay(targetId,"none");}
function clickToToggle(targetId){var target=ge(targetId);if(!target){return err("Could not find target "+targetId);}else{target.style.display=(target.style.display=="none")?'':'none';return false;}}
function clickToSetDisplay(targetId,disp){var target=ge(targetId);if(!target){return err("Could not find target "+targetId);}else{target.style.display=disp;return false;}}
function clickToEnable(targetId){return clickToSetDisabled(targetId,'');}
function clickToDisable(targetId){return clickToSetDisabled(targetId,'disabled');}
function clickToSetDisabled(targetId,disabled){var target=ge(targetId);if(!target){return err("Could not find target "+targetId);}else{target.disabled=disabled;return false;}}
function fbmlLogin(app_id){new AsyncRequest().setURI('/ajax/api/tos.php').setData({app_id:app_id,grant_perm:1,profile_id:typeof PROFILE_OWNER_ID=='undefined'?0:PROFILE_OWNER_ID,api_key:ge('api_key').value,auth_token:ge('auth_token').value,save_login:ge('save_login').checked==false?0:1}).setHandler(bind(this,function(response){if(response.getPayload()){form_hidden_inputs=response.getPayload();}
popup_login_continuation();})).setErrorHandler(bind(this,function(response){aiert(response.getErrorDescription());})).send();}
function addHiddenInputs(form_obj){if(form_hidden_inputs){var i;for(i=form_obj.childNodes.length-1;i>=0;i--){if(form_obj.childNodes[i].name&&form_obj.childNodes[i].name.indexOf('fb_sig')==0){form_obj.removeChild(form_obj.childNodes[i]);}}
form_obj.innerHTML=form_hidden_inputs+form_obj.innerHTML;}}
function requireLogin(app_id,continuation,cancellation){var old_content='';if(ge('generic_dialog_popup')&&$('generic_dialog').style.display!='none'){old_content=ge('pop_content').innerHTML;}
var dialog=new pop_dialog('api_confirmation');if(old_content){popup_login_continuation=function(){var old_dialog=new pop_dialog();old_dialog.show_dialog(old_content);continuation();dialog.fade_out(100);};}else{popup_login_continuation=function(){continuation();dialog.fade_out(100);};}
new AsyncRequest().setURI('/ajax/api/tos.php').setData({app_id:app_id}).setHandler(bind(this,function(response){if(response.getPayload()){dialog.show_dialog(response.getPayload());}else{popup_login_continuation();}})).setErrorHandler(bind(this,function(response){aiert(response.getErrorDescription());})).send();}
function attrBool(element,attr,defaultValue){if(!defaultValue){defaultValue=false;}
var el=ge(element);if(el.hasAttribute(attr)){var val=el.getAttribute(attr).toLowerCase();switch(val){case"false":case"no":case"0":return false;case"true":case"yes":return true;default:var intval=parseInt(val);if((intval<0)||(intval>0)){return true;}
return defaultValue;}}}
function cancelRequest(elem){generic_dialog.get_dialog(elem).fade_out(100);}
function sendRequest(request_form,app_id,request_type,invite,preview,is_multi){if(!preview&&is_multi){request_form.onSubmit=fsth.captured_event;}
var inputs=request_form.getElementsByTagName('input');var ids=[];for(var i=0;i<inputs.length;i++){if(inputs[i].getAttribute('fb_protected')=='true'&&(inputs[i].name=='ids[]'||inputs[i].name=='friend_selector_id')){ids.push(inputs[i].value);}}
var data={app_id:app_id,to_ids:ids,request_type:request_type,invite:invite,content:request_form.getAttribute('content'),preview:preview,is_multi:is_multi,form_id:request_form.id};var ajax_uri='/fbml/ajax/prompt_send.php';if(preview){var dialog=new pop_dialog();dialog.show_ajax_dialog(ajax_uri,data);}else{new Ajax(function(result){request_form.submit();},function(err){aiert('error: '+err);}).post(ajax_uri,data);}
return false;}
function removeReqRecipient(userid,request_form,is_multi){if(is_multi){fs.unselect(userid);fs.force_reset();}else{var inputs=request_form.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){if(inputs[i].getAttribute('fb_protected')=='true'&&inputs[i].value==userid){if(inputs[i].name=='ids[]'){inputs[i].parentNode.parentNode.parentNode.parentNode.parentNode.token.remove(true);}else if(inputs[i].name=='friend_selector_id'){inputs[i].typeahead.select_suggestion(false);inputs[i].typeahead.set_value('');inputs[i].value='';}}}}
var span=ge('sp'+userid);var recipients_list=span.parentNode;recipients_list.removeChild(span);for(var i=0;i<recipients_list.childNodes.length;i++){if(recipients_list.childNodes[i].nodeName=='SPAN'){return false;}}
generic_dialog.get_dialog(recipients_list).fade_out(100);return false;}
return{friendSelector:friendSelector,Contexts:Contexts,attachCurlFromObject:attachCurlFromObject,attachFromPreview:attachFromPreview,clickRewriteAjax:clickRewriteAjax,clickToShow:clickToShow,clickToShowDialog:clickToShowDialog,clickToHide:clickToHide,clickToEnable:clickToEnable,clickToDisable:clickToDisable,clickToToggle:clickToToggle,closeDialogInvoked:closeDialogInvoked,cancelRequest:cancelRequest,sendRequest:sendRequest,removeReqRecipient:removeReqRecipient,addHiddenInputs:addHiddenInputs,fbmlLogin:fbmlLogin,requireLogin:requireLogin};})();function fbjs_sandbox(appid,installed){this.appid=appid;this.installed=installed;this.pending_bootstraps=[];this.bootstrapped=false;fbjs_sandbox.instances['a'+appid]=this;}
fbjs_sandbox.instances={};fbjs_sandbox.prototype.bootstrap=function(){var appid=this.appid;var code=['a',appid,'_Math = new fbjs_math();','a',appid,'_Date = fbjs_date();','a',appid,'_String = new fbjs_string();','a',appid,'_RegExp = new fbjs_regexp();','a',appid,'_Ajax = fbjs_ajax(',appid,', ',this.installed,');','a',appid,'_Dialog = fbjs_dialog(',appid,');','a',appid,'_document = new fbjs_main(',appid,');','a',appid,'_undefined = undefined;','a',appid,'_console = new fbjs_console();','a',appid,'_setTimeout = fbjs_sandbox.set_timeout;','a',appid,'_setInterval = fbjs_sandbox.set_interval;','a',appid,'_escape = escapeURI;'];for(var i in{clearTimeout:1,clearInterval:1,parseFloat:1,parseInt:1,isNaN:1,isFinite:1}){code=code.concat(['a',appid,'_',i,'=',i,';']);}
eval(code.join(''));for(var i=0,il=this.pending_bootstraps.length;i<il;i++){eval_global(this.pending_bootstraps[i]);}
this.pending_bootstraps=[];this.bootstrapped=true;}
function ref(that){if(that==window){return null;}else if(that.ownerDocument==document){fbjs_console.error('ref called with a DOM object!');return fbjs_dom.get_instance(that);}else{return that;}}
function idx(b){return(b instanceof Object||fbjs_blacklist_props[b])?'__unknown__':b;}
var fbjs_blacklist_props={'caller':true}
function arg(args){var new_args=[];for(var i=0;i<args.length;i++){new_args.push(args[i]);}
return new_args;}
fbjs_sandbox.safe_string=function(str){if(str==undefined||str==null){return'';}else if(typeof str!='string'){fbjs_console.error('String expected.');return'';}else{if(ua.safari()){delete String.prototype.replace;delete String.prototype.toLowerCase;}
return str;}}
fbjs_sandbox.set_timeout=function(js,timeout){if(typeof js!='function'){fbjs_console.error('setTimeout may not be used with a string. Please enclose your event in an anonymous function.');}else{return setTimeout(js,timeout);}}
fbjs_sandbox.set_interval=function(js,interval){if(typeof js!='function'){fbjs_console.error('setInterval may not be used with a string. Please enclose your event in an anonymous function.');}else{return setInterval(js,interval);}}
function fbjs_main(appid){fbjs_private.get(this).appid=appid;}
fbjs_main.allowed_elements={a:true,abbr:true,acronym:true,address:true,b:true,br:true,bdo:true,big:true,blockquote:true,caption:true,center:true,cite:true,code:true,del:true,dfn:true,div:true,dl:true,dd:true,dt:true,em:true,fieldset:true,font:true,form:true,h1:true,h2:true,h3:true,h4:true,h5:true,h6:true,hr:true,i:true,img:true,input:true,ins:true,iframe:true,kbd:true,label:true,legend:true,li:true,ol:true,option:true,optgroup:true,p:true,pre:true,q:true,s:true,samp:true,select:true,small:true,span:true,strike:true,strong:true,sub:true,sup:true,table:true,textarea:true,tbody:true,td:true,tfoot:true,th:true,thead:true,tr:true,tt:true,u:true,ul:true};fbjs_main.allowed_events={focus:true,click:true,mousedown:true,mouseup:true,dblclick:true,change:true,reset:true,select:true,submit:true,keydown:true,keypress:true,keyup:true,blur:true,load:true,mouseover:true,mouseout:true,mousemove:true,selectstart:true};fbjs_main.prototype.getElementById=function(id){var appid=fbjs_private.get(this).appid;return fbjs_dom.get_instance(document.getElementById('app'+appid+'_'+id),appid);}
fbjs_main.prototype.getRootElement=function(){var appid=fbjs_private.get(this).appid;return fbjs_dom.get_instance(document.getElementById('app_content_'+appid).firstChild,appid);}
fbjs_main.prototype.createElement=function(element){var mix=fbjs_sandbox.safe_string(element.toLowerCase());if(fbjs_main.allowed_elements[mix]){return fbjs_dom.get_instance(document.createElement(mix),fbjs_private.get(this).appid);}else{switch(mix){case'fb:swf':return new fbjs_fbml_dom('fb:swf',fbjs_private.get(this).appid);break;default:fbjs_console.error(mix+' is not an allowed DOM element');break;}}}
fbjs_main.prototype.setLocation=function(url){url=fbjs_sandbox.safe_string(url);if(fbjs_dom.href_regex.test(url)){document.location.href=url;return this;}else{fbjs_console.error(url+' is not a valid location');}}
function fbjs_dom(obj,appid){obj.fbjs_instance=this.__instance=fbjs_dom.len;fbjs_dom[fbjs_dom.len]={instance:this,obj:obj,events:{},appid:appid};fbjs_dom.len++;}
fbjs_dom.len=0;fbjs_dom.factory=function(obj,appid){if(obj.tagName&&(!fbjs_main.allowed_elements[obj.tagName.toLowerCase()]||has_css_class_name(obj,'__fbml_tag')||(obj.tagName=='INPUT'&&(obj.name.substring(0,2)=='fb'||obj.name=='post_form_id'))||obj.getAttribute('fb_protected')=='true')){return null;}else{return new this(obj,appid);}}
fbjs_dom.get_data=function(handle){if(handle.__instance instanceof Object){return null;}else{var data=fbjs_dom[handle.__instance];return data.instance==handle?data:null;}}
fbjs_dom.get_obj=function(handle){if(handle instanceof fbjs_fbml_dom){return fbjs_fbml_dom.get_obj(handle);}else{if(typeof handle.__instance=='number'){var data=fbjs_dom[handle.__instance];if(data.instance==handle){return data.obj;}else{throw('Invalid object passed to fbjs_dom.get_obj.');}}else{throw('Invalid object passed to fbjs_dom.get_obj.');}}}
fbjs_dom.render=function(handle){if(handle instanceof fbjs_fbml_dom){fbjs_fbml_dom.render(handle);}}
fbjs_dom.get_instance=function(obj,appid){if(!obj){return null;}
if(typeof obj.fbjs_instance=='undefined'){return fbjs_dom.factory(obj,appid);}else{return fbjs_dom[obj.fbjs_instance].instance;}}
fbjs_dom.get_instance_list=function(list,appid){var objs=[];for(var i=0;i<list.length;i++){var obj=fbjs_dom.get_instance(list[i],appid);if(obj){objs.push(obj);}}
return objs;}
fbjs_dom.get_first_valid_instance=function(obj,next,appid){var ret=null;if(obj&&((obj.id&&obj.id.indexOf('app_content')!=-1)||(obj.tagName&&obj.tagName.toLowerCase()=='body'))){return null;}
while(obj&&(!(ret=fbjs_dom.factory(obj,appid)))){if(obj.id.indexOf('app_content')!=-1||obj.tagName.toLowerCase()=='body'){return null;}
obj=obj[next];}
return ret;}
fbjs_dom.clear_instances=function(obj,include){if(include&&obj.fbjs_instance){delete fbjs_dom[obj.fbjs_instance].obj;delete fbjs_dom[obj.fbjs_instance].events;delete fbjs_dom[obj.fbjs_instance].instance;delete fbjs_dom[obj.fbjs_instance];obj.fbjs_instance=undefined;}
var cn=obj.childNodes;for(var i=0;i<cn.length;i++){fbjs_dom.clear_instances(cn[i],true);}}
fbjs_dom.prototype.appendChild=function(child){fbjs_dom.get_obj(this).appendChild(fbjs_dom.get_obj(child));fbjs_dom.render(child);return child;}
fbjs_dom.prototype.insertBefore=function(child,caret){if(caret){fbjs_dom.get_obj(this).insertBefore(fbjs_dom.get_obj(child),fbjs_dom.get_obj(caret));}else{fbjs_dom.get_obj(this).appendChild(fbjs_dom.get_obj(child));}
fbjs_dom.render(child);return child;}
fbjs_dom.prototype.removeChild=function(child){var child=fbjs_dom.get_obj(child);fbjs_dom.clear_instances(child,true);fbjs_dom.get_obj(this).removeChild(child);return this;}
fbjs_dom.prototype.replaceChild=function(newchild,oldchild){fbjs_dom.clear_instances(oldchild,true);fbjs_dom.get_obj(this).replaceChild(fbjs_dom.get_obj(newchild),fbjs_dom.get_obj(oldchild));return this;}
fbjs_dom.prototype.cloneNode=function(tree){var data=fbjs_dom.get_data(this);return fbjs_dom.get_instance(data.obj.cloneNode(tree),data.appid);}
fbjs_dom.prototype.getParentNode=function(){var data=fbjs_dom.get_data(this);return fbjs_dom.get_first_valid_instance(data.obj.parentNode,'parentNode',data.appid);}
fbjs_dom.prototype.getNextSibling=function(){var data=fbjs_dom.get_data(this);return fbjs_dom.get_first_valid_instance(data.obj.nextSibling,'nextSibling',data.appid);}
fbjs_dom.prototype.getPreviousSibling=function(){var data=fbjs_dom.get_data(this);return fbjs_dom.get_first_valid_instance(data.obj.previousSibling,'previousSibling',data.appid);}
fbjs_dom.prototype.getFirstChild=function(){var data=fbjs_dom.get_data(this);return fbjs_dom.get_first_valid_instance(data.obj.firstChild,'nextSibling',data.appid);}
fbjs_dom.prototype.getLastChild=function(){var data=fbjs_dom.get_data(this);return fbjs_dom.get_first_valid_instance(data.obj.lastChild,'previousSibling',data.appid);}
fbjs_dom.prototype.getChildNodes=function(){var data=fbjs_dom.get_data(this);return fbjs_dom.get_instance_list(data.obj.childNodes,data.appid);}
fbjs_dom.prototype.getElementsByTagName=function(tag){var data=fbjs_dom.get_data(this);return fbjs_dom.get_instance_list(data.obj.getElementsByTagName(tag),data.appid);}
fbjs_dom.prototype.getOptions=function(){var data=fbjs_dom.get_data(this);return fbjs_dom.get_instance_list(data.obj.options,data.appid);}
fbjs_dom.prototype.getForm=function(){var data=fbjs_dom.get_data(this);return fbjs_dom.get_instance(data.obj.form,data.appid);}
fbjs_dom.prototype.serialize=function(){var elements=fbjs_dom.get_data(this).obj.elements;var data={};for(var i=elements.length-1;i>=0;i--){if(elements[i].name&&elements[i].name.substring(0,2)!='fb'&&elements[i].name!='post_form_id'&&!elements[i].disabled){if(!(elements[i].type=='radio'||elements[i].type=='checkbox')||elements[i].checked||(!elements[i].type||elements[i].type=='text'||elements[i].type=='password'||elements[i].type=='hidden'||elements[i].tagName=='TEXTAREA')){serialize_form_helper(data,elements[i].name,elements[i].value);}else if(elements[i].tagName=='SELECT'){var si=elements[i].selectedIndex;var val=null;if(si!=-1){val=(elements[i].options[si].getAttribute('value')==null)?undefined:obj.value;}
serialize_form_helper(data,elements[i].name,val);}}}
return data;}
fbjs_dom.prototype.setInnerFBML=function(fbml_ref){var html=fbjs_private.get(fbml_ref).htmlstring;var obj=fbjs_dom.get_obj(this);switch(obj.tagName){case'TEXTAREA':fbjs_console.error('setInnerFBML is not supported on textareas. Please use .value instead.');break;case'COL':case'COLGROUP':case'TABLE':case'TBODY':case'TFOOT':case'THEAD':case'TR':fbjs_console.error('setInnerFBML is not supported on this node.');break;default:set_inner_html(obj,html);break;}
return this;}
fbjs_dom.prototype.setTextValue=function(text){var obj=fbjs_dom.get_obj(this);fbjs_dom.clear_instances(obj,false);obj.innerHTML=htmlspecialchars(fbjs_sandbox.safe_string(text));return this;}
fbjs_dom.prototype.setValue=function(value){fbjs_dom.get_obj(this).value=value;return this;}
fbjs_dom.prototype.getValue=function(){var obj=fbjs_dom.get_obj(this);if(obj.tagName=='SELECT'){var si=obj.selectedIndex;if(si==-1){return null;}else{if(obj.options[si].getAttribute('value')==null){return undefined;}else{return obj.value;}}}else{return fbjs_dom.get_obj(this).value;}}
fbjs_dom.prototype.getSelectedIndex=function(){return fbjs_dom.get_obj(this).selectedIndex;}
fbjs_dom.prototype.setSelectedIndex=function(si){fbjs_dom.get_obj(this).selectedIndex=si;return this;}
fbjs_dom.prototype.getChecked=function(){return fbjs_dom.get_obj(this).checked;}
fbjs_dom.prototype.setChecked=function(c){fbjs_dom.get_obj(this).checked=c;return this;}
fbjs_dom.set_style=function(obj,style,value){if(typeof style=='string'){if(style=='opacity'){set_opacity(obj,parseFloat(value,10));}else{value=fbjs_sandbox.safe_string(value);if(fbjs_dom.css_regex.test(value)){obj.style[style]=value;}else{fbjs_console.error(style+': '+value+' is not a valid CSS style');}}}else{for(var i in style){fbjs_dom.set_style(obj,i,style[i]);}}}
fbjs_dom.css_regex=/^(?:[\w\-#%+]+|rgb\(\d+ *, *\d+, *\d+\)|url\('?http[^ ]+?'?\)| +)*$/i
fbjs_dom.prototype.setStyle=function(style,value){fbjs_dom.set_style(fbjs_dom.get_obj(this),style,value);return this;}
fbjs_dom.prototype.getStyle=function(style_str){return fbjs_dom.get_obj(this).style[style_str];}
fbjs_dom.prototype.setHref=function(href){href=fbjs_sandbox.safe_string(href);if(fbjs_dom.href_regex.test(href)){fbjs_dom.get_obj(this).href=href;return this;}else{fbjs_console.error(href+' is not a valid hyperlink');}}
fbjs_dom.href_regex=/^(?:https?|mailto|ftp|aim|irc|itms|gopher|\/|#)/;fbjs_dom.prototype.getHref=function(){return fbjs_dom.get_obj(this).href;}
fbjs_dom.prototype.setSrc=function(src){src=fbjs_sandbox.safe_string(src);if(fbjs_dom.href_regex.test(src)){fbjs_dom.get_obj(this).src=src;return this;}else{fbjs_console.error(src+' is not a valid hyperlink');}}
fbjs_dom.prototype.getSrc=function(){return fbjs_dom.get_obj(this).src;}
fbjs_dom.prototype.setTarget=function(target){fbjs_dom.get_obj(this).target=target;return this;}
fbjs_dom.prototype.getTarget=function(){return fbjs_dom.get_obj(this).target;}
fbjs_dom.prototype.setClassName=function(classname){fbjs_dom.get_obj(this).className=classname;return this;}
fbjs_dom.prototype.getClassName=function(){return fbjs_dom.get_obj(this).className;}
fbjs_dom.prototype.hasClassName=function(classname){return has_css_class_name(fbjs_dom.get_obj(this),classname);}
fbjs_dom.prototype.addClassName=function(classname){add_css_class_name(fbjs_dom.get_obj(this),classname);return this;}
fbjs_dom.prototype.removeClassName=function(classname){remove_css_class_name(fbjs_dom.get_obj(this),classname);return this;}
fbjs_dom.prototype.toggleClassName=function(classname){this.hasClassName(classname)?this.removeClassName(classname):this.addClassName(classname);return this;}
fbjs_dom.prototype.getTagName=function(){return fbjs_dom.get_obj(this).tagName;}
fbjs_dom.prototype.getNodeType=function(){return fbjs_dom.get_obj(this).nodeType;}
fbjs_dom.prototype.getId=function(){return fbjs_dom.get_obj(this).id;}
fbjs_dom.prototype.setId=function(id){var data=fbjs_dom.get_data(this);data.obj.id=['app',data.appid,'_',id].join('');return this;}
fbjs_dom.prototype.setDir=function(dir){fbjs_dom.get_obj(this).dir=dir;return this;}
fbjs_dom.prototype.getdir=function(dir){return fbjs_dom.get_obj(this).dir;}
fbjs_dom.prototype.getClientWidth=function(){return fbjs_dom.get_obj(this).clientWidth;}
fbjs_dom.prototype.getClientHeight=function(){return fbjs_dom.get_obj(this).clientHeight;}
fbjs_dom.prototype.getOffsetWidth=function(){return fbjs_dom.get_obj(this).offsetWidth;}
fbjs_dom.prototype.getOffsetHeight=function(){return fbjs_dom.get_obj(this).offsetHeight;}
fbjs_dom.prototype.getAbsoluteLeft=function(){return elementX(fbjs_dom.get_obj(this));}
fbjs_dom.prototype.getAbsoluteTop=function(){return elementY(fbjs_dom.get_obj(this));}
fbjs_dom.prototype.getScrollHeight=function(){return fbjs_dom.get_obj(this).scrollHeight;}
fbjs_dom.prototype.getScrollWidth=function(val){return fbjs_dom.get_obj(this).scrollWidth;}
fbjs_dom.prototype.getScrollTop=function(){return fbjs_dom.get_obj(this).scrollTop;}
fbjs_dom.prototype.setScrollTop=function(val){fbjs_dom.get_obj(this).scrollTop=val;return this;}
fbjs_dom.prototype.getScrollLeft=function(){return fbjs_dom.get_obj(this).scrollLeft;}
fbjs_dom.prototype.setScrollLeft=function(val){fbjs_dom.get_obj(this).scrollLeft=val;return this;}
fbjs_dom.prototype.getTabIndex=function(){return fbjs_dom.get_obj(this).tabIndex;}
fbjs_dom.prototype.setTabIndex=function(tabindex){fbjs_dom.get_obj(this).tabIndex=tabindex;return this;}
fbjs_dom.prototype.getTitle=function(){return fbjs_dom.get_obj(this).title;}
fbjs_dom.prototype.setTitle=function(title){fbjs_dom.get_obj(this).title=title;return this;}
fbjs_dom.prototype.getName=function(){return fbjs_dom.get_obj(this).name;}
fbjs_dom.prototype.setName=function(name){fbjs_dom.get_obj(this).name=name;return this;}
fbjs_dom.prototype.getCols=function(){return fbjs_dom.get_obj(this).cols;}
fbjs_dom.prototype.setCols=function(cols){fbjs_dom.get_obj(this).cols=cols;return this;}
fbjs_dom.prototype.getRows=function(){return fbjs_dom.get_obj(this).rows;}
fbjs_dom.prototype.setRows=function(rows){fbjs_dom.get_obj(this).rows=rows;return this;}
fbjs_dom.prototype.getAccessKey=function(){return fbjs_dom.get_obj(this).accessKey;}
fbjs_dom.prototype.setAccessKey=function(accesskey){fbjs_dom.get_obj(this).accessKey=accesskey;return this;}
fbjs_dom.prototype.setDisabled=function(disabled){fbjs_dom.get_obj(this).disabled=disabled;return this;}
fbjs_dom.prototype.getDisabled=function(){return fbjs_dom.get_obj(this).disabled;}
fbjs_dom.prototype.setMaxLength=function(length){fbjs_dom.get_obj(this).maxLength=length;return this;}
fbjs_dom.prototype.getMaxLength=function(){return fbjs_dom.get_obj(this).maxLength;}
fbjs_dom.prototype.setReadOnly=function(readonly){fbjs_dom.get_obj(this).readOnly=readonly;return this;}
fbjs_dom.prototype.getReadOnly=function(){return fbjs_dom.get_obj(this).readOnly;}
fbjs_dom.prototype.setType=function(type){type=fbjs_sandbox.safe_string(type);if(type!='password'){fbjs_dom.get_obj(this).type=type;}
return this;}
fbjs_dom.prototype.getType=function(){return fbjs_dom.get_obj(this).type;}
fbjs_dom.prototype.getSelection=function(){var obj=fbjs_dom.get_obj(this);return get_caret_position(obj);}
fbjs_dom.prototype.setSelection=function(start,end){var obj=fbjs_dom.get_obj(this);set_caret_position(obj,start,end);return this;}
fbjs_dom.prototype.submit=function(){fbjs_dom.get_obj(this).submit();return this;}
fbjs_dom.prototype.focus=function(){fbjs_dom.get_obj(this).focus();return this;}
fbjs_dom.prototype.select=function(){fbjs_dom.get_obj(this).select();return this;}
fbjs_dom.eventHandler=function(event){var e=(event instanceof fbjs_event)?event:new fbjs_event(event?event:window.event,this[2]);if(e.ignore){return;}
var r=this[1].call(this[0],e);if(r===false){e.preventDefault();}
return fbjs_event.destroy(e);}
fbjs_dom.prototype.addEventListener=function(type,func){type=fbjs_sandbox.safe_string(type.toLowerCase());if(!fbjs_main.allowed_events[type]){fbjs_console.error(type+' is not an allowed event');return false;}
var data=fbjs_dom.get_data(this);var obj=data.obj;if(!data.events[type]){data.events[type]=[];}
var handler=null;if(obj.addEventListener){obj.addEventListener(type,handler=fbjs_dom.eventHandler.bind([this,func,data.appid]),false);}else if(obj.attachEvent){obj.attachEvent('on'+type,handler=fbjs_dom.eventHandler.bind([this,func,data.appid]));}
data.events[type].push({func:func,handler:handler});return this;}
fbjs_dom.prototype.removeEventListener=function(type,func){type=type.toLowerCase();var data=fbjs_dom.get_data(this);var obj=data.obj;if(data.events[type]){for(var i=0,il=data.events[type].length;i<il;i++){if(data.events[type][i].func==func){if(obj.removeEventListener){obj.removeEventListener(type,data.events[type][i].handler,false);}else if(obj.detachEvent){obj.detachEvent('on'+type,data.events[type][i].handler);}
data.events[type].splice(i,1);}}}
if(obj['on'+type]==func){obj['on'+type]=null;}
return this;}
fbjs_dom.prototype.listEventListeners=function(type){type=type.toLowerCase();var data=fbjs_dom.get_data(this);var events=[];if(data.events[type]){for(var i=0,il=data.events[type].length;i<il;i++){events.push(data.events[type].func);}}
if(data.obj['on'+type]){events.push(data.obj['on'+type]);}
return events;}
fbjs_dom.prototype.purgeEventListeners=function(type){type=type.toLowerCase();var data=fbjs_dom.get_data(this);var obj=data.obj;if(data.events[type]){for(var i=0,il=data.events[type].length;i<il;i++){if(obj.removeEventListener){obj.removeEventListener(type,data.events[type][i].handler,false);}else if(obj.detachEvent){obj.detachEvent('on'+type,data.events[type][i].handler);}}}
if(obj['on'+type]){obj['on'+type]=null;}
return this;}
function fbjs_fbml_dom(type,appid){var data=fbjs_private.get(this);data.type=type;data.appid=appid;}
fbjs_fbml_dom.get_obj=function(instance){var data=fbjs_private.get(instance);if(!data.obj){data.obj=document.createElement('div');data.obj.className='__fbml_tag';}
return data.obj;}
fbjs_fbml_dom.render=function(instance){var data=fbjs_private.get(instance);if(data.rendered){return;}
data.id='swf'+parseInt(Math.random()*999999);switch(data.type){case'fb:swf':var flash_obj=new SWFObject(data.swf_src,data.id,data.width,data.height,'5.0.0',data.bg_color?data.bg_color:'000000');var flash_params={loop:true,quality:true,scale:true,align:true,salign:true};for(i in flash_params){if(data[i]){flash_obj.addParam(i,data[i]);}}
flash_obj.addParam('wmode','transparent');flash_obj.addParam('allowScriptAccess','never');if(data.flash_vars){for(var i in data.flash_vars){flash_obj.addVariable(i,data.flash_vars[i]);}}
var sandbox=fbjs_sandbox.instances['a'+data.appid];if(sandbox.validation_vars){for(var i in sandbox.validation_vars){flash_obj.addVariable(i,sandbox.validation_vars[i]);}}
if(data.wait_for_click){var img=document.createElement('img');img.src=data.img_src;if(data.width){img.width=data.width;}
if(data.height){img.height=data.height;}
if(data.img_style){fbjs_dom.set_style(img,data.img_style);}
if(data.img_class){img.className=data.img_class;}
var anchor=document.createElement('a');anchor.href='#';anchor.onclick=function(){flash_obj.write(data.obj);return false;}
anchor.appendChild(img);data.obj.appendChild(anchor);}else{flash_obj.write(data.obj);}
break;}}
fbjs_fbml_dom.prototype.setSWFSrc=function(swf){var data=fbjs_private.get(this);swf=fbjs_sandbox.safe_string(swf);if(fbjs_dom.href_regex.test(swf)){data.swf_src=swf;}else{fbjs_console.error(swf+' is not a valid swf');}}
fbjs_fbml_dom.prototype.setImgSrc=function(img){var data=fbjs_private.get(this);img=fbjs_sandbox.safe_string(img);if(fbjs_dom.href_regex.test(img)){data.img_src=img;}else{fbjs_console.error(img+' is not a valid src');}
return this;}
fbjs_fbml_dom.prototype.setWidth=function(width){var data=fbjs_private.get(this);data.width=parseInt(width,10);return this;}
fbjs_fbml_dom.prototype.setHeight=function(height){var data=fbjs_private.get(this);data.height=parseInt(height,10);return this;}
fbjs_fbml_dom.prototype.setImgStyle=function(style,value){var data=fbjs_private.get(this);var style_obj=data.img_style?data.img_style:data.img_style={};if(typeof style=='string'){style_obj[style]=value;}else{for(var i in style){this.setImgStyle(i,style[i]);}}
return this;}
fbjs_fbml_dom.prototype.setImgClass=function(img_class){var data=fbjs_private.get(this);data.img_class=img_class;return this;}
fbjs_fbml_dom.prototype.setFlashVar=function(key,val){var data=fbjs_private.get(this);var flash_vars=data.flash_vars?data.flash_vars:data.flash_vars={};flash_vars[key]=val;return this;}
fbjs_fbml_dom.prototype.setSWFBGColor=function(bg){var data=fbjs_private.get(this);if(fbjs_dom.css_regex.text(bg)){data.bg_color=bg;}else{fbjs_console.error(bg+' is not a valid background color.');}
return this;}
fbjs_fbml_dom.prototype.setWaitForClick=function(wait){var data=fbjs_private.get(this);data.wait_for_click=wait;return this;}
fbjs_fbml_dom.prototype.setLoop=function(val){var data=fbjs_private.get(this);data.loop=val;return this;}
fbjs_fbml_dom.prototype.setQuality=function(val){var data=fbjs_private.get(this);data.quality=val;return this;}
fbjs_fbml_dom.prototype.setScale=function(val){var data=fbjs_private.get(this);data.scale=val;return this;}
fbjs_fbml_dom.prototype.setAlign=function(val){var data=fbjs_private.get(this);data.align=val;return this;}
fbjs_fbml_dom.prototype.setSAlign=function(val){var data=fbjs_private.get(this);data.salign=val;return this;}
function fbjs_event(event,appid){if(!fbjs_event.hacks){fbjs_event.hacks=true;fbjs_event.should_check_double_arrows=ua.safari()&&(ua.safari()<500);fbjs_event.arrow_toggle={};}
for(var i in fbjs_event.allowed_properties){this[i]=event[i];}
var target=null;if(event.target){target=event.target;}else if(event.srcElement){target=event.srcElement;}
if(target&&target.nodeType==3){target=target.parentNode;}
this.target=fbjs_dom.get_instance(target,appid);var posx=0;var posy=0;if(event.pageX||event.pageY){posx=event.pageX;posy=event.pageY;}else if(event.clientX||event.clientY){posx=event.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;posy=event.clientY+document.body.scrollTop+document.documentElement.scrollTop;}
this.pageX=posx;this.pageY=posy;if(fbjs_event.should_check_double_arrows&&this.keyCode>=37&&this.keyCode<=40){fbjs_event.arrow_toggle[this.type]=!fbjs_event.arrow_toggle[this.type];if(fbjs_event.arrow_toggle[this.type]){this.ignore=true;}}
fbjs_private.get(this).event=event;}
fbjs_event.allowed_properties={type:true,ctrlKey:true,keyCode:true,metaKey:true,shiftKey:true}
fbjs_event.prototype.preventDefault=function(){var data=fbjs_private.get(this);if(!data.prevented&&data.event.preventDefault){data.event.preventDefault();data.prevented=true;}
data.return_value=false;}
fbjs_event.prototype.stopPropagation=function(){var event=fbjs_private.get(this).event;if(event.stopPropagation){event.stopPropagation();}else{event.cancelBubble=true;}}
fbjs_event.destroy=function(obj){var return_value=fbjs_private.get(obj).return_value;fbjs_private.remove(obj);delete obj.target;return return_value==undefined?true:return_value;}
function fbjs_math(){}
fbjs_math.prototype.abs=Math.abs;fbjs_math.prototype.acos=Math.acos;fbjs_math.prototype.asin=Math.asin;fbjs_math.prototype.atan=Math.atan;fbjs_math.prototype.atan2=Math.atan2;fbjs_math.prototype.ceil=Math.ceil;fbjs_math.prototype.cos=Math.cos;fbjs_math.prototype.exp=Math.exp;fbjs_math.prototype.floor=Math.floor;fbjs_math.prototype.log=Math.log;fbjs_math.prototype.max=Math.max;fbjs_math.prototype.min=Math.min;fbjs_math.prototype.pow=Math.pow;fbjs_math.prototype.random=Math.random;fbjs_math.prototype.round=Math.round;fbjs_math.prototype.sin=Math.sin;fbjs_math.prototype.sqrt=Math.sqrt;fbjs_math.prototype.tan=Math.tan;fbjs_math.prototype.valueOf=Math.valueOf;fbjs_math.prototype.E=Math.E;fbjs_math.prototype.LN2=Math.LN2;fbjs_math.prototype.LN10=Math.LN10;fbjs_math.prototype.LOG2E=Math.LOG2E;fbjs_math.prototype.PI=Math.PI;fbjs_math.prototype.SQRT1_2=Math.SQRT1_2;fbjs_math.prototype.SQRT2=Math.SQRT2;function fbjs_string(){}
fbjs_string.prototype.fromCharCode=String.fromCharCode;function fbjs_date(){var date=function(){var ret=new Date();if(arguments.length){ret.setFullYear.apply(ret,arguments);}
return ret;}
date.parse=Date.parse;return date;}
function fbjs_regexp(){var regexp=function(){var ret=arguments.length?new RegExp(arguments[0],arguments[1]):new RegExp();return ret;}
return regexp;}
function fbjs_console(){}
fbjs_console.error=function(text){if(typeof console!='undefined'&&console.error){console.error(text);}}
fbjs_console.render=function(obj){if(obj&&typeof obj.__priv!='undefined'){var new_obj={};for(var i in obj){new_obj[i]=obj[i];}
delete new_obj.__priv;delete new_obj.__private;for(var i in new_obj){new_obj[i]=fbjs_console.render(new_obj[i]);}
var priv=fbjs_private.get(obj);for(var i in priv){new_obj['PRIV_'+i]=priv[i];}
if(obj.__private){var priv=fbjs_private.get(obj.__private);for(var i in priv){new_obj['PRIV_'+i]=priv[i];}}
return new_obj;}else if(obj&&typeof obj.__instance!='undefined'&&obj.setInnerFBML){var new_obj={};for(var i in obj){new_obj[i]=obj[i];}
delete new_obj.__instance;new_obj.PRIV_obj=fbjs_dom.get_obj(obj);return new_obj;}else if(obj&&typeof obj=='object'&&obj.ownerDocument!=document){var new_obj=obj instanceof Array?[]:{};var changed=false;for(var i in obj){obj instanceof Array?new_obj.push(fbjs_console.render(obj[i])):new_obj[i]=fbjs_console.render(obj[i]);if(new_obj[i]!=obj[i]){changed=true;}}
return changed?new_obj:obj;}else{return obj;}}
fbjs_console.render_args=function(args){var new_args=[];for(var i=0;i<args.length;i++){new_args[i]=fbjs_console.render(args[i]);}
return new_args;}
if(typeof console!='undefined'){for(var i in console){fbjs_console.prototype[i]=console[i];}}
fbjs_console.prototype.debug=function(){if(typeof console!='undefined'&&console.debug){console.debug.apply(console,fbjs_console.render_args(arguments));}}
fbjs_console.prototype.log=function(){if(typeof console!='undefined'&&console.log){console.log.apply(console,fbjs_console.render_args(arguments));}}
fbjs_console.prototype.warn=function(){if(typeof console!='undefined'&&console.warn){console.warn.apply(console,fbjs_console.render_args(arguments));}}
fbjs_console.prototype.error=function(){if(typeof console!='undefined'&&console.error){console.error.apply(console,fbjs_console.render_args(arguments));}}
fbjs_console.prototype.assert=function(){if(typeof console!='undefined'&&console.assert){console.assert.apply(console,fbjs_console.render_args(arguments));}}
fbjs_console.prototype.dir=function(){if(typeof console!='undefined'&&console.dir){console.dir.apply(console,fbjs_console.render_args(arguments));}}
fbjs_console.prototype.group=function(){if(typeof console!='undefined'&&console.group){console.group.apply(console,fbjs_console.render_args(arguments));}}
fbjs_console.prototype.dirxml=function(obj){if(typeof console!='undefined'&&console.dirxml){if(obj.get_obj){console.dirxml(obj.get_obj(obj));}else{console.dirxml(obj);}}}
function fbjs_ajax(appid,installed){var prototype=function(){}
for(var i in fbjs_ajax.prototype){prototype.prototype[i]=fbjs_ajax.prototype[i];}
var priv=fbjs_private.get(prototype.prototype.__private={});priv.appid=appid;priv.installed=installed;prototype.JSON=fbjs_ajax.JSON;prototype.FBML=fbjs_ajax.FBML;prototype.RAW=fbjs_ajax.RAW;return prototype;}
fbjs_ajax.proxy_url='/fbml/fbjs_ajax_proxy.php';fbjs_ajax.RAW=0;fbjs_ajax.JSON=1;fbjs_ajax.FBML=2;fbjs_ajax.STATUS_WAITING_FOR_USER=1;fbjs_ajax.STATUS_WAITING_FOR_SERVER=2;fbjs_ajax.STATUS_IDLE=0;fbjs_ajax.prototype.responseType=0;fbjs_ajax.prototype.requireLogin=false;fbjs_ajax.prototype.status=fbjs_ajax.STATUS_IDLE;fbjs_ajax.new_xml_http=function(){try{return new XMLHttpRequest();}catch(e){try{return new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(e){return null;}}}}
fbjs_ajax.get_transport=function(instance,force_new){var data=fbjs_private.get(instance);if(data.xml&&!force_new){return data.xml;}else{data.xml=fbjs_ajax.new_xml_http();data.xml.onreadystatechange=fbjs_ajax.onreadystatechange.bind([instance,data.xml]);return data.xml;}}
fbjs_ajax.prototype.abort=function(){var xml=fbjs_ajax.get_transport(this,true);if(xml.abort){xml.abort();}
fbjs_private.get(this).inflight=false;}
fbjs_ajax.prototype.post=function(url,query){var xml=fbjs_ajax.get_transport(this,true);var priv=fbjs_private.get(this.__private);var appid=priv.appid;var post_form_id=ge('post_form_id');if(!priv.installed&&this.requireLogin){this.status=fbjs_ajax.STATUS_WAITING_FOR_USER;FBML.requireLogin(appid,function(){priv.installed=true;this.post(url,query);}.bind(this),function(){if(this.onerror){this.onerror();}}.bind(this));return;}
if(xml&&post_form_id){this.status=fbjs_ajax.STATUS_WAITING_FOR_SERVER;xml.open('POST',fbjs_ajax.proxy_url,true);xml.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xml.send(ajaxArrayToQueryString({url:url,query:query,post_form_id:post_form_id.value,type:this.responseType,require_login:this.requireLogin,fb_mockajax_context:fbjs_sandbox.instances['a'+appid].contextd,fb_mockajax_context_hash:fbjs_sandbox.instances['a'+appid].context,appid:appid}));fbjs_private.get(this).inflight=true;}else if(this.onerror){this.onerror();}else{fbjs_console.error('There was an uncaught Ajax error. Please attach on onerror handler to properly handle failures.');}}
fbjs_ajax.make_fbjs_recursive=function(obj){for(var i in obj){if(i.substring(0,5)=='fbml_'){obj[i]=new fbjs_fbml_string(obj[i]);}else if(typeof obj[i]=='object'){fbjs_ajax.make_fbjs_recursive(obj[i]);}}}
fbjs_ajax.onreadystatechange=function(){var xml=this[1];if(xml.readyState==4){var text=xml.responseText;this[0].status=fbjs_ajax.STATUS_READY;if(xml.status>=200&&xml.status<300&&text.length){var priv_data=fbjs_private.get(this[0]);if(priv_data.inflight){priv_data.inflight=false;}else{return;}
eval('var response = '+text);if(response.error!==undefined){if(this[0].onerror){this[0].onerror();}else{fbjs_console.error('There was an uncaught Ajax error. Please attach on onerror handler to properly handle failures.');}}else if(this[0].ondone){switch(response.type){case fbjs_ajax.RAW:this[0].ondone(response.data);break;case fbjs_ajax.JSON:fbjs_ajax.make_fbjs_recursive(response.data);this[0].ondone(response.data);break;case fbjs_ajax.FBML:this[0].ondone(new fbjs_fbml_string(response.data));break;}}}else{if(this[0].onerror){this[0].onerror();}else{fbjs_console.error('There was an uncaught Ajax error. Please attach on onerror handler to properly handle failures.');}}}}
function fbjs_dialog(appid){var prototype=function(type){var priv=fbjs_private.get(this);switch(type){case fbjs_dialog.DIALOG_CONTEXTUAL:priv.dialog=new contextual_dialog('app_content_'+appid);break;case fbjs_dialog.DIALOG_POP:default:priv.dialog=new pop_dialog('app_content_'+appid);break;}
priv.dialog.build_dialog();priv.dialog.hide();priv.dialog.content.id='app_content_'+gen_unique();}
for(var i in fbjs_dialog.prototype){prototype.prototype[i]=fbjs_dialog.prototype[i];}
prototype.DIALOG_POP=fbjs_dialog.DIALOG_POP;prototype.DIALOG_CONTEXTUAL=fbjs_dialog.DIALOG_CONTEXTUAL;return prototype;}
fbjs_dialog.DIALOG_POP=1;fbjs_dialog.DIALOG_CONTEXTUAL=2;fbjs_dialog.onconfirm=function(){var hide=true;if(this.onconfirm){if(this.onconfirm()===false){hide=false;}}
if(hide){fbjs_private.get(this).dialog.fade_out(200);}}
fbjs_dialog.oncancel=function(){var hide=true;if(this.oncancel){if(this.oncancel()===false){hide=false;}}
if(hide){fbjs_private.get(this).dialog.fade_out(200);}}
fbjs_dialog.prototype.setStyle=function(style,value){var dialog=fbjs_private.get(this).dialog;fbjs_dom.set_style(dialog.content,style,value);return ref(this);}
fbjs_dialog.prototype.showMessage=function(title,content,button1){this.showChoice(title,content,button1,false);return ref(this);}
fbjs_dialog.prototype.showChoice=function(title,content,button1,button2){var dialog=fbjs_private.get(this).dialog;dialog.show_choice(fbjs_fbml_string.get(title),fbjs_fbml_string.get(content),!button1?'Okay':fbjs_fbml_string.get(button1),fbjs_dialog.onconfirm.bind(this),button2===undefined?'Cancel':(button2?fbjs_fbml_string.get(button2):false),fbjs_dialog.oncancel.bind(this));return ref(this);}
fbjs_dialog.prototype.setContext=function(node){var dialog=fbjs_private.get(this).dialog;var obj=fbjs_dom.get_obj(node);dialog.set_context(obj);return ref(this);}
fbjs_dialog.prototype.hide=function(){var dialog=fbjs_private.get(this).dialog;dialog.fade_out(500);return ref(this);}
function fbjs_fbml_string(html){fbjs_private.get(this).htmlstring=html;}
fbjs_fbml_string.get=function(html){if(html instanceof fbjs_fbml_string){return fbjs_private.get(html).htmlstring;}else{return htmlspecialchars(fbjs_sandbox.safe_string(html));}}
fbjs_private=new Object();fbjs_private.len=0;fbjs_private.get=function(instance){if(typeof instance!='object'){return null;}
if(instance.__priv==undefined){var priv={data:{},instance:instance};instance.__priv=fbjs_private.len;fbjs_private.len++;priv.instance=instance;fbjs_private[instance.__priv]=priv;return priv.data;}else if(typeof instance.__priv=='number'){var priv=fbjs_private[instance.__priv];if(priv.instance==instance){return priv.data;}else{throw('Invalid object supplied to fbjs_private.get');}}else{throw('Invalid object supplied to fbjs_private.get');}}
fbjs_private.remove=function(instance){if(instance.__priv!=undefined){if(fbjs_private[instance.__priv].instance==instance){delete fbjs_private[instance.__priv];delete instance.__priv;}}}

function bodyKeyPress(event){if(!event)
event=window.event;if(event.keyCode)
keyPressed=event.keyCode;else if(event.which)keyPressed=event.which;if(keyPressed==KEYS.ESC)
cancelHit();if(keyPressed==KEYS.RETURN)
tagHit();}
function registerKeys()
{document.body.onkeypress=bodyKeyPress;}
function pHit(hitCheckbox)
{if(hitCheckbox.checked){friendHit=hitCheckbox.getAttribute("friend");activePersonName=friendHit;activePersonID=hitCheckbox.value;activePersonEmail=hitCheckbox.getAttribute("email");tagHit();}else{activePersonName="";activePersonID=-2;}}
function cancelHit()
{resetSelector();}
function nameChange(event)
{activePersonName="";activePersonID=-2;populateSelector();}
function show_invite_section(filter)
{ge('invite_name').innerHTML="<strong>"+htmlspecialchars(filter)+"</strong>";show('invite_section');}
function maybe_show_invite_section(filter)
{var filter_space=filter.indexOf(" ");if(filter_space!=-1&&filter_space!=filter.length-1){ge('invite_name').innerHTML="<strong>"+htmlspecialchars(filter.substr(0,filter_space))+"</strong>";show('invite_section');}}

var tagging=false;var tagging_initialized=false;var ajax_done=false;var friends=null;var superfriends=null;var frameWidth=166;var frameHeight=166;var activePersonID=-2;var activePersonName='';var lastActivePersonName='';var activeImageMouseX;var activeImageMouseY;var pid=0;var id=0;var idname="";var user=0;var oid=0;var aid=0;var ajax_setter_uri='/ajax/photo_tagging_ajax.php';var ajax_getter_uri='/ajax/photos_get_tag_options_ajax.php';var foundCount=0;var lastFoundName='';var lastFoundID=0;function showBoxAt(percentX,percentY){thePhoto=ge('myphoto');if(thePhoto==null)
aiert('null photo');thePhotoX=findX(thePhoto);thePhotoY=findY(thePhoto);ge('tagframeinside').innerHTML="+ "+thePhotoX+"."+thePhotoY+"<br>";ge('tagframeinside').innerHTML+="% "+percentX+"."+percentY+"<br>";ge('tagframeinside').innerHTML+="d "+thePhoto.width+"."+thePhoto.height+"<br>";ge('tagframeinside').innerHTML+='= '+((percentX*thePhoto.width)/100)+"."+((percentY*thePhoto.height)/100)+"<br>";newX=thePhotoX+((percentX*thePhoto.width)/100)-(frameWidth/2);newY=thePhotoY+((percentY*thePhoto.height)/100)-(frameHeight/2);ge('tagframeinside').innerHTML+="> "+newX+"."+newY;ge('tagframeinside').innerHTML="";imageMinX=findX(thePhoto);imageMinY=findY(thePhoto);imageMaxX=imageMinX+thePhoto.width;imageMaxY=imageMinY+thePhoto.height;frameX=imageMinX+((percentX*thePhoto.width)/100);frameY=imageMinY+((percentY*thePhoto.height)/100);if(frameX<imageMinX+(frameWidth/2))
frameX=imageMinX+(frameWidth/2);if(frameY<imageMinY+(frameHeight/2))
frameY=imageMinY+(frameHeight/2);if(frameX>imageMaxX-(frameWidth/2))
frameX=imageMaxX-(frameWidth/2);if(frameY>imageMaxY-(frameHeight/2))
frameY=imageMaxY-(frameHeight/2);ge('tagframe').style.left=(frameX-(frameWidth/2)-8)+"px";ge('tagframe').style.top=(frameY-(frameHeight/2)-8)+"px";show('tagframe');}
function hideBox()
{hide('tagframe');}
function showNameFrame(percentX,percentY,context){var snf_image=ge('myphoto');var snf_nameFrame=ge('nameframe');snf_nameFrame.innerHTML=context;snf_nameFrame.style.left=snf_nameFrame.style.top='-10000px';show('nameframe');var snf_x=Math.min(Math.max((percentX*snf_image.width/100)-frameWidth/2,0),snf_image.width-frameWidth);var snf_y=Math.min(Math.max((percentY*snf_image.height/100)-frameHeight/2,0),snf_image.height-frameHeight);snf_nameFrame.style.left=findX(snf_image)+snf_x+(frameWidth-snf_nameFrame.offsetWidth)/2+'px';snf_nameFrame.style.top=findY(snf_image)+snf_y+frameHeight-snf_nameFrame.offsetHeight-8+"px";}
function hideNameFrame(){hide('nameframe');}
var tag_mouse_move_counter=0;var tag_current_frame_index=-1;function findTag(event){if(!event){hideNameFrame();tag_current_frame_index=-1;return;}else if(!document.onmousemove){document.onmousemove=function(){findTag()};}else if(event){event.cancelBubble=true;}
if(tag_mouse_move_counter++%3!=0){return;}
var ft_image=ge('myphoto');var ft_activeImageMouseX=mousePosX(event)-findX(ft_image);var ft_activeImageMouseY=mousePosY(event)-findY(ft_image);var frame_percent_x=frameWidth/ft_image.width/2*100;var frame_percent_y=frameHeight/ft_image.height/2*100;var frame_min_x=frameWidth/2/ft_image.width*100;var frame_min_y=frameHeight/2/ft_image.height*100;var percent_x=ft_activeImageMouseX/ft_image.width*100;var percent_y=ft_activeImageMouseY/ft_image.height*100;var min_dist=-1;var min_index=-1;var dist;var dx;var dy;if(photo_tags){for(var i=0,il=photo_tags.length;i<il;i++){dx=Math.abs(Math.min(Math.max(frame_min_x,photo_tags[i][0]),100-frame_min_x)-percent_x);dy=Math.abs(Math.min(Math.max(frame_min_y,photo_tags[i][1]),100-frame_min_y)-percent_y);if(dx<=frame_percent_x&&dy<=frame_percent_y){dist=Math.pow(dx,2)+Math.pow(dy,2);if(min_dist==-1||dist<min_dist){min_dist=dist;min_index=i;}}}
if(min_index!=-1){if(tag_current_frame_index!=min_index){showNameFrame(photo_tags[min_index][0],photo_tags[min_index][1],photo_tags[min_index][2]);}}else{hideNameFrame();}
tag_current_frame_index=min_index;}}
function removeTag(params){var ajax=new Ajax();ajax.onDone=function(ajaxObj,responseText){hideBox();eval(responseText);ge("phototags").innerHTML=tag_html;}
ajax.onFail=function(ajaxObj){}
ajax.post(ajax_setter_uri,params);return false;}
function submitTag(){if(ge("phototags").getElementsByTagName("span").length>29){successMessage='<b>Unable to save tag. A photo may only have up to 30 tags. To add a new tag, you must first remove one of the existing tags on the photo.</b>';hide('tagging_instructions_default_message');ge('tagging_instructions_status_message').innerHTML=successMessage;focusInstructions();return false;}
var ajax=new Ajax();ajax.onDone=function(ajaxObj,responseText){eval(responseText);ge("phototags").innerHTML=tag_html;var successName;var requestText;var successMessage="";if(id==user){requestText=" ";tagAction=" tag ";}else{requestText=" request ";tagAction=" request tags in ";}
if(!activePersonName){successName=lastActivePersonNameEscaped;}else{successName=activePersonNameEscaped;}
if(isCurrentUser(successName)){successName="yourself";}
if(invite_saved=='1'){if(tag_success=='1'){successMessage='<b>Tag'+requestText+'for '+successName;if(id==user){successMessage+=' saved';}else{successMessage+=' sent to '+idname+' for approval';}
successMessage+='</b>.<br/>';}else if(tag_success=='0'){successMessage='<b style="color:red">'+'There was an error tagging this photo. Try again later.'+'</b><br />';}else if(unlinked_message){successMessage='<b style="color:red">'+unlinked_message+'</b><br />';}}
if(invite_message){if(invite_error=='0'){successMessage+='<b style="color: green">'+invite_message+'</b><br/>';}else{successMessage+='<b style="color: red">'+invite_message+'</b><br/>';}}
successMessage+='You can continue to'+tagAction+'the photo below.<br/>When you are done, click the "Done Tagging" button to resume browsing.';hide('tagging_instructions_default_message');ge('tagging_instructions_status_message').innerHTML=successMessage;focusInstructions();return false;}
ajax.onFail=function(ajaxObj){}
tagImage=ge('myphoto');percentX=(activeImageMouseX*100)/tagImage.width;percentY=(activeImageMouseY*100)/tagImage.height;var personEmail=ge('invite_email').value;params='pid='+pid
+'&id='+id
+'&subject='+escapeURI(activePersonID)
+'&name='+(activePersonName?escapeURI(activePersonName):escapeURI(lastActivePersonName))
+'&email='+escapeURI(personEmail)
+'&action=add'
+'&x='+percentX
+'&y='+percentY;ajax.post(ajax_setter_uri,params);resetSelector();removeTagOption(activePersonName,activePersonID);}
function removeTagOption(removeName,removeID){superfriends=removeFromList(removeName,removeID,superfriends);friends=removeFromList(removeName,removeID,friends);}
function removeFromList(removeName,removeID,list){listCount=list.length;for(i=0;i<listCount;i++){if(list[i]['name']==removeName&&list[i]['id']==removeID){list.splice(i,1);break;}}
return list;}
function show_tagging_ui(photo_id,owner_id,owner_name,user_id,album_id,obj_id){pid=photo_id;id=owner_id;user=user_id;aid=album_id;oid=obj_id;idname=owner_name;tagging=true;if(!tagging_initialized){var ajax=new Ajax(onGetTagOptionsSuccessFn,onGetTagOptionsFailFn);ajax.get(ajax_getter_uri+'?id='+id+'&pid='+pid+'&aid='+aid+'&oid='+oid);tagging_initialized=true;registerKeys();}
show('tagging_instructions');ge('name').value='';ge('invite_email').value='';ge('myphoto').style.cursor='crosshair';ge('myphotolink').href='#';ge('tagging_instructions_status_message').innerHTML='';show('tagging_instructions_default_message');}
function focusInstructions(){Vector2.scrollTo(Vector2.getElementPosition($('tagging_instructions'),'document').sub(0,8));}
function hide_tagging_ui(href){tagging=false;hide('tagging_instructions');ge('myphoto').style.cursor='';ge('myphotolink').href=href;hide('selector');hide('tagframe');}
function onGetTagOptionsSuccessFn(ajaxObj,responseText){eval(responseText.substr(8));superfriends=superfriends_ajax;friends=friends_ajax;me_text=me_text_ajax;populateSelector();ajax_done=true;}
function tagHit(){if((activePersonID==-2||activePersonName=="")&&ge('name').value==""){return;}
if(activePersonID==-2){activePersonName=ge('name').value;activePersonNameEscaped=htmlspecialchars(activePersonName);if(isCurrentUser(activePersonName)){activePersonID=user;}else{activePersonID=0;}}
else{activePersonNameEscaped=activePersonName;}
lastActivePersonName=activePersonName;lastActivePersonNameEscaped=activePersonNameEscaped;submitTag();}
function resetSelector(){hide('selector');hide('tagframe');activePersonID=-2;activePersonName="";ge('name').value="";ge('invite_email').value='';populateSelector();}
function populateSelector(){var i=0;var filter=ge('name').value.toLowerCase();var filterLen=filter.length;var superContents="";var friendContents="";var sepContents="";var superCount=0;if(filter==""){filter=null;}
foundCount=0;superContents=render_userlist(superfriends,filter);superCount=foundCount;friendContents=render_userlist(friends,filter);if(superCount>0&&foundCount>1){sepContents="<hr/>";}
ge('userlist').innerHTML=superContents+sepContents+friendContents;if(foundCount==1){activePersonID=lastFoundID;activePersonName=lastFoundName;ge('f0').checked=true;}
hide('invite_section');if(foundCount==0){hide('userlist');hide('userlistlabel');if(id==user&&!oid)
{maybe_show_invite_section(filter);}}else{show('userlist');show('userlistlabel');}}
function render_userlist(list,filter){var listCount=list.length;var str="";for(i=0;i<listCount;i++){if(!filter||list[i]['name'].toLowerCase().indexOf(filter)!=-1){str+="<input type=checkbox onclick=\"pHit(this);\" name='f"+foundCount+"' id='f"+foundCount+"' friend=\""+list[i]['name']+"\" value="+list[i]['id']+"><label for='f"+foundCount+"'>"+list[i]['name']+"</label><br>";lastFoundName=list[i]['name'];lastFoundID=list[i]['id'];foundCount++;}}
return str;}
function onGetTagOptionsFailFn(){}
function imageMouseUp(){if(tagging){ge('name').focus();ge('name').select();}}
function imageMouseDown(event,image,tagsID){if(tagging){activeImageMouseX=mousePosX(event)-findX(image);activeImageMouseY=mousePosY(event)-findY(image);updateFrame(image,activeImageMouseX,activeImageMouseY);return false;}}
function frameMouseDown(event)
{if(tagging){image=ge('myphoto');activeImageMouseX=mousePosX(event)-findX(image);activeImageMouseY=mousePosY(event)-findY(image);updateFrame(image,activeImageMouseX,activeImageMouseY);}}
function frameMouseUp()
{if(tagging){ge('name').focus();ge('name').select();}}
function updateFrame(image,imageMouseX,imageMouseY)
{imageMinX=findX(image);imageMinY=findY(image);imageMaxX=imageMinX+image.width;imageMaxY=imageMinY+image.height;frameX=findX(image)+imageMouseX;frameY=findY(image)+imageMouseY;if(frameX<imageMinX+(frameWidth/2))
frameX=imageMinX+(frameWidth/2);if(frameY<imageMinY+(frameHeight/2))
frameY=imageMinY+(frameHeight/2);if(frameX>imageMaxX-(frameWidth/2))
frameX=imageMaxX-(frameWidth/2);if(frameY>imageMaxY-(frameHeight/2))
frameY=imageMaxY-(frameHeight/2);var tagMinX=frameX-(frameWidth/2)-8;var tagMinY=frameY-(frameHeight/2)-8;ge('tagframe').style.left=tagMinX+"px";ge('tagframe').style.top=tagMinY+"px";if(imageMouseX<300){ge('selector').style.left=(tagMinX+frameWidth+16+10)+"px";}else{ge('selector').style.left=(tagMinX-190)+"px";}
ge('selector').style.top=tagMinY+"px";if(ajax_done){populateSelector();}
show('selector');show('tagframe');}
function isCurrentUser(name){return name.toLowerCase()=='me'||name.indexOf(me_text)!=-1;}

status_editor={active:false,menu_active:false,status_text:'',status_blur:false,status_reblur:false,setup:function(initial_status){this.status_text=initial_status;},reset:function(){ge('edit_status_text').value='';return false;},show:function(){if(!this.active){hide('profile_status');hide('profile_empty_status');this.hide_menu();show('status_editor');if(ge('status_text').firstChild){this.status_text=ge('status_text').firstChild.nodeValue;}
ge('edit_status_text').value=this.status_text;ge('edit_status_text').focus();ge('edit_status_text').select();this.status_blur=true;this.active=true;}else{ge('edit_status_text').focus();}
return false;},hide:function(){if(!this.active){return;}
this.active=false;this.status_blur=false;hide('status_editor');show((this.status_text!='')?'profile_status':'profile_empty_status');return false;},toggle_menu:function(event){if(ua.safari()||ua.ie()){this.status_reblur=true;}
if(this.menu_active){return this.hide_menu();}else{return this.show_menu();}},show_menu:function(event){this.menu_active=true;ge('edit_status_toggle').style.backgroundImage='url(/images/status_on.gif)';ge('edit_status_toggle').style.backgroundColor='#fff';ge('edit_status_select').style.display='block';return false;},hide_menu:function(){this.menu_active=false;ge('edit_status_toggle').style.backgroundImage='url(/images/status_off.gif)';ge('edit_status_toggle').style.backgroundColor='#D8DFEA';hide('edit_status_select');return false;},status_select:function(text){if(ua.safari()||ua.ie()){this.status_reblur=true;}
this.hide_menu();ge('edit_status_text').value=text;ge('edit_status_text').focus();ge('edit_status_text').select();},blur:function(){if(this.status_reblur){ge('edit_status_text').focus();this.status_reblur=false;return false;}
if(this.status_blur){if(ge('edit_status_text').value!=this.status_text){this.submit_status_set(ge('edit_status_text').value);}else{this.hide();}}
return true;},status_set:function(status){this.status_text=status||'';this.reset();this.hide();if(status!=null&&status!=''){ge('status_text').innerHTML=this.status_text;ge('status_time').innerHTML='Updated&nbsp;just&nbsp;a&nbsp;moment&nbsp;ago';}else{ge('status_text').innerHTML='Error Updating Status';}},submit_status_set:function(status){if(status==null||status=='')return;ajax=new Ajax();ajax.onDone=function(ajaxObj,response){this.status_set(response);}.bind(this);ajax.onFail=function(ajaxObj){this.status_set(null);}.bind(this);ajax.post('/updatestatus.php',{'status':status});return false;},status_cleared:function(){this.status_text='';ge('status_text').innerHTML='';this.hide();ge('status_blank_nag').innerHTML='Your status has been cleared.';setTimeout(function(){ge('status_blank_nag').innerHTML='Update your status...';}.bind(this),2500);},submit_status_clear:function(){this.status_blur=false;ajax=new Ajax();ajax.onDone=function(ajaxObj,response){this.status_cleared();}.bind(this);ajax.onFail=function(ajaxObj){this.status_cleared();}.bind(this);ajax.post('/updatestatus.php',{'clear':'1'});return false;},handle_key_press:function(event){event=event||window.event;key_code=event.keyCode||event.which;if(key_code==KEYS.RETURN){if(ge('edit_status_text').value!='')
this.submit_status_set(ge('edit_status_text').value);return false;}
if(key_code==KEYS.ESC){this.hide();return false;}
return true;}}
function click_trampoline(){return status_editor.hide_menu();}
var edit_status_visible=false;var edit_select_visible=false;var status_set=true;var status_cleared=true;var status_blur=false;var status_reblur=false;var status_init=false;var status_keepopen=false;var status_text='';function editStatus(){if(!edit_status_visible){if(ge('su_text').firstChild){status_text=ge('su_text').firstChild.nodeValue;}
ge('edit_status_text').value=status_text;hideEditStatusSelect();show('status_editor');ge('edit_status_text').focus();ge('edit_status_text').select();status_blur=true;edit_status_visible=true;}else{ge('edit_status_text').focus();}}
function hideEditStatus(){edit_status_visible=false;status_blur=false;status_init=false;status_keepopen=false;hideEditStatusSelect();hide('status_editor');}
function editStatusBlur(){if(status_reblur){ge('edit_status_text').focus();status_reblur=false;return false;}
if(status_blur){if(ge('edit_status_text').value&&(ge('edit_status_text').value!=status_text)){submitStatus(ge('edit_status_text').value);}else{if(status_keepopen){status_init=true;hideEditStatusSelect();}else{hideEditStatus();}}}
return true;}
function toggleEditStatusSelect(){if(status_init){if(ua.safari()){status_reblur=true;}
status_init=false;ge('edit_status_text').focus()}else if(ua.safari()||ua.ie()){status_reblur=true;}
edit_select_visible=!edit_select_visible;if(edit_select_visible){showEditStatusSelect();}else{hideEditStatusSelect();}}
function showEditStatusSelect(){edit_select_visible=true;ge('edit_status_select').style.display='block';ge('edit_status_toggle').style.backgroundImage='url(/images/status_on.gif)';ge('edit_status_toggle').style.backgroundColor='#fff';}
function hideEditStatusSelect(){edit_select_visible=false;hide('edit_status_select');ge('edit_status_toggle').style.backgroundImage='url(/images/status_off.gif)';ge('edit_status_toggle').style.backgroundColor='#D8DFEA';}
function statusSelect(element){toggleEditStatusSelect();ge('edit_status_text').value=element.innerHTML;ge('edit_status_text').focus();ge('edit_status_text').select();}
function clearStatus(){status_cleared=false;status_keepopen=false;window.setTimeout('showClearingMessage()',200);hideEditStatus();ajax=new Ajax();ajax.onDone=function(ajaxObj,response){statusCleared();};ajax.onFail=function(ajaxObj){statusCleared();};ajax.post('/updatestatus.php',{'clear':'1'});}
function showClearingMessage(){if(!status_cleared){hide('su_name');ge('su_text').innerHTML='<span style="color:gray;">Clearing status...</span>';}}
function statusCleared(){status_cleared=true;hide('su_name');ge('su_placeholder').innerHTML='Your status has been cleared.';show('su_placeholder');hide('su_edit');ge('su_text').innerHTML='';ge('su_time').innerHTML='';}
function submitStatus(status){if(status==null||status==''){return;}
status_keepopen=false;status_set=false;window.setTimeout('showUpdatingMessage()',200);hideEditStatus();ajax=new Ajax();ajax.onDone=function(ajaxObj,response){statusUpdated(response);};ajax.onFail=function(ajaxObj){statusUpdated(null);};ajax.post('/updatestatus.php',{'status':status});}
function showUpdatingMessage(){if(!status_set){hide('su_name');hide('su_placeholder');ge('su_text').innerHTML='<span style="color:gray;">Updating status...</span>';}}
function statusUpdated(status){status_set=true;if(status!=null&&status!=''){show('su_name');show('su_edit');hide('su_placeholder');ge('su_text').innerHTML=status;ge('su_time').innerHTML='a moment ago&nbsp;';ge('edit_status_text').value='';}else if(status==null){hide('su_name');ge('su_placeholder').innerHTML='Error updating status.';show('su_placeholder');hide('su_edit');ge('su_text').innerHTML='';ge('su_time').innerHTML='';}}
function statusTextKeyPress(event){if(!event){event=window.event;}
if(event.keyCode){keyPressed=event.keyCode;}else if(event.which){keyPressed=event.which;}
if(keyPressed==9){return false;}
if(keyPressed==13){submitStatus(ge('edit_status_text').value);return false;}
if(keyPressed==27){hideEditStatus();return false;}
return true;}
function home_statusupdates_show(user){show('home_statusupdates');hide('home_statusupdates_show_link');var a=new Ajax();a.post('/statusupdates.php',{'home_show':1});return false;}
function home_statusupdates_hide(user){hide('home_statusupdates');show('home_statusupdates_show_link');var a=new Ajax();a.post('/statusupdates.php',{'home_hide':1});return false;}
function preferences_statusupdates_onsubmit(person){if(person&&person.i){preferences_statusupdates_subscribe(person.i,person.t);}
this.clear();return false;}
function preferences_statusupdates_subscribe(id,name){preferences_subscribe(id,name,'statusupdates');}
function preferences_statusupdates_unsubscribe(id){preferences_unsubscribe(id,'statusupdates');}
function preferences_mobileuploads_onsubmit(person){if(person&&person.i){preferences_mobileuploads_subscribe(person.i,person.t);}
this.clear();return false;}
function preferences_mobileuploads_subscribe(id,name){preferences_subscribe(id,name,'mobileuploads');}
function preferences_mobileuploads_unsubscribe(id){preferences_unsubscribe(id,'mobileuploads');}
function preferences_unsubscribe(id,type){var a=new Ajax();a.onDone=function(ajaxObj,response){hide(type+'_subscription_'+id);}
a.onFail=function(ajaxObj){aiert('An error occured. Please try again.');}
if(type=='mobileuploads'){url='/ajax/mobileuploads.php';}else{url='/statusupdates.php';}
a.post(url,{'unsubscribe':id});}
function preferences_subscribe(id,name,type){var a=new Ajax();a.onDone=function(ajaxObj,response){var elem=ge(type+'_subscription_'+id);if(elem){show(elem);}else{var elem=document.createElement('div');elem.id=type+'_subscription_'+id;elem.className='subscription';elem.innerHTML=name+' <small><a href="#" onclick="preferences_'+type+'_unsubscribe('+id+');return false">remove</a></small>';ge(type+'_subscriptions').appendChild(elem);}}
a.onFail=function(ajaxObj){aiert('An error occured. Please try again.');}
if(type=='mobileuploads'){url='/ajax/mobileuploads.php';}else{url='/statusupdates.php';}
a.post(url,{'subscribe':id});}

var captcha=false;function ajax_wall_post(formEl,wallEl){var ajaxUrl='/ajax/wallpost_ajax.php';var ajax=new Ajax();var wallStatus=ge('wall_status');var wallError=ge('wall_error');var wallCaptcha=ge('wall_captcha');var AOK=true;hide(wallError);set_inner_html(wallStatus,'<h2>Posting...</h2>');show(wallStatus);attachments.submit_wall_post();ajax.onDone=function(ajaxObj,responseText){var responseObj=eval("("+responseText+")");if(responseObj['err']){AOK=false;var wallErrString='<h2>'+responseObj['errTitle']+'</h2>';if(responseObj['errBody']){wallErrString=wallErrString+'<p>'+responseObj['errBody']+'</p>';}
set_inner_html(wallError,wallErrString);show(wallError);hide(wallStatus);}
if(responseObj['st']){AOK=false;var wallStString='<h2>'+responseObj['stTitle']+'</h2>';if(responseObj['stBody']){wallStString=wallStString+'<p>'+responseObj['stBody']+'</p>';}
set_inner_html(wallStatus,wallStString);}
if(responseObj['captcha']){captcha=true;AOK=false;hide(wallStatus);var captchaCode=responseObj['captchaCode'];set_inner_html(wallCaptcha,captchaCode);show(wallCaptcha);formEl.wall_text.disabled=true;}
else if(responseObj['wp']){var postHack=document.createElement('div');postHack.innerHTML=responseObj['wp'];var post=postHack.firstChild;wallEl.insertBefore(post,wallEl.firstChild);eval_inner_js(post);if(formEl.wall_count.value>=Number(responseObj['nts'])){wallEl.removeChild(wallEl.lastChild);}else{formEl.wall_count.value++;}
var wall_subtitle=ge('wall_subtitle');formEl.wall_total.value++;set_inner_html(wall_subtitle,get_wall_subtitle(formEl.wall_count.value,formEl.wall_total.value,formEl.id.value));var txt=formEl.wall_text;txt.is_focused=0;txt.value=formEl.wall_text.getAttribute("placeholder");txt.style.color='#777';if(AOK){set_inner_html(wallStatus,'<h2>Post successful!</h2>');setTimeout("hide(ge('wall_status'))",2000);if(ge('attachment_buttons_list')){show('attachment_buttons_list');}}}}
ajax.onFail=function(ajaxObj){set_inner_html(wallError,'<h2>Wall is currently unavailable.</h2><p>Please try again later.</p>');show(wallError);hide(wallStatus);}
var attachment_string=attachments.get_attachment_post_string();attachments.remove_attachment_view();var params='to='+formEl.id.value+'&from='+formEl.user.value+'&wall_text='+encodeURIComponent(formEl.wall_text.value)+'&post_form_id='+formEl.post_form_id.value+attachment_string;if(captcha){params+='&captcha_challenge_code='+formEl.captcha_challenge_code.value;if(ge('recaptcha_challenge_field')){params+='&recaptcha_challenge_field='+formEl.recaptcha_challenge_field.value;}
params+='&captcha_response='+formEl.captcha_response.value;formEl.wall_text.disabled=false;hide(wallCaptcha);}
ajax.post(ajaxUrl,params);}
function formatInt(numstr,sep){var mod=numstr.length%3;var loop_pos=mod==0?3:mod;var res=new Array(numstr.substring(0,loop_pos));while(loop_pos<numstr.length){var next_pos=loop_pos+3;res.push(numstr.substring(loop_pos,next_pos));loop_pos=next_pos;}
return res.join(sep?sep:',');}
function get_wall_subtitle(wallCount,wallTotal,wallId){var wallSubtitle='';var wallLink='/wall.php?id='+wallId;if(wallCount<wallTotal){wallSubtitle='Displaying '+wallCount+' of <a href="'+wallLink+'">'+formatInt(wallTotal.toString())+' wall posts</a>.';}else if(wallCount==2){wallSubtitle='Displaying the only 2 wall posts.';}else if(wallCount>1){wallSubtitle='Displaying all '+wallCount+' wall posts.';}else if(wallCount==1){wallSubtitle='Displaying the only wall post.';}else{wallSubtitle='No wall posts.';}
return wallSubtitle;}

var Registry=[];var _registryIndex=0;var _lastKeyCode=-1;var _names;var _ids;var _images;var _networks;var TypeAhead=function(rootEl,formEl,textBoxEl,idEl,defaultOptions,instructions,useFilter,onSuccessHandler,onInputChangeHandler,onUpHandler,onDownHandler,onListElMouseDownHandler,placeholderText,showNoMatches,override_resize)
{this.resize=!override_resize;this.getMatchSingleTerm=function(term,document)
{var str="";var len=term.length;if(!document)return'';var curDocument=document;var index=0;index=curDocument.toUpperCase().indexOf(term.toUpperCase());if(index==-1)
{return str;}
var match=curDocument.substring(0,len);str+='<span class="suggest">'+match+'</span>';var moreMatches=0;curDocument=curDocument.substring(index+len);while((index=curDocument.toUpperCase().indexOf(term.toUpperCase()))!=-1)
{var pre=curDocument.substring(0,index);if(pre)
{str+=pre;}
var match=curDocument.substring(index,index+len);if(match)
{str+='<span class="suggest">'+match+'</span>';}
curDocument=curDocument.substring(index+len);moreMatches=1;}
if(moreMatches)
{str+=curDocument;}}
this.getMatchMultipleTerms=function(terms,document)
{if(!document)return'';var termsArr=terms.split(/\s+/);var docArr=document.split(/\s+/);var str="";for(var docIdx=0;docIdx<docArr.length;docIdx++)
{var matchFound=0;var doc=docArr[docIdx];for(var termIdx=0;termIdx<termsArr.length;termIdx++)
{var term=termsArr[termIdx];if(doc.toUpperCase().indexOf(term.toUpperCase())==0)
{matchFound=1;break;}}
if(docIdx>0)
{str+=' ';}
if(matchFound)
{var len=term.length;var pre=doc.substring(0,len);var suf=doc.substring(len);str+='<span class="suggest">'+pre+'</span>'+suf;}
else
{str+=doc;}}
return str;}
this.onListChange=function()
{this.selectedIndex=-1;if(!this.pEvent)
{this.idEl.value=-1;}
var dropDownEl=this.dropDownEl;if(dropDownEl&&dropDownEl.childNodes)
{this.dropDownCount=dropDownEl.childNodes.length;}
this.lastTypedValue=this.currentInputValue;if(this.currentInputValue==""||this.dropDownCount==0||this.pEvent)
{this.dropDownEl.hide();}
else
{this.dropDownEl.show();this.defaultDropDownEl.show();}
var matchFound=false;if(this.currentInputValue.length>0)
{for(var i=0;i<this.dropDownCount;i++)
{if(!matchFound)
{matchFound=true;this.selectedIndex=i;this.selectedEl=this.dropDownEl.childNodes[i];}
var str=this.getMatchSingleTerm(this.currentInputValue,this.dropDownEl.childNodes[i]._value);if(!str)
{str=this.getMatchMultipleTerms(this.currentInputValue,this.dropDownEl.childNodes[i]._value);}
this.dropDownEl.childNodes[i].setName(str);str=this.getMatchSingleTerm(this.currentInputValue,this.dropDownEl.childNodes[i]._loc);if(!str)
{str=this.getMatchMultipleTerms(this.currentInputValue,this.dropDownEl.childNodes[i]._loc);}
this.dropDownEl.childNodes[i].setLoc(str);}
if(!matchFound)
{for(var i=0;i<this.defaultDropDownCount;i++)
{if(this.defaultDropDownEl.childNodes[i]._value.toUpperCase().indexOf(this.currentInputValue.toUpperCase())==0)
{matchFound=true;this.selectedIndex=i;this.selectedEl=this.defaultDropDownEl.childNodes[i];break;}}}}
var value=this.currentInputValue;var keyIgnore=false;switch(this.lastKeyCode)
{case 8:case 33:case 34:case 35:case 35:case 36:case 37:case 39:case 45:case 46:keyIgnore=true;break;case 27:keyIgnore=true;break;default:break;}
if(!keyIgnore&&matchFound&&!this.pEvent)
{this.selectedEl.select();}
else
{}
this._noMatches=false;if(this.dropDownCount==0)
{if(this.textBoxEl.value!=""&&this.textBoxEl.value!=this.textBoxEl.ph)
{this._noMatches=true;if(this.showNoMatches)
{this.defaultTextEl.setText("No Matches Found");}}
else
{this.defaultTextEl.setDefault();}
this.defaultDropDownEl.show();if(this.showNoMatches)
{this.defaultTextEl.show();}}
else
{this.defaultTextEl.hide();}
if(this.dropDownCount>=1&&this.selectedEl&&this.getUnselectedLength()==this.selectedEl._value.length)
{this.idEl.value=this.selectedEl._id;if(this.dropDownCount==1){this.onTypeAheadSuccess();}else{this.textBoxEl.style.background="#e1e9f6";}}
else
{this.onTypeAheadFailure();}
if(this.lastKeyCode==27)
{this.textBoxEl.blur();}
this.setFrame();this.pEvent=0;}
this.setFrame=function()
{if(this.goodFrame)
{this.goodFrame.style.height=(this.containerEl.offsetHeight)+"px";this.goodFrame.style.width=(this.textBoxEl.offsetWidth)+"px";}}
this.onTypeAheadSuccess=function()
{this.dropDownEl.hide();this.textBoxEl.style.background="#e1e9f6";if(this.onSuccess&&!this.pEvent)
{this.onSuccess(this);}}
this.onTypeAheadFailure=function()
{this.textBoxEl.style.background="#FFFFFF";}
this.refocus=function()
{this.reFocused=true;this.textBoxEl.blur();setTimeout("Registry["+this.registryIndex+"].focus();",10);}
this.focus=function()
{this.textBoxEl.focus();}
this.handleKeyUp=function(event)
{if(!event&&window.event)
{event=window.event;}
if(event.keyCode==40||event.keyCode==38)
{if(this.isSafari&&(this.fireCount++%2==1))
{}}
var value=this.textBoxEl.value;var sLen=this.getSelectedLength();var uLen=this.getUnselectedLength();if(sLen>0&&uLen!=-1)
{value=value.substring(0,uLen);}
this.currentInputValue=value;var keyIgnore=false;switch(this.lastKeyCode)
{case 13:case 9:keyIgnore=true;break;case 38:keyIgnore=true;if(this.onUp)
{this.onUp(this);}
break;case 40:keyIgnore=true;if(this.onDown)
{this.onDown(this);}
break;}
this.pEvent=0;if(event.pEvent)
{this.pEvent=event.pEvent;}
if(!keyIgnore&&this.onInputChange)
{this.onInputChange(this);}
if(this.lastKeyCode==13)
{this.lastKeyCode=-1;_lastKeyCode=-1;}
this.lastInputValue=this.currentInputValue;}
this.getSelectedLength=function()
{var el=this.textBoxEl;var len=-1;if(el.createTextRange)
{var selection=document.selection.createRange().duplicate();len=selection.text.length;}
else if(el.setSelectionRange)
{len=el.selectionEnd-el.selectionStart;}
return len;}
this.getUnselectedLength=function()
{var el=this.textBoxEl;var len=0;if(el.createTextRange)
{var selection=document.selection.createRange().duplicate();selection.moveEnd("textedit",1);len=el.value.length-selection.text.length;}
else if(el.setSelectionRange)
{len=el.selectionStart;}
else
{len=-1;}
return len;}
this.handleKeyDown=function(event)
{if(!event&&window.event)
{event=window.event;}
if(event)
{this.lastKeyCode=event.keyCode;_lastKeyCode=event.keyCode;}
switch(this.lastKeyCode)
{case 38:break;case 40:break;case 27:this.textBoxEl.value="";break;case 13:case 9:if(this.selectedIndex!=-1)
{this.textBoxEl.value=this.selectedEl._value;this.defaultTextEl.hide();this.onTypeAheadSuccess();}
this.dropDownEl.hide();this.defaultDropDownEl.hide();this.setFrame();break;case 3:this.dropDownEl.hide();this.defaultDropDownEl.hide();this.setFrame();break;}
switch(this.lastKeyCode)
{case 38:this.selectPrevDropDown();if(this.onUp)
{this.onUp(this);}
break;case 40:this.selectNextDropDown();if(this.onDown)
{this.onDown(this);}
break;}
if(event&&(event.keyCode==13||event.keyCode==38||event.keyCode==40))
{event.cancelBubble=true;event.returnValue=false;}}
this.selectPrevDropDown=function()
{this.selectDropDown(this.selectedIndex-1);}
this.selectNextDropDown=function()
{this.selectDropDown(this.selectedIndex+1);}
this.selectDropDown=function(index)
{this.textBoxEl.value=this.lastTypedValue;if((this.dropDownCount+this.defaultDropDownCount)<=0)
{return;}
if(this.dropDownCount>0)
{this.dropDownEl.show();this.defaultDropDownEl.show();}
else
{this.dropDownEl.hide();}
this.setFrame();var usingDefaultDropDown=false;if(index>=this.dropDownCount&&this.defaultDropDownCount>0)
{usingDefaultDropDown=true;}
if(index>=this.dropDownCount+this.defaultDropDownCount)
{index=this.dropDownCount+this.defaultDropDownCount-1;}
if(this.selectedIndex!=-1&&index!=this.selectedIndex)
{this.selectedIndex=-1;this.selectedEl.unselect();}
if(index<0)
{this.selectedIndex=-1;return;}
this.selectedIndex=index;if(usingDefaultDropDown)
{this.selectedEl=this.defaultDropDownEl.childNodes[index-this.dropDownCount];}
else
{this.selectedEl=this.dropDownEl.childNodes[index];}
this.selectedEl.select();this.textBoxEl.value=this.selectedEl._value;}
this.displaySuggestList=function(names,ids,locs)
{if(names.length!=ids.length)
{return false;}
var dropDownEl=this.dropDownEl;while(dropDownEl.childNodes.length>0)
{dropDownEl.removeChild(dropDownEl.childNodes[0]);}
if(this.selectedEl)
{this.selectedEl.unselect();}
var match_i=0;var termsArr;var term;var matchFound;var name;var match_id;var filter=this.currentInputValue.toUpperCase();filter=filter.replace(/^\s+|\s+$/,'');for(var i=0;i<names.length&&match_i<10;i++)
{name=names[i];if(this.useFilter)
{if(!filter)
{continue;}
match_id=ids[i];if(window._ignoreList&&_ignoreList[match_id]&&_ignoreList[match_id]==1)
{continue;}
matchFound=0;if(name.toUpperCase().indexOf(filter)==0)
{matchFound=1;}
if(!matchFound)
{termsArr=name.split(/\s+/);for(var termIdx=0;termIdx<termsArr.length;termIdx++)
{term=termsArr[termIdx];if(term.toUpperCase().indexOf(filter)==0)
{matchFound=1;break;}}}
if(!matchFound)
{continue;}
match_i++;}
var listEl=this.createListElement(name,ids[i],locs[i],i);dropDownEl.appendChild(listEl);}
for(var i=0;i<this.defaultDropDownEl.childNodes.length;i++)
{var listEl=this.defaultDropDownEl.childNodes[i];listEl._index=i+this.dropDownEl.childNodes.length;}
return true;}
this.createListElement=function(name,id,loc,index)
{var listEl=document.createElement("div");listEl._value=name;listEl._loc=loc;listEl._id=id;listEl._index=index;listEl.setName=function(name)
{this.nameEl.innerHTML=name;}
listEl.setLoc=function(loc)
{if(this.locEl)
this.locEl.innerHTML=loc;}
listEl.select=function()
{this.className="list_element_container_selected";this.nameEl.className="list_element_name_selected";if(this.locEl)
{this.locEl.className="list_element_loc_selected";}
if(oThis.idEl)
{oThis.idEl.value=this._id;}}
listEl.unselect=function()
{this.className="list_element_container";this.nameEl.className="list_element_name";if(this.locEl)
{this.locEl.className="list_element_loc";}
if(oThis.idEl)
{}
oThis.selectedIndex=-1;}
listEl.onmousedown=function()
{oThis.textBoxEl.value=this._value;if(oThis.idEl)
{oThis.idEl.value=this._id;}
oThis.onTypeAheadSuccess();if(oThis.formEl)
{}
if(oThis.onListElMouseDown)
{oThis.onListElMouseDown(oThis,this);}
oThis.setFrame();}
listEl.onmouseover=function()
{if(oThis.selectedEl)
{oThis.selectedEl.unselect();}
oThis.selectedEl=this;oThis.selectedIndex=this._index;this.select();}
listEl.onmouseout=function()
{this.unselect();}
listEl.style.zIndex="101";var dividerEl;if(index==-1)
{dividerEl=this.createDivider();listEl.appendChild(dividerEl);}
var nameEl=document.createElement("div");nameEl.className="list_element_name";nameEl.innerHTML=name;listEl.appendChild(nameEl);listEl.nameEl=nameEl;listEl.locEl=locEl;if(loc)
{var locEl=document.createElement("div");locEl.className="list_element_loc";locEl.innerHTML=loc;listEl.appendChild(locEl);listEl.locEl=locEl;}
dividerEl=this.createDivider();listEl.appendChild(dividerEl);listEl.unselect();return listEl;}
this.createDivider=function()
{var dividerEl=document.createElement("div");dividerEl.className="list_element_divider";return dividerEl;}
this.createDropDownContainer=function()
{var containerEl=document.createElement("div");containerEl.className="dropdown-container";this.containerEl=containerEl;this.positionDropDown();}
this.createDropDown=function()
{var dropDownEl=document.createElement("div");dropDownEl.className="dropdown";dropDownEl.style.display="none";dropDownEl.style.zIndex="101";dropDownEl.hide=function()
{this.style.display="none";}
dropDownEl.show=function()
{this.style.display="";oThis.positionDropDown();}
this.containerEl.appendChild(dropDownEl);this.dropDownEl=dropDownEl;}
this.createDefaultDropDown=function()
{var defaultDropDownHeaderEl=document.createElement("div");defaultDropDownHeaderEl.className="typeahead_header";defaultDropDownHeaderEl.style.display="none";defaultDropDownHeaderEl.innerHTML="Search elsewhere...";this.containerEl.appendChild(defaultDropDownHeaderEl);this.defaultDropDownHeaderEl=defaultDropDownHeaderEl;var defaultDropDownEl=document.createElement("div");defaultDropDownEl.style.display="none";defaultDropDownEl.show=function()
{if(oThis.defaultDropDownCount>0)
{this.style.display="";oThis.defaultDropDownHeaderEl.style.display="";}
else
{oThis.dropDownEl.style.borderBottom="1px solid #777";}}
defaultDropDownEl.hide=function()
{this.style.display="none";oThis.defaultDropDownHeaderEl.style.display="none";}
var index=0;for(var option in this.defaultOptions)
{var listEl=this.createListElement(option,this.defaultOptions[option],"",index);index++;defaultDropDownEl.appendChild(listEl);}
defaultDropDownEl.className="default-dropdown";defaultDropDownEl.hide();this.containerEl.appendChild(defaultDropDownEl);this.defaultDropDownEl=defaultDropDownEl;this.defaultDropDownCount=defaultDropDownEl.childNodes.length;}
this.createDefaultText=function()
{var defaultTextEl=document.createElement("div");defaultTextEl.className="default-text";defaultTextEl.style.display="none";defaultTextEl.hide=function()
{this.style.display="none";}
defaultTextEl.show=function()
{this.style.display="";if(oThis.defaultDropDownCount==0)
{this.style.borderBottom="1px solid #777";}}
defaultTextEl.setDefault=function()
{this.innerHTML=instructions;}
defaultTextEl.setText=function(text)
{this.innerHTML=text;}
defaultTextEl.setDefault();if(!this.defaultOptions)
{defaultTextEl.style.borderBottom="0px solid";}
this.containerEl.appendChild(defaultTextEl);this.defaultTextEl=defaultTextEl;}
this.positionDropDown=function()
{var containerEl=this.containerEl;if(containerEl)
{if(this.customOffsetElement){containerEl.style.left=elementX(this.textBoxEl)-elementX(this.customOffsetElement)+"px";containerEl.style.top=elementY(this.textBoxEl)-elementY(this.customOffsetElement)+this.textBoxEl.offsetHeight+"px";}
else if(this.resize){containerEl.style.left=elementX(this.textBoxEl)+"px";containerEl.style.top=elementY(this.textBoxEl)+this.textBoxEl.offsetHeight+"px";}
if(!this.isIE)
{containerEl.style.width=this.textBoxEl.offsetWidth+"px";}
else
{containerEl.style.width=this.textBoxEl.offsetWidth+"px";}}}
this.getText=function()
{return this.textBoxEl.value;}
this.getSelectedText=function()
{return this.selectedEl?this.selectedEl._value:'';}
this.noMatches=function()
{return this._noMatches;}
this.getID=function()
{return this.selectedEl?this.selectedEl._id:0;}
this.setText=function(q,reset)
{this.textBoxEl.setText(q,reset);}
this.init=function()
{this._noMatches=false;this.registryIndex=_registryIndex;Registry[_registryIndex++]=this;this.lastKeyCode=-1;this.currentInputValue=textBoxEl.value;this.lastTypedValue="";this.lastInputValue="";this.dropDownCount=0;this.defaultDropDownCount=0;this.customOffsetElement=null;this.selectedIndex=-1;this.selectedEl=null;this.reFocused=false;textBoxEl.setAttribute("placeholder",placeholderText);textBoxEl.style.color='#777';textBoxEl.ph=placeholderText;textBoxEl.oThis=this;textBoxEl.onblur=function()
{if(!oThis.reFocused)
{oThis.dropDownEl.hide();oThis.defaultTextEl.hide();oThis.defaultDropDownEl.hide();}
if(oThis.selectedIndex==-1)
{oThis.idEl.value=-1;}
oThis.reFocused=false;var ph=this.getAttribute("placeholder");if(this.isFocused&&ph&&(this.value==""||this.value==ph))
{this.isFocused=0;this.value=ph;this.style.color='#777';}
oThis.setFrame();}
textBoxEl.onfocus=function()
{var oThis=this.oThis;if(!this.isFocused)
{this.isFocused=1;if(oThis.selectedIndex==-1&&this.value==this.getAttribute("placeholder"))
{this.value='';}}
if(oThis.dropDownCount>0||oThis.defaultTextEl.innerHTML!='')
{if(oThis.dropDownCount==0){oThis.defaultTextEl.show();}
if(this.createTextRange)
{var t=this.createTextRange();t.moveStart("character",0);t.select();}
else if(this.setSelectionRange)
{this.setSelectionRange(0,this.value.length);}
oThis.dropDownEl.show();oThis.defaultDropDownEl.show();oThis.positionDropDown();oThis.setFrame();}
this.style.color='#000';}
textBoxEl.onkeyup=function(event)
{oThis.handleKeyUp(event);}
textBoxEl.setText=function(q,reset)
{var ph=this.getAttribute("placeholder");this.isFocused=0;if(q)
{this.style.color='#000';this.value=q;var ev=new Object();ev.keyCode=0;ev.pEvent=1;oThis.handleKeyUp(ev);}
else if(ph&&ph!="")
{if(reset)
{this.value="";this.style.color='#000';}
else
{this.value=ph;this.style.color='#777';}
this.isFocused=0;oThis.textBoxEl.style.background="#FFFFFF";}
else
{this.value="";oThis.textBoxEl.style.background="#FFFFFF";}}
if(formEl)
{formEl.onsubmit=function()
{oThis.setFrame();if(_lastKeyCode==13)
{_lastKeyCode=-1;return false;}
if(oThis.selectedIndex!=-1&&oThis.selectedEl)
{oThis.idEl.value=oThis.selectedEl._id;}
return true;}}
this.formEl=formEl;this.textBoxEl=textBoxEl;this.idEl=idEl;this.onInputChange=onInputChangeHandler;this.onSuccess=onSuccessHandler;this.defaultOptions=defaultOptions;this.useFilter=useFilter;this.onUp=onUpHandler;this.onDown=onDownHandler;this.onListElMouseDown=onListElMouseDownHandler;this.showNoMatches=showNoMatches;this.fireCount=0;this.isIE=0;this.isSafari=0;if(navigator)
{this.browser=navigator.userAgent.toLowerCase();if(this.browser.indexOf("safari")!=-1)
{this.isSafari=1;}
if(this.browser.indexOf("msie")!=-1)
{this.isIE=1;}}
var blank_spot=rootEl;this.createDropDownContainer();this.createDropDown();this.createDefaultText();this.createDefaultDropDown();this.positionDropDown();var savior=document.createElement("div");savior.id="savior";this.containerEl.id="dropdown";this.goodFrame=null;if(rootEl)
{if(blank_spot&&this.isIE)
{rootEl.appendChild(savior);}
rootEl.appendChild(this.containerEl);}
if(blank_spot==rootEl&&this.isIE)
{var goodFrame=document.createElement('iframe');goodFrame.id="goodFrame";goodFrame.src="/js/blank.html";goodFrame.style.width="0px";goodFrame.style.height="0px";goodFrame.style.zIndex="98";blank_spot.insertBefore(goodFrame,blank_spot.firstChild);blank_spot.style.zIndex="99";this.goodFrame=goodFrame;}}
this.setCustomOffsetElement=function(el){this.customOffsetElement=el;}
var oThis=this;this.init();if(!window.onresize)
{window.onresize=function(event)
{for(var idx in Registry)
{Registry[idx].positionDropDown();}}}
textBoxEl.onkeydown=function(event)
{oThis.handleKeyDown(event);}}
function debug(str)
{document.getElementById("debug").innerHTML+=str+"<BR>";}

var Suggest=function(rootEl,q,formEl,textBoxEl,idEl,uri,param,successHandler,instructions,networkType,placeholderText,defaultOptions,showNoMatches,override_resize)
{this.onInputChange=function()
{var currentInputValue=oThis.typeAheadObj.currentInputValue;var cache=oThis.getCache(currentInputValue);if(cache)
{oThis.onSuggestRequestDone(currentInputValue,cache[0],cache[1],cache[2]);}
else
{var typeStr="";if(oThis.networkType)
{typeStr="&t="+oThis.networkType;}
var q=escapeURI(currentInputValue);var ajax=new Ajax(oThis.onAjaxDone,oThis.onAjaxFail);ajax.key=currentInputValue;ajax.pEvent=oThis.typeAheadObj.pEvent;ajax.get(oThis.suggestURI,oThis.suggestParam+"="+q+typeStr);}}
this.onAjaxFail=function()
{}
this.onAjaxDone=function(ajaxObj,responseText)
{var suggestNames=[];var suggestIDs=[];var suggestLocs=[];eval(responseText);oThis.onSuggestRequestDone(ajaxObj.key,suggestNames,suggestIDs,suggestLocs,ajaxObj.pEvent);}
this.onSuggestRequestDone=function(key,names,ids,locs,pEvent)
{this.setCache(key,names,ids,locs);if(this.typeAheadObj.displaySuggestList(names,ids,locs))
{this.typeAheadObj.pEvent=pEvent;this.typeAheadObj.onListChange();}}
this.getCache=function(key)
{return this.suggestCache[key.toUpperCase()];}
this.setCache=function(key,names,ids,locs)
{this.suggestCache[key.toUpperCase()]=new Array(names,ids,locs);}
this.init=function()
{this.suggestURI=uri;this.suggestParam=param;this.suggestCache=[];this.networkType=networkType;if(!instructions)
{instructions="Type to select a network";}
if(!defaultOptions)
{}
else
{}
textBoxEl.value=q;this.typeAheadObj=new TypeAhead(rootEl,formEl,textBoxEl,idEl,defaultOptions,instructions,0,successHandler,this.onInputChange,null,null,null,placeholderText,showNoMatches,override_resize);}
var oThis=this;this.init();}
function debug(str)
{document.getElementById("debug").innerHTML+=str+"<BR>";}

function tz_calculate(timestamp){var d=new Date();var raw_offset=d.getTimezoneOffset()/30;var time_sec=d.getTime()/1000;var time_diff=Math.round((timestamp-time_sec)/1800);var rounded_offset=Math.round(raw_offset+time_diff)%48;if(rounded_offset==0){return 0;}else if(rounded_offset>24){rounded_offset-=Math.ceil(rounded_offset/48)*48;}else if(rounded_offset<-28){rounded_offset+=Math.ceil(rounded_offset/-48)*48;}
return rounded_offset*30;}
function ajax_tz_set(tzForm){var timestamp=tzForm.time.value;var gmt_off=-tz_calculate(timestamp);var cur_gmt_off=tzForm.tz_gmt_off.value;if(gmt_off!=cur_gmt_off){var ajaxUrl='ajax/autoset_timezone_ajax.php';var ajax=new Ajax();params='user='+tzForm.user.value
+'&post_form_id='+tzForm.post_form_id.value
+'&gmt_off='+gmt_off;ajax.post(ajaxUrl,params);}}
function tz_autoset(){var tz_form=ge('tz_autoset_form');if(tz_form)
ajax_tz_set(tz_form);}

var geo_ajax_getter_uri='/ajax/geo_selector_ajax.php';var geo_countries_populated=false;var geo_country_name='';function select_geo_by_city_aa()
{show('city_selector_table');hide('country_selector_table');clear_values();hide('geo_selector_table');}
function select_geo_by_country_aa(){if(!geo_countries_populated){get_country_geos();}
show('country_selector_table');hide('city_selector_table');clear_values();hide('geo_selector_table');}
function on_city_selected_aa(){get_geos_by_city(ge('n').value);show('geo_selector_table');}
function select_geo_by_city(){showTableRow(getParentRow(ge('city_selector')));hide(getParentRow(ge('country')));if(ge('city_i8n')){hide(getParentRow(ge('city_i8n')));}
clear_values();if(ge('geo_selector')){hide(getParentRow(ge('geo_selector')));}}
function select_geo_by_country(){init_geo_by_country();showTableRow(getParentRow(ge('country')));if(ge('city_i8n')){showTableRow(getParentRow(ge('city_i8n')));}
hide(getParentRow(ge('city_selector')));clear_values();if(ge('geo_selector')){hide(getParentRow(ge('geo_selector')));}}
function init_geo_by_country(){if(!geo_countries_populated){get_country_geos();}}
function set_geo_by_country(index){init_geo_by_country();country_select=ge('country');for(i=0;i<country_select.length;i++){if(country_select.options[i].value==index){country_select.options[i].selected=true;break;}}}
function set_geo_by_country_name(name){country_select=ge('country');for(i=0;i<country_select.length;i++){if(country_select.options[i].innerHTML==name){country_select.options[i].selected=true;break;}}}
function clear_values(){ge('zipcode_id').value='';if(ge('city_i8n')){ge('city_i8n').value='';}
ge('n').value='';ge('country').value='';ge('sq').value='';}
function on_city_selected(){get_geos_by_city(ge('n').value);if(ge('geo_selector')){showTableRow(getParentRow(ge('geo_selector')));}}
function get_geos(param_name,param_value,success_fn){var ajax=new Ajax();var params=param_name+"="+param_value;ajax.onDone=success_fn;ajax.onFail=get_geos_failure;ajax.get(geo_ajax_getter_uri+"?"+params);}
function get_geos_by_city(city_id){get_geos('network_key',city_id,populate_div_with_geos);}
function get_country_geos(){get_geos('country_geos',true,populate_select_with_geos);}
function populate_div_with_geos(ajaxObj,responseText){eval(responseText);ge('zipcode_id').value=zipcode_id;if(ge('geo_selector')){var str='<table class="geo_options" border="0" cellpadding="0" cellspacing="0">';var checked='checked';var num_suggestions=0;for(var i in geo_array){str+='<tr><td><input type="radio" name="geo" value="'+i+'" '+checked+' id="'+i+'"></td><td> <label for="'+i+'">'+geo_array[i]+'</label></td></tr>';checked='';num_suggestions++;}
str+='</table>';if(num_suggestions==0){str='<div style="margin: 4px;">There are no suggestions, this may be because you are logged out.</div>';}
ge('geo_selector').innerHTML=str;}}
function populate_select_with_geos(ajaxObj,responseText){eval(responseText);country_select=ge('country');var select_i=1;for(var i=0,il=geo_array.length;i<il;i++){country_select.options[select_i]=new Option(geo_array[i]['name'],geo_array[i]['id']);if(typeof(geo_event)!="undefined"&&geo_event==true){if(country_select.options[select_i].value==geo_country){country_select.options[select_i].selected=true;}}
select_i++;}
if(select_i==1){country_select.options[select_i]=new Option('Please log in for country options.',0);}
geo_countries_populated=true;if(geo_country_name!=''){set_geo_by_country_name(geo_country_name);}}
function get_geos_failure(ajaxObj){}

function ft(metadata)
{ajax=new Ajax();ajax.get('ajax/f.php',{'meta':metadata},true);return true;}
function hide_poke(poke){var ajax=new Ajax();ajax.post('ajax/poke.php','p='+poke);return false;}
function hide_poke_obj(obj,rem_class,parent_class){if(obj&&parent_class){pobj=obj;while(pobj.className!=parent_class&&pobj.parentNode){pobj=pobj.parentNode;}}
if(obj&&rem_class){while(obj.className!=rem_class&&obj.parentNode){obj=obj.parentNode;}
if(obj){if(obj.parentNode.getElementsByTagName('div').length==2){remove_node(pobj);}
else{remove_node(obj);}}}
return false;}
function clearFriendFinder(){var ajax=new Ajax();ajax.post('ajax/hide_prefs_ajax.php','e=home_friend_finder&h=1');hide('findfriends');return false;}
function showNewStuff(){var ajax=new Ajax();ajax.post('ajax/hide_prefs_ajax.php','e=home_monetization&h=0');hide('new_stuff_non_content');show('new_stuff_content');return false;}
function hideNewStuff(){var ajax=new Ajax();ajax.post('ajax/hide_prefs_ajax.php','e=home_monetization&h=1');hide('new_stuff_content');show('new_stuff_non_content');return false;}
function clearIntroMessage(val){if(el=ge('overlay')){el.style.display="none";}
ge('announcement').style.display="none";ajaxIntroMessage(val);}
function ajaxIntroMessage(val){var ajax=new Ajax();ajax.onDone=function(){}
ajax.onFail=function(){}
ajax.post('ajax/hide_intro_ajax.php','intro='+val);}

function poll_make_ajax_request(poll_id,answer_id){var questions_name="questions_"+poll_id;hide(ge(questions_name));var status_name="status_"+poll_id;var status_obj=ge(status_name);show(status_obj);status_obj.innerHTML='<div class="waiting"><div class="spin"><p>Recording Vote...</p></div></div>';var ajaxObj=new Ajax(poll_ajax_vote_success_handler.bind(status_obj),poll_ajax_vote_failure_handler.bind(status_obj));var msg="poll_id="+poll_id+"&vote="+answer_id;ajaxObj.post("ajax/polls/poll_vote.php?",msg);}
function poll_ajax_vote_success_handler(ajaxObj,response_text){if(response_text=='Error'){this.innerHTML=poll_ajax_error_message();draw_poll_vote_error();}else{var poll_data=eval("("+response_text+")");var poll_id=poll_data.poll_id;var see_more_name="Poll_"+poll_id+"_see_more_div";if(ge(see_more_name)){show(ge(see_more_name));}
draw_poll_chart_js(poll_data,1);}}
function poll_ajax_error_message(){return'<div class="waiting"><p>Oops, there was an error getting results.  Reload the page to try again.</p></div>';}
function poll_ajax_vote_failure_handler(response_text){this.innerHTML=poll_ajax_error_message();}
function get_checked_value(radio){var len=radio.length;for(var i=0;i<len;i++){if(radio[i].checked){return radio[i].value;}}
return null;}
function submit_poll_form(poll_id,vote_id){if(poll_id&&vote_id){return poll_make_ajax_request(poll_id,vote_id);}
return false;}
function draw_poll_chart_js(poll_data,animate){var poll_id=poll_data.poll_id;var status_name="status_"+poll_id;hide(ge(status_name));var answers_name="answers_"+poll_id;var answers_name_elt=ge(answers_name);show(answers_name_elt);var max_width=180;var max_pct=poll_data.max_pct;var width_per_pct;if(max_pct>0){width_per_pct=max_width/max_pct;}else{width_per_pct=0;}
var user_vote=poll_data.user_vote;var bars=new Array();start_offset=0;for(var key in poll_data.answers){var pct_votes=poll_data.answers[key].pct_votes;var width=Math.round(pct_votes*width_per_pct);var modifier=1.8;var bar_name="a"+key;var bar_obj=ge(bar_name);if(user_vote==key){bar_obj.className="scaled myvote";}else{bar_obj.className="scaled";}
if(pct_votes>0){poll_slide_anim(ge(bar_name),width,modifier,start_offset);start_offset+=100;}
var pct_name="p"+key;ge(pct_name).innerHTML=poll_data.answers[key].pct_votes+"%";}}
function poll_slide_anim(elem,barwidth,modifier,start_offset){elem.style.width='0px';show(elem);barwidth=1*barwidth;for(var i=1;i<=100;i+=1){mod=modifier/_poll_slide_anim_velocity(i);(function(){var pos=i;setTimeout(function(){elem.style.width=((pos/100)*barwidth)+"px";},pos*mod+start_offset);})();}
start_offset=start_offset+100*mod;for(var i=1;i<=100;i+=1){mod=modifier;(function(){var pos=i;setTimeout(function(){elem.style.width=(barwidth+_poll_bounce_factor(pos)*0.1*barwidth)+"px";},pos*mod+start_offset);})();}}
function _poll_slide_anim_velocity(i){return 1;}
function _poll_bounce_factor(i){return Math.sin(Math.PI*2*i/100);}
function poll_update_results_chart(poll_id,chart_id){var ajaxObj=new Ajax(poll_update_results_success_handler,poll_update_results_failure_handler);var msg="poll_id="+poll_id+"&animate="+"0";ajaxObj.post("ajax/polls/poll_results.php?",msg);}
function poll_update_results_success_handler(ajaxObj,response_text){var chart_obj=getChartFromId("overalldiv");var poll_data=eval("("+response_text+")");if(poll_data.completed){window.location.reload();}
if(window.total_votes<poll_data.total_votes){window.total_votes=poll_data.total_votes;ge("cost").innerHTML=poll_data.cost;ge("responses").innerHTML=poll_data.total_votes;poll_render_recent_responses(poll_data.recent_responses);chart_obj.setDataXML(poll_data.results_xml);}}
function poll_render_recent_responses(recent_responses){var len=recent_responses.length;if(len>0){hide(ge("streamrows_noresponses"));}
for(var i=0;i<len;i++){var vote_name=recent_responses[i].vote_name;var vote_time_str=recent_responses[i].time_absolute_str;ge("answernameblock_"+i).innerHTML=vote_name;ge("timeblock_"+i).innerHTML=vote_time_str;show(ge("streamrow_"+i));}
return;}
function poll_update_results_failure_handler(){}

function leavePool(poolId,redirect,warn){var dialog=new pop_dialog();ge('leave_pool_name').innerHTML=ge('pool_'+poolId+'_name').innerHTML;ge('leave_pool_img').innerHTML=ge('pool_'+poolId+'_img').innerHTML;ge('plid_leave').value=poolId;if(redirect!=null){var redirectEl=ge('redirect_leave');redirectEl.value=1;}
if(redirect==1){redirectStr='&redirect';}else{redirectStr='';}
if(warn!=null){ge('leave_pool_warning').innerHTML='&nbsp;Since you\'re the last member, this pool will be deleted.';}else{ge('leave_pool_warning').innerHTML='';}
var hiddenHTML=ge('leave_pool_dialog');dialog.show_choice('Leave Pool?',hiddenHTML.innerHTML,'Leave Pool','do_post("/pools.php?leave&plid='+poolId+redirectStr+'")','Cancel',function(){generic_dialog.get_dialog(this).fade_out(100)});}
function leavePoolWarning(poolId,warn){var dialog=new pop_dialog();ge('leave_pool_name').innerHTML=ge('pool_'+poolId+'_name').innerHTML;ge('leave_pool_img').innerHTML=ge('pool_'+poolId+'_img').innerHTML;ge('plid_leave').value=poolId;warning='&nbsp;&nbsp;WARNING: You will not be allowed to rejoin the pool since scoring has started.&nbsp;';if(warn!=null){ge('leave_pool_warning').innerHTML=warning+'&nbsp;Since you\'re the last member, this pool will be deleted.';}else{ge('leave_pool_warning').innerHTML=warning;}
var hiddenHTML=ge('leave_pool_dialog');dialog.show_choice('Leave Pool?',hiddenHTML.innerHTML,'Leave Pool','do_post("/pools.php?leave&plid='+poolId+'")','Cancel',function(){generic_dialog.get_dialog(this).fade_out(100)});}
function joinPool(poolId,redirect){var dialog=new pop_dialog();var hiddenHTML=ge('join_pool_dialog');ge('join_pool_name').innerHTML=ge('pool_'+poolId+'_name').innerHTML;ge('join_pool_img').innerHTML=ge('pool_'+poolId+'_img').innerHTML;ge('plid_join').value=poolId;if(redirect!=null){var redirectEl=ge('redirect_join');redirectEl.value=1;}
if(redirect==1){redirectStr='&redirect';}else{redirectStr='';}
dialog.show_choice('Join Pool?',hiddenHTML.innerHTML,'Join Pool','do_post("/pools.php?join&plid='+poolId+redirectStr+'")','Cancel',function(){generic_dialog.get_dialog(this).fade_out(100)});}
function joinPoolAjax(poolId){var dialog=new pop_dialog();dialog.show_dialog('<div class="dialog_loading">Loading...</div>');var ajax=new Ajax();ajax.onDone=function(ajaxObj,responseText){dialog.show_choice('Join Pool?',responseText,'Join Pool','do_post("/pools.php?join&plid='+poolId+'&redirect")','Cancel',function(){generic_dialog.get_dialog(this).fade_out(100)});}
ajax.onFail=function(ajaxObj){}
ajax.post('/ajax/join_pool_ajax.php','plid='+poolId);}

var rooster_uri='/ajax/rooster_ajax.php';function urlencode(str){return encodeURIComponent(str);}
function ajaxEncodeForm(form)
{var codedString='';var ampersand='';var formLength=form.elements.length;for(index=0;index<formLength;index++){var element=form.elements[index];var placeholderValue=element.getAttribute('placeholder');if(placeholderValue!==null&&placeholderValue==element.value)
continue;if(!element.name||element.name==''||element.name=='undefined'||!element.value||element.value==''){continue;}
switch(element.type){case'text':case'hidden':case'password':case'textarea':case'select-one':codedString+=ampersand+element.name+'='+urlencode(element.value);break;case'radio':case'checkbox':if(element.checked)
codedString+=ampersand+element.name+'='+urlencode(element.value);break;}
ampersand='&';}
return codedString;}
function hideRooster(divid,constructForm){ge(divid).style.display='none';if(constructForm!=null){var formIdStr='temp_rooster_form';var form=document.createElement('form');form.action='/ajax/rooster_ajax.php';form.method='post';form.style.display='none';form.id=formIdStr;var input=document.createElement('input');input.type='hidden';input.name='post_form_id';input.value=ge('post_form_id').value;form.appendChild(input);var input=document.createElement('input');input.type='hidden';input.name='storytype';input.value=ge('storytype').value;form.appendChild(input);var input=document.createElement('input');input.type='hidden';input.name='storyid';input.value=ge('storyid').value;form.appendChild(input);document.body.appendChild(form);ajaxSubmitForm(formIdStr,'');}else{ajaxSubmitForm(divid,'');}
return false;}
function submitTOS(divid){form=document.forms[divid];if(form){ackElement=form.elements['ack'];if(ackElement){if(ackElement.checked){ge(divid).style.display='none';ajaxSubmitForm(divid,'');}}}
return false;}
function submitSecurity(divid){form=document.forms[divid];if(form){ansElement=form.elements['seca'];if(ansElement&&ansElement.value!=''){ge(divid).style.display='none';ajaxSubmitForm(divid,'');}}
return false;}
function submitBday(divid){form=document.forms[divid];if(form){month=form.elements['birthday_month'];day=form.elements['birthday_day'];year=form.elements['birthday_year'];if((month&&month.value>0)&&(day&&day.value>0)&&(year&&year.value>0)){ge(divid).style.display='none';ajaxSubmitForm(divid,'');}}
return false;}
function submitEmail(divid,emailid){form=document.forms[divid];if(form){email=form.elements[emailid];if(email&&email.value!=''&&is_email(email.value)){ge(divid).style.display='none';ajaxSubmitForm(divid,'');}}
return false;}
function showEmailEntry(divid){form=document.forms[divid];if(form){if(form.style.display=='none'){form.style.display='block';form.elements['newemail'].focus();}else{form.elements['newemail'].value='';form.style.display='none';}}
return false;}
function resendEmail(divid,type,id){if(divid!=''&&type!=''){form=document.forms[divid];if(form){if(form.elements['newemail']){form.elements['newemail'].value='';}
ge(divid).style.display='none';ajaxSubmitForm(divid,'&resend=1');}}
return false;}
function cancelEmail(divid,type,id){if(divid!=''&&type!=''){form=document.forms[divid];if(form){if(form.elements['newemail']){form.elements['newemail'].value='';}
ge(divid).style.display='none';ajaxSubmitForm(divid,'&cancel=1');}}
return false;}
function toggleHelp(spanid){ele=ge(spanid);ele.style.display=(ele.style.display=='none')?'block':'none';}
function ajaxSubmitForm(formid,extra)
{var codedForm=ajaxEncodeForm(document.forms[formid]);var query=(codedForm+extra);var ajax=new Ajax();ajax.onDone=function(ajaxObj,responseText){}
ajax.onFail=function(ajaxObj){}
ajax.post(rooster_uri,query,false,true);return false;}

var scrollDelay=null;var saved_message_timeout=null;var SCROLL_AMOUNT=10;var SCROLL_SPEED=50;var SCROLL_THRESHOLD=35;var SCROLL_MULTIPLIER=3;var SCROLL_DECAY=7;var MOVING_THRESHOLD=10;function track_moveable_box(header_obj,container_obj,possible_wide,possible_narrow){this.possible_wide=possible_wide;this.possible_narrow=possible_narrow;this.listContainer=container_obj;this.headerObj=header_obj;this.listContainer.onmousedown=function(e){return this._onclick(e?e:window.event);}.bind(this);}
track_moveable_box.prototype._onclick=function(e){this.clickMouseY=mouseY(e);this.clickMouseX=mouseX(e);if(!is_left_click(e))return false;document.onselectstart=function(e){return false;};document.onmousemove=function(e){return this._track_move(e?e:window.event)}.bind(this);document.onmouseup=function(e){this._track_drop(e?e:window.event)}.bind(this);return false;}
track_moveable_box.prototype._track_move=function(e){if(Math.abs(mouseY(e)-this.clickMouseY)>MOVING_THRESHOLD||Math.abs(mouseX(e)-this.clickMouseX)>MOVING_THRESHOLD){var moveable=new moveable_box(this.listContainer,this.possible_wide,this.possible_narrow);moveable._onclick(null,this.clickMouseY,this.clickMouseX);this.headerObj.onclick=null;}}
track_moveable_box.prototype._track_drop=function(e){document.onmouseout=document.onmouseup=document.onmousemove=document.onclick=null;if(!this.headerObj.onclick){boxFlexToggle(this.listContainer);}}
function moveable_box(obj,possible_wide,possible_narrow){this.obj=obj;this.obj.possible_positions=new Array();this.obj.possible_positions['wide']=possible_wide;this.obj.possible_positions['narrow']=possible_narrow;this.obj.onmousedown=function(e){return this._onclick(e?e:window.event);}.bind(this);}
moveable_box.prototype._onclick=function(e,mouseY,mouseX){if(e&&!is_left_click(e))return false;document.moving_box=this;document.isScrolling=false;this.obj.top=elementY(this.obj);this.obj.left=elementX(this.obj);this.obj.old_col_id=this.obj.parentNode.id;this.obj.handle=this.obj.childNodes[1];this.cur_col_id=this.obj.old_col_id;add_css_class_name(this.obj,'floating_box');add_css_class_name(this.obj,'explicit_width_'+this.obj.parentNode.id);this.obj.style.top=this.obj.top+'px';this.obj.style.left=this.obj.left+'px';this.mouseOffsetY=(mouseY?mouseY:mouseY(e))-this.obj.top;this.mouseOffsetX=(mouseX?mouseX:mouseX(e))-this.obj.left;this.cols=new Array();this.cols['wide']=ge('moveable_wide');this.cols['narrow']=ge('moveable_narrow');this.cols_y=new Array();this.cols_y['wide']=new Array();this.cols_y['narrow']=new Array();this.cols_y['wide']['top']=elementY(this.cols['wide']);this.cols_y['narrow']['top']=elementY(this.cols['wide']);this.cols_y['wide']['bottom']=this.cols_y['wide']['top']+this.cols['wide'].offsetHeight;this.cols_y['narrow']['bottom']=this.cols_y['narrow']['top']+this.cols['narrow'].offsetHeight;if(elementX(this.cols['narrow'])<elementX(this.cols['wide'])){this.target_left="narrow";this.container_left="moveable_narrow";this.target_right="wide";this.container_right="moveable_wide";}else{this.target_left="wide";this.container_left="moveable_wide";this.target_right="narrow";this.container_right="moveable_narrow";}
var childNodes=this.obj.childNodes;this.childNodesClassOld=new Array();for(var i=0;i<childNodes.length;i++){this.childNodesClassOld[i]=childNodes[i].className;if(childNodes[i].id!='box_handle'){childNodes[i].className+=' float_opacity';}}
this.placeholder=document.createElement('div');this.placeholder.id="placeholder";this.placeholder.className='placeholder ph_'+this.obj.parentNodeid;this.placeholder.style.height=(200<(this.obj.offsetHeight-15)?200:(this.obj.offsetHeight-15))+'px';this.obj.parentNode.insertBefore(this.placeholder,this.obj);this.obj.parentNode.parentNode.appendChild(this.obj);this.elements_y_side_col=this._get_elements_y(this.target_left,this.obj);this.elements_y_main_col=this._get_elements_y(this.target_right,this.obj);this.elements_x_threshold=elementX(this.cols[this.target_right]);document.onmousemove=function(e){return this._move(e?e:window.event,0,0)}.bind(this);document.onmouseup=function(e){this._drop()}.bind(this);return false;}
function print_elements_y(elements_y)
{var output=null;for(var i=0;i<elements_y.length;i++)
if(elements_y[i]!=null)
output=output+' '+elements_y[i]['top'];else
output=output+' null';}
moveable_box.prototype._get_elements_y=function(column_id){var col=this.cols[column_id];var elements=new Array();for(var i=0;i<col.childNodes.length;i++){if(col.childNodes[i].id=="placeholder"){this.obj.cur_index=i;}
elements[i]=new Array();elements[i]['top']=elementY(col.childNodes[i]);elements[i]['bottom']=elements[i]['top']+col.childNodes[i].offsetHeight;}
return elements;}
moveable_box.prototype._move=function(e){if(e){this.obj.mouse_left=mouseX(e);this.obj.top=mouseY(e)-this.mouseOffsetY;this.obj.left=mouseX(e)-this.mouseOffsetX;}
var windowScroll=false;if(document.isScrolling){if(getPageScrollHeight()>0||this.scrollYAmount>0){this.obj.left+=this.scrollXAmount;this.obj.top+=this.scrollYAmount;windowScroll=true;}}
this._calculate_placeholder();this.obj.style.top=this.obj.top+'px';this.obj.style.left=this.obj.left+'px';if(windowScroll){window.scrollBy(this.scrollXAmount,this.scrollYAmount);}
var scrollDown=false;var distance_from_top=this.obj.top-getPageScrollHeight();var distance_from_bottom=getPageScrollHeight()+getViewportHeight()-this.obj.top;if((scrollDown=distance_from_bottom<=SCROLL_THRESHOLD)||distance_from_top<=SCROLL_THRESHOLD){clearTimeout(scrollDelay);document.isScrolling=true;var distance_from_edge=scrollDown?distance_from_bottom:distance_from_top;distance_from_edge=distance_from_edge<0?0:distance_from_edge;var distance_fraction=(1-(distance_from_edge*1.0)/SCROLL_THRESHOLD);var scrollY=Math.round(SCROLL_AMOUNT+SCROLL_AMOUNT*SCROLL_MULTIPLIER*power(distance_fraction,SCROLL_DECAY));this.scrollXAmount=0;this.scrollYAmount=scrollDown?scrollY:-1*scrollY;scrollDelay=window.setTimeout(function(){if(document.isScrolling){document.moving_box._move(null);}},SCROLL_SPEED);}else{document.isScrolling=false;}}
function power(x,y){if(x==0){return 0;}
var power=1;for(var i=0;i<y;i++){power*=x;}
return power;}
moveable_box.prototype._calculate_placeholder=function(){if(this.obj.mouse_left<this.elements_x_threshold){if(this.placeholder.parentNode.id!=this.container_left){this._move_placeholder_to_other_column(this.target_left,this.elements_y_side_col);}else{this._move_placeholder_in_column(this.elements_y_side_col);}}else{if(this.placeholder.parentNode.id!=this.container_right){this._move_placeholder_to_other_column(this.target_right,this.elements_y_main_col);}else{this._move_placeholder_in_column(this.elements_y_main_col);}}}
moveable_box.prototype._move_placeholder_in_column=function(elements_y){var oldIndex=null;var childIndex=null;var upperBounds=null;var outOfBounds=false;var top=false;if(this.obj.cur_index<elements_y.length-1){var next_object_top=elements_y[this.obj.cur_index+1]['top'];next_object_threshold=elements_y[this.obj.cur_index+1]['bottom']-100;upperBounds=next_object_top>next_object_threshold?next_object_top:next_object_threshold;}
if(upperBounds!=null&&this.obj.top>upperBounds&&in_window_bounds(upperBounds,30)){oldIndex=this.obj.cur_index;this.obj.cur_index+=1;childIndex=this.obj.cur_index+1;}else
if(this.obj.cur_index>0&&this.obj.top<elements_y[this.obj.cur_index-1]['top']+40){oldIndex=this.obj.cur_index;this.obj.cur_index--;childIndex=this.obj.cur_index;}else
if((top=this.obj.top<(elementY(this.placeholder.parentNode)-150))){var message='The box cannot be placed any higher in this column.';display_error_message(this.obj,message,this.obj.top);}else{hide(has_child(this.obj,'floating_error'));}
if(oldIndex!=null){if(this.obj.cur_index<elements_y.length-1){this.placeholder.parentNode.insertBefore(this.placeholder,this.placeholder.parentNode.childNodes[childIndex]);}else{this.placeholder.parentNode.appendChild(this.placeholder);}
var col=this.placeholder.parentNode;elements_y[oldIndex]=new Array();elements_y[oldIndex]['top']=elementY(col.childNodes[oldIndex]);elements_y[oldIndex]['bottom']=elements_y[oldIndex]['top']+col.childNodes[oldIndex].offsetHeight;elements_y[this.obj.cur_index]=new Array();elements_y[this.obj.cur_index]['top']=elementY(this.placeholder);elements_y[this.obj.cur_index]['bottom']=elements_y[this.obj.cur_index]['top']+this.placeholder.offsetHeight;}}
moveable_box.prototype.check_column_bounds=function(column){col=column.id.replace("moveable_","");if((this.obj.top<this.cols_y[col]['top']-50)||(column.nextSibling&&this.obj.top>this.cols_y[col]['bottom']-50)||(!column.nextSibling&&!in_window_bounds(this.cols_y[col]['bottom'],20))){return true;}
return false;}
function display_saved_message(message,xPos,yPos){var saved_message=document.createElement('div');saved_message.className='saved_message';saved_message.innerHTML=message;saved_message.style.left=xPos+'px';saved_message.style.top=yPos+'px';saved_message.id='floating_saved_message';ge('content').appendChild(saved_message);}
function display_error_message(obj,message,obj_top){var error_message=false;if(!(error_message=has_child(obj,'floating_error'))){error_message=document.createElement('div');error_message.id='floating_error';obj.insertBefore(error_message,obj.firstChild);}
if(!in_window_bounds(obj_top,50)&&obj_top>=getPageScrollHeight()+getViewportHeight()-50){error_message.className='floating_error error_above';}else{error_message.className='floating_error error_below';}
error_message.innerHTML=message;show(error_message);}
function in_window_bounds(top,window_offset){if(top>getPageScrollHeight()+window_offset&&top<getPageScrollHeight()+getViewportHeight()-window_offset)
return true;return false;}
moveable_box.prototype._move_placeholder_to_other_column=function(column_id,elements_y){if(this.obj.possible_positions[column_id]!=true){display_error_message(this.obj,'This box cannot be moved into this column.',this.obj.top);return;}
hide(has_child(this.obj,'floating_error'));var col=this.cols[column_id];var index=0;for(var i=0;i<elements_y.length;i++){if(this.obj.top&&this.obj.top<=elements_y[i]['top']){if(this.obj.top+150<=elements_y[i]['top']||!in_window_bounds(elements_y[i]['top'],20)){if(i==0){display_error_message(this.obj,'This box cannot be placed any higher in this column.',this.obj.top);}
return;}
else
break;}else index++;}
if(index==0&&col.childNodes.length==0){var column_top=elementY(this.cols[column_id]);if(this.obj.top<column_top-30)
return;}
var lastChildBottom=elements_y.length>0?elements_y[elements_y.length-1]['bottom']:column_top;if(index<elements_y.length){col.insertBefore(this.placeholder,col.childNodes[index]);}else{col.appendChild(this.placeholder);}
this.elements_y_side_col=this._get_elements_y(this.target_left,this.obj);this.elements_y_main_col=this._get_elements_y(this.target_right,this.obj);this.cur_col_id='moveable_'+column_id;this.placeholder.style.width=(col.offsetWidth-4)+'px';}
function has_child(element,child_id){for(var i=0;i<element.childNodes.length;i++){if(element.childNodes[i].id==child_id){return element.childNodes[i];}}
return false;}
function get_type_from_id(col_id){return col_id.replace('moveable_','');}
moveable_box.prototype._drop=function(){document.isScrolling=false;var switched_cols=this.cur_col_id!=this.obj.old_col_id;var cur_col_type=get_type_from_id(this.cur_col_id);var placeholderYPos=elementY(this.placeholder)+40;var placeholderXPos=elementX(this.placeholder)+(this.placeholder.offsetWidth-130)/2;if(switched_cols){this.obj.style.width=this.cols[cur_col_type].offsetWidth+'px';this.obj.style.height=this.placeholder.offsetHeight+'px';var box_content=null;var header=null;for(var i=0;i<this.obj.childNodes.length;i++){if(this.obj.childNodes[i].id&&this.obj.childNodes[i].id.indexOf('box_subheader_')==0){header=this.obj.childNodes[i];}else if(this.obj.childNodes[i].id&&this.obj.childNodes[i].id.indexOf('app_content_')==0){box_content=this.obj.childNodes[i];}}
if(header)header.innerHTML="";box_content.innerHTML="Loading...";var ajax=new Ajax(function(ajax_obj,text){eval(text);this.markup=markup;if(!markup){return;}
this.obj.style.height=null;set_inner_html(this.obj,this.markup);this.obj.parentNode.replaceChild(this.obj.firstChild,this.obj);}.bind(this));var post_vars={'fbid':PROFILE_FBID,'app_id':this.obj.id,'new_col_type':cur_col_type};ajax.post('/ajax/profile_boxes.php',post_vars);}
if(error_message=has_child(this.obj,'floating_error')){error_message.parentNode.removeChild(error_message);}
var childNodes=this.obj.childNodes;for(var i=0;i<childNodes.length;i++){childNodes[i].className=this.childNodesClassOld[i];}
this.obj.handle.className='handle_invisible';remove_css_class_name(this.obj,'floating_box')
this.obj.style.top=null;this.placeholder.parentNode.replaceChild(this.obj,this.placeholder);var moveable_wide=ge('moveable_wide');var moveable_wide_list='';for(var i=0;i<moveable_wide.childNodes.length;i++){if(i!=0){moveable_wide_list+=':';}
moveable_wide_list+=moveable_wide.childNodes[i].id;}
var moveable_narrow=ge('moveable_narrow');var moveable_narrow_list='';for(var i=0;i<moveable_narrow.childNodes.length;i++){if(i!=0){moveable_narrow_list+=':';}
moveable_narrow_list+=moveable_narrow.childNodes[i].id;}
var previous_box_id=this.placeholder.previousSibling?this.placeholder.previousSibling.id:'';var ajax=new Ajax(function(obj,text){eval(text);}.bind(this));var post_vars={'fbid':PROFILE_FBID,'moveable_wide_list':moveable_wide_list,'moveable_narrow_list':moveable_narrow_list};ajax.post('/ajax/profile_boxes.php',post_vars);document.moving_box=false;this.obj.onmousedown=null;document.onmouseout=document.onmouseup=document.onmousemove=window.onscroll=null;}
function handle(obj,col_id,allow_both){if((obj.parentNode.parentNode.id=='moveable_narrow'||obj.parentNode.parentNode.id=='moveable_wide')&&!document.moving_box){this.obj=obj;var arrow_class=(allow_both?'movearrow':'updownarrow');this.obj.nextSibling.className='handle_'+col_id+' handle '+arrow_class;this.obj.onmouseout=function(e){return this._removearrow(e?e:window.event);}.bind(this);}}
handle.prototype._removearrow=function(){if(this.obj.parentNode.parentNode.id=='moveable_narrow'||this.obj.parentNode.parentNode.id=='moveable_wide')
this.obj.nextSibling.className='handle_invisible';}

function wall_video_thumb_adjust(play_img_div,thumb_img){if(parseInt(ua.ie())==6){play_img_div.style.marginTop=(-1*thumb_img.height-3)+'px';play_img_div.style.paddingTop=(thumb_img.height-19)+'px';}
play_img_div.style.display='block';}
function attachments(){}
attachments.attachment_added=false;attachments.attachment_oid=null;attachments.attachment_app_id=null;attachments.is_share=false;attachments.attached_share=false;attachments.prototype.show_attachment_edit=function(title,html,share_type,ajax_params){var is_app=(share_type==14);attachments.is_share=(share_type==100);var wrapper='<div id="attachment_edit_container">'+'<div id="attachment_edit_loading">&nbsp</div>'+'</div>';new pop_dialog('attachment_dialog').show_choice(title,wrapper,'Attach',function(){generic_dialog.get_dialog(this).hide();if(attachments.is_share){attachments.share_attach();}else{attachments.attach(is_app);}},'Cancel',function(){generic_dialog.get_dialog(this).fade_out(100);attachments.remove_attachment_view();});var container=ge('attachment_edit_container');var div=document.createElement('div');div.className='share_stage';div.id='attachment_edit';div.is_app=is_app;container.appendChild(div);set_inner_html(div,html);return div;}
attachments.prototype.show_attachment_view=function(html,is_app){var container=ge('attachment_view_container');var div=document.createElement('div');div.className='share_stage';div.id='attachment_view';div.is_app=is_app;container.appendChild(div);set_inner_html(div,html);hide('attachment_buttons_list');var wrapper=ge('attachment_view_wrapper');wrapper.style.display='block';attachments.attachment_added=true;return div;}
attachments.prototype.remove_attachment_view=function(){var container=ge('attachment_view_container');var attachment=ge('attachment_view');if(attachments.attachment_added&&attachment){attachment.removed=true;container.removeChild(attachment);hide('attachment_view_wrapper');if(ge('attachment_buttons_list')){show('attachment_buttons_list');}
var attachment_remove=ge('attachment_remove');attachment_remove.className=attachment_remove.className.replace(' edit','');}
attachments.attachment_added=false;attachments.attachment_oid=null;attachments.attachment_app_id=null;attachments.is_share=false;attachments.attached_share=false;}
attachments.prototype.get_attachment_input_string=function(attachment){if(!attachment){return'';}
var ret='';var inputs=attachment.getElementsByTagName('input');if(attachment.is_app){for(var i=0;i<inputs.length;i++){if(!(inputs[i].type=="radio"||inputs[i].type=="checkbox")||inputs[i].checked){if(ret!=''){ret+='&';}
ret+='attachment[app]['+inputs[i].name+']='+escapeURI(inputs[i].value);}}
ret+='&attachment[type]=14';}else{var has_type=false;for(var i=0;i<inputs.length;i++){if(ret!=''){ret+='&';}
if(inputs[i].name=='attachment[type]'){has_type=true;}
if(inputs[i].name=='attachment[params][url]'){if(!inputs[i].value||inputs[i].value=='http://'){return'';}}
ret+='&'+inputs[i].name+'='+escapeURI(inputs[i].value);}
if(!has_type){return'';}}
ret+='&context='+attachments.context;return ret;}
attachments.prototype.attach=function(is_app){var attachment=ge('attachment_edit');var ajax_params=attachments.get_attachment_input_string(attachment);if(!ajax_params){return;}
var loading=ge('attachment_view_loading');loading.style.display='block';var ajaxUrl='/ajax/attachments.php';var ajax=new Ajax();var view_container=attachments.show_attachment_view('',is_app);ajax.onDone=function(ajaxObj,responseText){var responseObj=eval("("+responseText+")");if(!view_container.removed){hide('attachment_view_loading');set_inner_html(view_container,responseObj['html']);attachments.attachment_oid=responseObj['oid'];attachments.attachment_app_id=responseObj['app_id'];var scroll=ge('scroll_here');if(scroll){scroll.id='scroll_dummy';}
ge('attachment_view_container').parentNode.id='scroll_here';var scroll_obj=ge('scroll_here');var scroll_page_obj=null;if(attachments.context==1){scroll_page_obj=ge('wall_post_form');}else if(attachments.context==3){scroll_page_obj=ge('compose_message');}}}
ajax.post('/ajax/attachments.php',ajax_params);}
attachments.prototype.get_attachment_post_string=function(){var ret='';if(attachments.attachment_added){if(attachments.attached_share){ret+=attachments.get_attachment_input_string(ge('attachment_view'));}else{ret+='&attachment[oid]='+attachments.attachment_oid;ret+='&attachment[app_id]='+attachments.attachment_app_id;}}
return ret;}
attachments.prototype.submit_wall_post=function(){var attachment=ge('attachment_view');if(attachment){var inputs=attachment.getElementsByTagName('input');for(var i=0;i<inputs.length;i++){inputs[i].disabled=true;}}}
attachments.prototype.show_full_attachment=function(post_id){hide('attachment_compact_'+post_id);hide('attached_item_info_'+post_id);hide('attachment_compact_td_'+post_id);show('wallattachment_'+post_id);}
attachments.prototype.hide_full_attachment=function(post_id){show('attachment_compact_'+post_id);show('attached_item_info_'+post_id);show('attachment_compact_td_'+post_id);hide('wallattachment_'+post_id);}
attachments.prototype.fix_app_inputs_on_send=function(){var attachment=ge('attachment_view');if(!attachments.attachment_added||!attachment){return;}
if(!attachments.attached_share){new_inputs=new Array();new_inputs.push(create_hidden_input('attachment[oid]',attachments.attachment_oid));new_inputs.push(create_hidden_input('attachment[app_id]',attachments.attachment_app_id));if(attachment.is_app){new_inputs.push(create_hidden_input('attachment[type]',14));new_inputs.push(create_hidden_input('attachment[app][message_sent]',true));}
for(var i=0,il=new_inputs.length;i<il;i++){attachment.appendChild(new_inputs[i]);}}}
attachments.prototype.share_attach_from_dialog=function(){generic_dialog.get_dialog(ge('attachment_edit_container')).hide();attachments.share_attach();}
attachments.prototype.share_attach=function(){var share_link=ge('share_link');var url=share_link.value;if(url&&url!='http://'){attachments.share_submit_url(url);}}
attachments.prototype.share_submit_url=function(url){attachments.show_attachment_view(attachments.share_html_block,false);var view_container=ge('attachment_view_container');var stage_area=view_container.childNodes[0].childNodes[0].childNodes[0];attachments.attach_link_url(stage_area,url,true);var attachment_remove=ge('attachment_remove');attachment_remove.className+=' edit';attachments.attached_share=true;}
attachments.prototype.attach_link_url=function(obj,url,show_loading){var attachment=composer_attachment.from_url(url);if(!attachment){return;}
attachment.container_ready(obj,show_loading);}
attachments.prototype.detect_url=function(obj){var url='';var start_position=-1;var end_position=-1;if(url=obj.value.match(/www\.\S*[\s|\)|\!]/i)){start_position=obj.value.indexOf(url[0]);end_position=start_position+url[0].length;url="http://"+url[0];}else{var match='';if(match=obj.value.match(/http:\/\/\S*[\s|\)|\!]/i)){url=match[0];start_position=obj.value.indexOf(match[0]);end_position=start_position+match[0].length;}}
if(url){url=url.replace(/[\s|\)|\!]/g,'');var last_char=url.charAt(url.length-1);if(last_char.match(/[,|.]/)){url=url.substr(0,url.length-1);}
var cursor_position=get_caret_position(obj).start;if(url!=attachments.last_url_scraped&&cursor_position&&start_position>=0&&end_position>=0&&(cursor_position<start_position||cursor_position>=end_position)){attachments.last_url_scraped=url;}else{url='';}}
return url;}
attachments.prototype.auto_scrape_url=function(obj){if(attachments.attachment_added){return false;}
var url=attachments.detect_url(obj);if(url){attachments.share_submit_url(url);}
return false;}
var attachments=new attachments();

function motion_show_delete_dialog(video_id,content,success_content,oid){new pop_dialog('video_delete_dialog').show_choice(content.title,content.html,content.verb,function(){generic_dialog.get_dialog(this).enable_buttons(false);motion_delete_video(video_id,success_content,this,oid);},'Cancel',function(){generic_dialog.get_dialog(this).enable_buttons(false);generic_dialog.get_dialog(this).fade_out(100);});}
function motion_delete_video(video_id,success_content,dialog_handle,oid){var ajax=new Ajax();ajax.onDone=function(obj,response){if(response=='1'){generic_dialog.get_dialog(dialog_handle).hide();success_dialog=new pop_dialog('video_delete_success_dialog').show_prompt(success_content.title,success_content.html);setTimeout(function(){goURI(success_content.url);},2000);}
return true;}
var params='delete_video=1&v='+video_id;if(oid){params+='&oid='+oid;}
ajax.post('/ajax/motion.php',params);}
function motion_show_profile_video_dialog(video_id,content,success_content){new pop_dialog('video_profile_video_dialog').show_choice(content.title,content.html,'Make Profile Video',function(){generic_dialog.get_dialog(this).enable_buttons(false);motion_set_profile_video(video_id,success_content,this);},'Cancel',function(){generic_dialog.get_dialog(this).enable_buttons(false);generic_dialog.get_dialog(this).fade_out(100);});}
function motion_set_profile_video(video_id,success_content,dialog_handle){var ajax=new Ajax();ajax.onDone=function(obj,response){if(response=='1'){goURI('/video/video.php?profile&v='+video_id);return true;}
return true;}
ajax.post('/ajax/motion.php','profile_video=1&v='+video_id);}
var recorder_dialog;function motion_submit_video_handler(video_id,video_category,oid){if(!video_id){goURI('/video/editvideo.php?error');}
switch(video_category){case 1:var result_text;var ajax=new Ajax();ajax.onDone=function(obj,text){attachments.attach_link_url(ge('attachment_stage_area'),text,true);}
ajax.post('/ajax/motion_fvr_dialog.php',{'action':'fvr_get_permalink','video_id':video_id});break;case 2:var ajax=new Ajax();ajax.onDone=function(obj,text){goURI('/video/editvideo.php?created&v='+video_id+'&oid='+oid);}
ajax.post('/ajax/motion.php',{'obj_attach':'1','v':video_id,'oid':oid});break;case 0:default:goURI('/video/editvideo.php?created&v='+video_id);break;}}
function video_add_video_msg_inputs(video_id){var attachment=ge('attachment_edit');if(attachment){if(ge('video_msg_id')){ge('video_msg_id').value=video_id;}else{var video_msg_id=document.createElement('input');video_msg_id.name='attachment[params][0]';video_msg_id.id='video_msg_id';video_msg_id.value=video_id;video_msg_id.type='hidden';var share_type=document.createElement('input');share_type.name='attachment[type]';share_type.id='video_msg_share_type';share_type.value=15;share_type.type='hidden';attachment.appendChild(video_msg_id);attachment.appendChild(share_type);}}}
function video_remove_video_msg_inputs(){var attachment=ge('attachment_edit');if(attachment){var video_msg_id=ge('video_msg_id');if(video_msg_id){attachment.removeChild(video_msg_id);var video_msg_share_type=ge('video_msg_share_type');if(video_msg_share_type){attachment.removeChild(video_msg_share_type);}}}}
function motion_video_delete_tag(video_id,uid,tags_el){var ajax=new Ajax();ajax.onFail=function(){}
ajax.onDone=function(obj,text){eval('var tag_data = '+text);if(typeof tag_data.tag_html!='undefined'){ge(tags_el).innerHTML=tag_data.tag_html;}}
ajax.post('/ajax/motion.php','delete_tag=1&v='+video_id+'&u='+uid);}
function video_toggle_dialog(dialog_type,value){var args={action:'toggle_dialog',dialog_type:dialog_type,dialog_value:value};var ajax=new Ajax();ajax.onDone=function(obj,response){}
ajax.post('/ajax/motion_invite.php',args);}

var RecaptchaTemplates={VertHtml:'<div id="recaptcha_scripts" style="display:none"></div>\n<input type="password" autocomplete="off" style="display:none" name="recaptcha_challenge_field" id="recaptcha_challenge_field" />\n\n <img id="recaptcha_image" width="230" height="57" alt=""><span id=\'recaptcha_play_audio\'></span> \n\t <div class="recaptcha_text">Enter <span style="color:black;"><b>both</b></span> words below, separated by a <span style="color:black"><b>space</b></span>.<br>Can\'t read this? <a id=\'recaptcha_reload_btn\' tabindex=\'-1\'>Try another.</a><div class="audiocaptcha"><a id=\'recaptcha_switch_img_btn\' tabindex=\'-1\' style="display:none">Back to text.<a><br /><a id=\'recaptcha_switch_audio_btn\' tabindex=\'-1\'>Try an audio captcha</a></div><a id=\'recaptcha_whatsthis_btn\' tabindex=\'-1\'>Captchas by ReCaptcha</a> ',VertCss:'.recaptchatable td img {\n  /* see http://developer.mozilla.org/en/docs/Images%2C_Tables%2C_and_Mysterious_Gaps */\n  display: block;\n}\n.recaptchatable .recaptcha_r1_c1 { width:318px; height:9px; }\n.recaptchatable .recaptcha_r2_c1 { width:9px; height:57px; }\n.recaptchatable .recaptcha_r2_c2 { width:9px; height:57px; } \n.recaptchatable .recaptcha_r3_c1 { width:9px; height:63px; }\n.recaptchatable .recaptcha_r3_c2 { width:300px; height:6px; }\n.recaptchatable .recaptcha_r3_c3 { width:9px; height:63px; }\n.recaptchatable .recaptcha_r4_c1 { width:171px; height:49px; }\n.recaptchatable .recaptcha_r4_c2 { width:7px; height:57px; } \n.recaptchatable .recaptcha_r4_c4 { width:97px; height:57px; }\n.recaptchatable .recaptcha_r7_c1 { width:171px; height:8px; }\n.recaptchatable .recaptcha_r8_c1 { width:25px; height:7px; }\n.recaptchatable .recaptcha_image_cell center img { height:57px;}\n.recaptchatable .recaptcha_image_cell center { height:57px;}\n.recaptchatable .recaptcha_image_cell {\n  background-color:white; height:57px;\n}\n\n/* some people break their style sheet, we need to clean up after them */\n#recaptcha_area {\n  width: 250px !important;\n}\n\n.recaptchatable, #recaptcha_area tr, #recaptcha_area td, #recaptcha_area th {\n  margin:0px !important;\n  border:0px !important;\n  padding:0px !important;\n  border-collapse: collapse !important;\n}\n\n.recaptchatable * {\n\tmargin:0px;\n\tpadding:0px;\n\tborder:0px;\n\tfont-family:helvetica,sans-serif;\n\tfont-size:8pt;\n\tcolor:black;\n\tposition:static;\n\ttop:auto;\n\tleft:auto;\n\tright:auto;\n\tbottom:auto;\n\ttext-align:left !important;\n}\n\n.recaptchatable #recaptcha_image {\n  margin:auto;\n}\n\n.recaptchatable a img {\n  border:0px;\n}\n\n.recaptchatable a, .recaptchatable a:hover {\n  -moz-outline:none;\n  border:0px !important;\n  padding:0px !important;\n  text-decoration:none;\n  color:blue;\n  background:none !important;\n  font-weight: normal;\n}\n\n.recaptcha_input_area {\n  position:relative !important;\n  width:146px !important;\n  height:45px !important;\n  margin-left:20px !important;\n  margin-right:5px !important;\n  margin-top:4px !important;\n  background:none !important;\n}\n\n.recaptchatable label.recaptcha_input_area_text {\n  margin:0px !important;  \n  padding:0px !important;\n  position:static !important;\n  top:auto !important;\n  left:auto !important;\n  right:auto !important;\n  bottom:auto !important;\n}\n\n.recaptcha_theme_red label.recaptcha_input_area_text,\n.recaptcha_theme_white label.recaptcha_input_area_text {\n  color:black !important;\n}\n\n.recaptcha_theme_blackglass label.recaptcha_input_area_text {\n  color:white !important;\n}\n\n.recaptchatable #recaptcha_response_field  {\n  width:145px !important;\n  position:absolute !important;\n  bottom:7px !important;\n\n  padding:0px !important;\n  margin:0px !important;\n  font-size:10pt;\n}\n\n.recaptcha_theme_blackglass #recaptcha_response_field,\n.recaptcha_theme_white #recaptcha_response_field {\n  border: 1px solid gray;\n}\n\n.recaptcha_theme_red #recaptcha_response_field {\n  border:1px solid #cca940;\n}\n\n.recaptcha_audio_cant_hear_link {\n  font-size:7pt;\n  color:black;\n}\n\n.recaptchatable {\n  line-height:1em;\n}\n\n.recaptcha_error_text {\n  color:red;\n}\n'};var RecaptchaStr={visual_challenge:"Get a visual challenge",audio_challenge:"Get an audio challenge",refresh_btn:"Get a new challenge",instructions_visual:"Type the two words:",instructions_audio:"Type the eight numbers:",help_btn:"Help",learn_more:"This helps fight spam and read old books.",cant_hear_this:"Can't hear the sound?"};var RecaptchaOptions;var RecaptchaDefaultOptions={tabindex:0,theme:'red',callback:null};var Recaptcha={widget:null,timer_id:-1,style_set:false,theme:null,callback:null,type:'image',helplink:'http://recaptcha.net/popuphelp/',$:function(id){if(typeof(id)=="string"){return document.getElementById(id);}
else{return id;}},create:function(public_key,element,options){if(Recaptcha.widget){Recaptcha.destroy();}
Recaptcha.widget=Recaptcha.$(element);RecaptchaOptions=options;Recaptcha.call_challenge(public_key);},destroy:function(){if(!Recaptcha.widget){return;}
if(Recaptcha.timer_id!=-1){clearInterval(Recaptcha.timer_id);}
Recaptcha.timer_id=-1;Recaptcha.widget.innerHTML="";Recaptcha.widget=null;},focus_response_field:function(){var $=Recaptcha.$;var field=$('recaptcha_response_field');if(field){field.focus();}},get_challenge:function(){if(typeof(RecaptchaState)=="undefined"){return null;}
return RecaptchaState.challenge;},get_response:function(){var $=Recaptcha.$;var field=$('recaptcha_response_field');if(!field){return null;}
return field.value;},call_challenge:function(public_key){var protocol=window.location.protocol;if(protocol=='https:'){var server="api-secure.recaptcha.net";}
else{var server="api.recaptcha.net";}
scriptURL=protocol+"//"+server+"/challenge?k="+public_key+"&ajax=1";Recaptcha.add_script(scriptURL);},add_script:function(scriptURL){var scriptTag=document.createElement("script");scriptTag.type="text/javascript";scriptTag.src=scriptURL;Recaptcha.get_script_area().appendChild(scriptTag);},get_script_area:function(){var parentElement=document.getElementsByTagName("head");if(!parentElement||parentElement.length<1){parentElement=document.body;}
else{parentElement=parentElement[0];}
return parentElement;},challenge_callback:function(){var element=Recaptcha.widget;Recaptcha.reset_timer();var comb_opt=RecaptchaDefaultOptions;RecaptchaOptions=RecaptchaOptions||{};for(var p in RecaptchaOptions){comb_opt[p]=RecaptchaOptions[p];}
RecaptchaOptions=comb_opt;if(window.addEventListener){window.addEventListener('unload',function(e){Recaptcha.destroy();},false);}
if(navigator.userAgent.indexOf("MSIE")>0&&window.attachEvent){window.attachEvent('onbeforeunload',function(){});}
if(navigator.userAgent.indexOf("KHTML")>0){var iframe=document.createElement('iframe');iframe.src="about:blank";iframe.style.height="0px";iframe.style.width="0px";iframe.style.visibility="hidden";iframe.style.border="none";var textNode=document.createTextNode("This frame prevents back/forward cache problems in Safari.");iframe.appendChild(textNode);document.body.appendChild(iframe);}
if(Recaptcha.is_gecko17_or_less()){window.setTimeout(Recaptcha.finish_widget,0);}else{Recaptcha.finish_widget();}},set_style:function(css){if(Recaptcha.style_set){return;}
Recaptcha.style_set=true;var styleTag=document.createElement("style");styleTag.type="text/css";if(styleTag.styleSheet){styleTag.styleSheet.cssText=css;}
else{var textNode=document.createTextNode(css);styleTag.appendChild(textNode);}
Recaptcha.get_script_area().appendChild(styleTag);},finish_widget:function(){var $=Recaptcha.$;var $_=RecaptchaStr;var $ST=RecaptchaState;var $OPT=RecaptchaOptions;var theme=$OPT.theme;switch(theme){case'red':case'white':case'blackglass':break;default:theme='red';break;}
if(!Recaptcha.theme){Recaptcha.theme=theme;}
var server_no_slash=$ST.server;if(server_no_slash[server_no_slash.length-1]=="/")
server_no_slash=server_no_slash.substring(0,server_no_slash.length-1);var IMGROOT=server_no_slash+"/img/"+Recaptcha.theme
var css=RecaptchaTemplates.VertCss;css=css.replace(/IMGROOT/g,IMGROOT);var html=RecaptchaTemplates.VertHtml;Recaptcha.set_style(css);Recaptcha.widget.innerHTML="<div id='recaptcha_area'>"+html+"</div>";$('recaptcha_image').src=$ST.server+'image?c='+$ST.challenge;$('recaptcha_challenge_field').value=$ST.challenge;$('recaptcha_reload_btn').href="javascript:Recaptcha.reload ('r');";$('recaptcha_reload_btn').title=$_.refresh_btn;$('recaptcha_reload_btn').alt=$_.refresh_btn;$('recaptcha_switch_audio_btn').href="javascript:Recaptcha.switch_type('audio');";$('recaptcha_switch_audio_btn').title=$_.audio_challenge;$('recaptcha_switch_audio_btn').alt=$_.audio_challenge;$('recaptcha_switch_img_btn').href="javascript:Recaptcha.switch_type('image');";$('recaptcha_switch_img_btn').title=$_.visual_challenge;$('recaptcha_switch_img_btn').alt=$_.visual_challenge;$('recaptcha_whatsthis_btn').href=Recaptcha.helplink;$('recaptcha_whatsthis_btn').target="_blank";$('recaptcha_whatsthis_btn').title=$_.help_btn;$('recaptcha_whatsthis_btn').alt=$_.help_btn;$('recaptcha_whatsthis_btn').onclick=function(){Recaptcha.showhelp();return false;};Recaptcha.set_instructions();if($ST.error_message){Recaptcha.$("recaptcha_instructions").innerHTML=$ST.error_message;}
Recaptcha.widget.style.display='';if($OPT.callback){$OPT.callback();}},switch_type:function(new_type){var $C=Recaptcha;$C.type=new_type;$C.reload($C.type=='audio'?'a':'v');},reload:function(reason){var $C=Recaptcha;var $=$C.$;var $ST=RecaptchaState;$('recaptcha_area').style.cursor='progress';$('recaptcha_reload_btn').style.cursor='progress';$('recaptcha_reload_btn').onclick=function(){return false;};var scriptURL=$ST.server+"reload?c="+$ST.challenge+"&k="+$ST.site+"&reason="+reason+"&type="+$C.type;$C.add_script(scriptURL);$C.doing_timeout=reason=='t';},finish_reload:function(new_challenge,type)
{var $C=Recaptcha;var $ST=RecaptchaState;var $=$C.$;$ST.challenge=new_challenge;$C.type=type;$('recaptcha_challenge_field').value=$ST.challenge;function unwait(){$('recaptcha_area').style.cursor='';$('recaptcha_reload_btn').style.cursor='';$('recaptcha_reload_btn').onclick=null;}
if(type=='audio'){$('recaptcha_image').style.display='none'
unwait();var wavURL=$ST.server+"image?c="+$ST.challenge;var embedCode='<EMBED SRC="'+wavURL+'" height="40" bgcolor="white" AUTOSTART="true"/><br/><a class="recaptcha_audio_cant_hear_link" target="_blank" href="'+wavURL+'">'+RecaptchaStr.cant_hear_this+'</a>';$("recaptcha_play_audio").innerHTML=embedCode;$("recaptcha_switch_audio_btn").style.display='none';$("recaptcha_switch_img_btn").style.display='';}else if(type=='image'){$('recaptcha_image').onload=function(){$('recaptcha_image').style.display=''
unwait();}
$("recaptcha_play_audio").innerHTML="";$('recaptcha_image').src=$ST.server+'image?c='+$ST.challenge;$("recaptcha_switch_img_btn").style.display='none';$("recaptcha_switch_audio_btn").style.display='';}
$C.set_instructions();$C.clear_input();if(!$C.doing_timeout){$('captcha_response').focus();}
$C.reset_timer();$C.doing_timeout=false;},reset_timer:function(){var $ST=RecaptchaState;clearInterval(Recaptcha.timer_id);Recaptcha.timer_id=setInterval("Recaptcha.reload('t');",($ST.timeout-60*5)*1000);},showhelp:function(){window.open(Recaptcha.helplink,"recaptcha_popup","width=460,height=570,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes");},clear_input:function()
{var resp=Recaptcha.$('captcha_response');resp.value=""},set_instructions:function(){},reloaderror:function(msg){var $=Recaptcha.$;$('recaptcha_area').style.cursor='';$('recaptcha_reload_btn').style.cursor='';$('recaptcha_reload_btn').onclick=null;$('recaptcha_image').style.display='none'
$("recaptcha_play_audio").innerHTML=msg;},is_gecko17_or_less:function(){var s=navigator.userAgent.toLowerCase();if(!/gecko\//.test(s))
return false;var geckoVersion=s.match(/gecko\/(\d+)/)[1];return((geckoVersion<20051111)||(/rv:1\.7/.test(s)));}};

var outside_search_first_toggle=true;function privacy_toggle_network_selector(obj,name,id,match){var value=obj.options[obj.selectedIndex].value;if(value==match){show(id);}else{hide(id);}
privacy_update_sparkline(name,value);if(name=="search_privacy"){privacy_toggle_outside_your_networks(name,value,5);}}
function privacy_toggle_outside_your_networks(name,value,match){if(value==match){privacy_toggle_form_state(ge("restrict_"+name),false);privacy_toggle_all_checkboxes(ge("restrict_"+name),true);outside_search_first_toggle=true;ge('search_filter_public').checked=true;ge('search_filter_indexed').checked=true;privacy_toggle_form_state(ge("search_indexing_on"),true);privacy_toggle_form_state(ge("public_profile_on"),true);show(ge('public_profile_on'));show(ge('search_indexing_on'));}else{privacy_toggle_form_state(ge("restrict_"+name),true);if(outside_search_first_toggle){privacy_toggle_all_checkboxes(ge("restrict_"+name),false);outside_search_first_toggle=false;ge('search_filter_public').checked=false;ge('search_filter_indexed').checked=false;privacy_toggle_form_state(ge("search_indexing_on"),false);privacy_toggle_form_state(ge("public_profile_on"),false);hide(ge('public_profile_on'));hide(ge('search_indexing_on'));}}}
function privacy_toggle_external_search_indexing(obj){if(obj.checked==true){ge('search_filter_indexed').checked=true;privacy_toggle_form_state(ge("search_indexing_on"),true);}else{ge('search_filter_indexed').checked=false;privacy_toggle_form_state(ge("search_indexing_on"),false);}}
function privacy_update_sparkline(name,value){id=name+'_sparkline';img=ge(id);if(!img){return false;}
src='/images/privacy/sparkline_'+value+'.jpg';img.src=src;}
function privacy_show_public_listing_preview_dialog(){var dialog=new pop_dialog('privacy_pop_public_listing_prrview_dialog');dialog.show_ajax_dialog('/ajax/privacy_public_listing_dialog.php');}
function privacy_show_dialog(field,url){var dialog=new pop_dialog('privacy_pop_dialog');dialog.show_ajax_dialog('/ajax/privacy_dialog.php?f='+field+'&u='+url);}
function editapps_show_privacy_dialog(app_id,url){var dialog=new pop_dialog('privacy_pop_dialog');dialog.show_ajax_dialog('/ajax/editapps_privacy.php?id='+app_id+'&u='+url);}
function privacy_toggle_albums(count){for(i=0;i<count;i++){var album_id="album_limited_"+i;ge(album_id).checked=true;}}
function privacy_check_all_networks(album_id){var networksCount=networks.length;for(i=0;i<networksCount;i++){checkbox_id="album_"+album_id+"_network_"+networks[i];ge(checkbox_id).checked=true;}}
function privacy_limited_profile_pop_message(){var dialog=new pop_dialog();dialog.show_choice('Limited Profile','Your limited profile allows you to hide some of your information from specific people.','Edit Limited Profile',function(){document.location='privacy.php?view=limited'},'Close',function(){generic_dialog.get_dialog(this).hide()});}
function privacy_view_public_listing_pop_message(){var dialog=new pop_dialog();dialog.show_choice('Public Search Listing','Your public search listing consists of your name and the thumbnail version of your profile picture. This listing will be shown to people who search for your name when they are not logged in to Facebook. <br/><br/>Use your search privacy settings to control whether your public search listing appears in searches from Facebook\'s Welcome page or external search engines.  Changes you make will take effect immediately on Facebook, but there may be a delay before search engines are updated as well. <br/><br/>For more information, see the <a href="/policy.php">Facebook Privacy Policy</a>.','Close',function(){generic_dialog.get_dialog(this).hide()});}
function privacy_pop_message(title,message){var dialog=new pop_dialog();dialog.show_choice(title,message,'Close',function(){generic_dialog.get_dialog(this).hide()});}
function privacy_save_contact_settings(field,label,networks,field_on_page){ajax=new Ajax();ajax.onDone=function(ajaxObj,response){}
ajax.onFail=function(ajaxObj){}
var params="field="+field;var count_networks=0;var count_fof=0;var count_friends=0;var count_self=0;var count_nobody=0;var summary_case=0;for(i=0;i<networks.length;i++){var element=field+"_"+networks[i];var p=ge(element);if(p){if(p.selectedIndex==0){params+="&"+element+"=15";count_networks++;}else if(p.selectedIndex==1){params+="&"+element+"=7";count_fof++;}else if(p.selectedIndex==2){params+="&"+element+"=3";count_friends++;}else if(p.selectedIndex==3){params+="&"+element+"=1";count_self++;}else if(p.selectedIndex==4){params+="&"+element+"=0";count_nobody++;}}}
ajax.post('/privacy/contact_ajax.php',params);var settings_status=label+' privacy settings were saved.';show_standard_status(settings_status);if(field_on_page!=''){hide_privacy_dialog(field_on_page);}else{hide_privacy_dialog(field);}
if(count_networks==networks.length){summary_case=1;}else if(count_fof==networks.length){summary_case=2;}else if(count_friends==networks.length){summary_case=3;}else if(count_self==networks.length){summary_case=4;}else if(count_nobody==networks.length){summary_case=5;}else{summary_case=9;}
privacy_update_privacy_contact_summary(field,summary_case);}
function privacy_update_privacy_contact_summary(field,summary_case){var element="contact_edit_"+field;var summary='';if(summary_case==1){summary+='Visible to your networks';}else if(summary_case==2){summary+='Visible to friends of friends';}else if(summary_case==3){summary+='Only visible to friends';}else if(summary_case==4){summary+='Hidden to your networks';}else if(summary_case==5){summary+='Hidden from everyone';}else{summary+='Custom privacy settings';}
ge(element).innerHTML=summary;}
function privacy_turn_off_select(c,field,index,networks){if(c){if(c.checked==true){privacy_set_select_state(field,networks,4);}else{privacy_set_select_state(field,networks,3);}}
return true;}
function privacy_set_select_state(field,networks,option){for(i=0;i<networks.length;i++){var element=field+"_"+networks[i];var p=ge(element);if(p){p.options[option].selected=true;}}}
function privacy_turn_off_checkbox(field,index,networks){var box="contact_nobody_"+index;var c=ge(box);var other_networks=Array();if(c){var count_off=0;for(i=0;i<networks.length;i++){var element=field+"_"+networks[i];var p=ge(element);if(p){if(p.selectedIndex==4){other_networks[count_off]=networks[i];count_off++;}}}}
if(count_off==1){c.checked=true;privacy_set_select_state(field,networks,4);}else if(count_off==2){c.checked=false;privacy_set_select_state(field,other_networks,3);}}
function show_privacy_dialog(field){var edit='privacy_edit_'+field;var panel='privacy_panel_'+field;show(edit);if(ua.ie()){var dialog=ge(panel);var goodFrame=ge('goodFrame_'+panel);goodFrame.style.width=(dialog.offsetWidth+120)+"px";goodFrame.style.height=(dialog.offsetHeight)+"px";}}
function hide_privacy_dialog(field){var edit='privacy_edit_'+field;var panel='privacy_panel_'+field;hide(edit);if(ua.ie()){var goodFrame=ge('goodFrame_'+panel);goodFrame.style.width="0px";goodFrame.style.height="0px";}}
function privacy_toggle_form_state(obj,state){old_class=state?'disabled':'enabled';new_class=state?'enabled':'disabled';obj.className=obj.className.indexOf(old_class)==-1?(obj.className.indexOf(new_class)==-1?obj.className+' '+new_class:obj.className):obj.className.replace(old_class,new_class);var inputs=obj.getElementsByTagName('input');var selects=obj.getElementsByTagName('select');var options=obj.getElementsByTagName('option');for(var i=0;i<inputs.length;i++){inputs[i].disabled=!state;}
for(var i=0;i<selects.length;i++){selects[i].disabled=!state;}
for(var i=0;i<options.length;i++){options[i].disabled=!state;}}
function privacy_toggle_all_checkboxes(obj,state){var checkbox=obj.getElementsByTagName('input');for(var i=0;i<checkbox.length;i++){checkbox[i].checked=state;}}
function create_goodFrame(parent){if(ua.ie()){var dialog=ge(parent);var goodFrame=document.createElement('iframe');goodFrame.id="goodFrame_"+parent;goodFrame.className='coupatroopa';goodFrame.style.width="0px";goodFrame.style.height="0px";goodFrame.style.zIndex='50';goodFrame.style.top='0px';goodFrame.style.left='0px';dialog.insertBefore(goodFrame,dialog.firstChild);}}
function privacy_limit_onfound(obj){var f=this.obj.form;f.k.disabled=f.n.disabled=f.q.disabled=f.a.disabled=obj?true:false;f.view.disabled=f.limit_user.disabled=f.id.disabled=f.version.disabled=obj?false:true;if(obj){f.action='privacy.php';f.method='post';f.limit_submit.value='Add';f.limit_submit.onclick=null;f.limit_submit.disabled=false;f.id.value=obj.i;}
else{f.action='s.php';f.method='get';f.q.value=this.obj.value;f.limit_submit.value=this.obj.value==''?'Add':'Search';f.limit_submit.disabled=(this.obj.value=='');}}
function privacy_limit_onsubmit(){return!this.obj.form.limit_submit.disabled;}
function privacy_toggle_limited_preview(obj,name){if(obj.checked==true){show(name);}else{hide(name);}
contact_checked=ge('limit_contact').checked;personal_checked=ge('limit_personal').checked;if(contact_checked==false&&personal_checked==false){hide('preview_information');}
if(contact_checked==true||personal_checked==true){info_is_displayed=ge('preview_information').style.display;if(info_is_displayed!='block'){show('preview_information');}}
work_checked=ge('limit_professional').checked;education_checked=ge('limit_education').checked;if(work_checked==false&&education_checked==false){hide('preview_educationandworktitle');hide('preview_educationtitle');hide('preview_worktitle');}
if(work_checked==true&&education_checked==true){show('preview_educationandworktitle');hide('preview_educationtitle');hide('preview_worktitle');}
if(work_checked==true&&education_checked==false){hide('preview_educationandworktitle');hide('preview_educationtitle');show('preview_worktitle');}
if(work_checked==false&&education_checked==true){hide('preview_educationandworktitle');show('preview_educationtitle');hide('preview_worktitle');}}
function privacy_platform_disable_all_cb(){var platform_options_list=ge('platform_options_list1');for(var i=0;i<platform_options_list.childNodes.length;i++){platform_options_list.childNodes[i].childNodes[0].disabled=true;}
platform_options_list.style.color='gray';platform_options_list=ge('platform_options_list2');for(i=0;i<platform_options_list.childNodes.length;i++){platform_options_list.childNodes[i].childNodes[0].disabled=true;}
platform_options_list.style.color='gray';}
function privacy_platform_enable_all_cb(){var platform_options_list=ge('platform_options_list1');for(var i=0;i<platform_options_list.childNodes.length;i++){platform_options_list.childNodes[i].childNodes[0].disabled=false;}
platform_options_list.style.color='black';platform_options_list=ge('platform_options_list2');for(i=0;i<platform_options_list.childNodes.length;i++){platform_options_list.childNodes[i].childNodes[0].disabled=false;}
platform_options_list.style.color='black';}
function privacy_platform_logout_app(app_id){var logout_hidden=ge(app_id+'_logout');if(logout_hidden!=null){logout_hidden.value=1;hide(app_id+'_logged_in_div');show(app_id+'_logged_out_div');}}
function privacy_platform_undo_logout_app(app_id){var logout_hidden=ge(app_id+'_logout');if(logout_hidden!=null){logout_hidden.value=0;hide(app_id+'_logged_out_div');show(app_id+'_logged_in_div');}}
function privacy_platform_revoke_app(app_id){var used_hidden=ge(app_id+'_app_used');if(used_hidden!=null){used_hidden.value=0;hide(app_id+'_used_div');show(app_id+'_revoked_div');privacy_platform_logout_app(app_id);hide(app_id+'_logged_out_div');}}
function privacy_platform_undo_revoke_app(app_id){var used_hidden=ge(app_id+'_app_used');if(used_hidden!=null){used_hidden.value=1;hide(app_id+'_revoked_div');show(app_id+'_used_div');privacy_platform_undo_logout_app(app_id);}}
function privacy_platform_unblock_app(app_id){var blocked_hidden=ge(app_id+'_app_blocked');if(blocked_hidden!=null){blocked_hidden.value=0;hide(app_id+'_blocked_div');show(app_id+'_unblocked_div');}}
function privacy_platform_undo_unblock_app(app_id){var blocked_hidden=ge(app_id+'_app_blocked');if(blocked_hidden!=null){blocked_hidden.value=1;hide(app_id+'_unblocked_div');show(app_id+'_blocked_div');}}
function privacy_platform_remove_app(app_id){var removed_hidden=ge(app_id+'_app_removed');if(removed_hidden!=null){removed_hidden.value=1;hide(app_id+'_remove_div');show(app_id+'_undo_remove_div');ge(app_id+'_div').className="platform_removed_app";}}
function privacy_platform_undo_remove_app(app_id){var removed_hidden=ge(app_id+'_app_removed');if(removed_hidden!=null){removed_hidden.value=0;hide(app_id+'_undo_remove_div');show(app_id+'_remove_div');ge(app_id+'_div').className="platform_added_app";}}
function privacy_platform_show_explain_dialog(){var dialog=new pop_dialog();var title=ge('explain_dialog_title');var content=ge('explain_dialog_text');dialog.show_message(title.innerHTML,content.innerHTML,'Ok');}
function privacy_platform_show_basic_info_dialog(){var dialog=new pop_dialog();var title=ge('basic_info_dialog_title');var content=ge('basic_info_dialog_text');dialog.show_message(title.innerHTML,content.innerHTML,'Ok');}
function privacy_platform_select_share_radio(){privacy_platform_enable_all_cb();var base_hidden=ge('base_permission');if(base_hidden!=null){base_hidden.value=1;}}
function privacy_platform_select_noshare_radio(){privacy_platform_disable_all_cb();var base_hidden=ge('base_permission');if(base_hidden!=null){base_hidden.value=0;}}
function privacy_platform_show_disabled_noshare_dialog(){var dialog=new pop_dialog();var title=ge('noshare_dialog_title');var content=ge('noshare_dialog_text');dialog.show_message(title.innerHTML,content.innerHTML,'Ok');}

function show_removefriend_dialog(to_uid,link_object,reload,remove_entry){var dialog=new pop_dialog();dialog.show_dialog('<div class="dialog_loading">Loading...</div>');this.onResponse=function(asyncResponse){var payload=asyncResponse.getPayload();if(payload['status']){dialog.show_choice(payload['dialog_title'],payload['dialog_contents'],'Remove Friend',function(){this.onResponsePost=function(asyncResponsePost){var payloadPost=asyncResponsePost.getPayload();dialog.show_message(payloadPost['dialog_title'],payloadPost['dialog_contents']);if(payloadPost['status']){if(reload){if(window.location.reload){window.location.reload();}}
if(remove_entry){remove_friends_entry(link_object);}
dialog.fade_out(1000,1600);}
if(!remove_entry&&!reload){add_add_to_friends_link(to_uid,link_object);}};asyncRequestPost=new AsyncRequest().setURI('/ajax/removefriend.php').setData({'uid':to_uid}).setHandler(bind(this,'onResponsePost')).setErrorHandler(bind(this,'onError')).send();},'Cancel',function(){generic_dialog.get_dialog(this).fade_out(100)});}else{dialog.show_message(payload['dialog_title'],payload['dialog_contents']);add_add_to_friends_link(to_uid,link_object);}};this.onError=function(asyncResponse){window.location.href='/friends.php?remove_friend=1&rr=1&friend_id='+to_uid;};new AsyncRequest().setURI('/ajax/removefriend.php').setData({'can_remove':to_uid}).setHandler(bind(this,'onResponse')).setErrorHandler(bind(this,'onError')).send();return false;}
function remove_friends_entry(link_node){var div_node=link_node;while(div_node.parentNode){var class_name=div_node.className;if(typeof class_name=='string'&&class_name.indexOf('friendtable')>=0){div_node.style.visibility='hidden';div_node.style.display='none';break;}
div_node=div_node.parentNode;}
var num_friends_node=ge('summary_num_friends');var friends_node=ge('summary_friends_string');if(typeof num_friends_node!='undefined'&&typeof friends_node!=undefined){var num_friends=parseInt(num_friends_node.innerHTML)-1;var friends_string='friends';if(num_friends==0){num_friends='no';}else{if(num_friends==1){friends_string='friend';}}
num_friends_node.innerHTML=num_friends;friends_node.innerHTML=friends_string;}}
function add_add_to_friends_link(to_uid,link_object){var newNode=document.createElement("a");newNode.innerHTML="Add to Friends";newNode.className="active";newNode.href='addfriend.php?id='+to_uid;newNode.setAttribute('onClick','show_addfriend_dialog('+to_uid+',this);return false;');link_object.parentNode.replaceChild(newNode,link_object);}

function scrollHere(scroll_obj,page_obj){if(!scroll_obj||!page_obj){return;}
var wh=window.innerHeight?window.innerHeight:document.documentElement.clientHeight;var dh=elementY(page_obj)+page_obj.offsetHeight;var ey=elementY(scroll_obj)-100;var bh=Math.max(document.documentElement.scrollTop,document.body.scrollTop);if(dh-ey<wh){ey-=(wh+ey)-dh;}
if(dh<wh+100){return;}
var obj={dy:ey,i:750,cy:0,bh:bh,st:(new Date()).getTime()};obj.h=setInterval(function(){var t=(new Date()).getTime();var s=null;if(t>this.i+this.st){s=this.dy;clearInterval(this.h);}else{var p=(t-this.st)/this.i;s=(this.dy-this.bh)*(1-Math.pow(1-Math.sin(Math.PI/2*p),2))+this.bh;}
if((this.ls1&&this.ls1!=document.documentElement.scrollTop)||(this.ls2&&this.ls2!=document.body.scrollTop)){clearInterval(this.h);}else{document.documentElement.scrollTop=document.body.scrollTop=s;this.ls1=document.documentElement.scrollTop;this.ls2=document.body.scrollTop;}}.bind(obj),25);}

function detect_browser_size(){var ajax=new Ajax();ajax.onDone=function(){}
ajax.onFail=function(){}
var width=0;var height=0;if(typeof(window.innerWidth)=='number'){width=window.innerWidth;height=window.innerHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){width=document.documentElement.clientWidth;height=document.documentElement.clientHeight;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){width=document.body.clientWidth;height=document.body.clientHeight;}
ajax.post('ajax/browser_sizes.php','w='+parseInt(width)+'&h='+parseInt(height));}

} catch(ex) {
  debug_rlog(ex,true);
}

deadmanSafety = true;
