BlogEngine ={$: function (id){return document.getElementById(id);},webRoot: '',i18n:{hasRated: '',savingTheComment: '',comments: '',commentWasSaved: '',commentWaitingModeration: '',cancel: '',filter: '',apmlDescription: ''},searchUrlBase: '',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';this.$('commentPreview').style.display = 'block';this.$('commentPreview').innerHTML = '<img src="' + BlogEngine.webRoot + 'pics/ajax-loader.gif" alt="Loading" />';var argument = this.$('commentPreview').innerHTML;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;var email = BlogEngine.comments.emailBox.value;var website = BlogEngine.comments.websiteBox.value;var country = BlogEngine.comments.countryDropDown ? BlogEngine.comments.countryDropDown.value : "";var content = BlogEngine.comments.contentBox.value;var notify = BlogEngine.$("cbNotify").checked;var captcha = BlogEngine.comments.captchaField.value;var replyToId = BlogEngine.comments.replyToDropDown ? BlogEngine.comments.replyToDropDown.value : "";var callback = isPreview ? BlogEngine.endShowPreview : BlogEngine.appendComment;var 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);},replyToComment: function (id){var found = false;for (var i = 0;i < BlogEngine.comments.replyToDropDown.options.length;i++){if (BlogEngine.comments.replyToDropDown.options[i].value == id){BlogEngine.comments.replyToDropDown.selectedIndex = i;found = true;break;}}if (!found){var newcomment = new Option("New Comment",id);try{BlogEngine.comments.replyToDropDown.add(newcomment,null);}catch (e){BlogEngine.comments.replyToDropDown.add(newcomment);}BlogEngine.comments.replyToDropDown.selectedIndex = BlogEngine.comments.replyToDropDown.options.length - 1;}var commentForm = BlogEngine.$('comment-form');if (!id || id == '' || id == null || id == '00000000-0000-0000-0000-000000000000'){var base = BlogEngine.$("commentlist");base.appendChild(commentForm);}else{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 = '';if (BlogEngine.comments.replyToDropDown)
if (BlogEngine.comments.replyToDropDown.selectedIndex > 0)
id = BlogEngine.comments.replyToDropDown.options[BlogEngine.comments.replyToDropDown.selectedIndex].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.replyToDropDown)
BlogEngine.comments.replyToDropDown.selectedIndex = 0;}BlogEngine.$("btnSaveAjax").disabled = false;},checkAuthorName: function (sender,args){args.IsValid = true;if (BlogEngine.comments.checkName){var author = BlogEngine.comments.postAuthor;var visitor = BlogEngine.comments.nameBox.value;args.IsValid = !this.equal(author,visitor);}},addBbCode: function (v){try{var contentBox = BlogEngine.comments.contentBox;if (contentBox.selectionStart){var pretxt = contentBox.value.substring(0,contentBox.selectionStart);var therest = contentBox.value.substr(contentBox.selectionEnd);var 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.$("searchfield");var check = this.$("searchcomments");var search = "search.aspx?q=" + encodeURIComponent(input.value);if (check != null && check.checked)
search += "&comment=true";top.location.href = root + search;return false;},listingsSearch: function (sBoxId){if (!sBoxId){return true;}if (!BlogEngine.searchUrlBase){return true;}var oBox = document.getElementById(sBoxId);if (!oBox){return true;}var url = BlogEngine.searchUrlBase;if (oBox.value.length > 0){url += "?q=" + encodeURIComponent(oBox.value);}window.location.href = url;return false;},searchClear: function (defaultText){var input = this.$("searchfield");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);var 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;months[context] = args;},toggleMonth: function (year){var monthList = BlogEngine.$("monthList");var years = monthList.getElementsByTagName("ul");for (i = 0;i < years.length;i++){if (years[i].id == year){var state = years[i].className == "open" ? "" : "open";years[i].className = state;break;}}},equal: function (first,second){var f = first.toLowerCase().replace(new RegExp(' ','gi'),'');var s = second.toLowerCase().replace(new RegExp(' ','gi'),'');return f == s;},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');for (i = 0;i < links.length;i++){var link = links[i];var rel = link.getAttribute('rel');if (rel && rel != "nofollow"){for (j = 0;j < BlogEngine.xfnRelationships.length;j++){if (rel.indexOf(BlogEngine.xfnRelationships[j]) > -1){link.title = 'XFN relationship: ' + rel;break;}}}}},showRating: function (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 ' + 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 ' + raters + '/5 Stars.';ul.appendChild(li);for (var i = 1;i <= 5;i++){var l = document.createElement('li');var a = document.createElement('a');a.innerHTML = i;a.href = 'rate/' + i;a.className = this.englishNumber(i);a.title = "Rate this " + i.toString() + " star" + (i == 1 ? "" : "s") + " out of 5";a.onclick = function (){BlogEngine.rate(id,this.innerHTML);return false;};l.appendChild(a);ul.appendChild(l);}this.$('rating_' + id).appendChild(div);},englishNumber: function (number){if (number == 1)
return 'one-star';if (number == 2)
return 'two-stars';if (number == 3)
return 'three-stars';if (number == 4)
return 'four-stars';return 'five-stars';},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;var height = document.documentElement.clientHeight + document.documentElement.scrollTop;document.body.style.position = 'static';var layer = document.createElement('div');layer.style.zIndex = 2;layer.id = 'layer';layer.style.position = 'absolute';layer.style.top = '0px';layer.style.left = '0px';layer.style.height = document.documentElement.scrollHeight + 'px';layer.style.width = width + 'px';layer.style.backgroundColor = 'black';layer.style.opacity = '.6';layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");document.body.appendChild(layer);var div = document.createElement('div');div.style.zIndex = 3;div.id = 'apmlfilter';div.style.position = (navigator.userAgent.indexOf('MSIE 6') > -1) ? 'absolute' : 'fixed';div.style.top = '200px';div.style.left = (width / 2) - (400 / 2) + 'px';div.style.height = '50px';div.style.width = '400px';div.style.backgroundColor = 'white';div.style.border = '2px solid silver';div.style.padding = '20px';document.body.appendChild(div);var p = document.createElement('p');p.innerHTML = BlogEngine.i18n.apmlDescription;p.style.margin = '0px';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');textbox.type = 'text';textbox.value = BlogEngine.getCookieValue('url') || 'http://';textbox.style.width = '320px';textbox.id = 'txtapml';textbox.name = 'apml';textbox.style.background = 'url(' + BlogEngine.webRoot + 'pics/apml.png) no-repeat 2px center';textbox.style.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 = 'javascript:void(0)';a.onclick = function (){document.body.removeChild(this.$('layer'));document.body.removeChild(this.$('apmlfilter'));document.body.style.position = '';};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,replyToDropDown: null},showDonationForm: function (){jQuery.blockUI({message: jQuery("div#donationForm"),overlayCSS:{backgroundColor: '#000',opacity: 0.8},css:{backgroundColor: 'transparent',top: (jQuery(window).height() - jQuery("div#donationForm").height()) / 2 + 'px',left: (jQuery(window).width() - jQuery("div#donationForm").width()) / 2 + 'px',width: jQuery("div#donationForm").width() + 'px','-webkit-border-radius': '10px','-moz-border-radius': '10px'}});jQuery('.blockOverlay').attr('title','').click(jQuery.unblockUI);return false;}};BlogEngine.addLoadEvent(BlogEngine.hightLightXfn);if (typeof($) == 'undefined')
window.$ = BlogEngine.$;function addBookmark(title,url){var sAskUserToManuallyBookmarkPage = "Press Ctrl-D to Bookmark Us!";if (!title || title.length == 0)
title = document.title;if (!url || url.length == 0){var sHref = window.location.href;var iSlashSlash = sHref.indexOf('//');if (iSlashSlash != -1){var iHostStart = iSlashSlash + 2;var iSlashAfterHost = sHref.indexOf('/',iHostStart + 1);if (iSlashAfterHost != -1)
url = sHref.substring(0,iSlashAfterHost + 1);else url = sHref;}}if (!url || url.length == 0){alert(sAskUserToManuallyBookmarkPage);return false;}if(window.sidebar){window.sidebar.addPanel(title,url,'');}else if(window.opera){var a = document.createElement("A");a.rel = "sidebar";a.target = "_search";a.title = title;a.href = url;a.click();}else if(document.all){window.external.AddFavorite(url,title);}else{alert(sAskUserToManuallyBookmarkPage);}return false;}var HoverMenu ={oTimer: null,oDivToBeHidden: null,oMenus: [],iScrollbarWidth: -1,addLoadEvent: function(func){var oldonload = window.onload;if (typeof window.onload != 'function'){window.onload = func;}else{window.onload = function(){oldonload();func();}}},registerMenu: function(id){var bInList = false;for (var i = 0;i < HoverMenu.oMenus.length;i++){if (HoverMenu.oMenus[i].id == id){bInList = true;break;}}if (!bInList){HoverMenu.oMenus.push(document.getElementById(id));}},getCoords: function(el){var iTop = 0,iLeft = 0;var current = el;while (current){iTop += current.offsetTop;iLeft += current.offsetLeft;current = current.offsetParent;}var iBottom = iTop + el.offsetHeight;var iRight = iLeft + el.offsetWidth;var coords ={top: iTop,bottom: iBottom,left: iLeft,right: iRight};return coords;},toggleMenu: function(el,bShow){el.style.visibility = bShow ? 'visible' : '';el.style.display = bShow ? 'block' : '';},clearHideTimer: function(){if (HoverMenu.oTimer){window.clearTimeout(HoverMenu.oTimer);}HoverMenu.oDivToBeHidden = null;HoverMenu.oTimer = null;},hideAllMenus: function(divIdThatWillBeShown){HoverMenu.clearHideTimer();for (var i = 0;i < HoverMenu.oMenus.length;i++){if (!divIdThatWillBeShown || HoverMenu.oMenus[i].id != divIdThatWillBeShown){HoverMenu.toggleMenu(HoverMenu.oMenus[i],false);}}},getScrollBarWidth: function(){if (HoverMenu.iScrollbarWidth != -1){return HoverMenu.iScrollbarWidth;}var inner = document.createElement('p');inner.style.width = "100%";inner.style.height = "200px";var outer = document.createElement('div');outer.style.position = "absolute";outer.style.top = "0px";outer.style.left = "0px";outer.style.visibility = "hidden";outer.style.width = "200px";outer.style.height = "150px";outer.style.overflow = "hidden";outer.appendChild(inner);document.body.appendChild(outer);var w1 = inner.offsetWidth;outer.style.overflow = 'scroll';var w2 = inner.offsetWidth;if (w1 == w2) w2 = outer.clientWidth;document.body.removeChild(outer);HoverMenu.iScrollbarWidth = w1 - w2;return HoverMenu.iScrollbarWidth;},windowSize: function(){var w = 0;var h = 0;if (!window.innerWidth){if (!(document.documentElement.clientWidth == 0)){w = document.documentElement.clientWidth;h = document.documentElement.clientHeight;}else{w = document.body.clientWidth;h = document.body.clientHeight;}}else{w = window.innerWidth - HoverMenu.getScrollBarWidth();h = window.innerHeight;}return{width: w,height: h};},showMenu: function(oLink,divId,bRightAlign,iOffsetAdjustmentX,iOffsetAdjustmentY){HoverMenu.registerMenu(divId);HoverMenu.hideAllMenus(divId);var oDiv = document.getElementById(divId);if (oDiv.style.visibility == 'visible'){return;}iOffsetAdjustmentY = iOffsetAdjustmentY || 0;iOffsetAdjustmentX = iOffsetAdjustmentX || 12;var linkCoords = HoverMenu.getCoords(oLink);oDiv.style.top = (linkCoords.bottom + iOffsetAdjustmentY) + "px";if (bRightAlign){var oWindowSize = HoverMenu.windowSize();oDiv.style.right = (oWindowSize.width - linkCoords.right - iOffsetAdjustmentX) + "px";}else{oDiv.style.left = (linkCoords.left - iOffsetAdjustmentX) + "px";}HoverMenu.toggleMenu(oDiv,true);},onMenuHover: function(oDiv){if (HoverMenu.oTimer && HoverMenu.oDivToBeHidden && HoverMenu.oDivToBeHidden.id == oDiv.id){HoverMenu.clearHideTimer();}},fullyHideMenu: function(oDiv){HoverMenu.hideAllMenus();},hideMenu: function(oDiv){if (typeof oDiv === "string"){oDiv = document.getElementById(oDiv);}HoverMenu.oDivToBeHidden = oDiv;HoverMenu.oTimer = window.setTimeout(function(){HoverMenu.fullyHideMenu(oDiv);},150);}};