(function(){var xmlHttp;var year='';var authorId='';function getXmlHttpObject(){var xmlHttp=null;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');}}
return xmlHttp;}
function change(){xmlHttp=getXmlHttpObject();if(xmlHttp==null){alert('Oop! Browser does not support HTTP Request.')
return;}
var url=aeGlobal.serverUrl+'/?action=ea_monthly_ajax'
+'&year='+year
+'&author='+authorId;xmlHttp.onreadystatechange=runChange;xmlHttp.open('GET',url,true);xmlHttp.setRequestHeader('Content-type','charset=UTF-8');xmlHttp.send(null);}
function runChange(){var archives=document.getElementById('easy-archives');var filter=getElementsByClassName('filter','div',archives)[0];if(xmlHttp.readyState<4&&!document.getElementById('ea-loader')){document.body.style.cursor='wait';var loadingText=(aeGlobal.loadingText==undefined)?'Loading...':aeGlobal.loadingText+'...';if(filter){filter.innerHTML='<div id="ea-loader" class="ea-loader">'+loadingText+'</div>';}}else if(xmlHttp.readyState==4||xmlHttp.readyState=='complete'){archives.innerHTML=xmlHttp.responseText;document.body.style.cursor='auto';bindActions();}}
function changeYear(select){year=select.value;change();}
function changeAuthor(select){authorId=select.value;change();}
function toggle(button){var parent=button.parentNode;var dailyArchives=parent.nextSibling;if(button.className=='ea-open-button'){button.className='ea-closed-button';dailyArchives.className='ea-closed';}else{button.className='ea-open-button';dailyArchives.className='ea-open';}}
function expandAll(){var elements=getElementsByClassName('ea-closed-button','a',document.getElementById('easy-archives'));for(var i=0;i<elements.length;i++){toggle(elements[i]);}}
function collapseAll(target){var elements=getElementsByClassName('ea-open-button','a',document.getElementById('easy-archives'));for(var i=0;i<elements.length;i++){toggle(elements[i]);}}
function getElementsByClassName(className,tag,parent){var allTags=(tag=='*'&&parent.all)?parent.all:parent.getElementsByTagName(tag);var matchingElements=new Array();className=className.replace(/\-/g,'\\-');var regex=new RegExp('(^|\\s)'+className+'(\\s|$)');var element;for(var i=0;i<allTags.length;i++){element=allTags[i];if(regex.test(element.className)){matchingElements.push(element);}}
return matchingElements;}
function addEvent(node,type,listener){if(node.addEventListener){node.addEventListener(type,listener,false);return true;}else if(node.attachEvent){node['e'+type+listener]=listener;node[type+listener]=function(){node['e'+type+listener](window.event);};node.attachEvent('on'+type,node[type+listener]);return true;}
return false;}
function bindActions(){var wrap=document.getElementById('easy-archives');var openButtons=getElementsByClassName('ea-open-button','a',wrap);for(var i=0;i<openButtons.length;i++){var openButton=openButtons[i];addEvent(openButton,'click',function(ev){toggle(this);});}
var closedButtons=getElementsByClassName('ea-closed-button','a',wrap);for(var i=0;i<closedButtons.length;i++){var closedButton=closedButtons[i];addEvent(closedButton,'click',function(ev){toggle(this);});}
var expandButton=getElementsByClassName('ea-expand-all','input',wrap);if(expandButton.length==1){expandButton=expandButton[0];addEvent(expandButton,'click',function(ev){expandAll();});}
var collapseButton=getElementsByClassName('ea-collapse-all','input',wrap);if(collapseButton.length==1){collapseButton=collapseButton[0];addEvent(collapseButton,'click',function(ev){collapseAll();});}
var yearSelector=getElementsByClassName('ea-year-selector','select',wrap);if(yearSelector.length==1){yearSelector=yearSelector[0];addEvent(yearSelector,'change',function(ev){changeYear(this);});}
var authorSelector=getElementsByClassName('ea-author-selector','select',wrap);if(authorSelector.length==1){authorSelector=authorSelector[0];addEvent(authorSelector,'change',function(ev){changeAuthor(this);});}}
function initPage(){var wrap=document.getElementById('easy-archives');var yearSelector=getElementsByClassName('ea-year-selector','select',wrap);if(yearSelector.length==1){yearSelector=yearSelector[0];yearSelector.selectedIndex=0;}
var authorSelector=getElementsByClassName('ea-author-selector','select',wrap);if(authorSelector.length==1){authorSelector=authorSelector[0];authorSelector.selectedIndex=0;}
bindActions();}
if(document.addEventListener){document.addEventListener("DOMContentLoaded",initPage,false);}else if(/MSIE/i.test(navigator.userAgent)){document.write('<script id="__ie_onload_for_wp_easyarchive" defer src="javascript:void(0)"></script>');var script=document.getElementById('__ie_onload_for_inove');script.onreadystatechange=function(){if(this.readyState=='complete'){initPage();}}}else if(/WebKit/i.test(navigator.userAgent)){var _timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){clearInterval(_timer);initPage();}},10);}else{window.onload=function(e){initPage();}}})();