function ClearLabel(lblClientId){var lbl = document.getElementById(lblClientId);lbl.innerHTML = "";return false;}nn=(document.layers)?true:false;ie=(document.all)?true:false;document.onkeyup=CheckFieldsForHTMLTags;if(nn) document.captureEvents(Event.KEYUP);function CheckFieldsForHTMLTags(){if (String(window.location).indexOf("RoleFeatureActionAssignment.aspx") > 0){}else{var frm = document.forms[0];var isValidated = true;var e;for (var i=0;i<frm.length;i++){e = frm.elements[i];if (e.type == 'text' || e.type == 'textarea'){if (e.value.indexOf('<') != -1 || e.value.indexOf('>') != -1){e.value = replaceAllMy(e.value,"<","");e.value = replaceAllMy(e.value,">","");isValidated = false;}}}}}function replaceAllMy(checkMe,toberep,repwith){var temp = checkMe;var i = temp.indexOf(toberep);while(i > -1){temp = temp.replace(toberep,repwith);i = temp.indexOf(toberep,i + repwith.length);}return temp;}fslBlog ={$: function(id){return document.getElementById(id);},webRoot: 'http://faisalmb.com/blog/',i18n:{hasRated: '',savingTheComment: '',comments: '',commentWasSaved: '',commentWaitingModeration: '',cancel: '',filter: '',apmlDescription: '',rateThisPost: '',currentlyRated: '',ratingHasBeenRegistered: '',rateThisXStars: ''},setFlag: function(iso){if (iso.length > 0)
fslBlog.comments.flagImage.src = fslBlog.webRoot + "pics/flags/" + iso + ".png";else fslBlog.comments.flagImage.src = fslBlog.webRoot + "pics/pixel.gif";},showCommentPreview: function(){var oPreview = this.$('preview');var oCompose = this.$('compose');if (oPreview) oPreview.className = 'selected';if (oCompose) oCompose.className = '';this.$('commentCompose').style.display = 'none';this.$('commentPreview').style.display = 'block';this.$('commentPreview').innerHTML = '<img src="' + fslBlog.webRoot + 'pics/ajax-loader.gif" alt="Loading" />';var argument = this.$('commentPreview').innerHTML;this.addComment(true);},composeComment: function(){var oPreview = this.$('preview');var oCompose = this.$('compose');if (oPreview) oPreview.className = '';if (oCompose) oCompose.className = 'selected';this.$('commentPreview').style.display = 'none';this.$('commentCompose').style.display = 'block';},endShowPreview: function(arg,context){fslBlog.$('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 = fslBlog.i18n.savingTheComment;}if (fslBlog.comments.nameBox == null)
var author = document.getElementById('ctl00_cphBody_CommentView1_txtName').value;else var author = fslBlog.comments.nameBox.value;if (fslBlog.comments.emailBox == null)
var email = document.getElementById('ctl00_cphBody_CommentView1_txtEmail').value;else var email = fslBlog.comments.emailBox.value;if (fslBlog.comments.websiteBox == null)
var website = document.getElementById('ctl00_cphBody_CommentView1_txtWebsite').value;else var website = fslBlog.comments.websiteBox.value;if (fslBlog.comments.countryDropDown == null)
var country = document.getElementById('ctl00_cphBody_CommentView1_ddlCountry').value;else var country = fslBlog.comments.countryDropDown ? fslBlog.comments.countryDropDown.value : "";if (fslBlog.comments.contentBox == null)
var content = document.getElementById('ctl00_cphBody_CommentView1_txtContent').value;else var content = fslBlog.comments.contentBox.value;var notify = fslBlog.$("cbNotify").checked;if (fslBlog.comments.captchaField == null)
var captcha = document.getElementById('ctl00_cphBody_CommentView1_hfCaptcha').value;else var captcha = fslBlog.comments.captchaField.value;if (fslBlog.comments.replyToId == null)
var replyToId = document.getElementById('ctl00_cphBody_CommentView1_hiddenReplyTo').value;else var replyToId = fslBlog.comments.replyToId ? fslBlog.comments.replyToId.value : "";var callback = isPreview ? fslBlog.endShowPreview : fslBlog.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);},cancelReply: function(){this.replyToComment('');},replyToComment: function(id){fslBlog.comments.replyToId.value = id;var commentForm = fslBlog.$('comment-form');if (!id || id == '' || id == null || id == '00000000-0000-0000-0000-000000000000'){var base = fslBlog.$("commentlist");base.appendChild(commentForm);fslBlog.$('cancelReply').style.display = 'none';}else{fslBlog.$('cancelReply').style.display = '';var parentComment = fslBlog.$('id_' + id);var replies = fslBlog.$('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);}fslBlog.comments.nameBox.focus();},appendComment: function(args,context){if (context == "comment"){var commentList = fslBlog.$("commentlist");if (commentList.innerHTML.length < 10)
commentList.innerHTML = "<h1 id='comment'>" + fslBlog.i18n.comments + "</h1>"
var id = fslBlog.comments.replyToId ? fslBlog.comments.replyToId.value : '';if (id != ''){var replies = fslBlog.$('replies_' + id);replies.innerHTML += args;}else{commentList.innerHTML += args;commentList.style.display = 'block';}fslBlog.comments.contentBox.value = "";fslBlog.comments.contentBox = fslBlog.$(fslBlog.comments.contentBox.id);fslBlog.$("ajaxLoader").style.display = "none";fslBlog.$("status").className = "success";if (!fslBlog.comments.moderation)
fslBlog.$("status").innerHTML = fslBlog.i18n.commentWasSaved;else fslBlog.$("status").innerHTML = fslBlog.i18n.commentWaitingModeration;fslBlog.composeComment();var commentForm = fslBlog.$('comment-form');commentList.appendChild(commentForm);if (fslBlog.comments.replyToId) fslBlog.comments.replyToId.value = '';if (fslBlog.$('cancelReply')) fslBlog.$('cancelReply').style.display = 'none';}fslBlog.$("btnSaveAjax").disabled = false;},checkAuthorName: function(sender,args){args.IsValid = true;if (fslBlog.comments.checkName){var author = fslBlog.comments.postAuthor;var visitor = fslBlog.comments.nameBox.value;args.IsValid = !this.equal(author,visitor);}},addBbCode: function(v){try{var contentBox = fslBlog.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;},searchClear: function(defaultText){var input = this.$("searchfield");if (input.value == defaultText)
input.value = "";else if (input.value == "")
input.value = defaultText;},searchClear2: function(defaultText){var input = this.$("searchfield2");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,fslBlog.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(fslBlog.i18n.ratingHasBeenRegistered);}else if (status == "HASRATED"){alert(fslBlog.i18n.hasRated);}else{alert("An error occured while registering your rating. Please try again");}},createCallback: function(url,callback){var http = fslBlog.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 = fslBlog.$('calendarContainer');cal.innerHTML = args;fslBlog.Calendar.months[context] = args;},toggleMonth: function(year){var monthList = fslBlog.$("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 = fslBlog.$('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 < fslBlog.xfnRelationships.length;j++){if (rel.indexOf(fslBlog.xfnRelationships[j]) > -1){link.title = 'XFN relationship: ' + rel;break;}}}}},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 = fslBlog.i18n.rateThisPost;}else{p.innerHTML = fslBlog.i18n.currentlyRated.replace('{0}',new Number(rating).toFixed(1)).replace('{1}',raters);}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 = 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 = fslBlog.i18n.rateThisXStars.replace('{0}',i.toString()).replace('{1}',i == 1 ? '' : 's');a.onclick = function(){fslBlog.rate(id,this.innerHTML);return false;};l.appendChild(a);ul.appendChild(l);}container.innerHTML = '';container.appendChild(div);container.style.visibility = 'visible';},applyRatings: function(){var divs = document.getElementsByTagName('div');for (var i = 0;i < divs.length;i++){if (divs[i].className == 'ratingcontainer'){var args = divs[i].innerHTML.split('|');fslBlog.showRating(divs[i],args[0],args[1],args[2]);}}},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 = fslBlog.i18n.apmlDescription;p.style.margin = '0px';div.appendChild(p);var form = document.createElement('form');form.method = 'get';form.style.display = 'inline';form.action = fslBlog.webRoot;div.appendChild(form);var textbox = document.createElement('input');textbox.type = 'text';textbox.value = fslBlog.getCookieValue('url') || 'http://';textbox.style.width = '320px';textbox.id = 'txtapml';textbox.name = 'apml';textbox.style.background = 'url(' + fslBlog.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 = fslBlog.i18n.filter;button.onclick = function(){location.href = fslBlog.webRoot + '?apml=' + encodeURIComponent(fslBlog.$('txtapml').value)};form.appendChild(button);var br = document.createElement('br');div.appendChild(br);var a = document.createElement('a');a.innerHTML = fslBlog.i18n.cancel;a.href = 'javascript:void(0)';a.onclick = function(){document.body.removeChild(fslBlog.$('layer'));document.body.removeChild(fslBlog.$('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,replyToId: null}};fslBlog.addLoadEvent(fslBlog.hightLightXfn);if (typeof ($) == 'undefined')
window.$ = fslBlog.$;if (typeof (registerCommentBox) != 'undefined')
fslBlog.addLoadEvent(registerCommentBox);if (typeof (registerVariables) != 'undefined')
fslBlog.addLoadEvent(registerVariables);if (typeof (setupfslBlogCalendar) != 'undefined')
fslBlog.addLoadEvent(setupfslBlogCalendar);fslBlog.addLoadEvent(fslBlog.applyRatings);