var mtCookieName="mt_blog_user";var mtCookieDomain=".adventureivan.com";var mtCookiePath="/";var mtCookieTimeout=14400;function mtHide(id){var el=(typeof id=="string")?document.getElementById(id):id;if(el)el.style.display='none';}
function mtShow(id){var el=(typeof id=="string")?document.getElementById(id):id;if(el)el.style.display='block';}
function mtAttachEvent(eventName,func){var onEventName='on'+eventName;var old=window[onEventName];if(typeof old!='function')
window[onEventName]=func;else{window[onEventName]=function(evt){old(evt);return func(evt);};}}
function mtFireEvent(eventName,param){var fn=window['on'+eventName];if(typeof fn=='function')return fn(param);return;}
if(!this.JSON){JSON={};}(function(){function f(n){return n<10?'0'+n:n;}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z';};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){k=rep[i];if(typeof k==='string'){v=str(k,value);if(v){partial.push(quote(k)+(gap?': ':':')+v);}}}}else{for(k in value){if(Object.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.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v;}else{delete value[k];}}}}return reviver.call(holder,key,value);}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');};}}());var MT=window.MT||{};MT.cons=function(){return{LOG:'log',WARN:'warn',DEBUG:'debug',INFO:'info',ERR:'error',JSON:'json'};}();MT.core=function(o){var _debug=false;return{connect:function(url,respType,respHandler){var xh=mtGetXmlHttp();if(!xh)return false;xh.onreadystatechange=function(){if(xh.readyState==4){if(xh.status&&(xh.status!=200)){}else{switch(respType){case'json':respHandler(JSON.parse(xh.responseText));break;case'xml':break;case'text':break;}}}};xh.open('GET',url);xh.send(null);},getEl:function(el){return MT.util.checkNodeType(el)==='element'?id:(document.getElementById(el)||false);},addEvent:function(el,type,func,obj){if(!obj&&document.addEventListener){el.addEventListener(type,func,false);}else if(obj&&document.addEventListener){el.addEventListener(type,function(){func.call(obj,event);},false);}else{if(obj){el.attachEvent('on'+type,function(){func.call(obj,event);});}else{el.attachEvent('on'+type,function(){func.call(el,event);});}}},log:function(level,msg){if(_debug&&window.console){switch(level){case'warn':case'debug':case'info':case'error':case'log':console[level](msg);break;default:return false;}}else{return false;}}}}();MT.util=function(){return{toggleVisibility:{show:function(){var i=arguments.length;while(i--){if(MT.util.checkNodeType(arguments[i])==='element'){arguments[i].style.visibility='visible';}else{MT.core.getEl(arguments[i]).style.visibility='visible';}}},hide:function(){var i=arguments.length;while(i--){if(MT.util.checkNodeType(arguments[i])==='element'){arguments[i].style.visibility='hidden';}else{MT.core.getEl(arguments[i]).style.visibility='hidden';}}}},toggleDisplay:{show:function(){var i=arguments.length;while(i--){if(MT.util.checkNodeType(arguments[i])==='element'){arguments[i].style.display='';}else{MT.core.getEl(arguments[i]).style.display='';}}},hide:function(){var i=arguments.length;while(i--){if(MT.util.checkNodeType(arguments[i])==='element'){arguments[i].style.display='none';}else{MT.core.getEl(arguments[i]).style.display='none';}}}},findDefiningParent:function(origin){if(MT.util.checkNodeType(origin)==='element'){for(var node=origin.parentNode;node.parentNode;node=node.parentNode){if((node.hasAttribute&&node.hasAttribute('id'))||node.getAttribute('id')){return node;}}}
return false;},checkNodeType:function(obj){if(obj&&obj.nodeName){switch(obj.nodeType){case 1:return'element';case 3:return(/\S/).test(obj.nodeValue)?'textnode':'whitespace';}}}}}();(function(){var M=MT.core,c=MT.cons,u=MT.util,cache,isLoading,direction,currentComments,commentAnchor,commentArrId,commentsPerPage,commentsTotalPages,loadingIcon,pageNum,commentsOffset,totalComments,entryID,commentContentDiv,topNav,nav,currentCommentsSpan,topCurrentCommentsSpan;M.addEvent(window,'load',_init);function _init(){if(!MT.entryCommentCount){return;}
_initializeVariables();_setCommentOffset(false);_checkForAnchor();_setCurrentComments();_toggleNavLinks();_initializeEvents();}
function _initializeVariables(){cache={};isLoading=false;commentAnchor='';commentArrId='';commentsPerPage=MT.commentsPerPage||50;currentComments='';direction='ascend';entryID=MT.entryID;totalComments=MT.entryCommentCount;commentsTotalPages=Math.ceil(totalComments/commentsPerPage);pageNum=1;loadingIcon="<img title='Loading...' src='http://adventureivan.com/mt/mt-static/images/indicator.white.gif' alt='Loading' />";commentContentDiv=M.getEl("comments-content");topNav=M.getEl("top-comment-nav");nav=M.getEl("comment-nav");currentCommentsSpan=M.getEl("current-comments");topCurrentCommentsSpan=M.getEl("top-current-comments");}
function _initializeEvents(){if(commentsPerPage<totalComments){M.addEvent(nav,'click',_handleEvents);M.addEvent(topNav,'click',_handleEvents);}}
function _checkForAnchor(){var found=String(window.location.hash).match(/comment-(\d{1,6})/);if(found){M.log(c.DEBUG,found);if(!Object.prototype.hasOwnProperty.call(M.getEl(found[0]),'className')){if(_findIdMatch(found[1])){pageNum=Math.floor(commentArrId/commentsPerPage)+1;M.log(c.DEBUG,'Comment Array Id: '+commentArrId);M.log(c.DEBUG,'Comments Per Page: '+commentsPerPage);M.log(c.DEBUG,'Page Number: '+pageNum);M.log(c.DEBUG,'Comment Offset: '+_getCommentOffset());_updateComments();}}}}
function _setCommentOffset(){commentsOffset=commentsPerPage*(pageNum-1);}
function _getCommentOffset(){return commentsOffset;}
function _handleEvents(e){var origin=e.target||e.srcElement,parentId;origin=origin.id&&M.getEl(origin.id)||false;if(origin){parentId=u.checkNodeType(origin.parentNode)==='element'&&origin.parentNode.getAttribute('id')&&origin.parentNode.id;}else{return false;}
switch(origin.nodeName){case'A':switch(parentId){case'prev-comments':case'top-prev-comments':if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}
if(!isLoading){_previousPage();}
break;case'next-comments':case'top-next-comments':if(e.preventDefault){e.preventDefault();}else{e.returnValue=false;}
if(!isLoading){_nextPage();}
break;}
break;}}
function _toggleNavLinks(){M.log(c.DEBUG,M.getEl('top-prev-comments'));if(pageNum<=commentsTotalPages&&pageNum!==1){u.toggleVisibility.show('prev-comments');u.toggleVisibility.show('top-prev-comments');}
if(pageNum>=1&&pageNum!==commentsTotalPages){u.toggleVisibility.show('next-comments');u.toggleVisibility.show('top-next-comments');}
if(pageNum===1||nav.style.visibility==='hidden'){u.toggleVisibility.hide('prev-comments');u.toggleVisibility.hide('top-prev-comments');}
if(pageNum===commentsTotalPages||nav.style.visibility==='hidden'){u.toggleVisibility.hide('next-comments');u.toggleVisibility.hide('top-next-comments');}}
function _nextPage(){if(pageNum<commentsTotalPages){pageNum++;_updateComments();}}
function _previousPage(){if(pageNum>1){pageNum--;_updateComments();}}
function _findIdMatch(id){var len=MT.commentIds.length;while(len--){if(MT.commentIds[len]==id){commentAnchor="comment-"+id;commentArrId=len;return true;}}
return false;}
function _setCurrentComments(){var commentsOnPage=pageNum!=commentsTotalPages?commentsOffset+commentsPerPage:totalComments;_setCurrentCommentsContent([commentsOffset+1," - ",commentsOnPage].join(''));}
function _setCurrentCommentsContent(currentCommentsHTML){currentCommentsSpan.innerHTML=currentCommentsHTML;topCurrentCommentsSpan.innerHTML=currentCommentsHTML;}
function _setCommentContent(commentHTML){commentContentDiv.innerHTML=commentHTML;}
function _updateComments(){var comments,jsonUrl;isLoading=true;_setCurrentCommentsContent(loadingIcon);_setCommentOffset();jsonUrl=["http://adventureivan.com/mt/mt-comments.cgi?__mode=comment_listing&direction=",direction,"&entry_id=",entryID,"&limit=",commentsPerPage,"&offset=",_getCommentOffset()].join('');if(!commentAnchor){commentAnchor="comments-content";}
if(cache.hasOwnProperty(jsonUrl)){_refreshComments(cache[jsonUrl]);isLoading=false;}else{M.connect(jsonUrl,c.JSON,function(json){cache[jsonUrl]=json.comments;_refreshComments(json.comments);isLoading=false;});}}
function _refreshComments(commentData){_setCommentContent(commentData);_setCurrentComments();window.location.hash='reset';window.location.hash=commentAnchor;_toggleNavLinks();}})();function mtRelativeDate(ts,fds){var now=new Date();var ref=ts;var delta=Math.floor((now.getTime()-ref.getTime())/1000);var str;if(delta<60){str='moments ago';}else if(delta<=86400){var hours=Math.floor(delta/3600);var min=Math.floor((delta%3600)/60);if(hours==1)
str='1 hour ago';else if(hours>1)
str='2 hours ago'.replace(/2/,hours);else if(min==1)
str='1 minute ago';else
str='2 minutes ago'.replace(/2/,min);}else if(delta<=604800){var days=Math.floor(delta/86400);var hours=Math.floor((delta%86400)/3600);if(days==1)
str='1 day ago';else if(days>1)
str='2 days ago'.replace(/2/,days);else if(hours==1)
str='1 hour ago';else
str='2 hours ago'.replace(/2/,hours);}
return str?str:fds;}
function mtEditLink(entry_id,author_id){var u=mtGetUser();if(!u)return;if(!entry_id)return;if(!author_id)return;if(u.id!=author_id)return;var link='<a href="mt.cgi?__mode=view&amp;_type=entry&amp;id='+entry_id+'">Edit</a>';document.write(link);}
function mtCommentFormOnFocus(){mtShowCaptcha();}
var mtCaptchaVisible=false;function mtShowCaptcha(){var u=mtGetUser();if(u&&u.is_authenticated)return;if(mtCaptchaVisible)return;var div=document.getElementById('comments-open-captcha');if(div){div.innerHTML='<div class="label"><label for="captcha_code">Captcha:</label></div><div class="field"><input type="hidden" name="token" value="lqGQQX4oHUCn7nZxP1VHqSQxNZ8ghdG7MxJg56QH" /><img src="/mt/mt-comments.cgi/captcha/1/lqGQQX4oHUCn7nZxP1VHqSQxNZ8ghdG7MxJg56QH" width="150" height="35" /><br /><input name="captcha_code" id="captcha_code" value="" autocomplete="off" /><p>Type the characters you see in the picture above.</p></div>';mtCaptchaVisible=true;}}
var is_preview;var user;function mtSetUser(u){if(u){user=u;mtSaveUser();mtFireEvent('usersignin');}}
function mtEscapeJS(s){s=s.replace(/'/g,"&apos;");return s;}
function mtUnescapeJS(s){s=s.replace(/&apos;/g,"'");return s;}
function mtBakeUserCookie(u){var str="";if(u.name)str+="name:'"+mtEscapeJS(u.name)+"';";if(u.url)str+="url:'"+mtEscapeJS(u.url)+"';";if(u.email)str+="email:'"+mtEscapeJS(u.email)+"';";if(u.is_authenticated)str+="is_authenticated:'1';";if(u.profile)str+="profile:'"+mtEscapeJS(u.profile)+"';";if(u.userpic)str+="userpic:'"+mtEscapeJS(u.userpic)+"';";if(u.sid)str+="sid:'"+mtEscapeJS(u.sid)+"';";str+="is_trusted:'"+(u.is_trusted?"1":"0")+"';";str+="is_author:'"+(u.is_author?"1":"0")+"';";str+="is_banned:'"+(u.is_banned?"1":"0")+"';";str+="can_post:'"+(u.can_post?"1":"0")+"';";str+="can_comment:'"+(u.can_comment?"1":"0")+"';";str=str.replace(/;$/,'');return str;}
function mtUnbakeUserCookie(s){if(!s)return;var u={};var m;while(m=s.match(/^((name|url|email|is_authenticated|profile|userpic|sid|is_trusted|is_author|is_banned|can_post|can_comment):'([^']+?)';?)/)){s=s.substring(m[1].length);if(m[2].match(/^(is|can)_/))
u[m[2]]=m[3]=='1'?true:false;else
u[m[2]]=mtUnescapeJS(m[3]);}
if(u.is_authenticated){u.is_anonymous=false;}else{u.is_anonymous=true;u.can_post=false;u.is_author=false;u.is_banned=false;u.is_trusted=false;}
return u;}
function mtGetUser(){if(!user){var cookie=mtGetCookie(mtCookieName);if(!cookie)return;user=mtUnbakeUserCookie(cookie);if(!user){user={};user.is_anonymous=true;user.can_post=false;user.is_author=false;user.is_banned=false;user.is_trusted=false;}}
return user;}
var mtFetchedUser=false;function mtFetchUser(cb){if(!cb)cb='mtSetUser';if((cb=='mtSetUser')&&mtGetUser()){var url=document.URL;url=url.replace(/#.+$/,'');url+='#comments-open';location.href=url;}else{mtFetchedUser=true;var script=document.createElement('script');var ts=new Date().getTime();script.src='http://adventureivan.com/mt/mt-comments.cgi?__mode=session_js&blog_id=1&jsonp='+cb+'&ts='+ts;(document.getElementsByTagName('head'))[0].appendChild(script);}}
function mtRememberMeOnClick(b){if(!b.checked)
mtClearUser(b.form);return true;}
var mtRequestSubmitted=false;function mtCommentOnSubmit(f){if(!mtRequestSubmitted){mtRequestSubmitted=true;if(f.armor)
f.armor.value='420712a5a88a365953dad84750235198b69d69c5';if(f.bakecookie&&f.bakecookie.checked)
mtSaveUser(f);if(f.preview_button)f.preview_button.disabled=true;if(f.post)f.post.disabled=true;var u=mtGetUser();if(!is_preview&&(u&&u.is_authenticated)){mtFetchedUser=false;mtFetchUser('mtCommentSessionVerify');return false;}
return true;}
return false;}
function mtCommentSessionVerify(app_user){var u=mtGetUser();var f=document['comments_form'];if(u&&app_user&&app_user.sid&&(u.sid==app_user.sid)){f.submit();}else{alert('Your session has expired. Please sign in again to comment.');mtClearUser();mtFireEvent('usersignin');}}
function mtUserOnLoad(){var u=mtGetUser();if(document.getElementById('comments-form')){if(u&&u.is_authenticated){mtShow('comments-form');mtHide('comments-open-data');if(mtCaptchaVisible)
mtHide('comments-open-captcha');}else{}
if(u&&u.is_banned)
mtHide('comments-form');if(is_preview)
mtShowCaptcha();else
mtShowGreeting();var cf=document['comments_form'];if(cf){if(u&&u.is_anonymous){if(u.email)cf.email.value=u.email;if(u.name)cf.author.value=u.name;if(u.url)cf.url.value=u.url;if(cf.bakecookie)
cf.bakecookie.checked=u.name||u.email;}else{if(u&&u.sid&&cf.sid)
cf.sid.value=u.sid;}
if(cf.post&&cf.post.disabled)
cf.post.disabled=false;if(cf.preview_button&&cf.preview_button.disabled)
cf.preview_button.disabled=false;mtRequestSubmitted=false;}}}
function mtEntryOnLoad(){var cf=document['comments_form'];if(cf&&cf.preview)cf.preview.value='';mtFireEvent('usersignin');}
function mtEntryOnUnload(){if(mtRequestSubmitted){var cf=document['comments_form'];if(cf){if(cf.post&&cf.post.disabled)
cf.post.disabled=false;if(cf.preview_button&&cf.preview_button.disabled)
cf.preview_button.disabled=false;}
mtRequestSubmitted=false;}
return true;}
mtAttachEvent('usersignin',mtUserOnLoad);function mtSignIn(){var doc_url=document.URL;doc_url=doc_url.replace(/#.+/,'');var url='http://adventureivan.com/mt/mt-cp.cgi?__mode=login&blog_id=1';if(is_preview){if(document['comments_form']){var entry_id=document['comments_form'].entry_id.value;url+='&entry_id='+entry_id;}else{url+='&return_url=http%3A%2F%2Fadventureivan.com%2F';}}else{url+='&return_url='+encodeURIComponent(doc_url);}
mtClearUser();location.href=url;}
function mtSignInOnClick(sign_in_element){var el;if(sign_in_element){el=document.getElementById(sign_in_element);if(!el)
el=document.getElementById('comment-form-external-auth');}
if(el)
el.innerHTML='Signing in... <span class="status-indicator">&nbsp;</span>';mtClearUser();mtFetchUser('mtSetUserOrLogin');return false;}
function mtSetUserOrLogin(u){if(u&&u.is_authenticated){mtSetUser(u);}else{mtSignIn();}}
function mtSignOut(entry_id){mtClearUser();var doc_url=document.URL;doc_url=doc_url.replace(/#.+/,'');var url='http://adventureivan.com/mt/mt-cp.cgi?__mode=logout&static=0';if(is_preview){if(document['comments_form']){var entry_id=document['comments_form'].entry_id.value;url+='&entry_id='+entry_id;}else{url+='&return_url=http%3A%2F%2Fadventureivan.com%2F';}}else{url+='&return_url='+encodeURIComponent(doc_url);}
location.href=url;}
function mtSignOutOnClick(){mtSignOut();return false;}
function mtShowGreeting(){var reg_reqd=false;var cf=document['comments_form'];if(!cf)return;var el=document.getElementById('comment-greeting');if(!el)
el=document.getElementById('comment-form-external-auth');if(!el)return;var eid=cf.entry_id;var entry_id;if(eid)entry_id=eid.value;var phrase;var u=mtGetUser();if(u&&u.is_authenticated){if(u.is_banned){phrase='You do not have permission to comment on this blog. (\<a href=\"javas\cript:void(0);\" onclick=\"return mtSignOutOnClick();\"\>sign out\<\/a\>)';}else{var user_link;if(u.is_author){user_link='<a href="http://adventureivan.com/mt/mt-comments.cgi?__mode=edit_profile&return_url='+encodeURIComponent(location.href);user_link+='">'+u.name+'</a>';}else{if(u.url)
user_link='<a href="'+u.url+'">'+u.name+'</a>';else
user_link=u.name;}
phrase='Thanks for signing in, __NAME__. (\<a href=\"javas\cript:void(0)\" onclick=\"return mtSignOutOnClick();\"\>sign out\<\/a\>)';phrase=phrase.replace(/__NAME__/,user_link);}}else{if(reg_reqd){phrase='\<a href=\"javas\cript:void(0)\" onclick=\"return mtSignInOnClick(\'comment-greeting\')\"\>Sign in\<\/a\> to comment.';}else{phrase='\<a href=\"javas\cript:void(0)\" onclick=\"return mtSignInOnClick(\'comment-greeting\')\"\>Sign in\<\/a\> to comment, or comment anonymously.';}}
el.innerHTML=phrase;}
function mtReplyCommentOnClick(parent_id,author){mtShow('comment-form-reply');var checkbox=document.getElementById('comment-reply');var label=document.getElementById('comment-reply-label');var text=document.getElementById('comment-text');var reply_text='Replying to \<a href=\"#comment-__PARENT__\" onclick=\"location.href=this.href; return false\"\>comment from __AUTHOR__\<\/a\>';reply_text=reply_text.replace(/__PARENT__/,parent_id);reply_text=reply_text.replace(/__AUTHOR__/,author);label.innerHTML=reply_text;checkbox.value=parent_id;checkbox.checked=true;try{text.focus();}catch(e){}
mtSetCommentParentID();}
function mtSetCommentParentID(){var checkbox=document.getElementById('comment-reply');var parent_id_field=document.getElementById('comment-parent-id');if(!checkbox||!parent_id_field)return;var pid=0;if(checkbox.checked==true)
pid=checkbox.value;parent_id_field.value=pid;}
function mtSaveUser(f){if(is_preview)return;var u=mtGetUser();if(f&&(!u||u.is_anonymous)){if(!u){u={};u.is_authenticated=false;u.can_comment=true;u.is_author=false;u.is_banned=false;u.is_anonymous=true;u.is_trusted=false;}
if(f.author!=undefined)u.name=f.author.value;if(f.email!=undefined)u.email=f.email.value;if(f.url!=undefined)u.url=f.url.value;}
if(!u)return;var cache_period=mtCookieTimeout*1000;if(u.is_anonymous&&f&&f.bakecookie&&f.bakecookie.checked)
cache_period=365*24*60*60*1000;var now=new Date();mtFixDate(now);now.setTime(now.getTime()+cache_period);var cmtcookie=mtBakeUserCookie(u);mtSetCookie(mtCookieName,cmtcookie,now,mtCookiePath,mtCookieDomain,location.protocol=='https:');}
function mtClearUser(){user=null;mtDeleteCookie(mtCookieName,mtCookiePath,mtCookieDomain,location.protocol=='https:');}
function mtSetCookie(name,value,expires,path,domain,secure){if(domain&&domain.match(/^\.?localhost$/))
domain=null;var curCookie=name+"="+escape(value)+
(expires?"; expires="+expires.toGMTString():"")+
(path?"; path="+path:"")+
(domain?"; domain="+domain:"")+
(secure?"; secure":"");document.cookie=curCookie;}
function mtGetCookie(name){var prefix=name+'=';var c=document.cookie;var cookieStartIndex=c.indexOf(prefix);if(cookieStartIndex==-1)
return'';var cookieEndIndex=c.indexOf(";",cookieStartIndex+prefix.length);if(cookieEndIndex==-1)
cookieEndIndex=c.length;return unescape(c.substring(cookieStartIndex+prefix.length,cookieEndIndex));}
function mtDeleteCookie(name,path,domain,secure){if(mtGetCookie(name)){if(domain&&domain.match(/^\.?localhost$/))
domain=null;document.cookie=name+"="+
(path?"; path="+path:"")+
(domain?"; domain="+domain:"")+
(secure?"; secure":"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT";}}
function mtFixDate(date){var skew=(new Date(0)).getTime();if(skew>0)
date.setTime(date.getTime()-skew);}
function mtGetXmlHttp(){if(!window.XMLHttpRequest){window.XMLHttpRequest=function(){var types=["Microsoft.XMLHTTP","MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP"];for(var i=0;i<types.length;i++){try{return new ActiveXObject(types[i]);}catch(e){}}
return undefined;};}
if(window.XMLHttpRequest)
return new XMLHttpRequest();}
function mtInit(){if(arguments.callee.done)return;arguments.callee.done=true;if(window._timer)clearInterval(window._timer);if(window.onload&&(window.onload!==window.mtInit)){window.onload();window.onload=function(){};}}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",mtInit,false);}
if(/WebKit/i.test(navigator.userAgent)){_timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){mtInit();}},10);}
window.onload=mtInit;var clearCookie=(window.location.hash&&window.location.hash.match(/^#_log(in|out)/))?true:false;if(clearCookie){mtClearUser();if(RegExp.$1=='in')
mtFetchUser();}else{if(is_preview&&!user)
mtFetchUser();}

(function(b,ib){var t="none",M="LoadedContent",c=false,v="resize.",o="y",q="auto",e=true,L="nofollow",m="x";function f(a,c){a=a?' id="'+i+a+'"':"";c=c?' style="'+c+'"':"";return b("<div"+a+c+"/>")}function p(a,b){b=b===m?n.width():n.height();return typeof a==="string"?Math.round(/%/.test(a)?b/100*parseInt(a,10):parseInt(a,10)):a}function U(b){return a.photo||/\.(gif|png|jpg|jpeg|bmp)(?:\?([^#]*))?(?:#(\.*))?$/i.test(b)}function cb(a){for(var c in a)if(b.isFunction(a[c])&&c.substring(0,2)!=="on")a[c]=a[c].call(l);a.rel=a.rel||l.rel||L;a.href=a.href||b(l).attr("href");a.title=a.title||l.title;return a}function w(c,a){a&&a.call(l);b.event.trigger(c)}function jb(){var b,e=i+"Slideshow_",c="click."+i,f,k;if(a.slideshow&&h[1]){f=function(){F.text(a.slideshowStop).unbind(c).bind(V,function(){if(g<h.length-1||a.loop)b=setTimeout(d.next,a.slideshowSpeed)}).bind(W,function(){clearTimeout(b)}).one(c+" "+N,k);j.removeClass(e+"off").addClass(e+"on");b=setTimeout(d.next,a.slideshowSpeed)};k=function(){clearTimeout(b);F.text(a.slideshowStart).unbind([V,W,N,c].join(" ")).one(c,f);j.removeClass(e+"on").addClass(e+"off")};a.slideshowAuto?f():k()}}function db(c){if(!O){l=c;a=cb(b.extend({},b.data(l,r)));h=b(l);g=0;if(a.rel!==L){h=b("."+G).filter(function(){return (b.data(this,r).rel||this.rel)===a.rel});g=h.index(l);if(g===-1){h=h.add(l);g=h.length-1}}if(!u){u=D=e;j.show();if(a.returnFocus)try{l.blur();b(l).one(eb,function(){try{this.focus()}catch(a){}})}catch(f){}x.css({opacity:+a.opacity,cursor:a.overlayClose?"pointer":q}).show();a.w=p(a.initialWidth,m);a.h=p(a.initialHeight,o);d.position(0);X&&n.bind(v+P+" scroll."+P,function(){x.css({width:n.width(),height:n.height(),top:n.scrollTop(),left:n.scrollLeft()})}).trigger("scroll."+P);w(fb,a.onOpen);Y.add(H).add(I).add(F).add(Z).hide();ab.html(a.close).show()}d.load(e)}}var gb={transition:"elastic",speed:300,width:c,initialWidth:"600",innerWidth:c,maxWidth:c,height:c,initialHeight:"450",innerHeight:c,maxHeight:c,scalePhotos:e,scrolling:e,inline:c,html:c,iframe:c,photo:c,href:c,title:c,rel:c,opacity:.9,preloading:e,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:c,returnFocus:e,loop:e,slideshow:c,slideshowAuto:e,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:c,onLoad:c,onComplete:c,onCleanup:c,onClosed:c,overlayClose:e,escKey:e,arrowKey:e},r="colorbox",i="cbox",fb=i+"_open",W=i+"_load",V=i+"_complete",N=i+"_cleanup",eb=i+"_closed",Q=i+"_purge",hb=i+"_loaded",E=b.browser.msie&&!b.support.opacity,X=E&&b.browser.version<7,P=i+"_IE6",x,j,A,s,bb,T,R,S,h,n,k,J,K,Z,Y,F,I,H,ab,B,C,y,z,l,g,a,u,D,O=c,d,G=i+"Element";d=b.fn[r]=b[r]=function(c,f){var a=this,d;if(!a[0]&&a.selector)return a;c=c||{};if(f)c.onComplete=f;if(!a[0]||a.selector===undefined){a=b("<a/>");c.open=e}a.each(function(){b.data(this,r,b.extend({},b.data(this,r)||gb,c));b(this).addClass(G)});d=c.open;if(b.isFunction(d))d=d.call(a);d&&db(a[0]);return a};d.init=function(){var l="hover",m="clear:left";n=b(ib);j=f().attr({id:r,"class":E?i+"IE":""});x=f("Overlay",X?"position:absolute":"").hide();A=f("Wrapper");s=f("Content").append(k=f(M,"width:0; height:0; overflow:hidden"),K=f("LoadingOverlay").add(f("LoadingGraphic")),Z=f("Title"),Y=f("Current"),I=f("Next"),H=f("Previous"),F=f("Slideshow").bind(fb,jb),ab=f("Close"));A.append(f().append(f("TopLeft"),bb=f("TopCenter"),f("TopRight")),f(c,m).append(T=f("MiddleLeft"),s,R=f("MiddleRight")),f(c,m).append(f("BottomLeft"),S=f("BottomCenter"),f("BottomRight"))).children().children().css({"float":"left"});J=f(c,"position:absolute; width:9999px; visibility:hidden; display:none");b("body").prepend(x,j.append(A,J));s.children().hover(function(){b(this).addClass(l)},function(){b(this).removeClass(l)}).addClass(l);B=bb.height()+S.height()+s.outerHeight(e)-s.height();C=T.width()+R.width()+s.outerWidth(e)-s.width();y=k.outerHeight(e);z=k.outerWidth(e);j.css({"padding-bottom":B,"padding-right":C}).hide();I.click(d.next);H.click(d.prev);ab.click(d.close);s.children().removeClass(l);b("."+G).live("click",function(a){if(!(a.button!==0&&typeof a.button!=="undefined"||a.ctrlKey||a.shiftKey||a.altKey)){a.preventDefault();db(this)}});x.click(function(){a.overlayClose&&d.close()});b(document).bind("keydown",function(b){if(u&&a.escKey&&b.keyCode===27){b.preventDefault();d.close()}if(u&&a.arrowKey&&!D&&h[1])if(b.keyCode===37&&(g||a.loop)){b.preventDefault();H.click()}else if(b.keyCode===39&&(g<h.length-1||a.loop)){b.preventDefault();I.click()}})};d.remove=function(){j.add(x).remove();b("."+G).die("click").removeData(r).removeClass(G)};d.position=function(f,d){function b(a){bb[0].style.width=S[0].style.width=s[0].style.width=a.style.width;K[0].style.height=K[1].style.height=s[0].style.height=T[0].style.height=R[0].style.height=a.style.height}var e,h=Math.max(document.documentElement.clientHeight-a.h-y-B,0)/2+n.scrollTop(),g=Math.max(n.width()-a.w-z-C,0)/2+n.scrollLeft();e=j.width()===a.w+z&&j.height()===a.h+y?0:f;A[0].style.width=A[0].style.height="9999px";j.dequeue().animate({width:a.w+z,height:a.h+y,top:h,left:g},{duration:e,complete:function(){b(this);D=c;A[0].style.width=a.w+z+C+"px";A[0].style.height=a.h+y+B+"px";d&&d()},step:function(){b(this)}})};d.resize=function(b){if(u){b=b||{};if(b.width)a.w=p(b.width,m)-z-C;if(b.innerWidth)a.w=p(b.innerWidth,m);k.css({width:a.w});if(b.height)a.h=p(b.height,o)-y-B;if(b.innerHeight)a.h=p(b.innerHeight,o);if(!b.innerHeight&&!b.height){b=k.wrapInner("<div style='overflow:auto'></div>").children();a.h=b.height();b.replaceWith(b.children())}k.css({height:a.h});d.position(a.transition===t?0:a.speed)}};d.prep=function(m){var c="hidden";function l(s){var p,f,m,c,l=h.length,q=a.loop;d.position(s,function(){function s(){E&&j[0].style.removeAttribute("filter")}if(u){E&&o&&k.fadeIn(100);k.show();w(hb);Z.show().html(a.title);if(l>1){typeof a.current==="string"&&Y.html(a.current.replace(/\{current\}/,g+1).replace(/\{total\}/,l)).show();I[q||g<l-1?"show":"hide"]().html(a.next);H[q||g?"show":"hide"]().html(a.previous);p=g?h[g-1]:h[l-1];m=g<l-1?h[g+1]:h[0];a.slideshow&&F.show();if(a.preloading){c=b.data(m,r).href||m.href;f=b.data(p,r).href||p.href;c=b.isFunction(c)?c.call(m):c;f=b.isFunction(f)?f.call(p):f;if(U(c))b("<img/>")[0].src=c;if(U(f))b("<img/>")[0].src=f}}K.hide();a.transition==="fade"?j.fadeTo(e,1,function(){s()}):s();n.bind(v+i,function(){d.position(0)});w(V,a.onComplete)}})}if(u){var o,e=a.transition===t?0:a.speed;n.unbind(v+i);k.remove();k=f(M).html(m);k.hide().appendTo(J.show()).css({width:function(){a.w=a.w||k.width();a.w=a.mw&&a.mw<a.w?a.mw:a.w;return a.w}(),overflow:a.scrolling?q:c}).css({height:function(){a.h=a.h||k.height();a.h=a.mh&&a.mh<a.h?a.mh:a.h;return a.h}()}).prependTo(s);J.hide();b("#"+i+"Photo").css({cssFloat:t,marginLeft:q,marginRight:q});X&&b("select").not(j.find("select")).filter(function(){return this.style.visibility!==c}).css({visibility:c}).one(N,function(){this.style.visibility="inherit"});a.transition==="fade"?j.fadeTo(e,0,function(){l(0)}):l(e)}};d.load=function(u){var n,c,s,q=d.prep;D=e;l=h[g];u||(a=cb(b.extend({},b.data(l,r))));w(Q);w(W,a.onLoad);a.h=a.height?p(a.height,o)-y-B:a.innerHeight&&p(a.innerHeight,o);a.w=a.width?p(a.width,m)-z-C:a.innerWidth&&p(a.innerWidth,m);a.mw=a.w;a.mh=a.h;if(a.maxWidth){a.mw=p(a.maxWidth,m)-z-C;a.mw=a.w&&a.w<a.mw?a.w:a.mw}if(a.maxHeight){a.mh=p(a.maxHeight,o)-y-B;a.mh=a.h&&a.h<a.mh?a.h:a.mh}n=a.href;K.show();if(a.inline){f().hide().insertBefore(b(n)[0]).one(Q,function(){b(this).replaceWith(k.children())});q(b(n))}else if(a.iframe){j.one(hb,function(){var c=b("<iframe frameborder='0' style='width:100%; height:100%; border:0; display:block'/>")[0];c.name=i+ +new Date;c.src=a.href;if(!a.scrolling)c.scrolling="no";if(E)c.allowtransparency="true";b(c).appendTo(k).one(Q,function(){c.src="//about:blank"})});q(" ")}else if(a.html)q(a.html);else if(U(n)){c=new Image;c.onload=function(){var e;c.onload=null;c.id=i+"Photo";b(c).css({border:t,display:"block",cssFloat:"left"});if(a.scalePhotos){s=function(){c.height-=c.height*e;c.width-=c.width*e};if(a.mw&&c.width>a.mw){e=(c.width-a.mw)/c.width;s()}if(a.mh&&c.height>a.mh){e=(c.height-a.mh)/c.height;s()}}if(a.h)c.style.marginTop=Math.max(a.h-c.height,0)/2+"px";h[1]&&(g<h.length-1||a.loop)&&b(c).css({cursor:"pointer"}).click(d.next);if(E)c.style.msInterpolationMode="bicubic";setTimeout(function(){q(c)},1)};setTimeout(function(){c.src=n},1)}else n&&J.load(n,function(d,c,a){q(c==="error"?"Request unsuccessful: "+a.statusText:b(this).children())})};d.next=function(){if(!D){g=g<h.length-1?g+1:0;d.load()}};d.prev=function(){if(!D){g=g?g-1:h.length-1;d.load()}};d.close=function(){if(u&&!O){O=e;u=c;w(N,a.onCleanup);n.unbind("."+i+" ."+P);x.fadeTo("fast",0);j.stop().fadeTo("fast",0,function(){w(Q);k.remove();j.add(x).css({opacity:1,cursor:q}).hide();setTimeout(function(){O=c;w(eb,a.onClosed)},1)})}};d.element=function(){return b(l)};d.settings=gb;b(d.init)})(jQuery,this);
$(document).ready(function(){$('a[href$=jpg]').colorbox({transition:"elastic",height:"95%"});$('a[rel="image"]').colorbox({transition:"elastic",height:"95%"});$("#popular").tabs();$('#first-time-header').click(function(){$('#first-time-body').fadeToggle();});});

