

        function keepalive(){
	        var keepAliveFrame = document.createElement("iframe");
	        keepAliveFrame.src = clientScriptPathInfo.ApplicationPath + "/keepalive.ashx";
	        keepAliveFrame.style.display = "none";
	        document.body.appendChild(keepAliveFrame);
        }






function titleAndStar(totalPosts, score, isMod, isAdmin, customTitle, customPic, imgID, titleID) {
        //alert(titleID + ' called!');
	    var title;
	    var star;
	    var separator = String.fromCharCode(1);
    	
	    if (score==null||score=="") score=0;
    	
	    if (isMod){
		    title = userLevelNameMod;
		    star = modStar;
	    }
	    if(isAdmin){
		    title = userLevelNameAdmin;
		    star = adminStar;
	    }
	    if (title==null){
		    for (var i=1; i<strTitle.length ; i++){
			    var userL = strTitle[i].split(separator);
			    var evaluation = eval(totalPosts+"<="+userL[0]+userL[1]+score+"<="+userL[2]);
			    if (evaluation){
				    title = userL[3];
				    star = userL[4]+starPicSuffix;
				    break;
			    }
		    }
		    if (title==null){
			    title = strTitle[strTitle.length-1].split(separator)[3];
			    star =  strTitle[strTitle.length-1].split(separator)[4]+starPicSuffix;
		    }

	    }
	    if (customTitle!="") (title = customTitle);
	    if (customPic!="") (star = customPic);

        theImage = $get(imgID);
        theTitle = $get(titleID);
        
        if (theTitle) theTitle.innerHTML = title; 
        if (theImage) theImage.src = clientScriptPathInfo.ApplicationPath + "/image/" + star;

	//document.write (title + "<br /><img src=\"" + clientScriptPathInfo.ApplicationPath + "/image/" + star + "\" /><br />");
}








/* http://www.kryogenix.org/code/browser/searchhi/ */
/* Modified 20021006 to fix query string parsing and add case insensitivity */
/* Modified 20070316 to stop highlighting inside nosearchhi nodes */

var ASPPG_searchQuery = 'high';

function highlightWord(node,word) {
    if (word.trim().length == 0) return;
	// Iterate into this nodes childNodes
	if (node.hasChildNodes) {
		var hi_cn;
		for (hi_cn=0;hi_cn<node.childNodes.length;hi_cn++) {
			highlightWord(node.childNodes[hi_cn],word);
		}
	}
	
	// And do this node itself
	if (node.nodeType == 3) { // text node
		tempNodeVal = node.nodeValue.toLowerCase();
		tempWordVal = word.toLowerCase();
		if (tempNodeVal.indexOf(tempWordVal) != -1) {
			pn = node.parentNode;
			// check if we're inside a "nosearchhi" zone
			checkn = pn;
			while (checkn.nodeType != 9 && 
			checkn.nodeName.toLowerCase() != 'body') { 
			// 9 = top of doc
				if (checkn.className.match(/\bnosearchhi\b/)) { return; }
				checkn = checkn.parentNode;
			}
			if (pn.className != ASPPG_searchQuery) {
				// word has not already been highlighted!
				nv = node.nodeValue;
				ni = tempNodeVal.indexOf(tempWordVal);
				// Create a load of replacement nodes
				before = document.createTextNode(nv.substr(0,ni));
				docWordVal = nv.substr(ni,word.length);
				after = document.createTextNode(nv.substr(ni+word.length));
				hiwordtext = document.createTextNode(docWordVal);
				hiword = document.createElement("span");
				hiword.className = ASPPG_searchQuery;
				hiword.appendChild(hiwordtext);
				pn.insertBefore(before,node);
				pn.insertBefore(hiword,node);
				pn.insertBefore(after,node);
				pn.removeChild(node);
			}
		}
	}
}
/*
function googleSearchHighlight() {
	if (!document.createElement) return;
	ref = document.referrer;
	if (ref.indexOf('?') == -1) return;
	qs = ref.substr(ref.indexOf('?')+1);
	qsa = qs.split('&');
	for (i=0;i<qsa.length;i++) {
		qsip = qsa[i].split('=');
	        if (qsip.length == 1) continue;
        	if (qsip[0] == 'q' || qsip[0] == 'p') { // q= for Google, p= for Yahoo
			words = unescape(qsip[1].replace(/\+/g,' ')).split(/\s+/);
	                for (w=0;w<words.length;w++) {
				highlightWord(document.getElementsByTagName("body")[0],words[w]);
                	}
	        }
	}
}
*/
// Highlight Words Script
// copyright Stephen Chapman, 17th January 2007
// you may copy this script provided that you retain the copyright notice
/*
var kw = [];
var qsParm = []; 
function qs() {var query = window.location.search.substring(1); var parms = query.split('&'); 
for (var i=0; i < parms.length; i++) {var pos = parms[i].indexOf('='); if (pos > 0) {var key = parms[i].substring(0,pos); var val = parms[i].substring(pos+1); qsParm[key] = val;}}} qsParm['hilite'] = null; qs();
if (qsParm['hilite'] != null) kw = qsParm['hilite'].split(',');
function start() {var bdy = document.getElementsByTagName('body')[0].innerHTML; for (var i = kw.length - 1; i >= 0; i--) {var re = new RegExp('(\\b'+kw[i]+'\\b)','ig'); bdy = bdy.replace(re,'<span class="hl">$1<\/span>'); var re1 = new RegExp('(<[^>]*?)<span class="hl">('+kw[i]+')<\/span>(.*?>)','ig'); bdy = bdy.replace(re1,'$1$2$3');var re2 = new RegExp('(<script.*?>)<span class="hl">('+kw[i]+')<\/span>(<\/script>)','ig'); bdy = bdy.replace(re2,'$1$2$3'); var re3 = new RegExp('(<textarea.*?>)<span class="hl">('+kw[i]+')<\/span>(<\/textarea>)','ig'); bdy = bdy.replace(re3,'$1$2$3');} document.getElementsByTagName('body')[0].innerHTML = bdy;}
window.onload = start;
*/

function ASPPGHighlight(){
    var qs = createRequestObject();
    var highlitewords = (qs[ASPPG_searchQuery]) ? qs[ASPPG_searchQuery].trim() : '';
    if (highlitewords!= 'undefined' && highlitewords!= undefined && highlitewords!= '') {
        var wordList = highlitewords.replace(/\s/gi, ',').split(',');
        for (i=0; i< wordList.length; i++){
            highlightWord(document.getElementsByTagName("body")[0],wordList[i]);
        }
    }
}                

addLoadListener(ASPPGHighlight);






var userLevelNameMod = "\"Moderator\"";
var userLevelNameAdmin = "\"Admin\"";
var starPicSuffix = "star.gif";
var modStar = "5starM.gif";
var adminStar = "5starA.gif";
var strTitle = new Array() ;
 strTitle [1] = "30||-7New Member1";
 strTitle [2] = "45||-7Starting Member2";
 strTitle [3] = "65||-7Junior Member3";
 strTitle [4] = "90||-7\'Senior Members\'4";
 strTitle [5] = "120||-7\"Super Member\"5";







    var tmSelectString;
    //var selectedFromMsg = false;
    
    function tmSelect(){
        
        //selectedFromMsg = true;
        
        if (window.getSelection)
        {
            tmSelectString = window.getSelection().toString();
        }   
        else if (window.document.selection)
        {
            var rng = window.document.selection.createRange();
            tmSelectString = rng.text;
        }
        else {
            tmSelectString = "";
        }
    }

    function attachSelectionToMsg(){
        var allMSG = getElementsByAttribute("class", "msg");
        
        for (var i = 0; i < allMSG.length ; i++){
            attachEventListener(allMSG[i], "mouseup", tmSelect);
        }
        
    }
    
    attachEventListener(document.body, "mouseup", tmSelect);
    
    //addLoadListener(attachSelectionToMsg);
    
    
    function changeTmSort(value){
        if (isNaN(value)) return;        
        createCookie(dbName + "tmRemember", value);
        self.location.replace(clientScriptPathInfo.RawUrl);
    }
    

    var cannotShowTip = false;
    
	function toolTipWin(url){
	    if(cannotShowTip) return;
	    cannotShowTip = true;
	    var tipwin = popRadWin('showpic.htm?img=' + url, 300, 300);
	    tipwin.set_behaviors(Telerik.Web.UI.WindowBehaviors.Move + Telerik.Web.UI.WindowBehaviors.Close);
	    setTimeout("cannotShowTip = false;",1000);
	}

    function reloadParent(radWindow){
        //alert("reloadParent");
        
        var arg = radWindow.argument;
        
        //alert(arg);
        
        if(typeof(arg) == 'string'){
            if (arg ==''){
                return;
            }
            else if (arg == 'true' || (arg == 'del' && !inTreeMode)) {
                refreshButton.click();
            }
            else if (arg == 'del' && inTreeMode) {
                tree.loadPrevious();                
            }
            else if (arg == 'reload'){
                self.location.replace(clientScriptPathInfo.RawUrl);
            }
            else if (!isNaN(arg)){
                self.location.replace(clientScriptPathInfo.ApplicationPath + "/tt.aspx?forumID=" + arg);
            }
            
        }
        
    }

    function switchMsgDivOnOff(msgID){
        document.getElementById('msg' + msgID).style.display = document.getElementById('msg' + msgID).style.display == 'none' ? '' : 'none';
        document.getElementById(msgID).style.height = '';
    }

	function SetMessageID(id){
	    currSelectedMsgID = id;
	}
	
	function SetRatingID(){
	    document.getElementById(msgRatingHiddenField).value = currSelectedMsgID.toString();

	}
	
	function RemoveRatingID(){
	    document.getElementById(msgRatingHiddenField).value = '';
	}
	
	function SubmitRating(){
	    refreshButton.click();
	    hideAllMenus();
	}
	
	function treeUpdate(msgID){
	    document.getElementById(msgTreeHiddenField).value = msgID;
	    refreshButton.click();
	}
	

	var tdSizeFired = false;
	var tdsToResize = [];
	
	function changeTdSize(){
	    try { 
	        if (tdSizeFired) return ; 
	        tdSizeFired = true;
	        
	        for (var i in tdsToResize){
	            document.getElementById(tdsToResize[i]).style.height = '';
                document.getElementById(tdsToResize[i]).style.height = (document.getElementById("td" + tdsToResize[i]).clientHeight - 50).toString() + 'px';	            
	        }
	        setTimeout("tdSizeFired = false;", 1000);
	    }
	    catch(err){
	        //alert(err.description);
	    }
	    
	}
	
	var multiQuoteIDs = [];
	
	function AddMultiQuote(msgID){
	    if (isNaN(msgID)) return ;
	    for (var i =0; i<multiQuoteIDs.length; i++){
	        if(multiQuoteIDs[i] == msgID) {return;}
        }	
	
	    if (multiQuoteIDs.length<3) {
	        multiQuoteIDs[multiQuoteIDs.length] = msgID;
            document.getElementById("multiquoteImg" + msgID).src = pageThemeImageURL + 'menuMultiQuote.gif';
        } else {
            alert(tooManyQuotes);
        }
        
        
	}
	
	function RemoveMultiQuote(msgID){
	    if (isNaN(msgID)) return ;
	    var indexToDelete = -1;
	    
	    for (var i =0; i<multiQuoteIDs.length; i++){
	        if(multiQuoteIDs[i] == msgID) {indexToDelete = i; break;}
        }
        
        if (indexToDelete!=-1) multiQuoteIDs.splice(indexToDelete,1);
        document.getElementById("multiquoteImg" + msgID).src = pageThemeImageURL + 'blank.gif';        
	}
	
    function openPreview(){
        var rwd = popRadWin('preview.aspx');
        rwd.argument = RadEditor1ClientObject.GetHtml();
        return false; 
    }
    
    function replySimulatedClick(msgID){
    
        var gotoURL = clientScriptPathInfo.ApplicationPath + '/' + String.format('post.aspx?mq={0}&messageID=', multiQuoteIDs.join()) + msgID ;
        if (popupPosting){
            popRadWin(gotoURL + '&pop=true');
        } else {
            self.location.href = gotoURL;
        }
        return false;
    }   

        




    var menuFired = false;

	function OnMenuItemClick(s, e){
	    
	    menuFired = true;
	    
	    setTimeout("menuFired = false;",1000);
	    
	    var item = e.get_item();
	    var baseURL = clientScriptPathInfo.ApplicationPath + '/';
	    var attributes = item.get_attributes();
        var itemArg = attributes.getAttribute('arg');
	    
	    switch (attributes.getAttribute('command')){
    
	        case 'friend':
	            return true;
	            break;	        
	        case 'ignore':
	            return true;
	            break;
	        case 'unignore':
                return true;
	            break;
	        case 'helpful' :
                return true;
	            break;
	        case 'reward' :
                return true;
	            break;
	        case 'mark' :
                return true;
	            break;	            	            
	        case 'pm':
	            var gotoURL = baseURL + 'pmsend.aspx?toMemId=' + itemArg ;
	            if (popupPosting){
	                popRadWin(gotoURL + '&pop=true');
	            } else {
	                self.location.href = gotoURL;
	            }
	            
	            break;	 
	        case 'reply':
	            var gotoURL = baseURL + String.format('post.aspx?mq={0}&messageID=', multiQuoteIDs.join()) + itemArg ;
	            if (popupPosting){
	                popRadWin(gotoURL + '&pop=true');
	            } else {
	                self.location.href = gotoURL;
	            }
	            
	            break;	
	        case 'quote':
	            var gotoURL = baseURL + String.format('post.aspx?quote=true&mq={0}&messageID=', multiQuoteIDs.join()) + itemArg ;
	            if (popupPosting){
	                popRadWin(gotoURL + '&pop=true');
	            } else {
	                self.location.href = gotoURL;
	            }
	            
	            break;	
	        case 'edit':
	            var gotoURL = baseURL + 'post.aspx?edit=true&messageID=' + itemArg ;
	            if (popupPosting){
	                popRadWin(gotoURL + '&pop=true');
	            } else {
	                self.location.href = gotoURL;
	            }
	            
	            break;		            
	        case 'manage':
	            var gotoURL = baseURL + 'management.aspx?messageID=' + itemArg ;
	            popRadWin(gotoURL, 550, 450);
	            
	            break;
	            
	        case 'flag':
	        	var gotoURL = baseURL + String.format('flagreport.aspx?messageID={0}&mode=flag',itemArg) ;
	            popRadWin(gotoURL, 600,275);
	            break;
	        case 'report':
	        	var gotoURL = baseURL + 'flagreport.aspx?messageID=' + itemArg ;
	            popRadWin(gotoURL, 600,575);  
	            break; 
	             
	        case 'fwd':
	        	var gotoURL = baseURL + 'forward.aspx?messageID=' + itemArg ;
	            popRadWin(gotoURL, 600,275);  
	            break; 
	            
	        case 'multiquote':
	            AddMultiQuote(itemArg);  
	            break; 	
            
            case 'ip' : 
	            popTip("<div style='margin:20px 10px;'>IP: <br /><input type='text' onfocus='this.select()' size='45' value='" +
	                 itemArg +"' /></div>", 450, 250, false, true, 5000, true, messageIDToolTipClientID);
	            break;   
	            	            
	        case 'msglink' : 
	            popTip("<div style='margin:20px 10px;'>URL: <br /><input type='text' onfocus='this.select()' size='45' value='" +
	                 clientScriptPathInfo.ForumDir + "fb.ashx?m=" + itemArg +"' /></div>", 450, 250, false, true, 5000, true, messageIDToolTipClientID);
	            break;           	                      	            	                       	    
	    }
	    
	    e.set_cancel(true);
	    return false;
	}
	

	function ShowMenu(e, id, isSelf, login, isFriend, isIgnored, viewerIsGuest, memberPMable) {
	    if (menuFired || typeof menu == 'undefined' || !menu) return;
	    
        hideAllMenus(150);
        
        with (menu) {
            var frienditem = findItemByValue("friend");
            var pmitem = findItemByValue("pm");
            var blockitem = findItemByValue("block");
        }

        var menuImgURL = clientScriptPathInfo.ApplicationPath + '/' + pageThemeImageURL;
        
        var oneItemVisible = false;
        
        with (frienditem) {
            set_imageUrl(menuImgURL + 'menuAdd.gif');
            set_text(String.format(FriendMemText, ''));
            
            menu.trackChanges();
            get_attributes().setAttribute('command', 'friend'); get_attributes().setAttribute('arg', id);
            if (isFriend || isIgnored || isSelf || viewerIsGuest) hide(); else {show(); oneItemVisible = true;}
            menu.commitChanges();
        }
        
        with (blockitem){
            var blockItemText = isIgnored ? UnBlockMemText : BlockMemText;
            var blockItemCommand = isIgnored ? 'unignore' : 'ignore';
            set_imageUrl(menuImgURL + (isIgnored ? 'menuUnblock.gif' : 'menuBlock.gif'));
            set_text(String.format(blockItemText, ''));
            
            menu.trackChanges();
            get_attributes().setAttribute('command', blockItemCommand); get_attributes().setAttribute('arg', id);
            if (isSelf || viewerIsGuest) hide(); else {show(); oneItemVisible = true;}
            menu.commitChanges();             
        }

        with (pmitem){
             set_imageUrl(menuImgURL + 'menuPM.gif');
             
             set_text(String.format(PmMemText, login)); 
             set_text(String.format(PmMemText, '')); 
             get_attributes().setAttribute('command', 'pm'); get_attributes().setAttribute('arg', id);
             
             if (isSelf || viewerIsGuest || !memberPMable) hide(); else {show(); oneItemVisible = true;}
        }
        
        if (oneItemVisible) menuShow(e, menu);

    }	
	
    function showOptionMenu(e, id, canReply, isMod, isLocked, isSelf, canDelete, canDeleteThread, isDeleted, canStillEditDelete, isPostWaitingModeration, viewerIsGuest){
	    if (menuFired || typeof menu == 'undefined' || !menu) return;
	    
	    hideAllMenus(110);
	    SetMessageID(id);

        with (menu) {
            var quoteitem = findItemByValue("quote");
            var multiquoteitem = findItemByValue("multiquote");
        }
        
        var menuImgURL = clientScriptPathInfo.ApplicationPath + '/' + pageThemeImageURL;
        
        with (quoteitem){
            set_text(QuoteMessageText); get_attributes().setAttribute('command', 'quote'); get_attributes().setAttribute('arg', id);
            set_imageUrl(menuImgURL + 'menuQuote.gif');
	        if(canReply && (!isLocked || isMod) && !isDeleted && !isPostWaitingModeration){show();} else {hide();}           
        } 
        
        with (multiquoteitem) {
	        set_text(MultiquoteText); get_attributes().setAttribute('command', 'multiquote'); get_attributes().setAttribute('arg', id);
	        set_imageUrl(menuImgURL + 'menuMultiQuote.gif');
	        if (!isDeleted && !viewerIsGuest && canReply){show();} else {hide();}         
	    } 
	          
	    menuShow(e, menu);
	    
	}	

	function showMoreOptionMenu(e, id, isMod, isThreadStarter, isSelf, isDeleted, isCashReward, isAnswered, CanFlagPost, 
	        isThread, isHelpfulPost, isRewardedPost, CanRatePost, canReply, viewerIsGuest, canDelete, canDeleteThread, 
	        canStillEditDelete, msgnum, ip){
	    if (menuFired || typeof menu == 'undefined' || !menu) return;
	    
	    hideAllMenus(150);
	    
	    SetMessageID(id);
	    
	    with(menu){
            
            var edititem = findItemByValue("edit");
            var manageitem = findItemByValue("manage");	
            var fwditem = findItemByValue("fwd");	
            	    
            var helpfulitem = findItemByValue("helpful");
            var rewarditem = findItemByValue("reward");
            var rateitem = findItemByValue("rate");
            var flagitem = findItemByValue("flag");
            var reportitem = findItemByValue("report");	    
	        //var multiquoteitem = findItemByValue("multiquote");	
	        
	        var ipitem = findItemByValue("ip");	        
	        var msglinkitem = findItemByValue("msglnk");	
	    }

	    var menuImgURL = clientScriptPathInfo.ApplicationPath + '/' + pageThemeImageURL;
	    
        with (edititem){
            set_text(EditMessageText); get_attributes().setAttribute('command', 'edit'); get_attributes().setAttribute('arg', id);
            set_imageUrl(menuImgURL + 'menuEdit.gif');
	        if (isMod || (isSelf && canStillEditDelete) && !viewerIsGuest){show();} else {hide();} 
        }
        
        with (manageitem){
            set_text(ManageMessageText); get_attributes().setAttribute('command', 'manage'); get_attributes().setAttribute('arg', id);
            set_imageUrl(menuImgURL + 'menuManage.gif');
            if (isMod || (isSelf && canStillEditDelete && (canDelete && id!=currentThreadID || canDeleteThread && id==currentThreadID)) && !viewerIsGuest){show();} else {hide();} 
        }
        
        with (fwditem){
            set_text(ForwardMessageText); get_attributes().setAttribute('command', 'fwd'); get_attributes().setAttribute('arg', id);
            set_imageUrl(menuImgURL + 'menuForward.gif');
            if (isDeleted || viewerIsGuest) hide(); else show();
        }	    
	    
	    with (helpfulitem) {
	        set_text(PostHelpfulText); 
	        set_imageUrl(menuImgURL + 'menuHelpful.gif');
	        
	        menu.trackChanges();
	        get_attributes().setAttribute('command', 'helpful'); get_attributes().setAttribute('arg', id);
	        if ((isMod || isThreadStarter) && !isDeleted && !isThread && !isHelpfulPost && !isRewardedPost && !viewerIsGuest){show();} else {hide();} 
	        menu.commitChanges();
	    }
	    
	    with (rewarditem) {
	        set_text(PostGetRewardText); 
	        set_imageUrl(menuImgURL + 'menuAward.gif');
	        
	        menu.trackChanges();
	        get_attributes().setAttribute('command', 'reward'); get_attributes().setAttribute('arg', id);
	        if ((isMod || isThreadStarter) && !isDeleted && isCashReward && !isAnswered && !isThread && !isHelpfulPost && !isRewardedPost && !viewerIsGuest){show();} else {hide();} 
	        menu.commitChanges();
	    }
	    
	    with (rateitem) {
	        set_text(RatingText); get_attributes().setAttribute('command', 'rate'); get_attributes().setAttribute('arg', id);
	        set_imageUrl(menuImgURL + 'menuRate.gif');
	        if (!isSelf && !isDeleted && CanRatePost && !viewerIsGuest){show();} else {hide();} 
	    }	    	    
	    
	    with (flagitem) {
	        set_text(PostInappropriateText); get_attributes().setAttribute('command', 'flag'); get_attributes().setAttribute('arg', id);
	        set_imageUrl(menuImgURL + 'menuFlag.gif');
	        if (!isMod && CanFlagPost && !isDeleted && !isSelf && !viewerIsGuest){show();} else {hide();} 
	    }
	    
	    with (reportitem) {
	        set_text(ReportAbuseText); get_attributes().setAttribute('command', 'report'); get_attributes().setAttribute('arg', id);
	        set_imageUrl(menuImgURL + 'menuReport.gif');
	        if (!isMod && !isDeleted && !isSelf && !viewerIsGuest){show();} else {hide();} 
	    }
	    
	    with (ipitem) {
	        set_text('IP: ' + ip); get_attributes().setAttribute('command', 'ip'); get_attributes().setAttribute('arg', ip);
	        //set_imageUrl(menuImgURL + 'menuFlag.gif');
	        if (isMod) {show();} else {hide();} 
	    }
	    
	    with (msglinkitem) {
	        set_text(menuMsgLinkText + ': #' + msgnum); get_attributes().setAttribute('command', 'msglink'); get_attributes().setAttribute('arg', id);
	        //set_imageUrl(menuImgURL + 'menuMultiQuote.gif');
	        show(); //if (!isDeleted && !viewerIsGuest && canReply){show();} else {hide();}         
	    }		        

	    menuShow(e, menu);
	    
	}

	function hideAllMenus(widthForImg){
	
	    if (typeof menu == 'undefined' || !menu) return;
        
        setNono(menu, widthForImg);
        
        for (var i = 0; i < menu.get_items().get_count(); i++)
        {
           var theItem = menu.get_items().getItem(i);
           if (theItem.get_value() != 'nono') theItem.hide();
        }

        menu.hide(); 

	}




function ASPPGFormatMsgBody(msgID, enableImg, enableLink){
var msgArea = $get('msg' + msgID);
sbody = msgArea.innerHTML;
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[(\/?(?:[bius]|[ou]l|hr|strike|pre|sub|sup))\]/gi,"<$1>");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[(?:align=)?(right|center|left)\]/gi,"<div align=\"$1\">");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[\/(?:right|center|left|align)\]/gi,"</div>");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[(\/)?\*\]/gi,"<$1li>");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[(\/?h[1-6]{1})\]/gi,"<$1>");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[(\/?h[1-6]{1} align\="\w+?")\]/gi,"<$1>");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[quote(?:=([^\]]+))?\]/gi,"<blockquote class=\"quote\"><i>$1</i><br>");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[\/quote\]/gi,"</blockquote>");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[(\/)?blockquote\]/gi,"<$1blockquote>");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[(size|color)\=((?:&quot;|")\s?)?([\+\-\#\w]+?)\2\]/gi,"<font $1=\"$3\">");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[font\=((?:&quot;|")\s?)?([\w\s\,\-]+?)\1\]/gi,"<font face=\"$2\">");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[\/(?:font|size|color)\]/gi,"</font>");
if (!((false && !enableImg) || (true && !enableLink))) sbody = sbody.replace(/\[(url|link)\=(\&quot\;)?((?:ftp|https?)\:\/\/.+?)\2\](.+?)\[\/\1\]/gi,"<a href=\"$3\" target=\"_blank\" rel=\"nofollow\">$4</a>");
if (!((false && !enableImg) || (true && !enableLink))) sbody = sbody.replace(/\[(url|link)\=?\]((?:ftp|https?)\:\/\/.+?)\[\/\1\]/gi,"<a href=\"$2\" target=\"_blank\" rel=\"nofollow\">$2</a>");
if (!((false && !enableImg) || (true && !enableLink))) sbody = sbody.replace(/\[email\=(\&quot\;)?([\w\.]+\@[\w\-\.]+\.[a-zA-Z]{2,4})\1\](.+?)\[\/email\]/gi,"<a href=\"mailto:$2\">$3</a>");
if (!((true && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/\[(im(?:g|age))\]((?:https?\:\/\/)(?:[^\?])+?\.(?:jpg|gif|jpeg|bmp|png))\[\/\1\]/gi,"<img src=\"$2\">");
if (!((false && !enableImg) || (false && !enableLink))) sbody = sbody.replace(/ <br> \[(im(?:g|age))\](?:local\:\/\/(?:upfiles\/)?)([\-\w\.\/]+?)\[\/\1\]/gi,"");
msgArea.innerHTML = sbody;
}


function ASPPGRestoreCodePGDCode(msgID, toReplace, replaceWith){
var msgArea = $get('msg' + msgID);
sbody = msgArea.innerHTML;
sbody = sbody.replace(toReplace, replaceWith.replace(/\$\'/gi, '$<span>\'</span>').replace(/\[(\/)?code\]/gi, '<$1pre class="code">').replace(/\s?<br>\s?/gi, '\r\n'));
msgArea.innerHTML = sbody;
}


function ASPPGRestoreHTMLPGDCode(msgID, toReplace, replaceWith){
var msgArea = $get('msg' + msgID);
sbody = msgArea.innerHTML;
sbody = sbody.replace(toReplace, replaceWith.replace(/\$\'/gi, '$<span>\'</span>').replace(/\[(\/)?html\]/gi, '').replace(/\s?<br>\s?/gi, '\r\n').replace(/&lt;/gi, '<').replace(/&gt;/gi, '>').replace(/&quot;/gi, '"').replace(/&amp;/gi, '&'));
msgArea.innerHTML = sbody;
}




