(function(){window.BlogEngine = BlogEngine ={$: function(id){return document.getElementById(id);},webRoot: '',i18n:{hasRated: '',savingTheComment: '',comments: '',commentWasSaved: '',commentWaitingModeration: '',cancel: '',filter: '',apmlDescription: ''},setFlag: function(iso){if (iso.length > 0){BlogEngine.comments.flagImage.src = BlogEngine.webRoot + "pics/flags/" + iso + ".png";}else{BlogEngine.comments.flagImage.src = BlogEngine.webRoot + "pics/pixel.gif";}},showCommentPreview: function(){this.$('preview').className = 'selected';this.$('compose').className = '';this.$('commentCompose').style.display = 'none';var preview = this.$('commentPreview');preview.style.display = 'block';preview.innerHTML = '<img src="' + BlogEngine.webRoot + 'pics/ajax-loader.gif" alt="Loading" />';this.addComment(true);},composeComment: function(){this.$('preview').className = '';this.$('compose').className = 'selected';this.$('commentPreview').style.display = 'none';this.$('commentCompose').style.display = 'block';},endShowPreview: function(arg,context){BlogEngine.$('commentPreview').innerHTML = arg;},addComment: function(preview){var isPreview = preview == true;if (!isPreview){this.$("btnSaveAjax").disabled = true;this.$("ajaxLoader").style.display = "inline";this.$("status").className = "";this.$("status").innerHTML = BlogEngine.i18n.savingTheComment;}var author = BlogEngine.comments.nameBox.value,email = BlogEngine.comments.emailBox.value,website = BlogEngine.comments.websiteBox.value,country = BlogEngine.comments.countryDropDown ? BlogEngine.comments.countryDropDown.value : "",content = BlogEngine.comments.contentBox.value,notify = BlogEngine.$("cbNotify").checked,captcha = BlogEngine.comments.captchaField.value,replyToId = BlogEngine.comments.replyToId ? BlogEngine.comments.replyToId.value : "",callback = isPreview ? BlogEngine.endShowPreview : BlogEngine.appendComment,argument = author + "-|-" + email + "-|-" + website + "-|-" + country + "-|-" + content + "-|-" + notify + "-|-" + isPreview + "-|-" + captcha + "-|-" + replyToId;WebForm_DoCallback('ctl00$cphBody$CommentView1',argument,callback,'comment',null,false);if (!isPreview && typeof (OnComment) != "undefined")
OnComment(author,email,website,country,content);},cancelReply: function(){this.replyToComment('');},replyToComment: function(id){BlogEngine.comments.replyToId.value = id;var commentForm = BlogEngine.$('comment-form');if (!id || id == '' || id == null || id == '00000000-0000-0000-0000-000000000000'){var base = BlogEngine.$("commentlist");base.appendChild(commentForm);BlogEngine.$('cancelReply').style.display = 'none';}else{BlogEngine.$('cancelReply').style.display = '';var parentComment = BlogEngine.$('id_' + id);var replies = BlogEngine.$('replies_' + id);if (replies == null){replies = document.createElement('div');replies.className = 'comment-replies';replies.setAttribute('id') = 'replies_' + id;parentComment.appendChild(replies);}replies.style.display = '';replies.appendChild(commentForm);BlogEngine.comments.nameBox.focus();}},appendComment: function(args,context){if (context == "comment"){var commentList = BlogEngine.$("commentlist");if (commentList.innerHTML.length < 10)
commentList.innerHTML = "<h1 id='comment'>" + BlogEngine.i18n.comments + "</h1>"
var id = BlogEngine.comments.replyToId ? BlogEngine.comments.replyToId.value : '';if (id != ''){var replies = BlogEngine.$('replies_' + id);replies.innerHTML += args;}else{commentList.innerHTML += args;commentList.style.display = 'block';}BlogEngine.comments.contentBox.value = "";BlogEngine.comments.contentBox = BlogEngine.$(BlogEngine.comments.contentBox.id);BlogEngine.$("ajaxLoader").style.display = "none";BlogEngine.$("status").className = "success";if (!BlogEngine.comments.moderation){BlogEngine.$("status").innerHTML = BlogEngine.i18n.commentWasSaved;}else{BlogEngine.$("status").innerHTML = BlogEngine.i18n.commentWaitingModeration;}BlogEngine.composeComment();var commentForm = BlogEngine.$('comment-form');commentList.appendChild(commentForm);if (BlogEngine.comments.replyToId){BlogEngine.comments.replyToId.value = '';}var cancelReply = BlogEngine.$('cancelReply');if (cancelReply){cancelReply.style.display = 'none';}}BlogEngine.$("btnSaveAjax").disabled = false;},checkAuthorName: function(sender,args){args.IsValid = true;if (BlogEngine.comments.checkName){args.IsValid = !this.equal(BlogEngine.comments.postAuthor,BlogEngine.comments.nameBox.value);}},addBbCode: function(v){try{var contentBox = BlogEngine.comments.contentBox;if (contentBox.selectionStart){var pretxt = contentBox.value.substring(0,contentBox.selectionStart),therest = contentBox.value.substr(contentBox.selectionEnd),sel = contentBox.value.substring(contentBox.selectionStart,contentBox.selectionEnd);contentBox.value = pretxt + "[" + v + "]" + sel + "[/" + v + "]" + therest;contentBox.focus();}else if (document.selection && document.selection.createRange){var str = document.selection.createRange().text;contentBox.focus();var sel = document.selection.createRange();sel.text = "[" + v + "]" + str + "[/" + v + "]";}}catch (ex){}return;},search: function(root){var input = this.$("sp-searchtext"),check = this.$("searchcomments"),search = "search.aspx?q=" + encodeURIComponent(input.value);if (check != null && check.checked){search += "&comment=true";}top.location.href = root + search;return false;},searchClear: function(defaultText){var input = this.$("sp-searchtext");if (input.value == defaultText){input.value = "";}else if (input.value == ""){input.value = defaultText;}},rate: function(id,rating){this.createCallback("rating.axd?id=" + id + "&rating=" + rating,BlogEngine.ratingCallback);},ratingCallback: function(response){var rating = response.substring(0,1),status = response.substring(1);if (status == "OK"){if (typeof OnRating != "undefined"){OnRating(rating);}alert("Your rating has been registered. Thank you!");}else if (status == "HASRATED"){alert(BlogEngine.i18n.hasRated);}else{alert("An error occured while registering your rating. Please try again");}},createCallback: function(url,callback){var http = BlogEngine.getHttpObject();http.open("GET",url,true);http.onreadystatechange = function(){if (http.readyState == 4){if (http.responseText.length > 0 && callback != null){callback(http.responseText);}}};http.send(null);},getHttpObject: function(){if (typeof XMLHttpRequest != 'undefined'){return new XMLHttpRequest();}try{return new ActiveXObject("Msxml2.XMLHTTP");}catch (e){try{return new ActiveXObject("Microsoft.XMLHTTP");}catch (e){}}return false;},updateCalendar: function(args,context){var cal = BlogEngine.$('calendarContainer');cal.innerHTML = args;BlogEngine.Calendar.months[context] = args;},toggleMonth: function(year){var monthList = BlogEngine.$("monthList"),years = monthList.getElementsByTagName("ul"),i=0,l=years.length;for (;i < l;++i){var yi=years[i];if (yi.id == year){var state = yi.className == "open" ? "" : "open";yi.className = state;break;}}},equal: function(first,second){var clearSpaceRegEx = new RegExp("\s","g");return first.toLowerCase().replace(clearSpaceRegEx,'') == second.toLowerCase().replace(clearSpaceRegEx,'')},xfnRelationships: ['friend','acquaintance','contact','met','co-worker','colleague','co-resident','neighbor','child','parent','sibling','spouse','kin','muse','crush','date','sweetheart','me'],hightLightXfn: function(){var content = BlogEngine.$('content');if (content == null){return;}var links = content.getElementsByTagName('a'),i=0,l=links.length;for (;i < l;++i){var link = links[i],rel = link.getAttribute('rel');if (rel && rel != "nofollow"){var j = 0,x=BlogEngine.xfnRelationships,xl=x.length;for (;j<xl;++j){if (rel.indexOf(x[j]) > -1){link.title = 'XFN relationship: ' + rel;break;}}}}},englishNumber: ['one-star','two-stars','three-stars','four-stars','five-stars'],showRating: function(container,id,raters,rating){var div = document.createElement('div');div.className = 'rating';var p = document.createElement('p');div.appendChild(p);if (raters == 0){p.innerHTML = 'Be the first to rate this post';}else{p.innerHTML = 'Currently rated ' + new Number(rating).toFixed(1) + ' by ' + raters + ' people';}var ul = document.createElement('ul');ul.className = 'star-rating small-star';div.appendChild(ul);var li = document.createElement('li');li.className = 'current-rating';li.style.width = Math.round(rating * 20) + '%';li.innerHTML = 'Currently ' + rating + '/5 Stars.';ul.appendChild(li);for (var i = 0;i < 5;i){var l = document.createElement('li'),a = document.createElement('a');a.className = this.englishNumber[i++];a.innerHTML = i;a.href = 'rate/' + i;a.title = "Rate this " + i + " star" + (i === 1 ? "" : "s") + " out of 5";a.onclick = function(){BlogEngine.rate(id,this.innerHTML);return false;};l.appendChild(a);ul.appendChild(l);}container.innerHTML = '';container.appendChild(div);container.style.visibility = 'visible';},applyRatings: function(){var BEshowRating = function(results){var args = results.innerHTML.split('|');BlogEngine.showRating(results,args[0],args[1],args[2]);},className="ratingcontainer",i=0,l;if (document.getElementsByClassName){var results = document.getElementsByClassName(className);for(l=results.length;i<l;++i){BEshowRating(results[i]);}}else if (document.evaluate){var query = document.evaluate(".//div[contains(concat(' ', @class, ' '), ' ratingcontainer ')]",document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for (l=query.snapshotLength;i<l;++i){BEshowRating(query.snapshotItem(i));}}else{var nodes = document.getElementsByTagName("div"),pattern = new RegExp("(^|\\s)ratingcontainer(\\s|$)");for (l=nodes.length;i<l;++i){var nodes_i=nodes[i];if(pattern.test(nodes_i.className)){BEshowRating(nodes_i);}}}},addLoadEvent: function(func){var oldonload = window.onload;if (typeof window.onload != 'function'){window.onload = func;}else{window.onload = function(){oldonload();func();}}},filterByAPML: function(){var width = document.documentElement.clientWidth + document.documentElement.scrollLeft,height = document.documentElement.clientHeight + document.documentElement.scrollTop;document.body.style.position = 'static';var layer = document.createElement('div');layerStyle=layer.style;layerStyle.zIndex = 9999;layer.id = 'layer';layerStyle.position = 'absolute';layerStyle.top='0';layerStyle.left='0';layerStyle.height = document.documentElement.scrollHeight + 'px';layerStyle.width = width + 'px';layerStyle.backgroundColor = 'black';layerStyle.opacity = '.6';layerStyle.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");document.body.appendChild(layer);var div = document.createElement('div'),divStyle=div.style;divStyle.zIndex = 10000;div.id = 'apmlfilter';divStyle.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed';divStyle.top = '200px';divStyle.left = (width / 2) - 200 + 'px';divStyle.height = '50px';divStyle.width = '400px';divStyle.backgroundColor = '#fff';divStyle.border = '2px solid silver';divStyle.padding = '20px';document.body.appendChild(div);var p = document.createElement('p');p.innerHTML = BlogEngine.i18n.apmlDescription;p.style.margin='0';div.appendChild(p);var form = document.createElement('form');form.method = 'get';form.style.display = 'inline';form.action = BlogEngine.webRoot;div.appendChild(form);var textbox = document.createElement('input'),textboxStyle = textbox.style;textbox.type = 'text';textbox.value = BlogEngine.getCookieValue('url') || 'http://';textboxStyle.width = '320px';textbox.id = 'txtapml';textbox.name = 'apml';textboxStyle.background = 'url(' + BlogEngine.webRoot + 'pics/apml.png) no-repeat 2px center';textboxStyle.paddingLeft = '16px';form.appendChild(textbox);textbox.focus();var button = document.createElement('input');button.type = 'submit';button.value = BlogEngine.i18n.filter;button.onclick = function(){location.href = BlogEngine.webRoot + '?apml=' + encodeURIComponent(BlogEngine.$('txtapml').value);};form.appendChild(button);var br = document.createElement('br');div.appendChild(br);var a = document.createElement('a');a.innerHTML = BlogEngine.i18n.cancel;a.href = '#';a.onclick = function(){document.body.removeChild(BlogEngine.$('layer'));document.body.removeChild(BlogEngine.$('apmlfilter'));document.body.style.position = '';return false;};div.appendChild(a);},getCookieValue: function(name){var cookie = new String(document.cookie);if (cookie != null && cookie.indexOf('comment=') > -1){var start = cookie.indexOf(name + '=') + name.length + 1;var end = cookie.indexOf('&',start);if (end > start && start > -1)
return cookie.substring(start,end);}return null;},comments:{flagImage: null,contentBox: null,moderation: null,checkName: null,postAuthor: null,nameBox: null,emailBox: null,websiteBox: null,countryDropDown: null,captchaField: null,controlId: null,replyToId: null}};function init(){if (arguments.callee.done){return;}arguments.callee.done = true;BlogEngine.hightLightXfn();BlogEngine.applyRatings();if (typeof ($) == 'undefined'){window.$ = BlogEngine.$;}if (typeof (registerCommentBox) != 'undefined'){registerCommentBox();}if (typeof (registerVariables) != 'undefined'){registerVariables();}if (typeof (setupBlogEngineCalendar) != 'undefined'){setupBlogEngineCalendar();}}if (document.addEventListener){document.addEventListener('DOMContentLoaded',init,false);}(function(){/*@cc_on
if (document.body){try{document.createElement('div').doScroll('left');return init();}catch(e){}}/*@if (false) @*/
if (/loaded|complete/.test(document.readyState)){return init();}/*@end @*/
if (!init.done){window.setTimeout(arguments.callee,50);}})();_prevOnload = window.onload;window.onload = function(){if (typeof _prevOnload === 'function'){_prevOnload();}init();};})();