var JSON;if(!JSON){JSON={};}
(function(){"use strict";function f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'-'+
f(this.getUTCDate())+'T'+
f(this.getUTCHours())+':'+
f(this.getUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==='string'?c:'\\u'+('0000'+a.charCodeAt(0).toString(16)).slice(-4);})+'"':'"'+string+'"';}
function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==='object'&&typeof value.toJSON==='function'){value=value.toJSON(key);}
if(typeof rep==='function'){value=rep.call(holder,key,value);}
switch(typeof value){case'string':return quote(value);case'number':return isFinite(value)?String(value):'null';case'boolean':case'null':return String(value);case'object':if(!value){return'null';}
gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==='[object Array]'){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||'null';}
v=partial.length===0?'[]':gap?'[\n'+gap+partial.join(',\n'+gap)+'\n'+mind+']':'['+partial.join(',')+']';gap=mind;return v;}
if(rep&&typeof rep==='object'){length=rep.length;for(i=0;i<length;i+=1){if(typeof rep[i]==='string'){k=rep[i];v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}
v=partial.length===0?'{}':gap?'{\n'+gap+partial.join(',\n'+gap)+'\n'+mind+'}':'{'+partial.join(',')+'}';gap=mind;return v;}}
if(typeof JSON.stringify!=='function'){JSON.stringify=function(value,replacer,space){var i;gap='';indent='';if(typeof space==='number'){for(i=0;i<space;i+=1){indent+=' ';}}else if(typeof space==='string'){indent=space;}
rep=replacer;if(replacer&&typeof replacer!=='function'&&(typeof replacer!=='object'||typeof replacer.length!=='number')){throw new Error('JSON.stringify');}
return str('',{'':value});};}
if(typeof JSON.parse!=='function'){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==='object'){for(k in value){if(Object.prototype.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}
return reviver.call(holder,key,value);}
text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return'\\u'+
('0000'+a.charCodeAt(0).toString(16)).slice(-4);});}
if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''))){j=eval('('+text+')');return typeof reviver==='function'?walk({'':j},''):j;}
throw new SyntaxError('JSON.parse');};}}());;if(!Array.prototype.indexOf){Array.prototype.indexOf=function(obj,fromIndex){for(var i=(fromIndex==null?0:fromIndex),length=this.length;i<length;i++){if(this[i]===obj){return i;}}
return-1;}}
if(!Array.prototype.contains){Array.prototype.contains=function(obj){return this.indexOf(obj)>=0;}}
if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/(?:^\s+|\s+$)/g,'');}}
if(!String.prototype.replaceAll){String.prototype.replaceAll=function(search,replace)
{var haystack=this;while(~haystack.indexOf(search))
haystack=haystack.replace(search,replace);return haystack;}}
var cafemomjs=function(){var utils={gotoPage:function(url,replace)
{if(replace)
window.location.replace(url);else
window.location=url;},reloadPage:function(){var loc=window.location,href=loc.href,hash=loc.hash,query=loc.search,cacheBust;if(hash.length){cacheBust=(query.length>1?'&':'?')+'_cmjs='+(new Date().getTime());href=href.replace(hash,cacheBust+hash);}
window.location=href;},setDocDomain:function(d)
{if(d==null)
d=2;if(typeof d=='number')
document.domain=document.domain.split('.').slice(0-d).join('.');else if(typeof d=='string')
document.domain=d;},fixPie:function(el)
{if('fireEvent'in el)
el.fireEvent('onmove');},asyncJS:function(src,cb)
{var script=dom.makeEl('script',null,null,{src:src,async:'async'});if(typeof cb==='function'){script.onload=script.onreadystatechange=function(){if(!script.readyState||/loaded|complete/.test(script.readyState)){cb();script.onload=script.onreadystatechange=null;}};}
dom.addEl(script,dom.head);}};var validator={regex:{email:/^[^@\s]+@[^@\s]+[.][^.@\s]+$/i,zip:/^[0-9]{5}$/,fullname:/[\w]+/,subject:/[\w]+/,bodyfield:/[\w]+/},valid:function(type,value)
{if(typeof validator.regex[type]==='undefined')
return false;return this.regex[type].test(value);}};var testDiv=document.createElement('div'),isIE7=window.XMLHttpRequest&&document.all&&(!document.documentMode||document.documentMode==7)?true:false,supports={W3CEvents:window.addEventListener?true:false,getElementsByClassName:'getElementsByClassName'in testDiv?true:false,localStorage:'localStorage'in window&&window['localStorage']!==null,placeholders:'placeholder'in document.createElement('input'),fileInputClick:false},quirks={zIndex:isIE7};var events={isReady:false,isLoaded:false,listen:function(listener,name,handler)
{var wrappedHandler=function(ev)
{ev=events.fixEvent(ev);handler.apply(ev.target||null,[ev]);}
if(!listener||typeof handler!='function')
return;else if(listener.addEventListener)
listener.addEventListener(name,wrappedHandler,false);else if(listener.attachEvent)
listener.attachEvent('on'+name,wrappedHandler);},onLoad:function(handler)
{if(events.isLoaded)
handler.call();else
pageEvents.queueHandler('load',handler);},onReady:function(handler)
{if(events.isReady)
handler.call();else
pageEvents.queueHandler('ready',handler);},fixEvent:function(ev)
{if(ev.preventDefault)
return ev;var fixed={},p;for(p in window.event)
if(~['string','number','boolean'].indexOf(typeof window.event[p]))
fixed[p]=window.event[p];if(fixed.type=='keypress'){fixed.which=fixed.keyCode;}
fixed.target=window.event.srcElement;fixed.stopPropagation=function(){window.event.cancelBubble=true};fixed.preventDefault=function(){window.event.returnValue=false};return fixed;}},pageEvents={queue:{ready:[],load:[]},queueHandler:function(type,handler)
{pageEvents.queue[type].push(handler);},handleAll:function(type)
{var handlers=pageEvents.queue[type],max=handlers.length,i=0,handler;while(handlers.length){handler=handlers.shift();handler.call();handler=null;}},handleReady:function()
{if(!events.isReady){events.isReady=true;pageEvents.handleAll('ready');}},handleLoad:function()
{events.isLoaded=true;pageEvents.handleReady();pageEvents.handleAll('load');}};if(supports.W3CEvents){document.addEventListener("DOMContentLoaded",pageEvents.handleReady,false);}
else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState=='complete'){pageEvents.handleLoad();}});}
events.listen(window,'load',pageEvents.handleLoad);var dom={getEl:function(el)
{if(typeof el.nodeName==='undefined')
return document.getElementById(el);return el;},getTags:function(tn,p)
{return(p||document).getElementsByTagName(tn||'*');},getByClass:function(cn,p)
{if(supports.getElementsByClassName)
return(p||document).getElementsByClassName(cn||'*');else{var matched=[],tags=dom.getTags('*',p),l=tags.length,i=0;for(;i<l;i++)
if(dom.hasClass(tags[i],cn))
matched.push(tags[i]);return matched;}},addEl:function(el,p)
{return(p?p:document.body).appendChild(el);},removeEl:function(el,p){var rem=null;try{rem=(p?p:(el.parentNode?el.parentNode:document.body)).removeChild(el);}
catch(err){}
return rem;},makeEl:function(tagName,className,html,attrs)
{var el=document.createElement(tagName||'div');if(className!=null)
dom.addClass(el,className);if(html!=null)
dom.html(el,html);if(attrs!=null)
dom.attr(el,attrs);return el;},fromHTML:function(html)
{var cnt=dom.makeEl('div',null,html),count=cnt.childNodes.length;if(count>1){var frag=document.createDocumentFragment();while(cnt.hasChildNodes())
dom.addEl(cnt.firstChild,frag);return frag;}
else
return cnt.firstChild;},hasClass:function(el,cn)
{var elcn=el.className||null;if(!elcn||!~elcn.indexOf(cn))
return false;else if(elcn==cn)
return true;else{elcn=' '+elcn+' ';cn=' '+cn+' ';return!!~elcn.indexOf(cn);}},addClass:function(el,cn)
{if(cn&&!dom.hasClass(el,cn))
el.className=el.className+' '+cn;},insertAfter:function(el,t)
{var p=t.parentNode?t.parentNode:document.body,n=dom.nextNode(t);if(n)
p.insertBefore(el,dom.nextNode(t));else
dom.addEl(el,p);},insertBefore:function(el,t)
{var p=t.parentNode?t.parentNode:document.body;p.insertBefore(el,t);},canIgnoreNode:function(n){return(n.nodeType==8)||((n.nodeType==3)&&!/[^\t\n\r ]/.test(n.data));},nextNode:function(n)
{while((n=n.nextSibling))
if(!dom.canIgnoreNode(n))
return n;return null;},prevNode:function(n)
{while((n=n.previousSibling))
if(!dom.canIgnoreNode(n))
return n;return null;},replace:function(oldNode,newNode)
{(oldNode.parentNode?oldNode.parentNode:document.body).replaceChild(newNode,oldNode);},removeClass:function(el,cn)
{if(cn&&dom.hasClass(el,cn)){el.className=el.className.replace(new RegExp('\\b'+cn+'\\b'),'');}},toggleClass:function(el,cn)
{if(dom.hasClass(el,cn))
dom.removeClass(el,cn);else
dom.addClass(el,cn);},attr:function(el,attrs,val)
{if(el&&attrs){if(typeof attrs=='string'){if(arguments.length==2)
return el.getAttribute(attrs);else if(val===null)
el.removeAttribute(attrs);else
el.setAttribute(attrs,val);}
else
for(p in attrs){if(attrs[p]===null)
el.removeAttribute(p);else
el.setAttribute(p,attrs[p]);}}},css:function(el,styles,val)
{if(styles){if(typeof styles=='string')
el.style[styles]=val;else
for(p in styles)
el.style[p]=styles[p];}},html:function(el,html)
{if(html!=null)
el.innerHTML=typeof html=='string'?html:String(html);return el.innerHTML;}};var ui={getPos:function(width,height,left,top)
{var pos={width:width?parseInt(width,10):500,height:height?parseInt(height,10):400};pos.left=left?parseInt(left,10):Math.max(1,Math.floor((ui.getBodyDim('clientWidth','min')-pos.width)/2+ui.getBodyDim('scrollLeft')));pos.top=top?parseInt(top,10):Math.max(1,Math.floor((ui.getBodyDim('clientHeight','min')-pos.height)/2+ui.getBodyDim('scrollTop')));pos.right=pos.left+pos.width;pos.bottom=pos.top+pos.height;return pos;},getBodyDim:function(dim,scale)
{if(!scale)
scale='max';return Math[scale](document.body[dim],document.documentElement[dim]);},setPos:function(el,pos,units)
{if(!units)
units='px';if(pos)
for(p in pos)
el.style[p]=pos[p]+units;}};var modal={current:null,open:function(content,width,height,opt)
{modal.close();if(opt==null)
opt={};var pop=dom.makeEl('div','modalPopup rounded shadow',(opt.noCloseButton?'':'<a class="modalClose" href="#" onclick="return cafemomjs.modal.close()">[x] close</a>')+content,{'id':'modalPopupWindow'}),frame=dom.makeEl('div','modalFrame','<div class="modalBackground"></div>');dom.css(frame,'height',ui.getBodyDim('scrollHeight')+'px');if(opt.className)
dom.addClass(pop,opt.className);ui.setPos(pop,ui.getPos(width,height));dom.css(pop,opt.styles);dom.addEl(pop,frame);modal.current=dom.addEl(frame);},openURL:function(url,width,height,opt)
{modal.open('<iframe border="0" frameborder="0" allowTransparency="true" class="modalIframe loading" src="'+url+'"></iframe>',width,height,opt);},lightboxImg:function(url,opt)
{if(opt==null)
opt={};opt.noCloseButton=true;if(url){modal.open('<div id="modalLightbox" class="loading"><br/></div>',20,20,opt);var img=new Image();img.src=url;events.listen(modal.current,'click',modal.close);events.listen(img,'error',function(){dialog.alert('Sorry, that image wasn\'t found.');});function showImage(){var lb=dom.getEl('modalLightbox');dom.removeClass(lb,'loading');dom.replace(lb.firstChild,img);modal.resize(img.width,img.height);}
if(img.complete){showImage();}
else{events.listen(img,'load',showImage);}}},close:function()
{if(modal.current)
dom.removeEl(modal.current);return false;},resize:function(width,height)
{if(modal.current)
ui.setPos(dom.getEl('modalPopupWindow'),ui.getPos(width,height));}};var dialog={_buttons:{},open:function(message,buttons,width,height,opt)
{if(opt==null)
opt={};opt.noCloseButton=true;dialog._buttons=buttons;var i,bo='';for(i in buttons)
if(typeof buttons[i]=='object'&&typeof buttons[i].label!='undefined')
bo+='<a class="standardBtn '+(buttons[i].className?buttons[i].className:'btnGreen')+'" href="javascript:cafemomjs.dialog.click(\''+i+'\')">'+buttons[i].label+'</a>';message='<div class="dialogMessage">'+message+'</div><div class="dialogButtons">'+bo+'</div>';modal.open(message,width?width:300,height?height:100,opt);},confirm:function(message,callback,returnVal,width,height,opt)
{opt=opt||{};dialog.open(message,{'confirm':{label:opt.confirm_label||'OK',callback:callback,params:[returnVal?returnVal:true],className:opt.confirm_class||'btnOrange'},'cancel':{label:opt.cancel_label||'Cancel',callback:callback,params:[false],className:opt.cancel_class||null}},width,height,opt)},alert:function(message,width,height,opt)
{opt=opt||{};dialog.open(message,{'confirm':{label:opt.confirm_label||'OK'},className:opt.confirm_class||'btnOrange'},width,height,opt);},prompt:function(message,defaultText,callback,width,height,opt)
{opt=opt||{};message+='<input type="text" class="dialogPrompt rounded" id="simpleUI-dialogPrompt" value="'+(defaultText?defaultText:'')+'"/>';buttons={'confirm':{label:opt.confirm_label||'OK',callback:dialog._handlePrompt,params:[true,callback],className:opt.confirm_class||'btnOrange'},'cancel':{label:opt.cancel_label||'Cancel',callback:dialog._handlePrompt,params:[false,callback],className:opt.cancel_class||null}};dialog.open(message,buttons,width,height,opt);dom.getEl('simpleUI-dialogPrompt').focus();},click:function(idx)
{var button=dialog._buttons[idx],cb=button?button.callback:null;if(button){if(cb)
dialog._doCallback(cb,button.params?button.params:[idx],button,idx);modal.close();}},_doCallback:function(cb,params,button,value)
{if(cb.apply)
cb.apply(button?button:null,params?params:[value]);else
eval(cb);},_handlePrompt:function(getVal,cb)
{var value=getVal?dom.getEl('simpleUI-dialogPrompt').value:null;dialog._doCallback(cb,[value],this,value);}}
var ajax={get:function(url,handler,params)
{ajax.open(url,handler,'GET',params||null);},post:function(url,handler,postData)
{ajax.open(url,handler,'POST',postData);},open:function(url,handler,method,postData)
{var xhr=ajax.xhr();if(method=='GET'&&postData!=null){if(typeof postData!='string')
postData=ajax.encodeParams(postData);if(/\?/.test(url))
url+='&';else
url+='?';url+=postData;postData=null;}
xhr.open(method,url,true);if(method=='POST'&&postData!=null){xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");if(typeof postData!='string')
postData=ajax.encodeParams(postData);}
if(handler){xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.responseXML&&typeof xhr.responseXML.value!=='undefined'){handler(xhr.responseXML,{url:url,method:method,postData:postData});}
else{handler(xhr.responseText,{url:url,method:method,postData:postData});}}};}
xhr.send(postData);},parseXML:function(xml)
{if(window.DOMParser)
return new DOMParser().parseFromString(xml,"text/xml");else{var parser=new ActiveXObject("Microsoft.XMLDOM");parser.async="false";return parser.loadXML(xml);}},parseJSON:function(text)
{return JSON.parse(text);},toJSON:function(obj)
{return JSON.stringify(obj);},xhr:function()
{if(window.XMLHttpRequest)
return new XMLHttpRequest();else
return new ActiveXObject("Microsoft.XMLHTTP");},encodeParams:function(params)
{var p,o=[];for(p in params){o.push([p,window.encodeURIComponent(params[p])].join('='));}
return o.join('&');}};var messages={clear:function(type,loc,msgs)
{},set:function(type,loc,msgs)
{}};var storage={enabled:false};if(supports.localStorage){storage={enabled:true,put:function(k,v)
{localStorage.setItem(k,v);},get:function(k)
{return localStorage.getItem(k);},remove:function(k)
{localStorage.removeItem(k);},clear:function()
{localStorage.clear();},size:function()
{return localStorage.length;}};};var _cmjs={'ui':ui,'dom':dom,'events':events,'ajax':ajax,'modal':modal,'dialog':dialog,'validator':validator,'supports':supports,'quirks':quirks,'utils':utils,'storage':storage};return _cmjs;}();if(!cafemomjs.supports.placeholders){cafemomjs.placeholders={};with(cafemomjs){placeholders.toggle=function(el,toggle){var placeholder=dom.attr(el,'placeholder');if(placeholder){if(toggle=='on'&&el.value==''){el.value=placeholder;dom.addClass(el,'placeholder');}
else if(toggle=='off'&&placeholder==el.value){el.value='';dom.removeClass(el,'placeholder');}}};placeholders.enable=function(el){if(dom.attr(el,'placeholder')){placeholders.toggle(el,'on');events.listen(el,'focus',function(ev){ev=events.fixEvent(ev);placeholders.toggle(ev.target,'off');});events.listen(el,'blur',function(ev){ev=events.fixEvent(ev);placeholders.toggle(ev.target,'on');});if(!placeholders._forms.contains(el.form)){placeholders._forms.push(el.form);events.listen(el.form,'submit',function(ev){ev=events.fixEvent(ev);var i=0,theForm=ev.target,max=theForm.elements.length;for(;i<max;i++){placeholders.toggle(theForm.elements[i],'off');}});}}};placeholders._forms=[];}
with(cafemomjs){events.onReady(function(){var forms=document.forms,max=forms.length,i=0,e,maxEls,theEl;for(;i<max;i++){maxEls=forms[i].elements.length;for(e=0;e<maxEls;e++){theEl=forms[i].elements[e];placeholders.enable(theEl);}}});}};function toggleDisplay(id,flag){document.getElementById(id).style.display=flag?'block':'none';}
function changeHTML(o,html){o.innerHTML=html;}
with(cafemomjs){events.onReady(function(){var dropdown_tabs=dom.getEl('cross-site-dropdowns');if(dropdown_tabs){events.listen(dropdown_tabs,'mouseover',function(ev){ev=events.fixEvent(ev);if(dom.hasClass(ev.target,'cs-dropdown')){var tId=ev.target.getAttribute('data-cs-dropdown-type');var box=dom.getEl('cs_content_'+tId);if(!box.innerHTML.length){dom.html(box,'<div class="loading" id="loading"></div>');ajax.get('/includes/nav_content_ajax.php?type='+tId,function(data){dom.html(box,data);});}}});}
var notifications=dom.getEl('user_notifications');if(notifications){events.listen(notifications,'click',function(ev){ev=events.fixEvent(ev);var target=ev.target.nodeName=='A'?ev.target:(ev.target.nodeName=='SPAN'?ev.target.parentNode:null);if(target&&dom.hasClass(target,'notifications')){ev.stopPropagation();ev.preventDefault();}});events.listen(notifications,'mouseover',function(ev){ev=events.fixEvent(ev);var target=ev.target.nodeName=='A'?ev.target:(ev.target.nodeName=='SPAN'?ev.target.parentNode:null);if(target&&dom.hasClass(target,'notifications')){var tId=target.getAttribute('data-notification-type');var box=dom.getEl('notifications_'+tId);if(!box.innerHTML.length){dom.html(box,'<div class="loading" id="loading"></div>');ajax.get('/includes/get_notifications_ajax.php?type='+tId,function(data){dom.html(box,data);});if(count=dom.getEl('notifications_count_'+tId)){dom.css(count,'display','none');}}}});};});}
function enable_crazyegg()
{var script="http://dnn506yrbagrg.cloudfront.net/pages/scripts/0012/1244.js?"+Math.floor(new Date().getTime()/3600000);cafemomjs.utils.asyncJS(script);}
function CE_READY()
{CE2.set(1,USER_ID?'member':'nonmember');};var is={};is.ie=(document.all)?true:false;is.ie6=(parseInt(navigator.appVersion.split('MSIE')[1])<=6)?true:false;is.mz=(!document.all&&document.getElementById&&window.navigator.vendorSub!=null)?true:false;is.sf=(!document.all&&document.getElementById&&window.navigator.vendorSub==null)?true:false;function stopHere(event){if(is.mz||is.sf){event.preventDefault();event.stopPropagation();}
else if(is.ie){event.cancelBubble=true;}}
function argsToURL(url,args){for(i in args)url=url+(url.indexOf('?')==-1?'?':'&')+i+'='+args[i];return url;}
function popup(URL,title,width,height)
{window.open(URL,"_new","width="+width+",height="+height+"toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=yes");}
function makeHeader(values)
{var header=document.createElement("tr");for(i=0;i<values.length;i++)
{var th=document.createElement("th");th.innerHTML=values[i];header.appendChild(th);}
return(header);}
function makeRow(id,hidden,values)
{var tr=document.createElement("tr");tr.setAttribute("id",id);if(values!=null)
{for(j=0;j<values.length;j++)
{var td=document.createElement("td");td.innerHTML=values[j];tr.appendChild(td);}}
if(hidden)tr.style.display='none';return(tr);}
function trim(value)
{if(typeof value=="string"&&String.prototype.trim)
return value.trim();else
return(value.replace(/^\s*|\s*$/g,""));}
function htmldecode(str){str=str.replaceAll("&gt;",">").replaceAll("&lt;","<").replaceAll("&quot;","\"").replaceAll("&amp;","&");return(str);}
function setTab(tabList,paneList,index)
{if(tabList!=null&&paneList!=null&&index!=null&&tabList.length==paneList.length)
{var tabs=new Array(tabList.length);var panes=new Array(paneList.length);for(i=0;i<tabs.length;i++)
{tabs[i]=document.getElementById(tabList[i]);panes[i]=document.getElementById(paneList[i]);if(i!=index-1)
{tabs[i].className="";panes[i].style.display="none";}
else
{tabs[i].className+=" active";panes[i].style.display="block";tabs[i].blur();}}}}
function selectAllRecipients()
{List=document.getElementById('chooser_recipients');if(List!=null)
{if(List.length&&List.options[0].value=='temp')return;for(i=0;i<List.length;i++)
{List.options[i].selected=true;}
List.name='recipients[]';}}
function copyToList(from,to,remove,add)
{fromList=document.getElementById(from);toList=document.getElementById(to);if(fromList!=null&&toList!=null)
{for(i=0;i<fromList.options.length;i++)
{var current=fromList.options[i];if(current.selected)
{txt=current.text;val=current.value;alreadyThere=false;for(j=0;j<toList.options.length;j++)
{if(toList.options[j].value==val)
alreadyThere=true;}
if(!alreadyThere&&add)
{toList.options[toList.length]=new Option(txt,val);}
if(remove)
{fromList.options[i]=null;i--;}
current.selected=false;}}}}
function toggleEditor(id,linkObj){if(tinyMCE.getInstanceById(id)==null){linkObj.innerHTML="hide editor";tinyMCE.execCommand('mceAddControl',false,id);}
else{linkObj.innerHTML="show editor";tinyMCE.execCommand('mceRemoveControl',false,id);}}
var submitted=false;function pleaseWait(id,txt,newClass){if(!submitted){var button=document.getElementById(id);if(typeof txt=='undefined'){txt="Please Wait...";}
if(button){if(button.nodeName.toLowerCase()=="input"){button.value=txt;button.disabled=true;button.className+=' '+newClass;}else if(button.nodeName.toLowerCase()=="button"){button.innerHTML='<span>'+txt+'</span>';button.disabled=true;button.onclick="function(){return false;}";button.className+=' '+newClass;}else{button.innerHTML=txt;button.parentNode.onclick="function(){return false;}";button.className+=' '+newClass;}
submitted=true;}
return(true);}
else{return(false);}}
function characterCounter(textElementId,countElementId,start)
{var textElement=document.getElementById(textElementId);var countElement=document.getElementById(countElementId);if(textElement!=null){if(start==null){if(countElement!=null){countElement.innerHTML=textElement.value.length;}}else{var value=start-parseInt(textElement.value.length);if(value<=0){textElement.value=textElement.value.substring(0,start);value=0;}
if(countElement!=null){countElement.innerHTML=value;}}}}
if(!document.getElementsByClassName){document.getElementsByClassName=function(cl){var retnode=[];var myclass=new RegExp('\\b'+cl+'\\b');var elem=this.getElementsByTagName('*');for(var i=0;i<elem.length;i++){var classes=elem[i].className;if(myclass.test(classes))retnode.push(elem[i]);}
return retnode;};}
function hideFlash(){for(j=0;j<document.getElementsByTagName('object').length;j++){if(document.getElementsByTagName('object')[j].innerHTML.indexOf('opaque')==-1&&typeof(document.getElementsByTagName('object')[j].style)!='undefined'){document.getElementsByTagName('object')[j].style.visibility='hidden';}}}
function showFlash(){for(j=0;j<document.getElementsByTagName('object').length;j++){if(document.getElementsByTagName('object')[j].innerHTML.indexOf('opaque')==-1&&typeof(document.getElementsByTagName('object')[j].style)!='undefined'){document.getElementsByTagName('object')[j].style.visibility='visible';}}}
function mceSetFocus()
{window.setTimeout(function(){if(tinyMCE!=null&&tinyMCE.activeEditor!=null&&tinyMCE.activeEditor.getContent().length>0){setTimeout("tinyMCE.execCommand('mceFocus', false, tinyMCE.activeEditor.id);window.focus();tinyMCE.execCommand('mceFocus', false, tinyMCE.activeEditor.id);",0);}});}
var nav_openmenu;var nav_openmenu_class;var nav_clickcount=0;function navMenuShow(t,ob){var m;if(t=='p'){m=ob.parentNode.parentNode.getElementsByTagName('div')[1];}
else{m=ob.parentNode.getElementsByTagName('ul')[0];}
m.blur();if(nav_openmenu==m)return;if(nav_openmenu){nav_openmenu.style.display='none';nav_openmenu.parentNode.className=nav_openmenu_class;}
nav_openmenu=m;nav_openmenu.style.display='block';nav_openmenu_class=nav_openmenu.parentNode.className;nav_openmenu.parentNode.className+=' highlight';document.onclick=navMenuHide;nav_clickcount=0;}
function navMenuHide(e){var target=(typeof e=='undefined'?event.srcElement.parentNode:e.target.parentNode);if(!nav_openmenu||!target)return;if(nav_clickcount++>0){if(target!=nav_openmenu){nav_openmenu.style.display='none';nav_openmenu.parentNode.className=nav_openmenu_class;nav_openmenu=null;document.onclick=null;}}}
ScreenNameDD={clickListenerAttached:false,documentClicked:function(e){var target=(typeof e.target=='undefined'?event.srcElement.parentNode:e.target.parentNode);if(ScreenNameDD.currentMenu&&target.className.indexOf('screennameMenu')==-1&&target.className.indexOf('screennameDDList')==-1&&target.parentNode&&target.parentNode.className.indexOf('screennameDDList')==-1&&target.parentNode.className.indexOf('screennameMenu')==-1&&target.parentNode.className.indexOf('screennameLinkItem')==-1)
{ScreenNameDD.currentMenu.parentNode.removeChild(ScreenNameDD.currentMenu);ScreenNameDD.currentMenu=null;}},showMenu:function(element,params){if(ScreenNameDD.currentMenu==null){var menu=document.createElement("ul");menu.className="screennameDDList";for(link in user_dropdown_links){var li=document.createElement("li");var url=user_dropdown_links[link];for(param in params){url=url.replaceAll('$'+param,params[param])}
li.innerHTML="&bull; <a href=\""+url+"\">"+link+"</a>";menu.appendChild(li);}
element.lastChild.appendChild(menu);ScreenNameDD.currentMenu=menu;if(!ScreenNameDD.clickListenerAttached){if(document.addEventListener){document.addEventListener("click",ScreenNameDD.documentClicked,false);}else if(document.attachEvent){document.attachEvent("onclick",ScreenNameDD.documentClicked);}
ScreenNameDD.clickListenerAttached=true;}}else{ScreenNameDD.currentMenu.parentNode.removeChild(ScreenNameDD.currentMenu);ScreenNameDD.currentMenu=null;}}}
function getElementPosition(elem){if(!elem||!elem.ownerDocument){return null;}
var box,top,left,doc=elem.ownerDocument,docElem=doc.documentElement;try{box=elem.getBoundingClientRect();}catch(e){}
if(!box){return{top:0,left:0};}
top=box.top;left=box.left;top=0;left=0;return{top:top,left:left};}
function getElementSize(e){var elem;if(document.getElementById){elem=document.getElementById(e);}else if(document.all){elem=document.all[e];}
xPos={width:elem.offsetWidth,height:elem.offsetHeight};return xPos;}
function tinymce_activate(id){tinyMCE.execCommand('mceAddControl',false,id);if(document.getElementById('tinymceLink')!=undefined){document.getElementById('tinymceLink').innerHTML='Use Plain-Text';document.getElementById('tinymceLink').onclick=function(){tinymce_deactivate(id);return(false);}}
if(document.getElementById('charlimitinfo')!=undefined){document.getElementById('charlimitinfo').style.display='none';}
if(document.getElementById('is_tinymce')!=undefined){document.getElementById('is_tinymce').value=1;}}
function tinymce_deactivate(id){tinyMCE.execCommand('mceRemoveControl',false,id);if(document.getElementById('tinymceLink')!=undefined){document.getElementById('tinymceLink').innerHTML='Use Full Editor';document.getElementById('tinymceLink').onclick=function(){tinymce_activate(id);return(false);}}
if(document.getElementById('charlimitinfo')!=undefined){document.getElementById('charlimitinfo').style.display='block';}
if(document.getElementById('is_tinymce')!=undefined){document.getElementById('is_tinymce').value=0;}}
function setEditorStyle(editor,styleString,quoteFlag,stylePageFlag){if(quoteFlag==null){quoteFlag=false;}
if(stylePageFlag==null){stylePageFlag=false;}
if(quoteFlag&&!styleString.length){styleString='0;0;0;0;;;';}
if(!styleString.length||editor==null){return;}
var ed=tinyMCE.get(editor);var tokens=styleString.split(';');var styleTags={bold:0,italic:0,underline:0,strikethrough:0,size:null,color:null,font:null};var styleHtml='';if(parseInt(tokens[0])!=ed.controlManager.get(editor+'_bold').isActive()){tinyMCE.execInstanceCommand(editor,'bold');}
if(parseInt(tokens[1])!=ed.controlManager.get(editor+'_italic').isActive()){tinyMCE.execInstanceCommand(editor,'italic');}
if(parseInt(tokens[2])!=ed.controlManager.get(editor+'_underline').isActive()){tinyMCE.execInstanceCommand(editor,'underline');}
if(parseInt(tokens[3])!=ed.controlManager.get(editor+'_strikethrough').isActive()){tinyMCE.execInstanceCommand(editor,'strikethrough');}
styleTags.bold=(tokens[0]=='1');styleTags.italic=(tokens[1]=='1');styleTags.underline=(tokens[2]=='1');styleTags.strikethrough=(tokens[3]=='1');if(tokens[4].length){ed.controlManager.get(editor+'_forecolor').setColor(tokens[4]);tinyMCE.execInstanceCommand(editor,'forecolor',false,tokens[4]);styleTags.color=tokens[4];}
if(tokens[5].length){ed.controlManager.get(editor+'_fontsizeselect').selectByIndex(tokens[5]);var fontSizes=ed.settings.theme_cafemom_font_sizes.split(',');var chosenFontSizeIndex=fontSizes[ed.controlManager.get(editor+'_fontsizeselect').selectedValue.fontSize-1].split('=')[1];tinyMCE.execInstanceCommand(editor,'fontsize',false,chosenFontSizeIndex);styleTags.size=chosenFontSizeIndex;}
if(tokens[6].length){ed.controlManager.get(editor+'_fontselect').selectByIndex(tokens[6]);var fontNames=ed.settings.theme_cafemom_fonts.split(';');var chosenFontName=fontNames[tokens[6]].split('=')[1];tinyMCE.execInstanceCommand(editor,'fontname',false,chosenFontName);styleTags.font=chosenFontName;}
if(tokens[5].length){ed.controlManager.get(editor+'_fontsizeselect').selectByIndex(tokens[5]);window.setTimeout('tinyMCE.get(\''+editor+'\').controlManager.get(\''+editor+'_fontsizeselect\').selectByIndex(\''+tokens[5]+'\')',200);}
if(tokens[6].length){ed.controlManager.get(editor+'_fontselect').selectByIndex(tokens[6]);window.setTimeout('tinyMCE.get(\''+editor+'\').controlManager.get(\''+editor+'_fontselect\').selectByIndex(\''+tokens[6]+'\')',200);}
styleHtml='<p>';if(styleTags.strikethrough){styleHtml+='<strike>';}
if(styleTags.italic){styleHtml+='<i>';}
if(styleTags.underline){styleHtml+='<u>';}
if(styleTags.bold){styleHtml+='<b>';}
if(styleTags.color!=null){styleHtml+='<font color="'+styleTags.color+'">';}
if(styleTags.size!=null){styleHtml+='<font size="'+styleTags.size+'">';}
if(styleTags.font!=null){styleHtml+='<font face="'+styleTags.font+'">';}
styleHtml+=quoteFlag?'<br />':(tinymce.isIE?'&nbsp;':'');if(styleTags.font!=null){styleHtml+='</font>';}
if(styleTags.color!=null){styleHtml+='</font>';}
if(styleTags.size!=null){styleHtml+='</font>';}
if(styleTags.bold){styleHtml+='</u>';}
if(styleTags.underline){styleHtml+='</u>';}
if(styleTags.italic){styleHtml+='</i>';}
if(styleTags.strikethrough){styleHtml+='</strike>';}
styleHtml+='</p>';if(tinymce.isIE){var cursorPos=ed.selection.getBookmark();}
if(tinymce.isIE||quoteFlag){ed.setContent(styleHtml+ed.getContent());}
if(quoteFlag){ed.setContent(ed.getContent()+styleHtml);if(!tinymce.isIE){ed.selection.select(ed.dom.select('p')[ed.dom.select('p').length-1]);}else{ed.selection.select(ed.dom.select('p')[ed.dom.select('p').length-1]);ed.execCommand("mceCleanup");}}
if(parseInt(tokens[0])!=ed.controlManager.get(editor+'_bold').isActive()){tinyMCE.execInstanceCommand(editor,'bold');}
if(parseInt(tokens[1])!=ed.controlManager.get(editor+'_italic').isActive()){tinyMCE.execInstanceCommand(editor,'italic');}
if(parseInt(tokens[2])!=ed.controlManager.get(editor+'_underline').isActive()){tinyMCE.execInstanceCommand(editor,'underline');}
if(parseInt(tokens[3])!=ed.controlManager.get(editor+'_strikethrough').isActive()){tinyMCE.execInstanceCommand(editor,'strikethrough');}
if(!stylePageFlag&&!quoteFlag){document.getElementById(editor+'_bold').focus();document.getElementById(editor+'_bold').blur();tinyMCE.execCommand('mceFocus',false,editor)
document.getElementById(editor+'_bold').focus();document.getElementById(editor+'_bold').blur();if(tinymce.isIE){ed.selection.moveToBookmark(cursorPos);}}else if(quoteFlag){document.getElementById(editor+'_bold').focus();document.getElementById(editor+'_bold').blur();}}
var timeout=0;var closetimer=0;var mainMenu=null;var subMenu=null;var currentOpen=null;var allSelect=null;function toggleSelect(show){if(!show){for(i=0;i<allSelect.length;i++)
allSelect[i].style.textIndent='-9999px';}
else{for(i=0;i<allSelect.length;i++)
allSelect[i].style.textIndent='0px';}}
function menuOpen(obj,topElementId){allSelect=document.getElementsByTagName('select');menuCancelclosetime();mainMenu=obj;if(subMenu)subMenu.style.display='none';if(currentOpen){currentOpen.parentNode.className="navItem";}
if(mainMenu){mainMenu.parentNode.className="navItem navHighlight";mainMenu.className="highlight";}
if(is.ie6&&allSelect.length>0)toggleSelect(false)
subMenu=mainMenu.parentNode.parentNode.getElementsByTagName('div')[1];subMenu.style.display='block';if(typeof(topElementId)!="undefined"){var navMenuBottom=getElementPosition(document.getElementById(topElementId)).top+document.getElementById(topElementId).offsetHeight;if(!is.ie){var ie_offset="0";}
else{var ie_offset="10";}
subMenu.style.top=navMenuBottom+parseInt(ie_offset)+"px";}
currentOpen=mainMenu;}
function menuClose(){if(is.ie6&&allSelect.length>0)toggleSelect(true)
if(subMenu)subMenu.style.display='none';if(currentOpen){currentOpen.parentNode.className="navItem";}}
function menuClosetime(){closetimer=window.setTimeout(menuClose,timeout);}
function menuCancelclosetime(){if(closetimer){window.clearTimeout(closetimer);closetimer=null;}}
function clearInputField(obj,fieldMsg){if(obj.value==fieldMsg)
obj.value="";obj.className=obj.className+' focus';}
function themeTab(tabState){if(tabState=='over'){document.getElementById('themeList').style.display='block';document.getElementById('themeTab').className='tab highlight';}
else{document.getElementById('themeList').style.display='none';document.getElementById('themeTab').className='tab';}}
function toggleNotificationBox(event,type){var e=event||window.event;var evtTarget=e.target||e.srcElement;var list=document.getElementById('loggedIn');var notifications=[document.getElementById('notification_messages'),document.getElementById('notification_invites'),document.getElementById('notification_activity')],i;var items=list.getElementsByTagName('li');var type=evtTarget.id;if(evtTarget&&(evtTarget.id=='messages'||evtTarget.id=='invites'||evtTarget.id=='activity')){var targetId=evtTarget.nextSibling.id.split('_')[0];var box=evtTarget.nextSibling.tagName.toLowerCase()=='div'?evtTarget.nextSibling:evtTarget.nextSibling.nextSibling;if(!(box.className)){box.className='dontDisplay';evtTarget.parentNode.className='notifications';return false;}
for(i in notifications){if(notifications[i]){notifications[i].className='dontDisplay';}}
for(var j=0;j<items.length;j++){if(items[j].className=='notifications active'){items[j].className='notifications';}}
box.className='';box.style.height='auto';if(!(box.className)){evtTarget.parentNode.className+=' active';}
if(box.innerHTML.length==0){box.innerHTML='<div class="loading" id="loading"></div>';ajax_getPage('/includes/notifications_ajax.php?type='+type,function(data){box.innerHTML=data;});if(document.getElementById(type+'_count')){document.getElementById(type+'_count').style.display='none';}}
return false;}
else{for(i in notifications){if(notifications[i].className==''){notifications[i].className='dontDisplay';notifications[i].parentNode.className='notifications';}}}}
function parseJSON(data){if(typeof data!=="string"||!data){return null;}
data=trim(data);var jr=window.jsonRegex=window.jsonRegex||{rvalidchars:/^[\],:{}\s]*$/,rvalidescape:/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rvalidtokens:/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rvalidbraces:/(?:^|:|,)(?:\s*\[)+/g};if(jr.rvalidchars.test(data.replace(jr.rvalidescape,"@").replace(jr.rvalidtokens,"]").replace(jr.rvalidbraces,""))){return window.JSON&&window.JSON.parse?window.JSON.parse(data):(new Function("return "+data))();}else{throw("Invalid JSON: "+data);}}
var reg_submitted=false;function ajax_register(f,pos){if(!reg_submitted){pos=pos||'';reg_submitted=true;var fields=['screen_name','email','passwd','birthday[Month]','birthday[Day]','birthday[Year]','successURL'],errorSpans=['screen_name','email','passwd','birthday'],blank='<p><span></span></p>',params={},i,dom=cafemomjs.dom,ajax=cafemomjs.ajax,utils=cafemomjs.utils;for(i=0;i<errorSpans.length;i++)
dom.html(dom.getEl(errorSpans[i]+'_error'+pos),'');for(i=0;i<fields.length;i++){if(f.elements[fields[i]]){params[fields[i]]=f.elements[fields[i]].value;}}
params['optin']=f.elements['optin'].checked?1:0;if(f.elements['join_group']&&f.elements['join_group'].value){params['join_group']=f.elements['join_group'].value;}
ajax.post('/actions/reg_submit_ajax.php',function(res){res=ajax.parseJSON(res);if(res.result=='success'){utils.gotoPage('/profile/basics.php');return;}
else if(res.result=='failed'){for(i=0;i<errorSpans.length;i++){if(res.errors[errorSpans[i]]){dom.html(dom.getEl(errorSpans[i]+'_error'+pos),'<p><span>ERROR</span></p>'.replace('ERROR',res.errors[errorSpans[i]]));}}}},params);reg_submitted=false;}
return false;};function ajax_getPage(page,callbackFunction){var xmlhttp=ajax_getInstance();xmlhttp.open('GET',page,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(typeof(callbackFunction)!='undefined'){if(xmlhttp.responseXML!=null&&typeof(xmlhttp.responseXML.value)!='undefined'){callbackFunction(xmlhttp.responseXML);}else if(xmlhttp.responseText){callbackFunction(xmlhttp.responseText);}}}}
xmlhttp.send(null)
return;}
function ajax_postPage(page,postData,callbackFunction){var xmlhttp=ajax_getInstance();xmlhttp.open('POST',page,true);xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(typeof(callbackFunction)!='undefined'){if(xmlhttp.responseXML!=null&&typeof(xmlhttp.responseXML.value)!='undefined'){callbackFunction(xmlhttp.responseXML);}else if(xmlhttp.responseText){callbackFunction(xmlhttp.responseText);}}}}
xmlhttp.send(postData)
return;}
function ajax_getInstance(){var xmlhttp=false;if(typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
else if(typeof ActiveXObject!='undefined'){try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(E){xmlhttp=false;}}}
return xmlhttp;}
function ajax_parseXmlString(string){var xmlDoc=null;try{xmlDoc=new ActiveXObject("Microsoft.XMLDOM");xmlDoc.async="false";xmlDoc.loadXML(string);}catch(e){parser=new DOMParser();xmlDoc=parser.parseFromString(string,"text/xml");}
return(xmlDoc);};var meebo_domain='http://www.cafemom.com';var topicsObj;function MeeboInitialize(domain,network_name,show_stage)
{if(domain){meebo_domain=domain;}
window.Meebo||function(b){function p(){return["<",i,' onload="var d=',g,";d.getElementsByTagName('head')[0].",j,"(d.",h,"('script')).",k,"='//",b.stage?"stage-":"","cim.meebo.com/cim?iv=",a.v,"&",q,"=",b[q],b[l]?"&"+l+"="+b[l]:"",b[e]?"&"+e+"="+b[e]:"","'\"></",i,">"].join("")}var f=window,a=f.Meebo=f.Meebo||function(){(a._=a._||[]).push(arguments)},d=document,i="body",m=d[i],r;if(!m){r=arguments.callee;return setTimeout(function(){r(b)},100)}a.$={0:+new Date};a.T=function(u){a.$[u]=new Date-a.$[0]};a.v=4;var j="appendChild",h="createElement",k="src",l="lang",q="network",e="domain",n=d[h]("div"),v=n[j](d[h]("m")),c=d[h]("iframe"),g="document",o,s=function(){a.T("load");a("load")};f.addEventListener?f.addEventListener("load",s,false):f.attachEvent("onload",s);n.style.display="none";m.insertBefore(n,m.firstChild).id="meebo";c.frameBorder="0";c.id="meebo-iframe";c.allowTransparency="true";v[j](c);try{c.contentWindow[g].open()}catch(w){b[e]=d[e];o="javascript:var d="+
g+".open();d.domain='"+d.domain+"';";c[k]=o+"void(0);"}try{var t=c.contentWindow[g];t.write(p());t.close()}catch(x){c[k]=o+'d.write("'+p().replace(/"/g,'\\"')+'");d.close();'}a.T(1)}
({network:network_name,stage:show_stage});}
function fillTopics(jsonData)
{topicsObj.innerHTML=jsonData;}
function addMeeboButtons()
{Meebo('addButton',{id:"button2",type:"menu",label:"Recent & Popular",icon:meebo_domain+"/images/chat/cafemom_im_recenticon.gif",items:[{value:1,text:"Popular Questions"},{value:2,text:"Popular Journals"},{value:3,text:"Active Group Posts"},{value:4,text:"Recent Blogs"}],onselect:function(value){if(value==1){location.href=meebo_domain+"/answers/archive.php?type=popular";}
if(value==2){location.href=meebo_domain+"/journals/archive.php?type=popular";}
if(value==3){location.href=meebo_domain+"/groups/forums/topic_archive.php?type=public";}
if(value==4){location.href=meebo_domain+"/dailybuzz";}}});Meebo('addButton',{id:"button3",type:"widget",label:"Hot Topics",icon:meebo_domain+"/images/chat/cafemom_im_hoticon.gif",width:300,height:250,oncreate:function(widget,element){topicsObj=element;element.innerHTML='Loading...';},onShow:function(widget,element){var request=meebo_domain+'/content/includes/chat_box.php?output=json&callback=fillTopics';var scriptObj=document.createElement("script");scriptObj.setAttribute("type","text/javascript");scriptObj.setAttribute("charset","utf-8");scriptObj.setAttribute("src",request);element.appendChild(scriptObj);}});};var cm_track=new Object();cm_track.VERSION_PREFIX='/v1';cm_track.TRACKING_HOST='http://track.cafemomstatic.com';cm_track.PAGEVIEW_PIXEL='/view';cm_track.EVENT_PIXEL='/event';cm_track.LOAD_TIME_MS=new Date().getTime().toString();cm_track.LOAD_TIME=parseInt(cm_track.LOAD_TIME_MS/1000);cm_track.page_viewed=0;cm_track.facebook_app_id=null;cm_track.site_section=null;cm_track.trackPageView=function(){if(this.page_viewed){return;}
var params=this.getStdParams();this.send(this.PAGEVIEW_PIXEL,params);this.page_viewed=1;};cm_track.trackEvent=function(category,action,label,extra){if(!this.page_viewed){this.trackPageView();}
var params=this.getStdParams();params['evt_cat']=category;params['evt_act']=action;if(label!=null){params['evt_lab']=label;}
if(extra!=null){for(var e in extra){params[e]=extra[e];}}
this.send(this.EVENT_PIXEL,params);};cm_track.getStdParams=function(){var p={'host':location.host,'path':location.pathname+((location.search.length)?location.search:''),'refer':document.referrer,'isid':this.readCookie('cafemomis'),'sid':this.readCookie('PHPSESSID'),'uid':this.readCookie('cafemomu'),'sn':this.readCookie('cafemomsn')};if(this.facebook_app_id){p['fbaid']=this.facebook_app_id;}
if(this.site_section){p['section']=this.site_section;}
return p;};cm_track.send=function(pixel,params){var url=this.TRACKING_HOST+this.VERSION_PREFIX+pixel;var pix=new Image(1,1);var pairs=new Array();for(var p in params){pairs.push(p+'='+((params[p]!=null)?this.encode(params[p]):''));}
url+='?'+pairs.join('&')
+'&its='+this.LOAD_TIME
+'&dms='+(new Date().getTime().toString()-this.LOAD_TIME_MS);pix.src=url;};cm_track.encode=function(s){s=encodeURIComponent(s);return s.replace(/~/g,'%7E').replace(/%20/g,'+');};cm_track.readCookie=function(name){var name_eq=name+"=";var ca=document.cookie.split(';');for(var i=0;i<ca.length;i++){var c=ca[i];while(c.charAt(0)==' '){c=c.substring(1,c.length);}
if(c.indexOf(name_eq)==0){return c.substring(name_eq.length,c.length);}}
return null;};cm_track.handleExtStirClick=function(href,section){cm_track.trackEvent('StirLink','Click',href,{section:section});};var simpleUI=function(){var ui={getEl:function(id)
{return document.getElementById(id);},addEl:function(el,p)
{return(p?p:document.body).appendChild(el);},removeEl:function(el,p){var rem=null;try{rem=(p?p:document.body).removeChild(el);}
catch(err){}
return rem;},makeEl:function(className,html,tagName,attrs)
{var el=document.createElement(tagName?tagName:'div');el.className=className;ui.html(el,html);ui.attr(el,attrs);return el;},hasClass:function(el,cn)
{return el.className&&el.className.indexOf(cn)>-1;},addClass:function(el,cn)
{if(!ui.hasClass(el,cn))
el.className=el.className+' '+cn;},removeClass:function(el,cn)
{if(ui.hasClass(el,cn))
el.className=el.className.replace(new RegExp('\\b'+cn+'\\b'),'');},css:function(el,styles,val)
{if(styles){if(typeof styles=='string')
el.style[styles]=val;else
for(p in styles)
el.style[p]=styles[p];}},attr:function(el,attrs,val)
{if(attrs){if(typeof attrs=='string')
el.setAttribute(attrs,val);else
for(p in attrs)
el.setAttribute(p,attrs[p]);}},html:function(el,html)
{if(html)
el.innerHTML=html;return el.innerHTML;},getPos:function(width,height,left,top)
{var pos={width:width?parseInt(width):500,height:height?parseInt(height):400};pos.left=left?parseInt(left):Math.max(1,Math.floor((ui.getBodyDim('clientWidth','min')-pos.width)/2+ui.getBodyDim('scrollLeft')));pos.top=top?parseInt(top):Math.max(1,Math.floor((ui.getBodyDim('clientHeight','min')-pos.height)/2+ui.getBodyDim('scrollTop')));pos.right=pos.left+pos.width;pos.bottom=pos.top+pos.height;return pos;},getBodyDim:function(dim,scale)
{if(!scale)
scale='max';return Math[scale](document.body[dim],document.documentElement[dim]);},setPos:function(el,pos)
{if(pos)
for(p in pos)
el.style[p]=pos[p]+'px';}};var modal={current:null,open:function(content,width,height,opt)
{modal.close();if(opt==null)
opt={};var pop=ui.makeEl('modalPopup',(opt.noCloseButton?'':'<a class="modalClose" href="#" onclick="return simpleUI.modal.close()">[x] close</a>')+content,'div',{'id':'modalPopupWindow'}),frame=ui.makeEl('modalPopupFrame','<div class="modalPopupBackground"></div>');ui.css(frame,'height',ui.getBodyDim('scrollHeight')+'px');if(opt.className)
ui.addClass(pop,opt.className);ui.setPos(pop,ui.getPos(width,height));ui.css(pop,opt.styles);ui.addEl(pop,frame);modal.current=ui.addEl(frame);},openURL:function(url,width,height,opt)
{modal.open('<iframe border="0" frameborder="0" class="modalIframe" src="'+url+'"></iframe>',width,height,opt);},close:function()
{if(modal.current)
ui.removeEl(modal.current);return false;},resize:function(width,height)
{if(modal.current)
ui.setPos(ui.getEl('modalPopupWindow'),ui.getPos(width,height));}};ui.modal=modal;var dialog={_buttons:{},open:function(message,buttons,width,height,opt)
{if(opt==null)
opt={};opt.noCloseButton=true;dialog._buttons=buttons;var i,bo='';for(i in buttons)
if(typeof buttons[i]=='object'&&typeof buttons[i].label!='undefined')
bo+='<a class="dialogButton '+(buttons[i].className?buttons[i].className:'')+'" href="javascript:simpleUI.dialog.click(\''+i+'\')">'+buttons[i].label+'</a>';message='<div class="dialogMessage">'+message+'</div><div class="dialogButtons">'+bo+'</div>';modal.open(message,width?width:300,height?height:100,opt);},confirm:function(message,callback,returnVal,width,height,opt)
{dialog.open(message,[{label:'OK',callback:callback,params:[returnVal?returnVal:true]},{label:'Cancel',callback:callback,params:[false]}],width,height,opt)},alert:function(message,width,height,opt)
{dialog.open(message,[{label:'OK'}],width,height,opt);},prompt:function(message,defaultText,callback,width,height,opt)
{message+='<input type="text" class="dialogPrompt" id="simpleUI-dialogPrompt" value="'+(defaultText?defaultText:'')+'"/>';buttons=[{label:'OK',callback:dialog._handlePrompt,params:[true,callback]},{label:'Cancel',callback:dialog._handlePrompt,params:[false,callback]}];dialog.open(message,buttons,width,height,opt);ui.getEl('simpleUI-dialogPrompt').focus();},click:function(idx)
{var button=dialog._buttons[idx],cb=button?button.callback:null;if(button){if(cb)
dialog._doCallback(cb,button.params?button.params:[idx],button,idx);modal.close();}},_doCallback:function(cb,params,button,value)
{if(cb.apply)
cb.apply(button?button:null,params?params:[value]);else
eval(cb);},_handlePrompt:function(getVal,cb)
{var value=getVal?ui.getEl('simpleUI-dialogPrompt').value:null;dialog._doCallback(cb,[value],this,value);}}
ui.dialog=dialog;return ui;}();;(function(){var field=null,input=null,allResults=null,currentResults=[],resultsPane=null,loading=false,timeout=null,focusTarget=-1,ieEvents=window.attachEvent?true:false,domEvents=window.addEventListener?true:false;function setup(){if(domEvents)
window.addEventListener('load',listen,false);else if(ieEvents)
window.attachEvent('onload',listen);}
function listen(){field=document.getElementById('headerSearchField')
if(!field||!/doLiveSearch/.test(field.className))
return;field.setAttribute('autocomplete','off');if(domEvents)
field.addEventListener('keyup',doSearch,false);else if(ieEvents){field.attachEvent('onkeyup',doSearch);}}
function initSearch(){if(!loading){loading=true;ajax_getPage('/includes/user_groups_livesearch.php',function(data){allResults=parseJSON(data);});}}
function doSearch(){var text=field.value?trim(field.value):'';if(timeout)
clearTimeout(timeout);if(allResults==null){if(!loading)
initSearch();if(text)
timeout=setTimeout(doSearch,200);return;}
if(input==text)
return;filterResults(text);if(currentResults.length){if(!resultsPane){resultsPane=document.createElement('div');resultsPane.setAttribute('id','liveSearchResults');document.getElementById('header').appendChild(resultsPane);if(domEvents){document.addEventListener('keydown',function(event){with(event){if(keyCode==40||keyCode==38){focusItem(keyCode==38);preventDefault();}}},false);document.addEventListener('click',function(event){if(event.target!=field){resultsPane.style.display='none';}},false);}
else if(ieEvents){document.attachEvent('onkeydown',function(){with(window.event){if(keyCode==40||keyCode==38){focusItem(keyCode==38);return false}}},false);document.attachEvent('onclick',function(){if(window.event.srcElement!=field){resultsPane.style.display='none';}});}}
resultsPane.innerHTML=buildHTML();resultsPane.style.display='block';}
else if(resultsPane){resultsPane.style.display='none';}};function filterResults(text){currentResults=[];if(!text)
return;var i=-1;if(allResults&&allResults.length)
while(++i<allResults.length&&currentResults.length<11)
if(allResults[i]['name'].toLowerCase().indexOf(text.toLowerCase())>-1)
currentResults.push(allResults[i]);}
function buildHTML(){var output=[],i;for(i in currentResults){if(i<10){output.push('<div><span>&bull;</span><a class="group" href="/group/'+currentResults[i]['group_id']+'?ct=live_search">'+truncate(currentResults[i]['name'],30)+'</a></div>');}}
output.push('<div><span>&bull;</span><a class="group more" href="/groups/archive.php?type=mine&ct=live_search">Go to My Groups</a></div>');return output.join('');}
function truncate(name,max){return name.length<=max?name:name.substring(0,max).replace(/^(.*)[\s][\S]*$/,'$1')+'...';}
function focusItem(decrement){if(currentResults.length&&resultsPane){var max=resultsPane.childNodes.length-1;if(focusTarget<0&&decrement||focusTarget==max&&!decrement)
return;if(decrement)
focusTarget--;else
focusTarget++;if(focusTarget<0)
document.getElementById('headerSearchField').focus();else
resultsPane.childNodes[focusTarget].childNodes[1].focus();}}
setup();return;})();
