//#Timer
var beforeload;
var foo='';
var quotePromote = 'Enter email addresses..';
//#Ajax calls
var oWUser = new WADJAX('User', { statusBar: false });                  //# -
var wjxProfile = new WADJAX('Profile', { statusBar: false });                             //# -
var wjxShhProfile = new WADJAX('Profile', { statusBar: false });        //# - 
var wjxLabel = new WADJAX('Labels', {statusBar: false});                //# handle feed actions
var wjxContacts = new WADJAX('Contacts', { statusBar: false });         //# handle contacts actions
var wjxMisc = new WADJAX('Misc', { statusBar: false });                 //# -
var fromjason='false';
var fromPagejason='false';
var exitsDeleteFeed='false';
var senderID; 
var senderUID;
var senderUID_number;
var senderUID_current = profileInfo.ownerWadjaID;
var gl_label_id='';
var gl_label_owner_id='';
var gl_label_privacy='';
var gl_label_issystem='';
var gl_label_name='';
var gl_label_about='';
var gl_label_owner_wadjaid='';
var gl_label_followers='0';

var currentlblNameDRopDown='';
var countAfterDelete = 0;
var countFolIntAfterDelete=0;
var countFolAfterDelete = 0;
var eimastesediagrafi=false;
var positionprev;
var positionnext;
var docTitle;
var onlyOnceEmbed='false';
var wantToemptyTheDescr = 'false'; //empty the descr only in edit page case
var isFollowFromRight = 'false';
var prevLabelId;
//#Store labels by category-autocomplete
//var autocompleteValues = new Meio.Element.List();
//var autocompleteValues_plus = new Meio.Element.List();
var autocompleteValues;
var autocompleteValues_plus;

var pushstart = 0; //set on/off when to push new feeds

//#Misc variables
var releaseMore=true;
var Feedlist='';//#for comments box-previous and next feature
var refTimer = false;
var commentsTimer = false;
var SMSpay, PicFB;
var cLabelID = 8;
var LabelInfo = null;
var FollowLink = 1; //1: Follow, 2: Stop following
var following = false;
var ComposeTimeout;
var BodyTimeout;
var BodyEditTimeout;
var searchCategory = '';
var leftSide = ((profileInfo.profileBelongsToViewer || !profileInfo.isLoggedIn) ? '' : ' | ');
var selectedLabelName = ''; //?
//var selectedLabelTO = '';

//var selectedLabelNamePrivacy = '';
var currentLabelName = ''; //Used by Google Ads
var mediaID = 0;
var Twitter = new Array();
var Tumblr = new Array();
var TwitterAutoPost = false;
var TumblrAutoPost = false;
var PreLabelID = -1;
var hide_overlay;
var hide_user_overlay;
var maxchar = 5000; //#compose form max characters
var UIView = 0; //#0:list view, 1:thumb view
var GoogleTAds = 0; //#Three GoogleAds per page
var GoogleLAds = 0; //#Three GoogleAds per page
var wHtmlCanvas = $('dvStream');    //#UI
var showAutocompleteBubble = false;
var stopwatch = 0; //#finetune mouse-overlay timing
var alertBox; // Delete or trash facebox
var ViewerOvelraysOn;
//#Metatags feature
var MetaInfo = false;
var MetaInfoValue = '';
var MetaThumb = '';
var MetaThumblist = 0;
var isDomReady = false;

//maria variable for handling id textarea for emoticons
var handleTextareaID = 'text_body_quick';
//maria variable for handling the bug in post emoticon of compose and comment
var forComposeEmoticonbug = false;
var forCommentEmoticonbug = false;
var forSmsEmoticonbug = false;
var currentLabelId;
var inParseEmos=false;

var isingmail='false';

//invite by promoteInterestLink.js
var source;

window.addEvent('load', function () {
    isDomReady = true; 			        //!On domready   
    currentLabelId='';
  currentLabelId=window.location.href.split("/");
     

    jsHelper.pulse.periodical(121000);  //Every 2 min check to see if session is still drinking!
    jsHelper.isNetworkUser(); 		 //!?
    jsHelper.logolink(); 		     //!Handle home-logo link
    jsHelper.handleSearch(); 	     //!Handle search requests-if search then do search
    jsHelper.handleScrollMore();     //!Handle scrolling
    jsHelper.handleStart();          //!Load first feeds
    jsHelper.handlePushfeedbar();    //!Add event on push-feed bar
    jsHelper.handleExternalFeeds();  //!Handle external feeds:EVERY 2 min
    
    (function () {

        jsHelper.handleOnlineFollowers();//!Handle Online followers:Every 90 sec
        jsHelper.handlePlusLabel();
        jsHelper.handleAutosuggest();    //!Handle compose form autosuggest:NO NEED TO HERE/OLD COMPOSE
        ////jsHelper.handleNotifications();  //Handle notifications
    }).delay(3 * 1000);
});
window.addEvent('domready', function () {
    
    /*
    stopped API req:
    (function () {}).delay(5 * 1000);*/
    //#Plus label 
    ///stopped API req:jsHelper.handleAutosuggestSearch();//!Handle Autocomplete for Search
    ///stopped API req:GetLabelistData.MyViewer();
    ///stopped API req:GetLabelistData.FollowViewer();
    ///jsHelper.handleLabelDropdowns();//!Handle label dropdowns-My, Follow, Every:NO NEED TO HERE/OLD COMPOSE
    ///jsHelper.attachments(); 		//!Attach link/youtube/photos:OLD COMPOSE
    ///jsHelper.handleSendButton();    //!Add event on send-compose button:NO NEED TO HERE/OLD COMPOSE
    ///jsHelper.handleTwitterButton(); //!Handle twitter button-show/hide:NO NEED TO HERE/OLD COMPOSE
    ///jsHelper.handleWadjaThinking(); //!Add event on message body-wadja thinking:NO NEED TO HERE/OLD COMPOSE
});

var wProfile = {
    Compose: {
        BodyLength: 0,
        From: 0,
        AutoSuggest: { Obj: false, Results: false },
        SetFrom: function (q, t) { wProfile.Compose.From = q; }, //#stopped->$('openID').innerHTML = 'from: ' + t + '<span class=\"arrowOn marL3\">&nbsp;</span>'; 
        Send: function () {
            return;
        },
        cls: function () {
            return;
        },
        Response: function (r) {
           return;
        },
        BodyType: function (event) {
           return;
        },
        Type: function (event) {
          return;
        },
        WadjaThinking: function (r) {
          return;
        }
    },
    Current: { DetailsID: profileInfo.ownerID, Category: 'My', LabelID: 8, Filter: 0, Per_Page: 8, Page: 1, MinID: 0, FeedsPending: 0, ViewerID: profileInfo.viewerID }, // What data to show
    CurrentSearch: { Page: 1, Category: '', Keyword: '' },
    Helper: { Loaded: [], Pending: [], Labels: [], Rendered: [] }, // Helper functions
    Render: {
        More: function () {
            ///Remove PRELOADING SKY!
            if (!$('overlaymask').hasClass('dnd'))
                $('overlaymask').addClass('dnd');
            ///
            //more-loading
            releaseMore=false;
           //  onlyOnceEmbed = 'true'; //prepei na einai true edw gia na mi ksanakanei embed
            if ($('feeds_more_button')) {
                $('feeds_more_button').set('disabled', true);
                $('feeds_more_button').set('value', $('feeds_more_button').get('value') + '...');
                /* loading icon */
                if ($('dvMore_loading'))
                    $('dvMore_loading').removeClass('dnd');
            }
            //end of more-loading
            wProfile.Load(wProfile.Current.DetailsID, wProfile.Current.Category, wProfile.Current.LabelID, (wProfile.Current.Page += 1), false);
        },
        Start_RC1: function (r, b, srch, postToMsg) //#beta rich view
        {
            //#thumb view-we need load this js on domready
            bootloader.load('/user/thumb.js', function () {
            ///Remove PRELOADING SKY!
                if (!$('overlaymask').hasClass('dnd'))
                    $('overlaymask').addClass('dnd');
                UIThumb.render(r, b, srch, postToMsg);
            });
        },
        Start: function (r, b, srch, postToMsg) {
     
     //mono an exei ginei refresh mariaaa
     if(isFollowFromRight =='true'){
          feedActions.loadSUGGESTInterests(profileInfo.ownerID);
          }

        
      //  javascript:followersjs.loadFollowersVIEW('" + lbl1.id + "'," + lbl1.Owner_ID + "," + ViewerID + ",'" + lbl1.name.Replace("'", "\\'") + "' ,'0','AR', '" + lbl1Owner.WadjaID + "');\">People follow this</a>
     
      //onlyOnceEmbed = 'true';
     //   wantToemptyTheDescr = 'false';
   
   // onlyOnceEmbed= 'false';
  // alert('wantToemptyTheDescr '+wantToemptyTheDescr);
 //   alert('onlyOnceEmbed '+onlyOnceEmbed);
      
       if(onlyOnceEmbed=='true'){
      
       if(prevLabelId!= wProfile.Current.LabelID.toString()){
       onlyOnceEmbed='false';
       }else{
       onlyOnceEmbed='true';
       }
       
        }
       //  prevLabelId = wProfile.Current.LabelID.toString();
       if(onlyOnceEmbed=='false'){
       currentLabelId=window.location.href.split("/");
         prevLabelId = currentLabelId[4];
        if($('label_about_body') && $('byPageOwnerSpan')){
        // $('label_about_body').empty();
        // $('label_about_body').removeClass('dndD');
        //     $('label_about_body').destroy();
           }
            if($('label_about_body') && wantToemptyTheDescr=='true' && $('byPageOwnerSpan')){
           //   alert(3);
             $('label_about_body').empty();
               $('label_about_body').addClass('dndD');
                 $('label_about_body').destroy();

                  $('byPageOwnerSpan').empty();
                  $('byPageOwnerSpan').addClass('dndD');
                  $('byPageOwnerSpan').destroy();
               
                  wantToemptyTheDescr = 'false';
              }
            if($('label_content_info')){
            //  alert(4);
              $('label_content_info').addClass('dndD');
              }
              }
             
            if (!isFromSearch) {
                //Get label followers
                try {
                    //alert('initlabel...');
                    InitLabelInfo(wProfile.Current.LabelID);
                }
                catch (Error) {
                    Notify.alert('Javascript error', '<div class="pad10">Javascript error while loading label followerd #' + Error + '. Label ID:' + wProfile.Current.LabelID + '</div>', 'Ok', 'red');
                }
            }
         
            //alert(selectedLabelName);
            // remove PRELOADING SKY!
            if (!$('overlaymask').hasClass('dnd'))
                $('overlaymask').addClass('dnd');
            // stop loading
            if ($('dvMore_loading'))
                $('dvMore_loading').addClass('dnd');
                   
            if($('text_body') && (forComposeEmoticonbug==false))
            {
                handleTextareaID = 'text_body';
                
            }
            else if($('replyTxt') && (forCommentEmoticonbug==false)){ //for comment compose
                handleTextareaID= 'replyTxt';
            }
            else if($('text_body') && (forSmsEmoticonbug==false)){ //for comment compose
                handleTextareaID= 'text_body_quick5';
            }
            else{ 
                handleTextareaID= 'text_body_quick5';  
            }

            //maria quickcompose be closed every time i change labels (appear the right label name in page link when i changes labels from left)
            if($('text_body_quick5'))
            {
                if($('closeQComp')){
                if(!$('closeQComp').hasClass('dnd')){
                quickComposeClass.hideQuickComp(); 
               }
                }
            }
            
         
          
            //STARTUP..................................................................................
            jsHelper.handlePopcornWindows();/* close all popcorn windows */
            //...Set compose box text
            //setTxtBodyText();
            //...Make drop-downs style active
            jsHelper.handleDropDowns();
            //...Custom profile settings
            jsHelper.handleCustomprofiles();
            // Overlay when typing a post: End
            // line----------------------------------------------------------------------------
            //#show hide blocked filter, add contacts icon
            if (wProfile.Current.LabelID == 5) {
                if ($('blockContactsFilter')) {
                    $('blockContactsFilter').removeClass('dndD');
//                    if (profileInfo.ownerID == profileInfo.viewerID && profileInfo.isLoggedIn)
//                        $('add_contact_form').removeClass('dnd');
                }
            }
            else {
                if ($('blockContactsFilter')) {
                    $('blockContactsFilter').addClass('dndD');
                    //$('add_contact_form').addClass('dnd');
                }
            }
            //#end show hide blocked filter
            // line----------------------------------------------------------------------------
           
            //...Close popup
            feedActions.viewOff();
            //----------------------------------------------------------------------------------------
            Feedlist = '';//reset nav
            //....If label changed empty 
            if (wProfile.Helper.Loaded.length == 0) {
                var myFx = new Fx.Scroll(window).toTop(); //.toElement('dvStream');
                wHtmlCanvas.empty();
            }
            //#Switch views-list, thumb
            if (UIView == 1) {
                //#Start-Rendering thumb view.
                wProfile.Render.Start_RC1(r, b, srch, postToMsg);
                return;
            }
            else {
                //#restore list view styles
                if (wHtmlCanvas.hasClass('thumb_view_profile')) {
                    wHtmlCanvas.empty();
                    wHtmlCanvas.addClass('dvProfFeeds'); //#thumb view class
                    wHtmlCanvas.removeClass('thumb_view_profile'); //#thumb view class
                }

                if ($('srch_users') && $('srch_users').hasClass('thumb_view_profile')) {
                    $('srch_users').empty();
                    $('srch_users').addClass('dvProfFeeds'); //#thumb view class
                    $('srch_users').removeClass('thumb_view_profile'); //#thumb view class
                }

                if ($('srch_labels') && $('srch_labels').hasClass('thumb_view_profile')) {
                    $('srch_labels').empty();
                    $('srch_labels').addClass('dvProfFeeds'); //#thumb view class
                    $('srch_labels').removeClass('thumb_view_profile'); //#thumb view class
                }

                if ($('srch_feeds') && $('srch_feeds').hasClass('thumb_view_profile')) {
                    $('srch_feeds').empty();
                    $('srch_feeds').addClass('dvProfFeeds'); //#thumb view class
                    $('srch_feeds').removeClass('thumb_view_profile'); //#thumb view class
                }
            }
            //----------------------------------------------------------------------------------------
            //...if search feeds initialize search variables
            var addTop = (b !== undefined);
            var isFromSearch = (srch !== undefined);
            if (srch !== undefined)
                isFromSearch = srch;
            else
                isFromSearch = false;
            if (!isFromSearch) jsHelper.resetSearchElements();
            //...if new post initialize variables
            var postToMessage = (postToMsg !== undefined);
            if (postToMsg !== undefined)
                postToMessage = postToMsg;
            else
                postToMessage = false;
            //...if Load Feeds, not Yellow Bar Click
            
            if (!addTop) {
                if (r.error != null) {
                    Notify.topBarOn(r.error, 'red', 7);
                    return;
                }
                /* debug:
                $('wzilla').set('html',r.value); */
                r = JSON.decode(r.value);
            } else {
                wProfile.Helper.Pending = [];
            }

            var isMessage = document.location.hash.Contains('!inbox/');
            //            if (isMessage && !postToMessage) {
            //                wProfile.Current.LabelID = -1;
            //                $('dvStream').empty();
            //                pushstart = 1; //stop pushing new feeds
            //            }
            //            else
            //                pushstart = 0; //start pushing new feeds

            var frag = document.createDocumentFragment();
            $('aNewFeeds').addClass('dnd');
            notificationsAlerts.reset(0, 0);


            if (isMessage && !postToMessage) {$('dvMore').addClass('dnd');$('dvMore_top').removeClass('dnd'); }
            else if (r != null && r.length == 0) {$('dvMore').addClass('dnd');$('dvMore_top').removeClass('dnd'); }
            else if (r != null && r[0].NoFeeds <= wProfile.Current.Page * wProfile.Current.Per_Page && !addTop) {$('dvMore').addClass('dnd');$('dvMore_top').removeClass('dnd'); }
            else if ($('dvMore') && addTop && $('dvMore').hasClass('dnd')) var t = 0; //do nothing
            else {$('dvMore').removeClass('dnd');$('dvMore_top').addClass('dnd');}

            var pendingLength = 0;

            //#on db timeout
            if (r == null) {
                Notify.topBarOn(T_TOOMANYFEEDS, 'red', 6)
                return '';
            }

            //#List view
            if (r.length > 15 && !isMessage)
                pendingLength = 15;
            else
                pendingLength = r.length;
            var inRecipients = false; //If user is in the recipients then do something-used for feed toolbar
            //#Helper variables for the presetation of the lsit view feeds
            var fromRecipientID, fromRecipientUI = '';  //Feed signature-sender
            var toRecipientID, toRecipientUI;    //Feed signature-recipient
            var feedSTATUS_STAR = ''; //#STAR: ON/OFF
            var feedSTATUS_DOT_STAR = 'dnd';
            var feedSTATUS_STARTIP = '';

           
            for (i = 0; i < pendingLength; i++) {
                if (!addTop && wProfile.Helper.Loaded.indexOf(r[i].FeedID) > -1)
                    continue; // If Feed is already displaying, skip to next
                inRecipients = false;

                var classConversation = "";
                if (r[i].BaseTypeID == 3 && r[i].ConversationID != null) {
                    classConversation = 'c_' + r[i].ConversationID.replaceAll("[ref: ", "").replaceAll("]", "").replaceAll("]", "").trim();
                    //#Group conversations
                    $$('.' + classConversation).each(function (element, index) {
                        $(element.get('id')).destroy();
                    });
                }

                //Label owner
                var ownerID = 0;
                var profileOwnerInRecipients = false;
                var profileViewerInRecipients = false;
                if (profileInfo.ownerID == r[i].DetailsID)
                    profileOwnerInRecipients = true;
                else if (r[i].Recipients != null) {
                    for (var rec = 0; rec < r[i].Recipients.length; rec++) {
                        if (profileInfo.ownerID == r[i].Recipients[rec].DetailsID) {
                            profileOwnerInRecipients = true;
                            break;
                        }
                    }
                }
           
                if (!profileOwnerInRecipients && profileInfo.viewerID == r[i].DetailsID)
                    profileViewerInRecipients = true;
                else if (!profileOwnerInRecipients && r[i].Recipients != null) {
                    for (var rec = 0; rec < r[i].Recipients.length; rec++) {
                        if (profileInfo.viewerID == r[i].Recipients[rec].DetailsID) {
                            profileViewerInRecipients = true;
                            break;
                        }
                    }
                }
                if (wProfile.Current.Category.toLowerCase() == 'my' && profileOwnerInRecipients)
                    ownerID = profileInfo.ownerID;
                else if (wProfile.Current.Category.toLowerCase() != 'follow' && profileViewerInRecipients)
                    ownerID = profileInfo.viewerID;
                else if (r[i].Recipients != null && r[i].Recipients.length == 1 && r[i].Recipients[0].DetailsID > 0)
                    ownerID = r[i].Recipients[0].DetailsID;
                else
                    ownerID = r[i].DetailsID;

                var dvFeed = new Element('div'); // create a div container
                var dvFeedBottom = new Element('div', {'id':'feedBottom_' + r[i].FeedID, 'class': 'feedBottom'});
                dvFeed.setAttribute("id", 'feed_' + r[i].FeedID);
                dvFeed.setAttribute("rel", r[i].FeedID+'_'+r[i].DetailsID);//#used by comments box for previous-next
                Feedlist += r[i].FeedID+'_'+r[i].DetailsID+',';
                dvFeed.setAttribute("class", "feedMask " + classConversation); // hide feed-we need this for the reveal effect
                var topLeftPlacehold = new Element("span",{'class': "psRel f_l"});
                dvFeed.appendChild(topLeftPlacehold);
                //#region Avatar,Name
                if (!isMessage || postToMessage) {
                    if (r[i].ConversationUnreadCounter > 0) {
                        //#Mark a message UNREAD
                        var spMARKREAD = new Element('span', { 'id': 'hr_' + r[i].FeedID, 'html': '&nbsp;', 'class': 'padL7 dnb' });
                        dvFeed.addClass('unread');

                        spMARKREAD.onclick = new Function("feedActions.markRead('" + r[i].FeedID + "','" + r[i].ConversationID + "');");
                        spMARKREAD.addClass('cursor');
                        dvFeed.appendChild(spMARKREAD); //#line break
                        //dvFeed.appendChild(new Element('span', { 'id': 'hr_arrow_' + r[i].FeedID, 'html': '&nbsp;', 'class': 'arrowUpFeed' })); //#arrow up
                    }
                    else{
                        /*
                        dvFeed.appendChild(new Element('span', { 'id': 'hr_' + r[i].FeedID, 'html': '&nbsp;--', 'class': 'padL7 dnb arrowFeed' })); //#line break
                        dvFeed.appendChild(new Element('span', { 'id': 'hr_arrow_' + r[i].FeedID, 'html': '&nbsp;++', 'class': 'arrowUpFeed' })); //#arrow up
                        */
                    }
                }

                var wID = (r[i].Recipients.length > 0) ? (r[i].Recipients[0].DetailsID < 1 ? r[i].WadjaID : r[i].Recipients[0].WadjaID) : r[i].WadjaID; // To User
                fromRecipientID = r[i].DetailsID;

                var dName = '';
                fromRecipientUI = '';
                var recipientLabels = '';
                var recipientIDforLabels = 0;
                //#One recipient
                //#Multiple recipients
                if (r[i].BaseTypeID == 6) {
              
                    dName = ' ';
                    if (r[i].ContactID == profileInfo.viewerID && r[i].Recipients.length == 1 && r[i].Recipients[0].DetailsID == profileInfo.viewerID && r[i].DetailsID == profileInfo.viewerID) {
                        fromRecipientUI = ' ' + T_UPDATEDBY + ' ' + '<a href=\"/' + profileInfo.viewerWadjaID + '\">' + T_ME + '</a>';
                    }
                    else if (r[i].ContactID == profileInfo.ownerID && r[i].Recipients.length == 1 && r[i].Recipients[0].DetailsID == profileInfo.ownerID && r[i].DetailsID == profileInfo.ownerID) {
                  
                        if (r[i].Name != null && r[i].Name.length > 0)
                            dName += '<span class=\"bolt lnk f13\">'+r[i].WadjaID + '</span> <span class=\"f11 grayColor\">' + r[i].Name + '<span>';
                        else
                            dName += r[i].WadjaID;
                            fromRecipientUI = '<a href=\"/' + r[i].WadjaID + '\">' + dName + '</a>';
                        //fromRecipientUI = '<a id="imgToThumb_' + r[i].DetailsID + '_' + r[i].FeedID + '" rel="' + r[i].DetailsID + '" class=\"imgTo b_r\" href=\"/' + r[i].WadjaID + '\" style=\"background-image:url(' + r[i].Thumbnail.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"/' + r[i].WadjaID + '\">' + dName + '</a>';
                        fromRecipientUI = ' ' + T_UPDATEDBY + ' ' + fromRecipientUI;
                    }
                    else {
                        if (r[i].DetailsID == profileInfo.viewerID)
                            fromRecipientUI = ' <a href=\"/' + profileInfo.viewerWadjaID + '\">' + T_ME + '</a>';
                        else {
                            if (r[i].Name != null && r[i].Name.length > 0)
                                dName +=  '<span class=\"bolt lnk f13\">'+r[i].WadjaID + '</span> <span class=\"f11 grayColor\">' + r[i].Name + '</span>';
                            else
                                dName += '<span class=\"bolt lnk f13\">'+r[i].WadjaID+'</span>';
                                fromRecipientUI = '<a href=\"/' + r[i].WadjaID + '\">' + dName + '</a>';
                            //fromRecipientUI = '<a id="imgTo_' + r[i].DetailsID + '_' + r[i].FeedID + '" rel="' + r[i].DetailsID + '" class=\"imgTo b_r\" href=\"/' + r[i].WadjaID + '\" style=\"background-image:url(' + r[i].Thumbnail.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"/' + r[i].WadjaID + '\">' + dName + '</a>';
                        }
                        fromRecipientUI = ' ' + T_ADDEDBY + ' ' + fromRecipientUI;
                   
                    }
                }
                else {
                
                    if (r[i].Recipients.length == 1) {
                        if (profileInfo.isLoggedIn && r[i].BaseTypeID != 3 && ((r[i].Recipients[0].DetailsID == 0 && fromRecipientID == profileInfo.viewerID) ||
                            r[i].Recipients[0].DetailsID == profileInfo.viewerID)) {
                            var temp = T_ME;
                            if (!profileInfo.profileBelongsToViewer)
                                temp = T_MY;
                            //Labels
                            if (r[i].Recipients[0].Labels != null && r[i].Recipients[0].Labels.length > 0) {                            
                                for (j = 0; j < r[i].Recipients[0].Labels.length; j++) {
                                    temp = T_MY;
                                    if (j == 0)
                                        fromRecipientUI += '<a href=\"/' + r[i].Recipients[0].Labels[j].OwnerWadjaID.toLowerCase() + '#!My/' + r[i].Recipients[0].Labels[j].id + '/1\">' + temp + '&nbsp;#' + r[i].Recipients[0].Labels[j].name + '</a>';
                                    else
                                        fromRecipientUI += '<a href=\"/' + r[i].Recipients[0].Labels[j].OwnerWadjaID.toLowerCase() + '#!My/' + r[i].Recipients[0].Labels[j].id + '/1\">#' + r[i].Recipients[0].Labels[j].name + '</a>';
                                }
                            }
                            else
                                fromRecipientUI = '<a href=\"/' + profileInfo.viewerWadjaID + '\">' + temp + '</a>';
                            recipientIDforLabels = r[i].Recipients[0].DetailsID;
                        }
                        else if (r[i].BaseTypeID == 3) {
                            if (r[i].isSMS) {
                                dName = ' +';
                            }
                            else {
                                dName = ' ';
                            }
                            if (r[i].Recipients[0].DetailsID > 0) {
                                if (r[i].Recipients[0].DetailsID == profileInfo.viewerID) {
                                    fromRecipientUI = '<a href=\"/' + profileInfo.viewerWadjaID + '\">' + T_ME + '</a>';
                                }
                                else {
                                    if (r[i].Recipients[0].Name != null && r[i].Recipients[0].Name.length > 0)
                                    //dName += r[i].Recipients[0].WadjaID + ' (' + r[i].Recipients[0].Name + ')';
                                        dName += r[i].Recipients[0].Name;
                                    else
                                        dName += r[i].Recipients[0].WadjaID;
                                        fromRecipientUI = '<a href=\"/' + r[i].Recipients[0].WadjaID + '\">' + dName + '</a>';
                                    //fromRecipientUI = '<a id="imgTo_' + r[i].Recipients[0].DetailsID + '_' + r[i].FeedID + '" rel="' + r[i].Recipients[0].DetailsID + '" class=\"imgTo b_r\" href=\"/' + r[i].Recipients[0].WadjaID + '\" style=\"background-image:url(' + r[i].Recipients[0].ImageURL.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"/' + r[i].Recipients[0].WadjaID + '\">' + dName + '</a>';
                                }
                            }
                            else {
                                dName += r[i].Recipients[0].WadjaID;
                                if (r[i].isSMS)
                                    fromRecipientUI = '<a href=\"javascript:Contacts.ShowAddContactForm(\'\',\'' + r[i].Recipients[0].WadjaID + '\');\">' + dName + '</a>';
                                    //fromRecipientUI = '<a class=\"imgTo b_r\" href=\"javascript:Contacts.ShowAddContactForm(\'\',\'' + r[i].Recipients[0].WadjaID + '\');\" style=\"background-image:url(' + r[i].Recipients[0].ImageURL.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"javascript:Contacts.ShowAddContactForm(\'\',\'' + r[i].Recipients[0].WadjaID + '\');\">' + dName + '</a>';
                                else
                                    fromRecipientUI = '<a href=\"javascript:Contacts.ShowAddContactForm(\'' + r[i].Recipients[0].WadjaID + '\',\'\');\">' + dName + '</a>';
                                    //fromRecipientUI = '<a class=\"imgTo b_r\" href=\"javascript:Contacts.ShowAddContactForm(\'' + r[i].Recipients[0].WadjaID + '\',\'\');\" style=\"background-image:url(' + r[i].Recipients[0].ImageURL.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"javascript:Contacts.ShowAddContactForm(\'' + r[i].Recipients[0].WadjaID + '\',\'\');\">' + dName + '</a>';
                            }
                        }
                        else if (r[i].Recipients[0].DetailsID > 0) {
                            if (r[i].Recipients[0].Name != null && r[i].Recipients[0].Name.length > 0)
                            //dName = ' @' + r[i].Recipients[0].WadjaID + ' (' + r[i].Recipients[0].Name + ')';
                                dName = ' ' + r[i].Recipients[0].Name;
                            else
                                dName = ' ' + r[i].Recipients[0].WadjaID;
                            //Labels
                            if (r[i].Recipients[0].Labels != null && r[i].Recipients[0].Labels.length > 0) {
                                for (j = 0; j < r[i].Recipients[0].Labels.length; j++) {
                                    if (j == 0)
                                        fromRecipientUI = '<a href=\"/' + r[i].Recipients[0].Labels[j].OwnerWadjaID.toLowerCase() + '#!My/' + r[i].Recipients[0].Labels[j].id + '/1\">' + dName + '</a>';
                                    else
                                        fromRecipientUI += '<a href=\"/' + r[i].Recipients[0].Labels[j].OwnerWadjaID.toLowerCase() + '#!My/' + r[i].Recipients[0].Labels[j].id + '/1\">#' + r[i].Recipients[0].Labels[j].name + '</a>';
                                }
                            }
                            else
                                fromRecipientUI = '<a href=\"/' + r[i].Recipients[0].WadjaID + '\">' + dName + '</a>';
                                //fromRecipientUI = '<a id="imgTo_' + r[i].Recipients[0].DetailsID + '_' + r[i].FeedID + '" rel="' + r[i].Recipients[0].DetailsID + '" class=\"imgTo b_r\" href=\"/' + r[i].Recipients[0].WadjaID + '\" style=\"background-image:url(' + r[i].Recipients[0].ImageURL.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"' + r[i].Recipients[0].WadjaID + '\">' + dName + '</a>';
                            //fromRecipientUI = '<a href=\"/' + r[i].Recipients[0].WadjaID + '\">' + dName + '</a>'; 

                            recipientIDforLabels = r[i].Recipients[0].DetailsID;
                        }
                        else {
                            if (r[i].Name != null && r[i].Name.length > 0)
                            //dName = ' @' + r[i].WadjaID + ' (' + r[i].Name + ')';
                                dName = ' ' + r[i].Name;
                            else
                                dName = ' ' + r[i].WadjaID;
                              fromRecipientUI = '<a href=\"/' + r[i].WadjaID + '\">' + dName + '</a>';
                            //fromRecipientUI = '<a class=\"imgTo b_r\" href=\"/' + r[i].WadjaID + '\" style=\"background-image:url(' + r[i].Thumbnail.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"/' + r[i].WadjaID + '\">' + dName + '</a>';
                            //recipientIDforLabels = r[i].DetailsID;
                        }                    
                    }
                    else if (r[i].Recipients.length > 1) {
                        var seperator = '&nbsp;,&nbsp;';
                        if (r[i].Recipients.length == 1)
                            seperator = '';
                        for (var rec = 0; rec < r[i].Recipients.length; rec++) {
                            if (r[i].isSMS)
                                dName = ' +';
                            else
                                dName = ' ';
                            if (rec == r[i].Recipients.length - 1)
                                seperator = '';

                            if (r[i].Recipients[rec].DetailsID > 0) {
                                if (r[i].Recipients[rec].DetailsID == profileInfo.viewerID) {
                                    fromRecipientUI += '<a href=\"/' + profileInfo.viewerWadjaID + '\">' + T_ME + '</a>' + seperator;
                                }
                                else {
                                    if (r[i].Recipients[rec].Name != null && r[i].Recipients[rec].Name.length > 0)
                                    //dName += r[i].Recipients[rec].WadjaID + ' (' + r[i].Recipients[rec].Name + ')';
                                        dName += r[i].Recipients[rec].Name;
                                    else
                                        dName += r[i].Recipients[rec].WadjaID;
                                    //fromRecipientUI += '<a id="imgTo_' + r[i].Recipients[rec].DetailsID + '_' + r[i].FeedID + '" rel="' + r[i].Recipients[rec].DetailsID + '" class=\"imgTo b_r\" href=\"/' + r[i].Recipients[rec].WadjaID + '\" style=\"background-image:url(' + r[i].Recipients[rec].ImageURL.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"/' + r[i].Recipients[rec].WadjaID + '\">' + dName + '</a>' + seperator;
                                    fromRecipientUI += '<a href=\"/' + r[i].Recipients[rec].WadjaID + '\">' + dName + '</a>' + seperator;
                                }
                            }
                            else {
                                dName += r[i].Recipients[rec].WadjaID;
                                if (r[i].isSMS)
                                fromRecipientUI = '<a href=\"javascript:Contacts.ShowAddContactForm(\'\',\'' + r[i].Recipients[rec].WadjaID + '\');\">' + dName + '</a>' + seperator;
                                    //fromRecipientUI = '<a class=\"imgTo b_r\" href=\"javascript:Contacts.ShowAddContactForm(\'\',\'' + r[i].Recipients[rec].WadjaID + '\');\" style=\"background-image:url(' + r[i].Recipients[rec].ImageURL.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"javascript:Contacts.ShowAddContactForm(\'\',\'' + r[i].Recipients[rec].WadjaID + '\');\">' + dName + '</a>' + seperator;
                                else
                                 fromRecipientUI = '<a href=\"javascript:Contacts.ShowAddContactForm(\'' + r[i].Recipients[rec].WadjaID + '\',\'\');\">' + dName + '</a>' + seperator;
                                    //fromRecipientUI = '<a class=\"imgTo b_r\" href=\"javascript:Contacts.ShowAddContactForm(\'' + r[i].Recipients[rec].WadjaID + '\',\'\');\" style=\"background-image:url(' + r[i].Recipients[rec].ImageURL.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"javascript:Contacts.ShowAddContactForm(\'' + r[i].Recipients[rec].WadjaID + '\',\'\');\">' + dName + '</a>' + seperator;
                                
                            }
                        }
                    }
                    else {
                    /*maria for adding @ in tweeter feeds */
                   
                        if (r[i].DetailsID == profileInfo.viewerID && profileInfo.isLoggedIn) {
                           
                            fromRecipientUI = '<a href=\"/' + profileInfo.viewerWadjaID + '\">' + T_ME + '</a>';
                                
                        }
                        else {
                            if (r[i].Name != null && r[i].Name.length > 0)
                            //dName = ' @' + r[i].WadjaID + ' (' + r[i].Name + ')';
                                dName = ' ' + r[i].Name;
                            else
                                dName = ' ' + r[i].WadjaID;
                            //fromRecipientUI = '<a id="imgTo_' + r[i].DetailsID + '_' + r[i].FeedID + '" rel="' + r[i].DetailsID + '" class=\"imgTo b_r\" href=\"/' + r[i].WadjaID + '\" style=\"background-image:url(' + r[i].Thumbnail.replace("_n.", "_s.") + ');\">&nbsp;</a> <a href=\"/' + r[i].WadjaID + '\">' + dName + '</a>';
                            fromRecipientUI = '<a href=\"/' + r[i].WadjaID + '\">' + dName + '</a>';
                        }
                    }
                    //#NEW FEATURE-DISPLAY THE FIRST LABEL
                      if (r[i].Labels != null) {
                        for (j = 0; j < r[i].Labels.length; j++) {    
                        if(!r[i].Labels[j].isSystem || (r[i].Labels[j].isSystem && r[i].Labels[j].id == rootlabel))  {                                                                 
                            //if(recipientIDforLabels > 0 && recipientIDforLabels != ownerID && r[i].Labels[j].Owner_ID == recipientIDforLabels && r[i].Labels[j].id != r[i].BaseLabelID) {
                                //if(j==1)
                                var wheellabeldropdown = ''; 
                                //if(r[i].Labels[j].Owner_ID ==  profileInfo.viewerID) {
                                    var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + r[i].Labels[j].id + '&o=' + r[i].Labels[j].Owner_ID + '&n="></script>';            
                                    // wheel dropdown - Ariana
                                    wheellabeldropdown += '<div class="subWheelPr">';
                                    wheellabeldropdown += '<div class="share-arrow-left">&nbsp;</div>';
                                    wheellabeldropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                                    wheellabeldropdown += '<ul>';
                                    wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_GO_TO_PAGE+'</span><a href=\"http://'+ profileInfo.networkDomain+'/'+r[i].Labels[j].OwnerWadjaID.toLowerCase()+'#!My/'+r[i].Labels[j].id+'/1\">http://'+ profileInfo.networkDomain+'/'+r[i].Labels[j].OwnerWadjaID.toLowerCase()+'.'+r[i].Labels[j].name.replace("\'", "\\'")+'</a></li>';
                                    wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+r[i].Labels[j].id+'_' +r[i].FeedID +'" onclick="this.focus();this.select();" value="http://'+ profileInfo.networkDomain+'/'+r[i].Labels[j].OwnerWadjaID.toLowerCase()+'.'+r[i].Labels[j].name.replace("\'", "\\'")+'"/></li>';
                                    wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+r[i].Labels[j].id+'_' +r[i].FeedID +'" class="textBoxSmall" onclick="this.focus();this.select();" /></li>';
                                    if(r[i].BaseTypeID != 6) {
                                        if(((r[i].Labels[j].Owner_ID == 0) || r[i].Labels[j].Owner_ID == profileInfo.viewerID) && !isFromSearch) {
                                            wheellabeldropdown += '<li onclick="feedActions.remove(' + r[i].FeedID + ',' + r[i].Labels[j].id + ',\'' + r[i].Labels[j].name.replace("\'", "\\'") + '\');"><span>'+DEF_DELETE_TO_THIS+'</span></li>';
                                        }
                                    }
                                    wheellabeldropdown += '</ul></div><div class=\"clearboth\"></div></div>';
                                //}                                
                                recipientLabels += '<span id=\"attachedlabel_' + r[i].FeedID + '_' + r[i].Labels[j].Owner_ID + '_' + r[i].Labels[j].id+'\" class=\"showApply\"><span class=\"f_l\">' + wheellabeldropdown + '&nbsp;</span><a class=\"f_l\" href=\"/' + r[i].Labels[j].OwnerWadjaID.toLowerCase() + '#!My/' + r[i].Labels[j].id + '/1\">' + r[i].Labels[j].name + '</a><span class=\"f_l\">&nbsp;'+T_BY +'&nbsp;</span><div class=\"clearboth\"></div></span>';
                             }
                             else {
                             // # what if system label???? 
                             //recipientLabels += '<span id=\"attachedlabel_' + r[i].FeedID + '_' + r[i].Labels[j].Owner_ID + '_' + r[i].Labels[j].id+'\" class=\"showApply\"><a class=\"f_l\" href=\"/' + r[i].Labels[j].OwnerWadjaID.toLowerCase() + '#!My/' + r[i].Labels[j].id + '/1\">' + r[i].Recipients[0].Labels[j].name + '</a><span class=\"f_l\">&nbsp;'+T_BY + '&nbsp;</span></span>';
                             }
                             break;
                        }
                    }
                    fromRecipientUI = '<span>&nbsp;' +T_TO + '&nbsp;</span>'  + recipientLabels +  fromRecipientUI;

                }

                var fromImageClass = ''
                if (profileInfo.ownerID == r[i].DetailsID)
                    fromImageClass = ' changeprofpic_' + r[i].DetailsID;

               
                if (r[i].isThirdParty) {
                    if (r[i].BaseTypeID == 14)//#Youtube-currently no photo, no user info
                    {
                               //#format: photo, name
                       
                         var divForLikePoints = new Element('div', { 'id': 'divForLikePoints_' + r[i].FeedID, 'class': 'divForLikePoints', 'html': '' });
                        dvFeed.appendChild(new Element('a', { 'id': 'imgFrom_' + r[i].FeedID, 'rel': r[i].FeedID, 'href': ('http://www.youtube.com'), 'class': 'imgFrom ' + fromImageClass, 'html': '', 'styles': { 'background-image': 'url(/s3.images/labels/youtube-icon-profile.png)'} }));
                        dvFeed.appendChild(new Element('a', { 'href': ('http://www.youtube.com'), 'class': 'hrfFrom', 'html': '<b>YouTube</b>' }));
                              topLeftPlacehold.appendChild(divForLikePoints);
                      
                    }
                    else {
                   // alert('here');
                       //#TWITTER:format: photo, name
                       var dName = r[i].ExternalUserFullnameURL;
                     
                       dName = dName.replace("(", "</span> <span class='f11 grayColor'>").replace(")","</span>");
                       var divForLikePoints = new Element('div', { 'id': 'divForLikePoints_' + r[i].FeedID, 'class': 'divForLikePoints', 'html': '' });
                       dvFeed.appendChild(new Element('a', { 'id': 'imgFrom_' + r[i].FeedID, 'rel': r[i].FeedID, 'href': 'javascript:twittercardjs.profile("'+r[i].ExternalUserProfileURL+'","'+dName+'");', 'class': 'imgFrom ' + fromImageClass, 'html': '', 'styles': { 'background-image': 'url(' + r[i].ExternalUserThumbnailURL + ')'} }));
                       topLeftPlacehold.appendChild(divForLikePoints);
                       /*maria for removing @ in tweeter*/
                       if (r[i].BaseTypeID == 13)
                       {
                            dvFeed.appendChild(new Element('a', { 'href': 'javascript:twittercardjs.profile("'+r[i].ExternalUserProfileURL+'","'+dName+'");', 'class': 'hrfFrom', 'html': '<span class=\"bolt lnk f13\">' + dName }));
                       }
                       else{
                            dvFeed.appendChild(new Element('a', { 'href': 'javascript:twittercardjs.profile("'+r[i].ExternalUserProfileURL+'","'+dName+'");', 'class': 'hrfFrom', 'html': '<span class=\"bolt lnk f13\">' + dName }));
                       }
                    }
                }
                else if (r[i].BaseTypeID == 6) {
                    if (r[i].ContactID == profileInfo.ownerID) {
                        senderImageID = 'sender_pic_' + r[i].DetailsID;
                        senderImageClass = 'sender_image_class_' + r[i].DetailsID;
                        if (r[i].Name != null && r[i].Name.length > 0) {
                            dName = '<span class=\"bolt lnk f13\">'+r[i].WadjaID + '</span> <span class=\"f11 grayColor\">' + r[i].Name + '</span>';
                        }
                        else {
                            dName ='<span class=\"bolt lnk f13\">'+ r[i].WadjaID + '</span>';
                        }

                        dThumb = r[i].Thumbnail;
                        //maria old// dURL = "javascript:profilecardjs.loadUserCard("+ r[i].DetailsID+");";
                       
                        dURL = "/" + r[i].WadjaID;
                    }
                    else {
                        //fromImageClass = ' changeprofpic_' + r[i].Recipients[0].DetailsID;
                        //senderImageID = 'sender_pic_' + r[i].Recipients[0].DetailsID;
                        senderImageClass = 'sender_image_class_' + r[i].Recipients[0].DetailsID;
                        if (r[i].Recipients[0].Name != null && r[i].Recipients[0].length > 0) {
                            dName = r[i].Recipients[0].WadjaID + '</span> <span class=\"f11 grayColor\">' + r[i].Recipients[0].Name + '</span>';
                        }
                        else {
                            dName = r[i].Recipients[0].WadjaID + '</span>';
                        }

                        dThumb = r[i].Recipients[0].ImageURL.replace("_n.", "_s.");
                        ///dURL = "javascript:profilecardjs.loadUserCard("+ r[i].Recipients[0].DetailsID+");";
                        dURL = "/" + r[i].Recipients[0].WadjaID;
                    }
              // alert('ssssss');
                    var divForLikePoints = new Element('div', { 'id': 'divForLikePoints_' + r[i].FeedID, 'class': 'divForLikePoints', 'html': '' });
                    dvFeed.appendChild(new Element('a', { 'id': 'imgFrom_' + r[i].FeedID, 'href': dURL, 'rel': r[i].FeedID, 'class': 'imgFrom ' + fromImageClass, 'html': '', 'styles': { 'background-image': 'url(' + dThumb + ')'} })); // From User Image
                    dvFeed.appendChild(new Element('a', { 'href': dURL, 'class': 'hrfFrom', 'html': dName })); // From User Name
                 topLeftPlacehold.appendChild(divForLikePoints);
                }
                else {
                    //#format: photo, name
                //  alert('kkkkk');
                    var divForLikePoints = new Element('div', { 'id': 'divForLikePoints_' + r[i].FeedID, 'class': 'divForLikePoints', 'html': ''});
                   dvFeed.appendChild(new Element('a', { 'id': 'imgFrom_' + r[i].FeedID, 'href': '/'+ r[i].WadjaID, 'rel': r[i].FeedID, 'class': 'imgFrom ' + fromImageClass, 'html': '', 'styles': { 'background-image': 'url(' + r[i].Thumbnail + ')'} })); // From User Image
                   //WRONG:dvFeed.appendChild(new Element('a', { 'id': 'imgFrom_' + r[i].FeedID, 'href':'/'+ r[i].Recipients[0].WadjaID , 'rel': r[i].FeedID, 'class': 'imgFrom b_r ' + fromImageClass, 'html': '', 'styles': { 'background-image': 'url(' + r[i].Thumbnail + ')'} })); // From User Image
                     topLeftPlacehold.appendChild(divForLikePoints);
                    var ddName; //# wadja id (name)
                    if (r[i].Name != null && r[i].Name.length > 0)
                        ddName = '<span class=\"bolt lnk f13\">' + r[i].WadjaID + '</span> <span class=\"f11 grayColor\">' + r[i].Name + '</span> ';
                    else
                        ddName = '<span class=\"bolt lnk f13\">' + r[i].WadjaID + '</span> ';

                  dvFeed.appendChild(new Element('a', { 'href': '/'+ r[i].WadjaID, 'class': 'hrfFrom', 'html': ddName + '' })); // From User Name
                  ///WRONG:dvFeed.appendChild(new Element('a', {'href': "/"+ r[i].Recipients[0].WadjaID , 'rel': r[i].FeedID, 'class': 'imgFrom b_r ' + fromImageClass, 'html': '', 'styles': { 'background-image': 'url(' + r[i].Thumbnail + ')'} })); // From User Image
                 }
                //#endregion Avatar,Sender

                // BIO text 
                /*if(r[i].BaseTypeID != 14 && r[i].BaseTypeID != 28 && r[i].BaseTypeID != 13)
                dvFeed.appendChild(new Element('div', {'html':'What\'s interesting about me','class':'aboutme'}));*/
               
               //maria alert
               // alert(' r[i].Body '+r[i].Body);
                 //#EDIT-My feeds
                /*...*/


                 // Edit feed -
                 var editdots = '';
                 var dRepliesCounter;
                 if  (profileInfo.isLoggedIn && ((profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My') || ( r[i].DetailsID == profileInfo.viewerID || inRecipients)))
                 editdots = '&nbsp;&#183;&nbsp;'; 
                var FeedEditA = new Element('a', { 'id': 'feed_edit_' + r[i].FeedID, 'href': 'javascript:editFeed.edit(\'' + r[i].FeedID + '\',\'L\');','class': 'dib hoverNounderline grayColor f_r applyEdit', 'html':'', 'title': T_EDITFEED, 'onmouseover':'Tip.doTipLbl(\'feed_edit_' + r[i].FeedID + '\' ,\''+ T_EDITFEED +'\',\'8\',\'10\');', 'onmouseout':'Tip.doTipOff(\'feed_edit_' + r[i].FeedID + '\');' });
  
                //start experimenting
                var myregexp_pipe = 'pipeSymbolFromEmoticon';
                var bodyvalue;
                var result_pipe;
              
                result_pipe= r[i].Body.match(myregexp_pipe);
       
                if (result_pipe != null) { r[i].Body = r[i].Body.replaceAll('pipeSymbolFromEmoticon','|');}
                //end experiment                
               
                var dVia;

                if (r[i].ExternalUserProfileURL != null && r[i].ExternalUserThumbnailURL != null) {
                    if (r[i].BaseTypeID == 13)
                        dVia = 'Twitter';
                    else if (r[i].BaseTypeID == 14)
                        dVia = 'YouTube';
                    else if (r[i].BaseTypeID == 28)
                        dVia = 'Last.FM';
                                     
                    if (r[i].BaseTypeID == 13 && !isFromSearch)//#Twitter
                        dvFeed.appendChild(new Element('div', { 'class': 'spnDate ' + ((isMessage && !postToMessage) ? 'f_l mtmt vam' : ''), 'html': '<span class=\"dateIcon\">' + wProfile.Render.DateDiff(r[i].Date) + '</span><span> - ' + T_VIA + '&nbsp;</span><a target=\"_blank\" href=\"' + r[i].ExternalUserProfileURL + '\">' + dVia + '</a>' + fromRecipientUI })); // Date (ago)
                   // add sender name-url to profile
                    else if (r[i].ExternalUserFullnameURL.length > 0 && !isFromSearch)
                        dvFeed.appendChild(new Element('div', { 'class': 'spnDate ' + ((isMessage && !postToMessage) ? 'f_l mtmt vam' : ''), 'html':'<span class=\"dateIcon\">' + wProfile.Render.DateDiff(r[i].Date) + '</span><span> - ' + T_VIA + '&nbsp;</span><a target=\"_blank\" href=\"' + r[i].ExternalUserProfileURL + '\">' + dVia + '</a>' + fromRecipientUI })); // Date (ago)
                    else if (isFromSearch)
                        dvFeed.appendChild(new Element('div', { 'class': 'spnDate ' + ((isMessage && !postToMessage) ? 'f_l mtmt vam' : ''), 'html':'<span class=\"dateIcon\">' + wProfile.Render.DateDiff(r[i].Date) + '</span><span> - ' + T_VIA + '&nbsp;</span><a target=\"_blank\" href=\"' + r[i].ExternalUserProfileURL + '\">' + dVia + '</a>' + fromRecipientUI  })); // Date (ago)
                   }
                else if (r[i].BaseTypeID == 3 || r[i].BaseTypeID == 10 || r[i].BaseTypeID == 28) {                    
                    dVia = '<a target=\"_blank\" href=\"http://' + r[i].SenderNetworkURL + '\">' + r[i].SenderNetworkName + '</a>';
                    dvFeed.appendChild(new Element('div', { 'class': 'spnDate ' + ((isMessage && !postToMessage) ? 'f_l mtmt vam' : ''), 'html':'<span class=\"dateIcon\">' + wProfile.Render.DateDiff(r[i].Date)+ '</span><span> - ' + T_VIA + '&nbsp;</span><span>' + dVia +'</span>' + fromRecipientUI })); // Date (ago)
                }
                else {                    
                    dVia = '<a target=\"_blank\" href=\"http://' + r[i].SenderNetworkURL + '\">' + r[i].SenderNetworkName + '</a>';
                    if (r[i].BaseTypeID == 14)
                        dVia = '<a target=\"_blank\" href=\"http://www.youtube.com\">YouTube</a>';
                    dvFeed.appendChild(new Element('div', { 'class': 'spnDate ' + ((isMessage && !postToMessage) ? 'f_l mtmt vam' : ''), 'html':'<span class=\"dateIcon\">' + wProfile.Render.DateDiff(r[i].Date) + '</span><span> - ' + T_VIA + '&nbsp;</span><span>' + dVia+'</span>'  + fromRecipientUI  })); // Date (ago)
                }
                //#replies- on feeds count comments, on message count replies
                    var dRepliesClass, dRepliesText;
                    dRepliesClass = 'reply_comments';
                    dRepliesCounter = '';

                    var UIType = 0;
                    if (r[i].BaseTypeID == 3) {
                        UIType = 1;
                        //#count replies
                        var dUndread = '';
                        var dUndreadEvent = '';
                        if (r[i].ConversationUnreadCounter > 0) {
                            dUndread = 'bolt';
                            dRepliesClass = 'reply_comments_unread';
                            dUndreadEvent = "onclick=\"feedActions.markRead('" + r[i].FeedID + "','" + r[i].ConversationID + "');\"";
                        }

                        if (r[i].ConversationMessageCounter > 1) {

                            dRepliesCounter = r[i].ConversationMessageCounter - 1;
                            if (dRepliesCounter > 1)
                                dRepliesCounter = '<span id=\"list_replies_' + r[i].FeedID + '\" ' + dUndreadEvent + '  class=\"' + dUndread + ' replies_counter\"><span id=\"replies_counter_' + r[i].FeedID + '\" class=\"' + dRepliesClass + '\">' + dRepliesCounter + '</span><span  class=\"reply_text_comments\">' + T_REPLIES + '</span></span>';
                            else
                                dRepliesCounter = '<span id=\"list_replies_' + r[i].FeedID + '\" class=\"' + dUndread + ' replies_counter\"><span id=\"replies_counter_' + r[i].FeedID + '\" class=\"' + dRepliesClass + '\">' + dRepliesCounter + '</span><span id=\"replies_counter_' + r[i].FeedID + '\" class=\"reply_text_comments\">' + T_REPLY + '</span></span>';
                        }
                        else
                            dRepliesCounter = '<span id=\"list_replies_' + r[i].FeedID + '\" class=\"' + dUndread + ' replies_counter\"><span id=\"replies_counter_' + r[i].FeedID + '\" class=\"reply_text_comments\">' + T_REPLY + '</span></span>';
                    }
                    else if (r[i].BaseTypeID == 6) {
                        var editText = '';
                        if (!r[i].ContactReal)
                            editText = '<span>&nbsp;(' + T_EDITCONTACT + ')';
                        //#count comments
                        if (r[i].CommentCounter > 1) {
                            dRepliesCounter = r[i].CommentCounter;
                            dRepliesCounter = '<span  class=\"' + dUndread + ' replies_counter\"><span id=\"list_replies_' + r[i].FeedID + '\" class=\"' + dRepliesClass + '\">' + dRepliesCounter + '</span></span><span id=\list_replies_text_' + r[i].FeedID + '\" class=\"reply_text_comments\">' + T_NOTES + editText + '</span>';
                        }
                        else if (r[i].CommentCounter == 1) {
                            dRepliesCounter = r[i].CommentCounter;
                            dRepliesCounter = '<span class=\"' + dUndread + ' replies_counter\"><span class=\"' + dRepliesClass + '\"  id=\"list_replies_' + r[i].FeedID + '\">' + dRepliesCounter + '</span></span><span id=\"list_replies_text_' + r[i].FeedID + '\" class=\"reply_text_comments\">' + T_NOTE + editText + '</span>';
                        }
                        else {
                            dRepliesCounter = '<span class=\"' + dUndread + ' replies_counter\"><span class=\"' + dRepliesClass + ' dnd\"  id=\"list_replies_' + r[i].FeedID + '\">' + dRepliesCounter + '</span><span id=\"list_replies_text_' + r[i].FeedID + '\" class=\"reply_text_comments\">' + T_NOTE_V + editText + '</span>';
                        }
                    }
                    else {
                        //#count comments
                        if (r[i].CommentCounter > 1) {
                            dRepliesCounter = r[i].CommentCounter;
                            dRepliesCounter = '<span id=\"list_replies_text_' + r[i].FeedID + '\" class =\"reply_text_comments\">' + dRepliesCounter + ' '+ T_COMMENTS + '</span><span class=\"' + dUndread + ' replies_counter\"></span>';
                        }
                        else {
                            if (r[i].CommentCounter == 1) {
                                dRepliesCounter = r[i].CommentCounter;
                                dRepliesCounter = '<span class=\"replies_counter\"><span id=\"list_replies_text_' + r[i].FeedID + '\" class =\"reply_text_comments\">' + dRepliesCounter + ' '+ T_COMMENT + '</span></span>';
                            }
                            else
                                dRepliesCounter = '<span class=\"replies_counter\"><span id=\"list_replies_text_' + r[i].FeedID + '\" class=\"reply_text_comments\">' +' '+T_COMMENT_V + '</span></span>';
                        }

                    }
                    var repliesSpan = new Element('span', { 'id': 'repliesSpan_' + r[i].FeedID, 'title': T_VIEWREPLY, 'class': 'repliesSpan f_l padT8 f11 grayColor', 'html':  dRepliesCounter });
                    try {
                        repliesSpan.onclick = new Function("feedActions.openPopup(" + r[i].FeedID + "," + UIType + ",'" + r[i].ConversationID + "'," + ownerID + ");");
                        
                    }
                    catch (errRl) {
                        alert(errRl);
                    }
                    //dvFeed.appendChild(repliesSpan);

                  // Plus one points - Ariana oldd maria
                 var plusOneSpan = new Element('span', { 'id': 'plus_one_sp_'+ r[i].FeedID, 'class' : 'psAbs', 'style' : 'top:-4px;left:-20px;' });
                //  dvFeed.appendChild(plusOneSpan);
                ///  //Plus one points end- Ariana
                divForLikePoints.appendChild(plusOneSpan);


                  // content feed 
                 //#region Separator
                dvFeed.appendChild(new Element('div', {'html':'&nbsp;','style':'clear: both;height:20px;'}));                
                //#endregion Separator
                var spnTextClass = "spnText";

                if (r[i].BaseLabelID == 11 || (isMessage && !postToMessage) || r[i].BaseTypeID == 21) //photos - message - points:remove left margin
                    spnTextClass = "spnTextNomargin";
                else if (r[i].BaseLabelID == 13 || r[i].BaseLabelID == 5)
                    spnTextClass = "spnTextYoutube";
                else
                    spnTextClass = "spnText";              
                
                var textID;
                if (r[i].BaseLabelID == 5 && !isFromSearch && r[i].ContactID != 0 && !r[i].ContactReal)
                    textID = r[i].ContactID;
                else
                    textID = r[i].FeedID;
              //maria alert body feed
             //  alert('r[i].Body '+r[i].Body);
                var eFeed = new Element('span', { 'id': ('spnText' + textID), 'class': spnTextClass, 'html': wProfile.Render.Body(r[i].Body.replaceAll("href=", "target='_blank' href="), r[i].BaseTypeID, r[i].FeedID, isFromSearch).replaceAll('\n', '<br>'), 'styles': {} });
                var eFeedEditForm = new Element('span', { 'id': ('spnTextForm' + textID), 'class': 'dndD', 'html': '' });
                if (profileInfo.isLoggedIn)
                    if (r[i].DetailsID == profileInfo.viewerID && r[i].BaseTypeID == 10) {
                        /*eFeed.setAttribute('class', 'spnText cursor');
                        eFeed.onclick = new Function("editFeed.edit('"+textID+"','L')");
                        eFeed.onmouseover =  new Function("editFeed.over('"+textID+"','L')");
                        eFeed.onmouseout =  new Function("editFeed.out('"+textID+"','L')");*/
                        dvFeed.appendChild(eFeedEditForm); //Feed Body
                    }
                //end experiment                

            dvFeed.appendChild(eFeed); //Feed Body
            var spanTitle = dvFeed.getChildren(".spnText>h6>span");
            spanTitle.addEvent("click",new Function("feedActions.openPopup(" + r[i].FeedID + "," + UIType + ",'" + r[i].ConversationID + "'," + ownerID + ");"));
               // #attached-link,youtube,photos
                if (r[i].Attachment != null && r[i].Attachment != '') {
              
                    try {
                        var attInfo = JSON.decode(r[i].Attachment);
                        //#thumb

                        var att_embed = attInfo.embed;
                        var att_embedplay = '';
                        var att_playicon = '';
                        var att_playspan = '';
                        if (att_embed.trim().length > 0) {
                     
                            att_embed = attInfo.embed;
                            //Matsagkonies
                            //Add transparency to youtube embed
                            var temp1 = '</param>';
                            var temp2 = '<embed ';
                            var temp3 = '<object ';
                            var newParam1 = '<param name="wmode" value="transparent"></param>';
                            var newParam2 = 'wmode="transparent" ';
                            var paramIndex = att_embed.lastIndexOf(temp1);
                            var firstPiece = att_embed.substring(0, paramIndex) + temp1;
                            var secondPiece = att_embed.substring(paramIndex + temp1.length);
                            att_embed = firstPiece + newParam1 + secondPiece;

                            paramIndex = att_embed.lastIndexOf(temp2);
                            firstPiece = att_embed.substring(0, paramIndex) + temp2;
                            secondPiece = att_embed.substring(paramIndex + temp2.length);
                            att_embed = firstPiece + newParam2 + secondPiece;

                            paramIndex = att_embed.lastIndexOf(temp3);
                            firstPiece = att_embed.substring(0, paramIndex) + temp3;
                            secondPiece = att_embed.substring(paramIndex + temp3.length);
                            att_embed = firstPiece + newParam2 + secondPiece;
                            //---------------------------------------------------------
                            att_embedplay = 'onclick=\"MyElement.dissolve(\'attach_thumb_' + r[i].FeedID + '\');MyElement.reveal(\'attach_embed_' + r[i].FeedID + '\');MyElement.reveal(\'feed_play_attach' + r[i].FeedID + '\');\"';
                            att_playicon = '<a href=\"javascript:#\" ' + att_embedplay + ' class=\"imgYuTb\" title=\"Click to play youtube video\" style=\"width:100px;height:70px;display:block; background-image: url(' + attInfo.thumb.replace('hqdefault.jpg', 'default.jpg') + ');\"><span class=\"youtube_play\">&nbsp;</span></a>';
                        }
                        else {
                        if(attInfo.thumb.trim() != '' || attInfo.thumb == null || attInfo.thumb == 0)                        
                            att_playicon = '<img onclick=\"feedActions.openPopup(' + r[i].FeedID + ',0,\'' + r[i].ConversationID + '\',' + ownerID + ');\" class=\"cursor\" ' + att_embedplay + ' style=\"width:100px;\" src=\"' + attInfo.thumb + '\"/>';
                        }
          
                        if (attInfo.url.indexOf('youtube.com')>=0) {
                        if(attInfo.thumb.trim() != '' || attInfo.thumb == null || attInfo.thumb == 0) 
                            att_playspan = '<span onclick=\"feedActions.openPopup(' + r[i].FeedID + ',0,\'' + r[i].ConversationID + '\',' + ownerID + ');\" class=\"youtube_play cursor\" style=\"position:absolute;left:35px; top:30px;\">&nbsp;</span>';
                        }
                        /*maria for vimeo */
                        if (attInfo.url.indexOf('vimeo.com')>=0) {
                        if(attInfo.thumb.trim() != '' || attInfo.thumb == null || attInfo.thumb == 0) 
                            att_playspan = '<span onclick=\"feedActions.openPopup(' + r[i].FeedID + ',0,\'' + r[i].ConversationID + '\',' + ownerID + ');\" class=\"youtube_play cursor\" style=\"position:absolute;left:35px; top:30px;\">&nbsp;</span>';
                        }
                        if (attInfo.thumb.trim() != '')
                            dvFeed.appendChild(new Element('div', { 'class': 'psRel marT20 z1',  'html': '<div id=\"attach_embed_' + r[i].FeedID + '\" class=\"dnd marT5\">' + att_embed + '</div><table cellpadding=\"0\"  cellspacing=\"0\"><tr><td id=\"attach_thumb_' + r[i].FeedID + '\" style=\"vertical-align:top; padding-top:5px;\">' + att_playicon + att_playspan + '</td><td style=\"vertical-align:top;word-wrap: break-word;\" class=\"padL10 padR20\"><table cellpadding=\"5\"  cellspacing=\"1\"><tr><td><a target=\"_blank\" href=\"' + attInfo.url + '\">' + attInfo.title.replaceAll('&quot;', '\"').replaceAll('&#39;', '\'') + '</a></td></tr><tr><td> <a target=\"_blank\" href=\"' + attInfo.url + '\" class=\"feedLink grayColor ofh dib\">' + attInfo.url + '</a></td></tr><tr><td>' + attInfo.description.replaceAll('&quot;', '\"').replaceAll('&#39;', '\'') + '</td></tr></table></td></tr></table>' }));
                        else
                            dvFeed.appendChild(new Element('div', { 'class': 'marT10',  'html': '<table cellpadding=\"0\"  cellspacing=\"0\" style=\"vertical-align:top;word-wrap: break-word;\"><tr><td><a target=\"_blank\" href=\"' + attInfo.url + '\">' + attInfo.title.replaceAll('&quot;', '\"').replaceAll('&#39;', '\'') + '</a></td></tr><tr><td> <a target=\"_blank\" href=\"' + attInfo.url + '\" class=\"grayColor\">' + attInfo.url + '</a></td></tr><tr><td>' + attInfo.description.replaceAll('&quot;', '\"').replaceAll('&#39;', '\'').replaceAll(/\"/g, '\'') + '</td></tr></table></td></tr></table>' }));

                    }
                    catch (jError) {
                        dvFeed.appendChild(new Element('div', { 'html': '' })); //render attachments:' + jError + '<b>'+ r[i].Attachment +'</b>
                    }
                }  
                dvFeed.appendChild(new Element('div', {'style':'height:20px; clear:both;'}));    
               
                // #design label badge
                // #design attached labels  

                if (r[i].Recipients.length == 0) {// no recipient
                    // #remove label rule
                    if (profileInfo.isLoggedIn) {
                        if (profileInfo.viewerID == r[i].DetailsID)
                            removeLabel = true;
                    }
                    else
                        removeLabel = false;
                }
                var labelsAr='';
                if (r[i].Labels != null) {
               // alert(2);
                    var labelsCount = 0;                    
                    var firstLabel = false;
                    for (j = 0; j < r[i].Labels.length; j++) {
                        if (labelsCount == 0)
                            firstLabel = true;   
                                             
                        /* Calculate labels array for points system */
                        if (r[i].Labels[j].isSystem && r[i].Labels[j].id != rootlabel) {
                           //alert(3);
                       // if (gl_label_issystem) {
                           //if(r[i].Labels[j].isSystem){

                        //   alert('system');//}/* ignore system interests */
                        }
                        else {  
                        labelsAr +=r[i].Labels[j].id+',';                          
                        labelsCount=labelsCount+1;
                        if(labelsCount != 1) {
                        wProfile.Helper.Labels[r[i].Labels[j].id] = r[i].Labels[j];

                        //var attachRemoveButton = '';
                        var attachLoadLabelLink = '#!';
                        var wheellabel = '';      
                        var wheellabeldropdown = ''; 
                        var wheelColor = '';
                        var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + r[i].Labels[j].id + '&o=' + r[i].Labels[j].Owner_ID + '&n="></script>';            

                        // wheel dropdown - Ariana
                        wheellabeldropdown += '<div class="subWheelPr marT20" id="attachedlabellink_' + r[i].FeedID + '_' + r[i].Labels[j].Owner_ID + '_' + r[i].Labels[j].id+'Dropdown">';
                        wheellabeldropdown += '<div class="share-arrow-left">&nbsp;</div>';
                        wheellabeldropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                        wheellabeldropdown += '<ul>';
                        wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_GO_TO_PAGE+'</span><a href=\"http://'+ profileInfo.networkDomain+'/'+r[i].Labels[j].OwnerWadjaID.toLowerCase()+'#!My/'+r[i].Labels[j].id+'/1\">http://'+ profileInfo.networkDomain+'/'+r[i].Labels[j].OwnerWadjaID.toLowerCase()+'.'+r[i].Labels[j].name.replace("\'", "\\'")  +'</a></li>';
                        wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+r[i].Labels[j].id+'_' +r[i].FeedID +'" onclick="this.focus();this.select();" value="http://'+ profileInfo.networkDomain+'/'+r[i].Labels[j].OwnerWadjaID.toLowerCase()+'.'+r[i].Labels[j].name.replace("\'", "\\'")+'"/></li>';
                        wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+r[i].Labels[j].id+'_' +r[i].FeedID +'" class="textBoxSmall" onclick="this.focus();this.select();" /></li>';
                        if(r[i].BaseTypeID != 6) {
                            if(((r[i].Labels[j].Owner_ID == 0) || r[i].Labels[j].Owner_ID == profileInfo.viewerID) && !isFromSearch) {
                                wheellabeldropdown += '<li onclick="feedActions.remove(' + r[i].FeedID + ',' + r[i].Labels[j].id + ',\'' + r[i].Labels[j].name.replace("\'", "\\'") + '\');"><span>'+DEF_DELETE_TO_THIS+'</span></li>';
                            }
                        }
                        wheellabeldropdown += '</ul></div></div>';
                        
                        // Gray or white wheel - Ariana                        
                        function setColor(theColor){
                        var txtColor ='';
                        txtColor = parseInt(theColor.substr(1),16)
                            if(txtColor<170)
                            wheelColor = 'wheel_labels_white';
                            else
                            wheelColor = 'wheel_labels';
                        }
                        setColor(r[i].Labels[j].bgColor.replace("#", ""));

                        feedSTATUS_STARTIP = T_STARFEED;
                        feedSTATUS_STAR = 'applyStarOff';
                        feedSTATUS_DOT_STAR = '';
                        //#STAR STATUS
                        if (r[i].Labels[j].id == 4) {
                            feedSTATUS_STAR = 'applyStar';
                            feedSTATUS_DOT_STAR = '';
                            feedSTATUS_STARTIP = T_STARFEEDOFF;

                        }

                         if (removeLabel) {
                            // 1.(check here)if (labels.id is equal to session.id) OR (labels.recipients.id is equal to session.id)
                            // then profileInfo.ownerID
                            // 2.(check under attach label badge)if (labelbadge.ownerID_id is 0) or (labels.owner_id is equal session.id) 
                            // then user can remove attach label badge
                            if (((r[i].Labels[j].Owner_ID == 0) || r[i].Labels[j].Owner_ID == profileInfo.viewerID) && !isFromSearch)
                                removeLabel = true;
                            else
                                removeLabel = false;
                        }

                        //Handle load label links
                        attachLoadLabelLink = "#!"; //(wProfile.Current.Category != 'My' ? '/' + r[i].WadjaID.toLowerCase() : '') + '#!';
                        if (r[i].Labels[j].StyleID == 0) {
                            // #default labels design
                            // #tools - Remove "x" icon from label bundle - Ariana
                            //if (removeLabel)
                                //attachRemoveButton = '<span title="' + T_REMOVELABEL + '" class="" onclick="feedActions.remove(' + r[i].FeedID + ',' + r[i].Labels[j].id + ',\'' + r[i].Labels[j].name.replace("\'", "\\'") + '\');">&times;</span>';
                            // #wheel - Interest info - Ariana
//                            if((r[i].Labels[j].privacy == 3 || r[i].Labels[j].privacy == 2) && r[i].Labels[j].Owner_ID != profileInfo.viewerID)
//                                wheellabel='';
//                            else {
//                                wheellabel = '<span id="Wheel_' + r[i].Labels[j].id + '_' + r[i].FeedID + '" class="'+wheelColor+' dropdown psRel inactiveWheel" onmouseout="MyMenu.hideAll(\'\');" onmouseover="var event = arguments[0] || window.event;if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble = true;} MyMenu.DropDown(\'Wheel_' + r[i].Labels[j].id + '_' + r[i].FeedID + '\',\'\',\'\',\'Wheel_' + r[i].Labels[j].id + '_' + r[i].FeedID + 'Dropdown\',\'\',\'\');">&nbsp;</span>';
//                            }
                            // # My, Follow, Every: wProfile.Current.Category
                            attachLoadLabelLink = '/' + r[i].Labels[j].OwnerWadjaID.toLowerCase() + '#!'; //3/8/2010
                            if (isFromSearch)
                                attachLoadLabelLink = '/' + r[i].WadjaID.toLowerCase() + '#!';
                            if(labelsCount == 2) {
                            dvFeedBottom.appendChild(new Element('span', {'id':'post_also_'+r[i].FeedID, 'class':'f_l grayColor f11 padT8 marR5', 'html':T_POST_IS_ALSO}));
                            }
                            dvFeedBottom.appendChild(new Element('span', { 'id': 'attachedlabel_' + r[i].FeedID + '_' + r[i].Labels[j].Owner_ID + '_' + r[i].Labels[j].id, 'rel': r[i].Labels[j].name.replace("'", "\'"), 'class': 'showApply f_l psRel labelcount_' + r[i].FeedID, 'html': '<span class=\"f_l\">'+wheellabeldropdown+'</span><a href="' + attachLoadLabelLink + 'My/' + r[i].Labels[j].id + '/1" rel="' + r[i].Labels[j].name.replace("'", "\'") + '" class="lblBox f_l ' + r[i].Labels[j].style+'">' + r[i].Labels[j].name + '</a>'}));
                            //dvFeed.appendChild(new Element('span', {'html': wheellabeldropdown , 'class':'f_l'}));
                        }
                        else // #custom label badges
                        {
                            // #share 
                            var attachShareButton = '';
                            var attachFollowersButton = '';
                            var attachFollowersCounter = '99+';
                            var attachLabelCustomIcon = '';
                            var attachCustomStyle = '';
                            var attachLabelName = r[i].Labels[j].name;

                            // #Custom button styles
                            if (r[i].Labels[j].thumbURL.length > 0)
                                //attachCustomStyle = 'background-color:' + r[i].Labels[j].bgColor + ';color:' + r[i].Labels[j].fontColor + ' !important;';
                                if(r[i].Labels[j].fontColor.toLowerCase() != "#fff" && r[i].Labels[j].fontColor.toLowerCase() != "#ffffff")
                                attachCustomStyle = 'color:' + r[i].Labels[j].fontColor + ' !important;';
                                else
                                attachCustomStyle = 'color: #000fff !important;';
                            else
                                //attachCustomStyle = 'background-color:' + r[i].Labels[j].bgColor + ';color:' + r[i].Labels[j].fontColor + ' !important;padding:3px 5px !important;';
                                if(r[i].Labels[j].fontColor.toLowerCase() != "#fff" && r[i].Labels[j].fontColor.toLowerCase() != "#ffffff")
                                attachCustomStyle = 'color:' + r[i].Labels[j].fontColor + ' !important;padding:3px 5px 3px 0!important;';
                                else
                                attachCustomStyle = 'color:#0000ff !important;padding:3px 5px 3px 0!important;';

                            // #Remove button function
                            attachHoverStyle = '' + r[i].Labels[j].bgColor.replace("#", "");
                            // #tools - Remove "x" icon from label bundle - Ariana 
                            //if (removeLabel)
                                //attachRemoveButton = '<span style="' + attachCustomStyle + '" tile="' + T_REMOVELABEL + '" onclick="feedActions.remove(' + r[i].FeedID + ',' + r[i].Labels[j].id + ',\'' + r[i].Labels[j].name.replace("\'", "\\'") + '\');" class=" h_' + attachHoverStyle + '">&times;</span>';
                            // #wheel - Interest info - Ariana
//                            if((r[i].Labels[j].privacy == 3 || r[i].Labels[j].privacy == 2) && r[i].Labels[j].Owner_ID != profileInfo.viewerID)
//                                wheellabel='';
//                            else {
//                                wheellabel = '<span id="Wheel_' + r[i].Labels[j].id + '_' + r[i].FeedID + '" onmouseout="MyMenu.hideAll(\'\');" onmouseover="var event = arguments[0] || window.event;if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble = true;} MyMenu.DropDown(\'Wheel_' + r[i].Labels[j].id + '_' + r[i].FeedID + '\',\'inactiveWheel\',\'activeWheel\',\'Wheel_' + r[i].Labels[j].id + '_' + r[i].FeedID + 'Dropdown\',\'\',\'\');" style="' + attachCustomStyle + '" class="inactiveWheel '+wheelColor+' dropdown  h_' + attachHoverStyle + '">&nbsp;</span>';
//                             
//                            }
                            // #Custom label icon
                            if (r[i].Labels[j].thumbURL.length > 0)
                                attachLabelCustomIcon = '<img height="14px" width="17px" class="cursor"  src="' + r[i].Labels[j].thumbURL + '" />';                            
                            if(labelsCount == 2) {
                            dvFeedBottom.appendChild(new Element('span', {'id':'post_also_'+r[i].FeedID, 'class':'f_l grayColor f11 padT8 marR5', 'html':T_POST_IS_ALSO}));
                            }
                            dvFeedBottom.appendChild(new Element('span', { 'id': 'attachedlabel_' + r[i].FeedID + '_' + r[i].Labels[j].Owner_ID + '_' + r[i].Labels[j].id, 'rel': r[i].Labels[j].name.replace("\'", "\\'"), 'class': 'showApply psRel f_l labelcount_' + r[i].FeedID, 'html':'<span class=\"f_l\">'+wheellabeldropdown+'</span><a href="/' + r[i].Labels[j].OwnerWadjaID.toLowerCase() + attachLoadLabelLink + 'My/' + r[i].Labels[j].id + '/1" class="lblBox f_l ' + r[i].Labels[j].style+' h_' + attachHoverStyle + '" style="' + attachCustomStyle + '">' + attachLabelCustomIcon + attachLabelName + '</a>' + attachFollowersButton + attachShareButton}));
                            
                            //dvFeed.appendChild(new Element('span', {'html': wheellabeldropdown, 'class':'f_l'}));                            
                         }
                      }          
                    }                    
                        //-------------------- 
                  }
                
                                                       
                  //old if(labelsCount ==1 && (profileInfo.viewerID == r[i].DetailsID || profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My'))
                    //Hidden field for label count
                    dvFeedBottom.appendChild(new Element('input', { 'type': 'hidden', 'id': 'label_count_hidden_' + r[i].FeedID, 'value': labelsCount }));
                }
                 //#feature: +1
               if (r[i].BaseTypeID != 3 && r[i].BaseTypeID != 6) {                   
                    //Like button
                    if (profileInfo.isLoggedIn && r[i].DetailsID != profileInfo.viewerID) {
                        var likeButton = '';
                        if (r[i].IFplusOne) {

                            likeButton = new Element('a', { 'id': 'FeedLikeButton_' + r[i].FeedID, 'class': 'plusOne f10 f_l grayColor marT5', 'html': '<span class=\"\" id=\"FeedLikeCounter_' + r[i].FeedID+'\">'+r[i].plusOneCounter+'</span> ','onmouseover':'Tip.doTipLbl("FeedLikeCounter_'+ r[i].FeedID +'" ,"Total points","10","8");', 'onmouseout':'Tip.doTipOff("FeedLikeCounter_'+ r[i].FeedID +'");' });
                             //var likeCounter = new Element('a', { 'id': '', 'title': '', 'class': '', 'html': '+'+r[i].plusOneCounter }); 
                        }
                        else {
                      
                        //var likeCounter = new Element('span', { 'id': ', 'title': '', 'class': '', 'html': '+'+r[i].plusOneCounter });
                        likeButton = new Element('a', { 'id': 'FeedLikeButton_' + r[i].FeedID, 'class': 'plusOne cursor f10 f_l marT5 blueLightColor', 'html': '<span id=\"FeedLikeCounter_' + r[i].FeedID+'\" class=\"\">'+r[i].plusOneCounter+'</span> ','onmouseover':'Tip.doTipLbl("FeedLikeCounter_'+ r[i].FeedID +'" ,"Click to +1 this post","10","8");', 'onmouseout':'Tip.doTipOff("FeedLikeCounter_'+ r[i].FeedID +'");' });
                       
                        likeButton.onclick = new Function('feedActions.plusOne(' + r[i].FeedID + ',\''+labelsAr+'\', false);');
                       
                        }       
                    }
                    else {
                    var likeButton = '';
                        likeButton = new Element('a', { 'id': 'FeedLikeButton_' + r[i].FeedID, 'class': 'plusOne f_l f10 marT5 grayColor', 'html': '<span id=\"FeedLikeCounter_' + r[i].FeedID+'\" class=\"\">'+r[i].plusOneCounter+'</span> ','onmouseover':'Tip.doTipLbl("FeedLikeCounter_'+ r[i].FeedID +'" ,"Total points","10","8");', 'onmouseout':'Tip.doTipOff("FeedLikeCounter_'+ r[i].FeedID +'");' });                                       
                    //var likeCounter = new Element('a', { 'id': 'FeedLikeCounter_' + r[i].FeedID, 'title': '', 'class': 'f_l f11 marT5 grayColor', 'html': '+'+r[i].plusOneCounter });
                    }
                     //Like counter
                  
                   
                   plusOneSpan.appendChild(likeButton);
                }

                 if (profileInfo.isLoggedIn && ((profileInfo.viewerID == r[i].DetailsID || profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My' || inRecipients) || (isMessage && !postToMessage)) && r[i].BaseTypeID != -1) {
                 
                    if ((!isMessage || postToMessage) && !isFromSearch) {
                        //apply label drop-down
                          
                        if(labelsCount > 1) 
                            var applyTitle = T_ADDLABEL_EXISTING;
                        else
                        {
                            var applyTitle = T_ADDLABEL;
                            dvFeedBottom.appendChild(new Element('span', {'html':T_LINK_THIS_POST, 'class':'grayColor f11 padT8 f_l marR3'}));
                        }

                        var tempEl = new Element('span', { 'class': 'f_l f11 marT8 padB5 psRel dropdown', 'id': 'feed_pluslabel_' + r[i].FeedID + '', 'title': T_APPLYLABEL, 'html':'<a class="lnk" id="addPage_' + r[i].FeedID + '" onmouseover="Tip.doTipLbl(\'addPage_' + r[i].FeedID + '\' ,\''+ T_APPLYLABEL +'\',10,10);" onmouseout="Tip.doTipOff(\'addPage_' + r[i].FeedID + '\');">'+applyTitle+'</a>' });
                        tempEl.onclick = new Function('var event = arguments[0] || window.event;if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble = true;} feedActions.plusLabel(' + r[i].FeedID + ');return false;');
                                             
                        var dvApply = new Element('span', { 'id': 'feed_pluslabel_' + r[i].FeedID +'Dropdown', 'class': 'dndD dropdown feed_pluslabel_dropdown', 'html': '{drop-down}' }); // dndD create a div container:.
                        tempEl.appendChild(dvApply);
                        var dvPlus = dvFeedBottom.appendChild(tempEl);
//                //Comments Icon and counter
//                var commentsIcon = new Element('a', { 'id': 'feed_comment_' + r[i].FeedID, 'href': 'javascript:feedActions.openPopup(' + r[i].FeedID + ',' + UIType + ',\'' + r[i].ConversationID + '\',' + ownerID + ');','class': 'dib hoverNounderline grayColor', 'html':  r[i].ConversationMessageCounter , 'title': T_COMMENTS, 'onmouseover':'Tip.doTipLbl(\'feed_comment_' + r[i].FeedID + '\' ,\''+ T_COMMENTS +'\',\'3\',\'0\');', 'onmouseout':'Tip.doTipOff(\'feed_comment_' + r[i].FeedID + '\');' });
                        //dvFeed.appendChild(dvApply);
                        dvFeedBottom.appendChild(new Element('span', { 'id': 'attachedlabel_spot_' + r[i].FeedID, 'html': '' }));        
                        dvFeedBottom.appendChild(dvPlus);
                   
                        dvFeedBottom.appendChild(new Element('div',{'html':'&nbsp;-&nbsp;', 'class':'f_l padT7'})); 
                  
                    }

                } 
                else if (r[i].BaseTypeID == 6 && !isFromSearch && r[i].ContactReal && profileInfo.isLoggedIn) {
                    var contactClass = 'unblock_contact f_r';
                    var contactTitle = T_BLOCKUSER;
                    var value = 1;
                    if (r[i].ContactBlocked) {
                        contactClass = 'block_contact f_r';
                        contactTitle = T_UNBLOCKUSER;
                        value = 0;
                    }
                    var contactID = r[i].ContactID;
                    if (profileInfo.ownerID == contactID)
                        contactID = r[i].DetailsID;
                    if (r[i].CanBlock)
                        dvFeed.appendChild(new Element('a', { 'href': 'javascript:feedActions.block_unblock(' + r[i].FeedID + ',' + contactID + ',' + value + ');', 'class': contactClass, 'html': ' ', 'title': contactTitle, 'id': 'block_unblock_' + r[i].FeedID }));
                }
                //#attach new labels after add page   
                dvFeedBottom.appendChild(repliesSpan);       
                dvFeed.appendChild(dvFeedBottom);
                frag.appendChild(dvFeed); // append to document fragment


                //#Stopped: @argyris 
                //if (wID != r[i].WadjaID) // If to User not Self
                //    dvFeed.appendChild(new Element('a', { 'href': '/' + wID, 'class': 'hrfLabels', 'html': ('@' + wID) })); // show @recipient
                //-----------------------------------------------
                //#Handle feed links #u2,#pearl jam
                //#Stopped: #u2 #nike
                //-----------------------------------------------
                //var attachTitleLabelLinks = '#!My/';
                //if (profileInfo.viewerID != r[i].DetailsID)
                //attachTitleLabelLinks = '/' + r[i].WadjaID.toLowerCase();
                //else
                //attachTitleLabelLinks = '';
                //for (j = 0; j < r[i].Labels.length; j++) { //#Show Labels #Labels Links
                //dvFeed.appendChild(new Element('a', { 'href': attachTitleLabelLinks + '#!My/' + r[i].Labels[j].id + '/1', 'class': 'hrfLabels', 'html': ('#' + r[i].Labels[j].name) }));
                //}
                //-----------------------------------------------

               

                //#Remove label rule
                var removeLabel = false;
                //#Conversation pagelet:ismessage
                if (isMessage && !postToMessage) {
                    var temp_class = '';
                    var temp_delivery_counter = 0;
                    var temp_delivery_status = '';
                    var deliveryReportsBox = '';

                    for (var j = 0; j < r[i].Recipients.length; j++) {
                        if (r[i].Recipients.length == 1 && (r[i].isSMS)) {
                            if (r[i].Recipients[j].DeliveryStatus.length > 0)
                                temp_delivery_status = r[i].Recipients[j].DeliveryStatus;
                            else
                                temp_delivery_status = '';

                            temp_delivery_counter = 1;
                        }
                        else {
                            temp_delivery_status = T_DELIVERYREPORTS.replace('#X', r[i].Recipients.length);
                            temp_delivery_counter = r[i].Recipients.length;
                        }

                        //#Build delivery reports box
                        if (r[i].isSMS) {
                            if (r[i].Recipients[j].DeliveryStatus != null) {
                                var temp_status = r[i].Recipients[j].DeliveryStatus.trim();
                                if (r[i].Recipients[j].DeliveryStatus.trim().toLowerCase() == 'delivered') {
                                    temp_status = T_DELIVERED;
                                    temp_class = 'blueColor';
                                }
                                else if (r[i].Recipients[j].DeliveryStatus.trim().toLowerCase() == 'sending...') {
                                    temp_status = T_SENDING;
                                    temp_class = 'greenColor';
                                }
                                else
                                    temp_class = 'redColor';
                            }
                            var deliver_rec = r[i].Recipients[j].WadjaID;
                            if (r[i].Recipients[j].Name != null && r[i].Recipients[j].Name.length > 0)
                                deliver_rec = r[i].Recipients[j].Name;

                            deliveryReportsBox = deliveryReportsBox + '<div class=\"deliveryInfo\">' + deliver_rec + '<span class=\"' + temp_class + '\">' + temp_status + '</span></div>';
                            //?:deliveryReportsBox = deliveryReportsBox + "SMS sent to " + r[i].Recipients[j].Name + " &rarr; Status: " + r[i].Recipients[j].DeliveryStatus + "<br>";
                        }
                        //#Display recipients list
                        if (j <= 3)
                            dvFeed.appendChild(new Element('a', { 'href': '/' + r[i].Recipients[j].WadjaID, 'class': 'hrfMessage', 'html': r[i].Recipients[j].Name }));
                    }
                       
                    //#SMS-attach delivery report
                    if (r[i].isSMS) {
                        dvFeed.appendChild(new Element('a', { 'href': 'javascript:MyElement.toggleReveal("deliveryRp' + r[i].FeedID + '");', 'class': 'hrfMessage f_r cursor counterLabels', 'html': T_DELIVERYREPORTS.replace('#X', r[i].Recipients.length) }));
                        //#Delivery reports on the site
                        dvFeed.appendChild(new Element('div', { 'class': 'deliveryReportsDiv dnd', 'html': '<div><span class=\"f_l counterLabels\">' + temp_delivery_counter + '</span><span class=\"f_l\">' + T_DELIVERYREPORTS + '</span><a href\"javascript:MyElement.dissolve(\'deliveryRp' + r[i].FeedID + '\');\" id=\"close_dev_report_' + r[i].FeedID + '\" class="f_r closeIcon" >&nbsp;</a><div class=\"clearboth\"></div></div><div id=\"delivery_info\">' + deliveryReportsBox + '</div>', 'id': 'deliveryRp' + r[i].FeedID }));


                        //                        var tempFunction = new Function('MyElement.dissolve(\'deliveryRp' + r[i].FeedID + '\');');
                        //                        $('close_dev_report_' + r[i].FeedID).onclick = tempFunction;
                    }


                }
                else if (r[i].Recipients.length > 0) { // If recipient count > 0 (message / notes)
                    var pic = (r[i].Recipients[0].DetailsID < 1 ? r[i].Thumbnail.replace("_n.", "_n.") : r[i].Recipients[0].ImageURL.replace("_s.", "_n."));

                    // #remove label rule
                    // #if session alive-signed in
                    if (profileInfo.isLoggedIn) {
                        //#1.(check here)if (labels.id is equal to session.id) OR (labels.recipients.id is equal to session.id)
                        //#then profileInfo.ownerID
                        //#2.(check under attach label badge)if (labelbadge.ownerID_id is 0) or (labels.owner_id is equal session.id) 
                        //#then user can remove attach label badge
                        if ((profileInfo.viewerID == r[i].DetailsID) || (profileInfo.viewerID == r[i].Recipients[0].DetailsID))
                            removeLabel = true;

                        if (profileInfo.viewerID == r[i].Recipients[0].DetailsID)//if user in recipients
                            inRecipients = true;
                    }
                    else
                        removeLabel = false;

                    if (!isFromSearch && r[i].BaseLabelID != 2 && !(r[i].BaseLabelID == 5 && !r[i].ContactReal)) {
                        /* #disable recipient -dvFeed.appendChild(new Element('a', { 'href': '/' + wID, 'class': '', 'html': ('@' + wID + ' ') })); // show @recipient*/
                    }
                    else if (r[i].BaseLabelID == 5 && !r[i].ContactReal) {
                        /* #disable recipient -dvFeed.appendChild(new Element('a', { 'href': ''+location.href+'', 'class': '', 'html': (''+wID + ' ') })); // show @recipient*/
                    }
                    else {
                        //#SMS-Show delivery report
                        if (r[i].isSMS) {
                            var temp_class = '';
                            var temp_delivery_counter = 0;
                            var temp_delivery_status = '';
                            var deliveryReportsBox = '';

                            for (var j = 0; j < r[i].Recipients.length; j++) {
                                if (r[i].Recipients.length == 1 && (r[i].isSMS)) {
                                    if (r[i].Recipients[j].DeliveryStatus.length > 0)
                                        temp_delivery_status = r[i].Recipients[j].DeliveryStatus;
                                    else
                                        temp_delivery_status = '';

                                    temp_delivery_counter = 1;
                                }
                                else {
                                    temp_delivery_status = T_XDELIVERYREPORTS.replace('#X', r[i].Recipients.length);
                                    temp_delivery_counter = r[i].Recipients.length;
                                }

                                //#Build delivery reports box

                                if (r[i].Recipients[j].DeliveryStatus != null) {
                                    var temp_status_del = r[i].Recipients[j].DeliveryStatus;
                                    if (r[i].Recipients[j].DeliveryStatus.toLowerCase() == 'delivered') {
                                        temp_status_del = T_DELIVERED;
                                        temp_class = 'blueColor';
                                    }
                                    else if (r[i].Recipients[j].DeliveryStatus.toLowerCase() == 'sending...') {
                                        temp_status_del = T_SENDING;
                                        temp_class = 'greenColor';

                                    }
                                    else
                                        temp_class = 'redColor';
                                }
                                var deliver_rec = r[i].Recipients[j].WadjaID;
                                if (r[i].Recipients[j].Name != null && r[i].Recipients[j].Name.length > 0)
                                    deliver_rec = r[i].Recipients[j].Name;

                                deliveryReportsBox = deliveryReportsBox + '<div  class=\"deliveryInfo\">' + deliver_rec + '<span class=\'' + temp_class + '\'>' + temp_status_del + '</span></div>';
                                //?:deliveryReportsBox = deliveryReportsBox + "SMS sent to " + r[i].Recipients[j].Name + " &rarr; Status: " + r[i].Recipients[j].DeliveryStatus + "<br>";
                                //#disabled rec-if (j<=3)
                                //#disabled rec-    dvFeed.appendChild(new Element('a', { 'href': '/' + r[i].Recipients[j].WadjaID, 'class': 'hrfMessage', 'html': '+'+ r[i].Recipients[j].Name })); // show @recipient
                            }
                            // Ariana 18/2/2010
                            //dvFeed.appendChild(new Element('a', { 'href': 'javascript:MyElement.toggleReveal("deliveryRp' + r[i].FeedID + '");', 'class': 'hrfMessage f_r cursor hrfDLR counterLabels', 'html': T_XDELIVERYREPORTS.replace('#X', r[i].Recipients.length) })); // show delivery report
                            //#Delivery reports on the site

                            dvFeed.appendChild(new Element('div', { 'class': 'deliveryReportsDiv dnd', 'html': '<div><span class=\"f_l counterLabels\">' + temp_delivery_counter + '</span><span class=\"f_l\">' + T_DELIVERYREPORTS + '</span><a class="f_r closeIcon" href=\"javascript:MyElement.dissolve(\'deliveryRp' + r[i].FeedID + '\');\">&nbsp;</a><div class=\"clearboth\"></div></div><div id=\"delivery_info\">' + deliveryReportsBox + '</div>', 'id': 'deliveryRp' + r[i].FeedID }));
                            //?:dvFeed.appendChild(new Element('a', { 'class': 'hrfMessage f_r cursor', 'html': '<span onclick=\"javascript:$(\'deliveryRp\'+r[i].FeedID).removeClass(\'dnd\');\">'+temp_delivery_status+'</span>' })); // show delivery report
                        }
                    }
                }
                    
                // Apply Label / Print / Pin / Trash etc icons, bottom right
                // #Rules
                // Enable tools only when user singed in and he/she is the owner of the label
                // #Message: 	3  reply|forward|print|push-pin|star|trash|apply
                // #Youtube: 	14 push-pin|star|apply|trash
                // #Twitter: 	13 push-pin|star|apply|trash
                // #Photo: 		12 push-pin|set as profile|star|apply|trash
                // #Lastfm: 	28 push-pin|star|apply|trash
                // #Digg: 		27 push-pin|star|apply|trash
                // #Text: 		9  push-pin|star|apply|trash
                // #Credits: 	21 star|apply|trash
                // #Contact: 	6  edit|message|sms|star|apply|trash
                // #Trash:		4  restore?


                //#placeholder: COMMENTS, +1, STAR, PUSH PIN, DELETE
                //if (profileInfo.isLoggedIn && ((profileInfo.viewerID == r[i].DetailsID || inRecipients) || (isMessage && !postToMessage)) && r[i].BaseTypeID != -1) {
                   //?if  (profileInfo.isLoggedIn && ((profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My') || (feed.feedOwner == profileInfo.viewerID || inRecipients))) {
if  (profileInfo.isLoggedIn && ((profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My') || ( r[i].DetailsID == profileInfo.viewerID || inRecipients))) {                       

 //#Trash
 var iconsContainerContainer = new Element('div', {'class':'psRel f_r feedIconsContainerContainer'});
 var iconsContainer = new Element('div', {'class':'feedIconsContainer f_r psRel', 'id' : 'feedIconsContainer_' + r[i].FeedID });
    iconsContainerContainer.appendChild(iconsContainer);
    dvFeed.appendChild(iconsContainerContainer);

    var showArrow = new Element('div', {'class': 'showHideArrow'});

    showArrow.addEvent('click',function(){
        $(this).addClass('dnd');
        var show = new Fx.Morph($(this).getParent(), {
        duration: 'short',
        transition: Fx.Transitions.Bounce.easeOut
    
    });
        show.start({'right' : '5px'});
    });

    
    var hideArrow = new Element('div', 
        {'id': 'hideicons_'+ r[i].FeedID ,
        'class': 'hideArrow', 
        'onmouseover':'Tip.doTipLbl(\'hideicons_'+ r[i].FeedID  +'\' ,\'Hide icons\',\'3\',\'10\');', 
        'onmouseout':'Tip.doTipOff(\'hideicons_'+ r[i].FeedID+ '\');'});

    iconsContainer.appendChild(showArrow);
    iconsContainer.appendChild(hideArrow);
    if (!(r[i].BaseTypeID == 6 && profileInfo.viewerID == r[i].ContactID) && profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My') {
                    
                       exitsDeleteFeed = 'true'; 
                            var trashContainer = new Element('span', {'id':'applytrashSpan_' + r[i].FeedID});
                            if (wProfile.Current.LabelID == '3') { // already in Trash label
                      
                                trashContainer.appendChild(new Element('a', { 'href': 'javascript:feedActions.deleteFeed(' + r[i].FeedID + ',' + r[i].BaseTypeID + ');', 'class': 'applyTrash f_r', 'html': '', 'title': T_DELETEFEED,'id':'applytrash_' + r[i].FeedID, 'onmouseover':'Tip.doTipLbl(\'applytrash_' + r[i].FeedID + '\' ,\''+ T_DELETEFEED +'\',\'3\',\'10\');', 'onmouseout':'Tip.doTipOff(\'applytrash_' + r[i].FeedID + '\');' }));
                        
                            }
                            else {
                         
                                trashContainer.appendChild(new Element('a', { 'href': 'javascript:feedActions.trash_deleteFeed(' + r[i].FeedID + ',' + r[i].BaseTypeID + ',3);', 'class': 'applyTrash f_r', 'html': '', 'title': T_TRASHFEED, 'id':'applytrash_' + r[i].FeedID, 'onmouseover':'Tip.doTipLbl(\'applytrash_' + r[i].FeedID + '\' ,\''+ T_TRASHFEED +'\',\'3\',\'10\');', 'onmouseout':'Tip.doTipOff(\'applytrash_' + r[i].FeedID + '\');' }));
                                
                            }
                        
                            if($('applytrash_' + r[i].FeedID)){
                         
                            
                            }
                            iconsContainer.appendChild(trashContainer); 
                            //iconsContainer.appendChild(new Element('span',{  'class': 'grayColor f_r marT5', 'html': '&nbsp;&#183;&nbsp;'}));                       
                        }

                        if ((!isMessage || postToMessage) && !isFromSearch) { 
                         //     alert('ssss '+r[i].FeedID);               
                        
                        // #Push pin
                        if (!(r[i].BaseTypeID == 6) && profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My') { //if Contact no pushpin icon       
                      //    alert('iiiiii '+r[i].FeedID); 
                            var pushPinContainer = new Element('span');  
                            var Pushpin;                   
                            if (r[i].HasPushpin)
                                PushPin = new Element('a', { 'href': 'javascript:feedActions.pushPin(' + r[i].FeedID + ',' + !r[i].HasPushpin + ');', 'class': 'applyPin_on f_r', 'html': '', 'title': T_THISFEEDISARCHIVED, 'id': 'push_pin_' + r[i].FeedID, 'onmouseover':'Tip.doTipLbl(\'push_pin_' + r[i].FeedID + '\' ,\''+ T_THISFEEDISARCHIVED +'\',\'35\',\'10\');', 'onmouseout':'Tip.doTipOff(\'push_pin_' + r[i].FeedID + '\');' });
                            else
                                PushPin = new Element('a', { 'href': 'javascript:feedActions.pushPin(' + r[i].FeedID + ',' + !r[i].HasPushpin + ');', 'class': 'applyPin_off f_r', 'html': '', 'title': T_CLICKTOARCHIVE, 'id': 'push_pin_' + r[i].FeedID, 'onmouseover':'Tip.doTipLbl(\'push_pin_' + r[i].FeedID + '\' ,\''+ T_CLICKTOARCHIVE +'\',\'35\',\'10\');', 'onmouseout':'Tip.doTipOff(\'push_pin_' + r[i].FeedID + '\');' });
                            pushPinContainer.appendChild(PushPin);
                            iconsContainer.appendChild(pushPinContainer);
                            //dvFeed.appendChild(new Element('span',{  'class': 'grayColor f_r marT5', 'html': '&nbsp;&#183;&nbsp;'}));
                        }                  
                        
                    }
                       if (r[i].Attachment != null ) {
                       
                    iconsContainer.appendChild(new Element('a', { 'id': 'feed_play_attach' + r[i].FeedID, 'href': 'javascript:MyElement.dissolve(\'attach_embed_' + r[i].FeedID + '\');MyElement.reveal(\'attach_thumb_' + r[i].FeedID + '\');MyElement.dissolve(\'feed_play_attach' + r[i].FeedID + '\');', 'class': 'dnd hoverNounderline f11 f_r padR7 padT7 marT5', 'html': '&nbsp;&#183;&nbsp;<span class=\"f11 blueLightColor\">&uarr; ' + T_CLOSE+'</span>', 'title': T_CLOSEYOUTUBE, 'onmouseover':'Tip.doTipLbl(\'feed_play_attach' + r[i].FeedID + '\' ,\''+ T_CLOSEYOUTUBE +'\',\'5\',\'1\');', 'onmouseout':'Tip.doTipOff(\'feed_play_attach' + r[i].FeedID + '\');' }));
                    
                  //#EDIT-My feeds
                /*...*/

                 // Edit feed -
                var editdots = '';
                  
                 if  (profileInfo.isLoggedIn && ((profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My') || ( r[i].DetailsID == profileInfo.viewerID || inRecipients))){
                 editdots = '&nbsp;&#183;&nbsp;';
                var FeedEditA = new Element('a', { 'id': 'feed_edit_' + r[i].FeedID, 'href': 'javascript:editFeed.edit(\'' + r[i].FeedID + '\',\'L\');','class': 'dib hoverNounderline grayColor f_r applyEdit', 'html':'', 'title': T_EDITFEED, 'onmouseover':'Tip.doTipLbl(\'feed_edit_' + r[i].FeedID + '\' ,\''+ T_EDITFEED +'\',\'5\',\'10\');', 'onmouseout':'Tip.doTipOff(\'feed_edit_' + r[i].FeedID + '\');' });

                 var TrashFeedA = new Element('a', { 'href': 'javascript:feedActions.deleteFeed(' + r[i].FeedID + ',' + r[i].BaseTypeID + ');', 'class': 'applyTrash f_r', 'html': '', 'title': T_DELETEFEED,'id':'applytrash_' + r[i].FeedID, 'onmouseover':'Tip.doTipLbl(\'applytrash_' + r[i].FeedID + '\' ,\''+ T_DELETEFEED +'\',\'3\',\'10\');', 'onmouseout':'Tip.doTipOff(\'applytrash_' + r[i].FeedID + '\');' });
}
                 // #attach-edit button
                        if (r[i].DetailsID == profileInfo.viewerID && r[i].BaseTypeID == 10) {
                     
                            var FeedEditContainer = new Element('span');
                            FeedEditContainer.appendChild(FeedEditA);
                           if(exitsDeleteFeed=='false'){
                       
                             var trashContainer = new Element('span', {'id':'applytrashSpan_' + r[i].FeedID});
                            trashContainer.appendChild(TrashFeedA);
                              iconsContainer.appendChild(trashContainer);
                              }
                            iconsContainer.appendChild(FeedEditContainer);
                          
                            //dvFeed.appendChild(commentsIcon);
                        }   
                
 // Message -
                    if (r[i].BaseTypeID == 3 && (isMessage && !postToMessage)) {                        
                        iconsContainer.appendChild(new Element('a', { 'href': '/user/views/print.aspx?id=' + r[i].FeedID + '&subj=' + r[i].ConversationID, 'target': '_blank', 'class': 'applyPrint f_l', 'html': '', 'title': T_PRINTCONVERSATION }));
                        iconsContainer.appendChild(new Element('a', { 'href': 'javascript: void(0);', 'class': 'applyForward f_r', 'html': '', 'title': T_FORWARD, 'events': { 'click': (function (a) { return function () { feedActions.forward(a); } })(r[i].Body)} }));
                        iconsContainer.appendChild(new Element('a', { 'href': 'javascript: void(0);', 'class': 'applyReply f_r', 'html': '', 'title': T_REPLYFEED, 'events': { 'click': (function (a) { return function () { feedActions.reply(a); } })(r[i])} }));
                        iconsContainer.appendChild(new Element('span',{  'class': 'grayColor f_r', 'html': '&nbsp;&#183;&nbsp;'}));
                        feedActions.reply(r[i]);
                        
                    } // Youtube -
                    else if (r[i].BaseTypeID == 14) {
                        iconsContainer.appendChild(new Element('a', { 'id': 'feed_play_' + r[i].FeedID, 'href': 'javascript:wProfile.Render.YouTubeClose(' + r[i].FeedID + ');', 'class': 'dndD hoverNounderline f_r closePic f11 grayColor marT5', 'html': '&nbsp;&#183;&nbsp;<span class=\"blueLightColor\">&uarr; ' + T_CLOSE+'</span>', 'title': T_CLOSEYOUTUBE }));
                       
                    }
                    // Photo -
                    else if (r[i].BaseTypeID == 12) {
                        var getMediaID = r[i].Body.split('|'); //[0]: Image URL,[1]: Feed text, [2]: Media id                       
                        if (getMediaID[0] != r[i].Thumbnail.replace("http://photos.wadja.com/", "").replace("_n", "_o")) {   
                            //iconsContainer.appendChild(new Element('span',{  'class': 'grayColor f_r marT5', 'html': '&nbsp;&#183;&nbsp;'}));                         
                            iconsContainer.appendChild(new Element('a', { 'href': 'javascript:feedActions.setProfilepic(\'' + getMediaID[0] + '\',' + getMediaID[2] + ');', 'class': 'applyPic f_r padT2 marT5', 'html': '&nbsp;', 'title': T_SETPROFILEPIC }));
                        }
                        iconsContainer.appendChild(new Element('a', { 'id': 'feed_view_' + r[i].FeedID, 'href': 'javascript:wProfile.Render.viewPhotoClose(' + r[i].FeedID + ');', 'class': 'f_r hoverNounderline f11 marT5 closePic grayColor dndD', 'html': '&nbsp;&#183;&nbsp;<span class=\"f11 blueLightColor\">&uarr; ' + T_CLOSE+'</span>', 'title': T_CLOSEPIC }));
                        
                    } 
                }
                //#STAR-ON/ OFF
                if(profileInfo.profileBelongsToViewer && wProfile.Current.Category == 'My') {
                    //Get Star status
                    if (r[i].Labels != null) {

                        for (j = 0; j < r[i].Labels.length; j++) {
                            feedSTATUS_STARTIP = T_STARFEED;
                            feedSTATUS_STAR = 'applyStarOff';
                            feedSTATUS_DOT_STAR = '';
                            //#STAR STATUS
                            if (r[i].Labels[j].id == 4) {
                                feedSTATUS_STAR = 'applyStar';
                                feedSTATUS_DOT_STAR = '';
                                feedSTATUS_STARTIP = T_STARFEEDOFF;
                                break;
                            }
                        }
                    }
                    //
                    if (r[i].BaseTypeID != 6)                
                    {
                        var toolstarContainer = new Element('span');            
                        toolstarContainer.appendChild(new Element('a', { 'id': 'toolstar_' + r[i].FeedID, 'href': 'javascript:feedActions.star(' + r[i].FeedID + ',4,\'Starred\',\'lblStarred\');', 'class': feedSTATUS_STAR + ' f_r', 'html': '', 'title': T_STARFEED, 'onmouseover':'Tip.doTipLbl(\'toolstar_' + r[i].FeedID + '\' ,\''+ T_STARFEED +'\',\'3\',\'10\');', 'onmouseout':'Tip.doTipOff(\'toolstar_' + r[i].FeedID + '\');' }));  
                        iconsContainer.appendChild(toolstarContainer);
                        //iconsContainer.appendChild(new Element('span',{ 'id': 'toolstar_dot_' + r[i].FeedID, 'class': feedSTATUS_DOT_STAR+' grayColor f_r marT5', 'html': '&nbsp;&#183;&nbsp;'}));                          
                    }
                }

                var rightPos = (-1*((iconsContainer.getChildren("span").length * 25) + 30));

                hideArrow.addEvent('click',function(){
                    var show = new Fx.Morph($(this).getParent(), {
                    duration: 'short',
                    transition: Fx.Transitions.Bounce.easeOut
                });

                show.start({'right' : (-1*(($(this).getParent().getChildren("span").length * 25) + 30)) + 'px'});
                $(this).getParent().getChildren('.showHideArrow').removeClass('dnd');
                });

                iconsContainer.set("style", "right:" + (rightPos) + "px");
                //#end of placeholder: COMMENTS, +1, STAR, PUSH PIN, DELETE
                    if (!isMessage) {
                    wProfile.Helper.Loaded.push(r[i].FeedID); // add to loaded feeds
                    wProfile.Helper.Rendered.push(r[i]); // add to rendered feeds
                    wProfile.Current.MinID = Math.max(wProfile.Current.MinID, r[i].FeedID); // update min id (for new feeds)
                //dvFeed.appendChild(new Element('div', {'html':'&nbsp;','class':'endFeed'}));
                }
                }
            }    
           
            //No feeds-actions
           
       
            if (r.length == 0 && $('dvStream').get('html').length == 0 && !isFromSearch) {
                //check cookie as well
                var myCookie = Cookie.read("wj_news");

                if (myCookie == 'off')//turned off 
                {
                    $('noFeeds').addClass('dnd');
                    $('master_feeds_container').removeClass('dnd');
                }
                else if (myCookie != gl_label_name) //turned off for all labels
                {
                    $('noFeeds').removeClass('dnd');                   
                    $('master_feeds_container').addClass('dnd');
                }
                else if (myCookie == null) //turned off-other than the above
                {
                    $('noFeeds').removeClass('dnd');                   
                    $('master_feeds_container').addClass('dnd');
                }
                // when viewing Trash label do not show noFeeds div
                if (wProfile.Current.LabelID == '3') {
                    $('noFeeds').addClass('dnd');
                }
                //#Disable Views
                //$('dvView').addClass('dnd');
                var selectedLblID = parseInt(wProfile.Current.LabelID);
                    var selectedLblName = '';
                    res = JSON.decode(jsHelper.cachedData.My);
                    if (res != null && selectedLblID > 0) {
                        for (var i = 0; i < res.length; i++) {
                            if (res[i].labelID == selectedLblID) {
                                selectedLblName = res[i].labelName;
                                break;
                            }
                        }
                    }

                if($('subjectLbl')) {                    
                    if(selectedLblName == '')
                        $('subjectLbl').set('html', '#' + MyLocationName);
                    else
                        $('subjectLbl').set('html', '#' + selectedLblName);
                }
                /* Load promote form */
                //$('promote_frame').src="/user/views/promote.aspx?lblID="+wProfile.Current.LabelID.toString()+'&ownerID='+profileInfo.ownerID+'&lblName='+ selectedLabelName+'&cache=' + new Date().getTime();
                  /* Load promote form - not with iframe, but loading the whole url*/
                   // Ariana - check for privacy before displaying the promote page
                   wjxShhProfile.send('GetInfo', wProfile.Current.LabelID, profileInfo.ownerID, function (r) {
                            if (r.error != null)
                                return;
                            else
                            {
                                r = JSON.decode(r.value);
                                if (r!=null)
                                    wProfile.Helper.Labels[r.id] = r; 
                            }
                    if (wProfile.Helper.Labels[selectedLabelID].privacy == 2) {  
                   
                                              
                    if($('noFeeds')) 
                       $('noFeeds').removeClass('dnd');   
                       $('master_feeds_container').addClass('dnd');            
                          if ($('noFeedsContainer_blank')) {
                                    $('noFeedsContainer_blank').removeClass('dnd');
                                    $('noFeedsContainer_blank').set('html', T_PRIVATELLABELOWNER);
                                }
                                if ($('noFeedsContainer'))
                                    $('noFeedsContainer').addClass('dnd');
                    }
                    else {
                    if ($('noFeedsContainer')) {                
                       $('noFeedsContainer').empty();
                        if (wProfile.Current.Category == 'My')
                        {   
                            var labelIDPromote = "";
                            if (wProfile.Current.LabelID.toString() == rootlabel)
                                labelIDPromote = "";
                            else 
                                labelIDPromote = wProfile.Current.LabelID.toString();
                            
                            source=0;
                            var req = new Request({
                                method: 'get',
                                evalScripts: true,
                                noCache: true,
                                url: '/user/views/promote.aspx?lblID='+labelIDPromote+'&ownerID='+profileInfo.ownerID+'&lblName='+gl_label_name +'&cache=' + new Date().getTime()+'&source='+source,
                                onComplete: function (response) {
                                promoteInterestLinkjs.getpromoteInterestLinkProfile(profileInfo.ownerID, labelIDPromote,gl_label_name, source);
                                  if ($('noFeedsContainer'))
                                  {
                                 
                                    $('noFeedsContainer').empty();
                                    $('noFeedsContainer').appendChild(new Element('div', { 'html': response, 'class':'pad10' }));
                                     
                                      $('noFeedsContainer').removeClass('dnd');
                                      $('noFeedsContainer_blank').addClass('dnd');
                                 //hide the content in case tha label hasent feeds maria
                                    if ($('link')) {
                                    var mySlideLink = new Fx.Slide('linkContent_'+source);
                                    mySlideLink.hide();
                                    }
                                    if ($('embed')) {
                                    var mySlideEmbed = new Fx.Slide('embedContent_'+source);
                                    mySlideEmbed.hide();
                                    }
                                    if ($('embedQR')) {
                                    var mySlideEmbedQr = new Fx.Slide('embedQRContent_'+source);
                                    mySlideEmbedQr.hide();
                                    }

                                      if ($('text_emaillist2_' + source)) {
                                        $('text_emaillist2_' + source).set('value', quotePromote);
                                    }
                                  }
                                }
                            }).send();
                        }
                        else
                        {   

                       
            
                            /* When no feeds load suggestions */
                            $('dvMore_loading').removeClass('dnd');
                            var nofeedAjax = new WADJAX('user', { statusBar: false });
                            nofeedAjax.send('InterestedIn', profileInfo.viewerID, function (res) {
                                if ($('noFeedsContainer'))
                                {
                                    $('noFeedsContainer').empty();
                                    $('noFeedsContainer').set('html','<div class=\"f13 bolt fewsugg\">'+PROF_CARD_SUGGESTIONTOSELECT+'</div><div class=\"padL10 padB10\">'+ res.value+'</div>');
                                }
                                $('dvMore_loading').addClass('dnd');
                            });
                            
                        }
                    }
                 }
                 
                 });
              }
            else { 
          
           
               $('noFeeds').addClass('dnd');
                if (!isFromSearch)
                    $('master_feeds_container').removeClass('dnd');
                //#Disable Views
                //$('dvView').removeClass('dnd');
                //#$('Tofrom').removeClass('dnd');
                if (profileInfo.isLoggedIn)
                    //if (profileInfo.ownerID == profileInfo.viewerID)
                        //$('wheelSetting').removeClass('dnd');
                helpTooltips.Off();
            }

            try {
//                if (!profileInfo.isLoggedIn) {
//                    $('noFeeds').addClass('dnd');
//                }
            }
            catch (Error) { }

            if (isFromSearch) {
                switch (srch) {
                    case 'feeds':
                        $('srch_feeds').removeClass('dndD');
                        $('srch_feeds').appendChild(frag);
                        break;
                    case 'labels':
                        $('srch_labels').removeClass('dndD');
                        $('srch_labels').appendChild(frag);
                        break;
                    case 'people':
                        $('srch_users').removeClass('dndD');
                        $('srch_users').appendChild(frag);
                        break;
                    case 'web':
                        $('srch_web').removeClass('dndD');
                        $('srch_web').appendChild(frag);
                        break;
                    default:
                        break;
                }
            } else if (addTop) {
                try {
                    $('dvStream').insertBefore(frag, $('dvStream').childNodes[0]);
                }
                catch (err) { $('dvStream').appendChild(frag); }
            } else {

                $('dvStream').appendChild(frag); // Add to page

                //push new feeds every 15 sec!
                clearInterval(refTimer);
                refTimer = setInterval(function () {
                    if (pushstart == 0)
                        wProfile.GetNew();
                }, 15 * 1000);
                //#show current label-more info
                var selectedLabelID = parseInt(wProfile.Current.LabelID);

                if (selectedLabelID > 0 && wProfile.Helper.Labels.length > 0) {                 
                    // Change header link
                    if (wProfile.Helper.Labels[selectedLabelID] === undefined) {   
                
      
                    // Ariana - toolbar                 
                       wjxShhProfile.send('GetInfo', selectedLabelID, profileInfo.ownerID, function (r) {
                          if (r.error != null){
                                return;
                                }
                            else{
                               r = JSON.decode(r.value);
                               }
                            wProfile.Helper.Labels[r.id] = r;
     
                            if ($('lblSignedOut')) {
                                $('lblSignedOut').innerHTML = wProfile.Helper.Labels[r.id].name;
                                selectedLabelName = wProfile.Helper.Labels[r.id].name;
                                if (profileInfo.isLoggedIn) {
                                    if (profileInfo.ownerID !== profileInfo.viewerID)
                                        selectedLabelNamePrivacy = wProfile.Helper.Labels[r.id].privacy;
                                }
                                else
                                    selectedLabelNamePrivacy = wProfile.Helper.Labels[r.id].privacy;
                            }
                            else {
                                selectedLabelName = wProfile.Helper.Labels[selectedLabelID].name;
                                selectedLabelTO =  wProfile.Helper.Labels[selectedLabelID].WadjaID;
                                if (profileInfo.isLoggedIn) {
                                    if (profileInfo.ownerID !== profileInfo.viewerID)
                                        selectedLabelNamePrivacy = wProfile.Helper.Labels[selectedLabelID].privacy;
                                }
                                else
                                    selectedLabelNamePrivacy = wProfile.Helper.Labels[selectedLabelID].privacy;
                          }                           
                       if( wProfile.Helper.Labels[r.id].id==rootlabel){ //in rootlabel another title
                 
                               if(ownerName!=''){
                              document.title =  document.title+ " (" + ownerName + ")";
                              }else{
                                document.title =  document.title;
                              }
                            if($('authorHeader')){
                                if($('authorHeader').hasClass('dnd'))
                                $('authorHeader').removeClass('dnd');
                            }
                            if($('name_dv_2')){
                                if($('name_dv_2').hasClass('dnd'))
                                $('name_dv_2').removeClass('dnd');
                            }
                            if($('showBioArrow')){
                                if($('showBioArrow').hasClass('dnd'))
                                $('showBioArrow').removeClass('dnd'); 
                            } 
                       }else{
    
                           docTitle=document.title.split(' ');
                           docTitle=docTitle[0].split('.');
                       // docTitle[1]=' ';
                       // if(docTitle[0].indexOf(' ')!=-1){

                       // docTitle[1] = '';
                     //   docTitle[0] ='';
                       // }
                     
               
                        document.title = docTitle[0]+'.'+selectedLabelName;
                     //   docTitle[0]='';
                   //  document.title =document.title+'.'+selectedLabelName;
                   }
                     if($('followerslinkLi'))
                      {
               
                            $('followerslinkLi').set('html', '<span id="linkforthefollowers" class="lnk">'+gl_label_followers+ ' people follow this page</span>');
                            $('followersNumber').set('html',gl_label_followers);
                            $('linkforthefollowers').set('onclick', 'followersjs.loadFollowersVIEW(\''+wProfile.Helper.Labels[r.id].id+'\','+ profileInfo.ownerID+','+ profileInfo.viewerID+',\''+ wProfile.Helper.Labels[r.id].name.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                            $('followersNumber').set('onclick', 'followersjs.loadFollowersVIEW(\''+wProfile.Helper.Labels[r.id].id+'\','+ profileInfo.ownerID+','+ profileInfo.viewerID+',\''+ wProfile.Helper.Labels[r.id].name.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                            GetAllFollowers(wProfile.Helper.Labels[r.id].id,profileInfo.ownerID , profileInfo.viewerID, 2, 4, 1);      

                      }

                        });
                        

                          
                    }
                    else {
               
                 //   document.title =' ';
                  //   document.title =document.title+'.'+wProfile.Helper.Labels[selectedLabelID].name;
                     



                      if(wProfile.Current.LabelID.toString()!=rootlabel){
                   
                   docTitle=document.title.split(' ');
                  docTitle=docTitle[0].split('.');
                
                                   document.title =docTitle[0]+'.'+ wProfile.Helper.Labels[selectedLabelID].name;
                          
                                    }else{

                                        if(ownerName!=''){
                              
                                        document.title =  document.title+ " (" + ownerName + ")";
                                        }else{
                                   
                                        document.title =  document.title;
                                        }
                                    if($('authorHeader')){
                                    if($('authorHeader').hasClass('dnd'))
                                    $('authorHeader').removeClass('dnd');
                                    }
                                    if($('name_dv_2')){
                                    if($('name_dv_2').hasClass('dnd'))
                                    $('name_dv_2').removeClass('dnd');
                                    }
                                    if($('showBioArrow')){
                                    if($('showBioArrow').hasClass('dnd'))
                                    $('showBioArrow').removeClass('dnd'); 
                                    } 
                                    
                                    }








                     // Ariana - check for privacy before displaying the promote page
                     var oWadjaX = new WADJAX('labels', { statusBar: false });
                        oWadjaX.send('IsFollower', wProfile.Current.LabelID, profileInfo.ownerID, profileInfo.viewerID, function (res) {
                            if (!res.error) {
                            if (res.value == '1') {
                                if (gl_label_privacy == 2 && !profileInfo.profileBelongsToViewer) { 
                                if($('noFeeds')) 
                                   $('noFeeds').removeClass('dnd');   
                                   $('master_feeds_container').addClass('dnd');            
                                      if ($('noFeedsContainer_blank')) {
                                                                        $('noFeedsContainer_blank').removeClass('dnd');
                                                                        $('noFeedsContainer_blank').set('html', T_PRIVATELLABEL);
                                                                    }
                                                                    if ($('noFeedsContainer'))
                                                                        $('noFeedsContainer').addClass('dnd');
                                }
                            }
                            else {
                                if ((gl_label_privacy == 3 || gl_label_privacy == 2) && wProfile.Current.Category == "Follow" ) {    
                                                 
                                    if($('noFeeds')) 
                                       $('noFeeds').removeClass('dnd');   
                                       $('master_feeds_container').addClass('dnd');            
                                          if ($('noFeedsContainer_blank')) {
                                                                            $('noFeedsContainer_blank').removeClass('dnd');
                                                                            $('noFeedsContainer_blank').set('html', T_PRIVATELLABEL);
                                                                        }
                                                                        if ($('noFeedsContainer'))
                                                                            $('noFeedsContainer').addClass('dnd');
                                    }
                                }
                         }
                     });
//                        if ($('lblSignedOut'))
//                            $('lblSignedOut').innerHTML = wProfile.Helper.Labels[selectedLabelID].name;
                            
                        //selectedLabelName = wProfile.Helper.Labels[selectedLabelID].name;
                        //selectedLabelTO =  wProfile.Helper.Labels[selectedLabelID].WadjaID;
                        //#When signed out-adding label name on user's info badge
                        if ($('guest_follow_current_label'))
                            $('guest_follow_current_label').set('html', '#' + wProfile.Helper.Labels[selectedLabelID].name);
                     
                    }                    
                    // Trash all feeds under a specific label - This has to be removed from feeds - It's in the Edit Interest pop-up - Ariana
                    // Added trash Icon only when the user is under Trash and Message Interest - Ariana
                    if (profileInfo.profileBelongsToViewer && (!isMessage || postToMessage) && wProfile.Current.Category == 'My') {
                        var trashall_function = function () {feedActions.trashAll(wProfile.Current.LabelID); }
                        var emptyTrash_function = function () { feedActions.emptyTrash(); }
                        if($('spnFilters_trashall'))
                        $('spnFilters_trashall').removeEvents('click');
                        if (wProfile.Current.LabelID == '3') { // when viewing Trash label
                            if($('spnFilters_trashall')) {
                            $('spnFilters_trashall').addEvent('click', emptyTrash_function);
                            $('spnFilters_trashall').set('title', T_DELETEFOREVER);
                            }
                            if($('dvFilters_trashall'))
                                $('dvFilters_trashall').removeClass('dnd');
                                $('dvFilters').removeClass('dnd');
                        }
                        else if(wProfile.Current.LabelID == '2') {
                        if($('spnFilters_trashall')) {
                            $('spnFilters_trashall').addEvent('click', trashall_function);
                            $('spnFilters_trashall').set('title', T_TRASHALLFEEDS);
                            }
                        if($('dvFilters_trashall'))
                           $('dvFilters_trashall').removeClass('dnd');
                           $('dvFilters').removeClass('dnd');
                        }                       
                    }
                    else {
                        if($('dvFilters_trashall'))
                        $('dvFilters_trashall').addClass('dnd');
                        if ($('dvFilters_sender'))
                        $('dvFilters_sender').addClass('dnd');
                    }
                }
                else {
            
         
                            /// if returned to default labels-not under a specific label clear current label text-on top left
                    if (selectedLabelID > 0) {
                   
                            //// Ariana - check for privacy before displaying the promote page
                            if(gl_label_privacy != 2) {                            
                            if ($('noFeedsContainer')) {      
                                $('noFeedsContainer').empty();
                                if (wProfile.Current.Category == 'My')
                                { 
                                
                                 var labelIDPromote = "";
                                if (wProfile.Current.LabelID.toString() == rootlabel)
                                    labelIDPromote = "";
                                else 
                                    labelIDPromote = wProfile.Current.LabelID.toString();
                                source=0;

                                    wjxShhProfile.send('GetInfo', wProfile.Current.LabelID, profileInfo.ownerID, function (r) {
                                    if (r.error != null)
                                        return;
                                    else
                                    {
                                        r = JSON.decode(r.value);
                                        if (r!=null)
                                            wProfile.Helper.Labels[r.id] = r; 
                                    }
                                    
                                    
                                    //maria set Title of Page
                                    if(wProfile.Current.LabelID.toString()!=rootlabel){
                                 
                                        docTitle=document.title.split('.');
                                        docTitle=document.title.split(' ');
                                        docTitle[1]=' ';
                                    document.title = docTitle[0] +'.'+ gl_label_name;
                                     //tha fugei
                                    // alert(1);
//                                     if($('follower_icon'))
//                                    $('follower_icon').onclick = new Function('followersjs.loadFollowersVIEW(\''+wProfile.Helper.Labels[r.id].id+'\','+ profileInfo.ownerID+','+ profileInfo.viewerID+',\''+ wProfile.Helper.Labels[r.id].name.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
//                

                                      if($('followerslinkLi'))
                                      {
                                          //alert('exists1');
$('followerslinkLi').set('html', '<span id="linkforthefollowers" class="lnk">'+gl_label_followers+ ''+DropDownpeople+'</span> <span class="grayColor">'+DropDownFollothispage+'</span>');
                                          $('followersNumber').set('html',gl_label_followers);
                                          $('linkforthefollowers').set('onclick', 'followersjs.loadFollowersVIEW(\''+wProfile.Helper.Labels[r.id].id+'\','+ profileInfo.ownerID+','+ profileInfo.viewerID+',\''+ wProfile.Helper.Labels[r.id].name.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                                          $('followersNumber').set('onclick', 'followersjs.loadFollowersVIEW(\''+wProfile.Helper.Labels[r.id].id+'\','+ profileInfo.ownerID+','+ profileInfo.viewerID+',\''+ wProfile.Helper.Labels[r.id].name.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                                          GetAllFollowers(wProfile.Helper.Labels[r.id].id,profileInfo.ownerID , profileInfo.viewerID, 2, 4, 1);      

                                      }
                                    
                                    }else{

                                        if(ownerName!=''){
                           
                                        document.title =  document.title+ " (" + ownerName + ")";
                                        }else{
                                   
                                        document.title =  document.title;
                                        }
                                        if($('authorHeader')){
                                                    if($('authorHeader').hasClass('dnd'))
                                                    $('authorHeader').removeClass('dnd');
                                                }
                                                if($('name_dv_2')){
                                                    if($('name_dv_2').hasClass('dnd'))
                                                    $('name_dv_2').removeClass('dnd');
                                                }
                                                if($('showBioArrow')){
                                                    if($('showBioArrow').hasClass('dnd'))
                                                    $('showBioArrow').removeClass('dnd'); 
                                                } 
                                    
                                    }
/*
                                    var req = new Request({
                                        method: 'get',
                                        evalScripts: true,
                                        noCache: true,
                                        url: '/user/views/promote.aspx?lblID='+labelIDPromote+'&ownerID='+profileInfo.ownerID+'&lblName='+gl_label_name +'&cache=' + new Date().getTime()+'&source='+source,
                                        onComplete: function (response) {
                                         alert('3 fort');
                                        //maria for check if the user has chosen to post in this page (left/profcard) focus in quickcompose of this page
                                            if (window.location.hash.indexOf('&cmp=1') > 0)
                                            {
                                            $('text_body_quick5').focus();
                                            $('page_post_lnk').set('html', gl_label_name);
                                            }  
                                         
                                         promoteInterestLinkjs.getpromoteInterestLinkProfile(profileInfo.ownerID, labelIDPromote,gl_label_name, source);
                                 
                                            $('noFeedsContainer').empty();
                                            $('noFeedsContainer').appendChild(new Element('div', { 'html': response, 'class':'pad10' }));
                                        
                                            if ($('link')) {

                                            var mySlideLink = new Fx.Slide('linkContent_0');
                                            mySlideLink.hide();
                                            }
                                            if ($('embed')) {
                                            var mySlideEmbed = new Fx.Slide('embedContent_0');
                                            mySlideEmbed.hide();
                                            }
                                            if ($('embedQR')) {
                                            var mySlideEmbedQr = new Fx.Slide('embedQRContent_0');
                                            mySlideEmbedQr.hide();
                                            }
                                        }
                                    }).send();*/
                                     });
                                }
                                else
                                {   
                                    /* When no feeds load suggestions */
                                    $('dvMore_loading').removeClass('dnd');
                                    var nofeedAjax = new WADJAX('user', { statusBar: false });
                                    nofeedAjax.send('InterestedIn', profileInfo.viewerID, function (res) {
                                        if ($('noFeedsContainer'))
                                            $('noFeedsContainer').set('html','<div class=\"f13 bolt fewsugg\">'+PROF_CARD_SUGGESTIONTOSELECT+'</div><div class=\"padL10 padB10\">'+ res.value+'</div>');
                                        $('dvMore_loading').addClass('dnd');
                                    });
                            
                                }
                             }
                           }
                           else {
                               if ($('noFeedsContainer_blank')) {
                                                        $('noFeedsContainer_blank').removeClass('dnd');
                                                        $('noFeedsContainer_blank').set('html', T_PRIVATELLABEL);
                                                    }
                                                    if ($('noFeedsContainer'))
                                                        $('noFeedsContainer').addClass('dnd');
                           }
                        //});
                    }
                    else {
                        //selectedLabelName = ''; //your general key words in case you don't have any.                         
                        //selectedLabelTO = '';
                        if($('dvFilters_trashall'))
                            $('dvFilters_trashall').addClass('dnd');
                        if(wProfile.Current.Category != 'My' && $('dvFilters_sender'))
                            $('dvFilters_sender').addClass('dnd');
                    }
                }


                if (isMessage && !postToMessage) {
                    $('dvFilters').removeClass('dnd'); //
                    if ($('dvFilters_sender'))
                    $('dvFilters_sender').addClass('dnd'); //hide from/to/to-from filters
                    if($('dvFilters_trashall'))
                    $('dvFilters_trashall').addClass('dnd');
                    $('dvBack').removeClass('dnd');
                } else {
                    $('dvBack').addClass('dnd');
                }
            }

            //reveal
            if (!isFromSearch) {
                $$('.feedMask').each(function (element, index) {
                    //new Fx.Reveal($(element.get('id')), { duration: 750 }).reveal();
                    $(element.get('id')).set('opacity', 0);
                    $(element.get('id')).setStyle('display', 'block').fade('in');
                });
            }
            else {
            if($('label_text'))
                $('label_text').addClass('dnd');
            if ($('bio_feed')) 
                $('bio_feed').addClass('dnd');
            if ($('compose_box')) 
                $('compose_box').addClass('dnd');
          //  if ($('arrowFeed')) 
           //     $('arrowFeed').addClass('dnd');
                $('search_feeds_container').getElements('div.feedMask').each(function (element, index) {
                    //new Fx.Reveal($(element.get('id')), { duration: 750 }).reveal();
                    $(element.get('id')).set('opacity', 0);
                    $(element.get('id')).setStyle('display', 'block').fade('in');
                });
            }
            
            /*
            feedActions.labelhoverinfo(); //#attach hover info
            feedActions.userhoverinfo(false); //#attach user hover info
            */

            //$('dvStream').style.width = ($('profileTHEME').getSize().x - 500) + 'px';
           
            //stop more-loading
            if ($('feeds_more_button')) {
                $('feeds_more_button').set('disabled', false);
                $('feeds_more_button').set('value', $('feeds_more_button').get('value').replace('...', ''));
            }
            releaseMore=true;
            //end of more-loading
            $('timer').set('html',pageloadingtime()+'s');
        },
        Body: function (txt, type, fID, srch) {
        //maria if the feed is from contact don parse the emoticons
       
           txt = txt.replaceAll("&nbsp;", " ");
          txt = txt.replaceAll("&amb;", "&");
          txt = txt.urlDecode();
          
         
          //maria alert body feed
       
          if( type != 6){          
            txt = parseemos(txt);           
            }            
   
            if (type == 14) return '<a href=\"javascript:feedActions.openPopup(' + fID + ',0,\'0\',' + profileInfo.ownerID + ');\" class="imgYuTb" title="' + T_CLICKTOPLAY + '" style="background-image: url(http://img.youtube.com/vi/' + txt + '/default.jpg);"><span class=\"youtube_play\">&nbsp;</span></a><div></div>';
            else if (type == 12) {//#Photos
                var splitText = txt.split('|'); 
                //[0]: Image URL,[1]: Feed text,[2]: Media ID
                //return '<img src=\"/s3.images/labels/feed_arrow.png\" class=\"imgToArr f_l\"/><img src=\"/s3.images/share/upload_image.png\" class=\"f_l padL10 padR10\" height=\"30px\" width=\"30px\"/><a href="javascript: wProfile.Render.viewPhoto(\'' + txt + '\', ' + fID + ');" class="imgYuTb b_r f_l" style="background-image: url(http://photos.wadja.com/' + splitText[0].replace('_o.', '_n.') + ');"></a><span class=\"f_l padT10 padL10\">' + splitText[1] + '</span>';
                return '<span id="spnPhoto_caption_' + fID + '" class="dnb">' + wProfile.Render.Links(splitText[1].replaceAll("'", "\'")) + '</span><a href=\"javascript:feedActions.openPopup(' + fID + ',0,\'null\',' + profileInfo.ownerID + ');\" class="imgYuTb marT5"><img src=\"http://photos.wadja.com/' + splitText[0].replace('_o.', '_d.') + '\" class=\"\" width=\"100%\" height=\"100%\"><span class=\"photo_play\">&nbsp;</span></a>';

            }
            else if (type == 9) return wProfile.Render.Links(txt);
            else if (type == 13) return wProfile.Render.Links(txt.replaceAll("&apos;", "\'")); //Tweets.Links
            else if (type == 28) return wProfile.Render.Links(txt); //LAST FM.Links
            else if (type == 27) return wProfile.Render.Links(txt); //DIGG.Links
            else if (type == 6) {//#Contacts
                var splitText = txt.split('|');
                var contacts_string = '';
                var location = splitText[1];
                var name = splitText[0];
                var born = splitText[2];
                var email = splitText[3];

                if (name != null && name.length != 0)
                    contacts_string += '<span class=\" \">' + name + '</span><span class=\"born \">&nbsp;-&nbsp;' + born + '</span>';
                else
                    contacts_string += '<span class=\"born \">' + born + '</span>';
                if (location != null && location.length != 0)
                    contacts_string += '<span class=\"location\">&nbsp;-&nbsp;' + location + '</span>';
                if (email != null && email.length != 0)
                    contacts_string += '<span class=\"email\">&nbsp;-&nbsp;<a href=\"' + email + '\" target=\"_blank\">' + email + '</a></span>';

                return contacts_string;
            }
            else
                return wProfile.Render.Links(txt);
            /*
            #For search
            if (type == -1 && srch) {
            var splitText = txt.split('|');
            var abstract = splitText[0];
            var DisplayURL = splitText[1];
            var ClickURL = splitText[2];
            return '<span class=\"f_l  padL10\">' + abstract + '</span><br/><a href=\"' + ClickURL + '\" class=\"f_l  padL10\">' + DisplayURL + '</a>';
            }*/
               // txt = txt.stripTags();
            
            return txt;
            
        },
        viewPhoto: function (txt, type, fID) {
            //if already opened
            if ($('spnText_viewer_' + fID)) {
                wProfile.Render.viewPhotoClose(fID);
                return;
            }
            //split text,image
            var splitFeed = txt.split('|');
            var htmlPhotoViewer = '<div id="vphoto_' + fID + '" ><img class="marT10 marL42" onClick="wProfile.Render.viewPhotoClose(' + fID + ');" title="' + T_CLICKPHOTO + '" class="cursor"  src="http://photos.wadja.com/' + splitFeed[0] + '" width=\"550px\"/></div>';

            //Hide photo thumb
            $('spnText' + fID).appendChild(new Element('span', { 'id': 'spnText_viewer_' + fID, 'class': '', 'html': htmlPhotoViewer }));
            //hide photo text
            if ($('spnPhoto_caption_' + fID))
                $('spnPhoto_caption_' + fID).addClass('dnd');
            //show close link
            if ($('feed_view_' + fID))
                $('feed_view_' + fID).removeClass('dndD');

        },
        viewPhotoClose: function (fID) {
            if ($('spnText_viewer_' + fID))
                $('spnText_viewer_' + fID).destroy();
            //show photo text
            if ($('spnPhoto_caption_' + fID))
                $('spnPhoto_caption_' + fID).removeClass('dnd');
            if ($('feed_view_' + fID))
                $('feed_view_' + fID).addClass('dndD');
        },
        YouTube: function (ytID, fID) {
            //if already opened
            if ($('spnText_player_' + fID)) {
                wProfile.Render.YouTubeClose(fID);
                return;
            }
            //Hide video thumb
            $('spnText' + fID).appendChild(new Element('span', { 'id': 'spnText_player_' + fID, 'class': 'padL10 f_l padT3', 'html': '<object id="yvideo' + fID + '" width="440" height="285"><param name="movie" value="http://www.youtube.com/v/' + ytID + '&hl=en_US&fs=1"></param><param name="allowFullScreen" value="true"></param> <param name="wmode" value="opaque" /><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + ytID + '&hl=en_US&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="440" height="285"  wmode="opaque"></embed></object>' }));
            //show close link
            if ($('feed_play_' + fID))
                $('feed_play_' + fID).toggleClass('dndD');
            //$('spnText' + fID).innerHTML = '<div class="loadingImage b_r"></div>';
        },
        YouTubeClose: function (fID) {
            if ($('spnText_player_' + fID))
                $('spnText_player_' + fID).destroy();
            if ($('feed_play_' + fID))
                $('feed_play_' + fID).toggleClass('dndD');
        },
          Vimeo: function (ytID, fID) {
        
            //if already opened
            if ($('spnText_player_' + fID)) {
                wProfile.Render.VimeoClose(fID);
                return;
            }
            //Hide video thumb
            $('spnText' + fID).appendChild(new Element('span', { 'id': 'spnText_player_' + fID, 'class': 'padL10 f_l padT3', 'html': '<object id="yvideo' + fID + '" width="440" height="285"><param name="movie" value="http://www.vimeo.com/'+ytID+'"></param><param name="allowFullScreen" value="true"></param> <param name="wmode" value="opaque" /><param name="allowscriptaccess" value="always"></param><embed src="http://www.vimeo.com/'+ytID+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="440" height="285"  wmode="opaque"></embed></object>' }));
            //show close link
            if ($('feed_play_' + fID))
                $('feed_play_' + fID).toggleClass('dndD');
            //$('spnText' + fID).innerHTML = '<div class="loadingImage b_r"></div>';
        },
        VimeoClose: function (fID) {
            if ($('spnText_player_' + fID))
                $('spnText_player_' + fID).destroy();
            if ($('feed_play_' + fID))
                $('feed_play_' + fID).toggleClass('dndD');
        },
        DateDiff: function (dat) {
            var dtNow = new Date();

            dt = new Date(parseInt(/\/Date\((\d+).*/.exec(dat)[1]));
            var oMinutes = Math.floor((dtNow.getTime() - dt.getTime()) / (1000 * 60));

            if (oMinutes <= 0) // fix error displaying -1
                return T_JUSTNOW;

            if (oMinutes >= (24 * 60 * 30))
                return Math.floor(oMinutes / (24 * 60 * 30)) + T_MONTH + (Math.floor(oMinutes / (24 * 60 * 30)) == 1 ? "" : "") + T_AGO; //? "" : "s")

            if (oMinutes >= (24 * 60))
                return Math.floor(oMinutes / (24 * 60)) + T_DAY + (Math.floor(oMinutes / (24 * 60)) == 1 ? "" : "") + T_AGO;

            if (oMinutes >= 60)
                return Math.floor(oMinutes / 60) + T_HOUR + (Math.floor(oMinutes / 60) == 1 ? "" : "") + T_AGO;

            return oMinutes  + T_MINUTESAGO;
        },
        Links: function (s) {//MARK - URL parse
            if (s.indexOf('imgYouTube') > 0)
                return s; ///exclude feed content
            //            if(s.indexOf('youtube.com') > 0)
            //                return s;
            else {
                var initialString = s;
                var myregexp = /((((https?)|(ftps?)):\/\/)|(www.))[a-zA-Z0-9+&@#\/%=~\-_|$?!:.,\Z]+[.][a-zA-Z0-9+&@#\/%=~\-_|$?!:.,\Z]*[a-zA-Z0-9/]+/ig;
                var result = '';         // my match (valid url)

                var finalString = ''; //initialString;
                var temp = '';
                var startPoint = 0;
                var endPoint = 0;
                var tempString = '';
                var i = 0;

                while ((startPoint = initialString.indexOf('[artist]')) > -1) {
                    if ((endPoint = initialString.indexOf('[/artist]')) > -1) {
                        startPoint += '[artist]'.length;
                        tempString = initialString.substring(startPoint, endPoint);
                        tempString = tempString.replace(' ', '+');
                        //document.write(tempString + "<br/>");

                        initialString = initialString.replace('[artist]', '<a target=\"_blank\" href=\"http://www.last.fm/music/' + tempString + '\">');
                        initialString = initialString.replace('[/artist]', '</a>');
                    }
                    else
                        break;
                }

                while (initialString.indexOf('[url]') > -1)
                    initialString = initialString.replace('[url]', '  ');


                while ((startPoint = initialString.indexOf('[url=')) > -1) {
                    if (initialString.indexOf('[/url]') > -1 && (endPoint = initialString.indexOf(']')) > startPoint) {
                        startPoint += '[url='.length;
                        tempString = initialString.substring(startPoint, endPoint);
                        temp = tempString.substring(0, 4).toLowerCase(); // check if http exists at start of tempString, if not add it to the url

                        initialString = initialString.replace('[/url]', '</a>');
                        initialString = initialString.replace(']', '\">');

                        if (temp == 'http') {
                            initialString = initialString.replace('[url=', '<a target=\"_blank\" href=\"');
                        }
                        else {
                            initialString = initialString.replace('[url=', '<a target=\"_blank\" href=\"http://');
                        }
                    }
                    else
                        break;
                }


                var initialStringArray = initialString.split(' ');
                var finalStringArray = new Array();

                for (i = 0; i < initialStringArray.length; i++) {
                    //result = myregexp.exec(initialStringArray[i]); 
                    result = initialStringArray[i].match(myregexp);

                    if (result != null) {

                        temp = result[0].substring(0, 4).toLowerCase(); // check if http exists at start of result[0], if not add it to the url

                        startPoint = initialStringArray[i].indexOf(temp, 0);
                        tempString = initialStringArray[i].substring(startPoint - 6, startPoint);

                        if (tempString != 'href=\"') {
                            if (temp == 'http') {
                                finalStringArray[i] = initialStringArray[i].replace(result[0], '<a target=\"_blank\" href=\"' + result[0] + '\">' + result[0] + '</a>');
                            }
                            else {
                                finalStringArray[i] = initialStringArray[i].replace(result[0], '<a target=\"_blank\" href=\"http://' + result[0] + '\">' + result[0] + '</a>');
                            }
                        }
                        else
                            finalStringArray[i] = initialStringArray[i];
                    }
                    else
                        finalStringArray[i] = initialStringArray[i];

                    result = '';
                    temp = '';
                    tempString = '';
                }

                for (i = 0; i < finalStringArray.length; i++) {
                    finalString += finalStringArray[i];
                    finalString += ' ';
                }

                while (finalString.indexOf('[/url]') > -1)
                    finalString = finalString.replace('[/url]', '');


                // MARK-Return new link
                return finalString;
            }

        }
    },
    showNew: function () { // Show Feeds (after Send::Compose)

        wjxShhProfile.send('GetFeeds', this.Current.DetailsID, this.Current.Category, 0, this.Current.Filter, this.Current.Page, this.Current.Per_Page, this.Current.MinID, function (r) {
            if (r.error != null) return;
            r = JSON.decode(r.value);
            if (r == "") return;

            for (i = 0; i < r.length; i++) {
                if (wProfile.Helper.Loaded.indexOf(r[i].FeedID) > -1) continue;
                wProfile.Current.MinID = Math.max(wProfile.Current.MinID, r[i].FeedID); // update min id (for new feeds)
                wProfile.Helper.Pending.push(r[i]);
                wProfile.Helper.Loaded.push(r[i].FeedID);
            }
            //new Fx.Reveal($('aNewFeeds'), { duration: 500 }).dissolve();
            //notificationsAlerts.reset(0,0);
            $('aNewFeeds').addClass('dnd');
            wProfile.Render.Start(wProfile.Helper.Pending, true);
        });
    },
    GetNew: function () { // Check for new feeds (yellow bar)

        if (window.location.hash.indexOf('!inbox') > 0) return;
        wjxShhProfile.send('GetFeeds', this.Current.DetailsID, this.Current.Category, this.Current.LabelID, this.Current.Filter, this.Current.Page, this.Current.Per_Page, this.Current.MinID, function (r) {

            if (r.error != null) return;
            r = JSON.decode(r.value);
            if (!r) return;
            if (r == "") return;
            wProfile.Current.FeedsPending += r.length;
            for (i = 0; i < r.length; i++) {
                if (wProfile.Helper.Loaded.indexOf(r[i].FeedID) > -1) continue;
                wProfile.Current.MinID = Math.max(wProfile.Current.MinID, r[i].FeedID); // update min id (for new feeds)
                wProfile.Helper.Pending.push(r[i]);
                wProfile.Helper.Loaded.push(r[i].FeedID);
            }

            /// Push new feeds
            if (($('aNewFeeds').getElement('span').innerHTML = wProfile.Helper.Pending.length) > 0) {
                //old line:new Fx.Reveal($('aNewFeeds'), { duration: 500 }).reveal();
                //new line below-
                $('aNewFeeds').removeClass('dnd');
                //                //#Update notifications
                //                var NotMsg=0;
                //                if ($('head_notifications_dropdown_message'))
                //                {
                //                    if ($('head_notifications_dropdown_message').hasClass('dndD'))
                //                    {
                //                        //#do nothing
                //                    }
                //                    else
                //                    {
                //                        NotMsg = parseInt($('head_notifications_dropdown_message_counter').get('html'));
                //                    }
                //                }
                //                notificationsAlerts.update(NotMsg,wProfile.Helper.Pending.length);
            }
        });
       
        //notificationsAlerts.update();
    },
    Search: function (category, keyword) { // Search for people/feeds/labels/web
        //profilePage.hide();
        wProfile.CurrentSearch.Keyword = keyword = keyword.replace('%20', '');
        if (category == '') category = 'feeds';
        wProfile.CurrentSearch.Category = category;
        wProfile.CurrentSearch.Page = 1;
        pushstart == 1; //stop push feeds
        $('srch_feeds').empty();
        $('srch_labels').empty();
        $('srch_users').empty();
        $('srch_web').empty();
        $('master_feeds_container').addClass('dnd');
        $('search_feeds_container').removeClass('dnd');
        $('dvsearchMore').removeClass('dnd');
        $('dvFilters_search').removeClass('dnd');
         if($('label_text'))
            $('label_text').addClass('dnd');
         if ($('bio_feed')) 
             $('bio_feed').addClass('dnd');
        if ($('compose_box')) 
            $('compose_box').addClass('dnd');
        $('filter_search_keyword').set('html', T_RESULTSFOR + ' <span class=\"bolt\">' + wProfile.CurrentSearch.Keyword + '</span>'); //show result keyword
        if (keyword.toLowerCase().indexOf('interest:') == 0) {
            wjxProfile.send('Search', keyword, category, wProfile.CurrentSearch.Page/*page*/, 3/*items_per_page*/, profileInfo.ownerID, this.SearchAjaxCallBack);
        }
        else if (category == '')
            wjxProfile.send('Search', keyword, category, wProfile.CurrentSearch.Page/*page*/, 3/*items_per_page*/, this.SearchAjaxCallBack);
        else
            wjxProfile.send('Search', keyword, category, wProfile.CurrentSearch.Page/*page*/, 9/*items_per_page*/, this.SearchAjaxCallBack);

    },
    SearchMore: function () {
        keyword = wProfile.CurrentSearch.Keyword.replace('%20', '');
        category = wProfile.CurrentSearch.Category;
        if ($('moreSearch_button')) {
            $('moreSearch_button').set('disabled', true);
            $('moreSearch_button').set('value', $('moreSearch_button').get('value') + '...');
        }
        if (category == '')
            wjxProfile.send('Search', keyword, category, wProfile.CurrentSearch.Page/*page*/, 3/*items_per_page*/, this.SearchAjaxCallBack);
        else
            wjxProfile.send('Search', keyword, category, wProfile.CurrentSearch.Page/*page*/, 9/*items_per_page*/, this.SearchAjaxCallBack);
    },
    SearchAjaxCallBack: function (r) {
        if ($('moreSearch_button')) {
            $('moreSearch_button').set('disabled', false);
            $('moreSearch_button').set('value', $('moreSearch_button').get('value').replace('...', ''));
        }
        if (r.error != null) return;
        r = JSON.decode(r.value);

        if ((wProfile.CurrentSearch.Category == 'feeds' && r.FeedList.length == 0) ||
            (wProfile.CurrentSearch.Category == 'labels' && r.LabelList.length == 0) ||
            (wProfile.CurrentSearch.Category == 'contacts' && r.UserList.length == 0)) {
            //no results text
            if ((wProfile.CurrentSearch.Category == 'feeds' && $('srch_feeds').get('html') == '') ||
            (wProfile.CurrentSearch.Category == 'labels' && $('srch_labels').get('html') == '') ||
            (wProfile.CurrentSearch.Category == 'contacts' && $('srch_users').get('html') == '')) {
                $('srch_feeds').removeClass('dndD');
                $('srch_feeds').set('html', '<span class=\'f11 testShadow pad10 dnb\'>' + T_CANTFIND + '</span>');
            }
            $('dvsearchMore').addClass('dnd');
            return;

        }
        wProfile.CurrentSearch.Page++;
        var category = searchCategory;
        $('master_feeds_container').addClass('dnd');
        $('search_feeds_container').removeClass('dnd');
        $('dvFilters_search').removeClass('dnd');
        $('dvsearchMore').removeClass('dnd');
         if($('label_text'))
            $('label_text').addClass('dnd');
         if ($('bio_feed')) 
             $('bio_feed').addClass('dnd');
        if ($('compose_box')) 
            $('compose_box').addClass('dnd');

        if (r.FeedList != null) { // Process FeedList
            wProfile.Render.Start(r.FeedList, false, 'feeds');
        }
        if (r.LabelList != null) { // Process LabelList
            wProfile.Render.Start(r.LabelList, false, 'labels');
        }
        if (r.UserList != null) { // Process UserList
            wProfile.Render.Start(r.UserList, false, 'people'); //TODO: Render.Start_RV should process user feeds
        }
        if (r.WebList != null) { // Process WebList
            wProfile.Render.Start(r.WebList, false, 'web'); //TODO: Render.Start_RV should process web results
        }
    },
    SetSearchType: function (oType) {
        this.Search.Type = oType;
    },
    Feed: function (feedid) {
        //profilePage.hide();
        wjxLabel.send('GetFeedInfo', profileInfo.ownerID, feedid, function (res) {
            if (res.error) return;
            var tmpArray = new Array();
            if (JSON.decode(res.value).FeedID != 0)
                tmpArray.push(JSON.decode(res.value));
            var tmp = { value: JSON.encode(tmpArray) };
            wProfile.Helper.Loaded = [];
            wProfile.Render.Start(tmp);
        });
    },
    Feeds: function (feeds, labelID) {
        var feedsList = feeds.split(',');
        wProfile.Current.LabelID = labelID;
        feedsList = JSON.encode(feedsList);
        pushstart = 1;
        wHtmlCanvas.empty();
        wProfile.Helper.Loaded = [];
        wProfile.Helper.Pending = [];
        //old line:new Fx.Reveal($('aNewFeeds'), { duration: 500 }).dissolve();
        //new line below-
        $('aNewFeeds').removeClass('dnd');
        wjxLabel.send('GetFeedListInfo', profileInfo.viewerID, feedsList, wProfile.Render.Start);
        //setTimeout("setTxtBodyText()", 2500);
    },
    Inbox: function (s) {
        wjxProfile.send('Inbox', s.urlDecode(), wProfile.Render.Start);
    },
    Load: function (oDetailsID, oCategory, oLabelID, oPage, resetFeeds) { // Load feeds (page_load / clicke label)
        /* initialize LABEL info values for public use */
        // alert('2');
        //setLABEL.info(oDetailsID,oLabelID);        
        //QuickPost
        //maria for emoticons of quick compose
        //  if ($('compose_box')){
       //             if($('loadEmoticons'))
       //             {
        //                $('loadEmoticons').set('html', '<span id=\"emoticons_link\" onmouseout="Tip.doTipOff(\'emoticons_link\');"  onmouseover="Tip.doTipLbl(\'emoticons_link\',\'Emoticons\',\'1\',\'4\');" onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'emoticons_link\', \'\', \'\', \'emoticons_linkDropdown\', \'\', \'\');emoticonsjs.getEmoticons(\'text_body_quick\');\" title=\"Emoticons\">&nbsp;</span>');
        //            }
       //   } 

        if (oLabelID!=0)
            composejs.getQuickpost(1);
        else
            composejs.getQuickpost(0);

        this.Current.DetailsID = oDetailsID;
        this.Current.Category = oCategory;
        this.Current.LabelID = oLabelID;
        this.Current.Page = parseInt(oPage);
        
        //#-- start: permanent link
        var addressDOMAIN = document.location;
        var addressURL = document.domain;
        var addressLABEL = '';

        if (profileInfo.ownerWadjaID == 'wadja') {
            /*//#if guest-posting
            if (getQuerystring('labelname') != '' && getQuerystring('post') != '')
            {}
            else*/
            this.Current.Category = 'Every';
        }
        if ($('EmbedFeed_text'))
            $('EmbedFeed_text').set('value', '<iframe name=\"I1\" frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" style=\"border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; width: 300px; height: 560px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; border-width: initial; border-color: initial;\" src=\"http://www.wadja.com/user/connect.aspx?wadjaid=' + profileInfo.ownerWadjaID + '&label=' + oLabelID.toString().replace('0', '8') + '\" id=\"I1\"></iframe>');

        //#Reset filters everytime we change label
        if (PreLabelID == -1) //#first time
            PreLabelID = oLabelID;

        if (PreLabelID != oLabelID) {
            PreLabelID = oLabelID;
            jsHelper.resetFilters();
        }
        //-end of reset filters rule

        if (resetFeeds) {
            this.Current.MinID = 0;
            this.Helper.Loaded = [];
            this.Helper.Pending = [];
            this.Helper.Rendered = [];
            this.Current.FeedsPending = 0;
            showAutocompleteBubble = false;

            if ($('custom-tweet-button')) 
                $('custom-tweet-button').set('html', '');
            jsHelper.likeButtons();
            //            if (this.Current.LabelID == 5 && this.Current.Category == 'My' && profileInfo.profileBelongsToViewer) {
            //                this.Current.Filter = 1;
            //                $('privacyicon_1').set('class', 'fromImageDr');
            //            }
            //            else {
            this.Current.Filter = 0;
//            if ($('privacyicon_1'))
//                $('privacyicon_1').set('class', 'tofromImageDr');
            //            }
            //delay
            setTimeout('setInLabelSearch()', 2000);

        }
        pushstart = 0; //start push feeds

        // if (oPage > 1) {
        //        this.Current.MinID = 0;
        // }
        //Clear search results

        if ($('srch_feeds'))
            $('srch_feeds').empty();
        if ($('srch_labels'))    
            $('srch_labels').empty();
        if ($('srch_users'))  
            $('srch_users').empty();
        if ($('srch_web'))  
            $('srch_web').empty();
        if ($('master_feeds_container')) 
            $('master_feeds_container').removeClass('dnd');
        if ($('search_feeds_container'))     
            $('search_feeds_container').addClass('dnd');
        if ($('dvFilters_search')) 
            $('dvFilters_search').addClass('dnd');
        
        /* No more Profile card - Ariana 7/7/2011
        // Show Feeds or Profile Card - Ariana
       
       
        //#if location url ends with wadjaID and wadjaID is not empty and location url does not contain #! and not in followers page, display profile card - Ariana
        if ((locHref.endsWith(profileInfo.ownerWadjaID) || locHref.endsWith(profileInfo.ownerWadjaID.replaceAll(profileInfo.ownerNetworkDomain, ''))) && profileInfo.ownerWadjaID != ''   && locHref.indexOf('#!') < 0 && profileInfo.ownerNetworkDomain != profileInfo.ownerWadjaID && locHref.indexOf('followers') < 0 && locHref.indexOf('?u=no') < 0) {
             //edw elegxos gia bio
             $('FeedPage').addClass('dnd');
             $('profileCard').removeClass('dnd');
             profilecardjs.loadUserCard(profileInfo.ownerID,0);            
             if ($('inviteLbl')) {
                 $('inviteLbl').removeClass('dndD');
                 $('inviteLbl').set('html', '<a class=\"f12 lnk\"  onclick=\"javascript:promoteInterestLinkjs.getpromoteInterestLink('+profileInfo.ownerID+',\'\',\'\', \'1\');\" title=\"' + T_INVITETOFOLLOW + '\">'+T_PROMOTE_INTEREST+'</a>');              
             }
             //Install WALL
            
             return;
        }
        else if (locHref.indexOf('.')>0){
             //top.location.href='#!My/'+rootlabel+'/1/';
             //#region Page permanent link
             var permanent_url=locHref.substring(locHref.lastIndexOf('/')+1,locHref.length);
             var page_url='';
             if (permanent_url.indexOf('.')>0) {
                //Get page URL
                
                page_url=permanent_url.replace(profileInfo.ownerWadjaID+'.','');
               //#jsHelper.cachedData.My
                    var rLABELLIST = MyLabelList;
                    for (i = 0; i < rLABELLIST.length; i++) {
                        
                        if (rLABELLIST[i].labelName.toLowerCase() == decodeURI(page_url).toLowerCase()) {
                            this.Current.LabelID = rLABELLIST[i].labelID;
                            break;
                        }
                    }
             }
             //#endregion
             //top.location.href=profileInfo.ownerWadjaID+'#!My/'+this.Current.LabelID+'/1/';
        }
        No more Profile card - Ariana 7/7/2011*/
       
       //Load permanent links
       var locHref = location.href;
       var permanent_url='';
    
       locHref = locHref.substring(0, locHref.length);
       permanent_url=locHref.substring(locHref.lastIndexOf('/')+1,locHref.length);
       
       if (permanent_url.indexOf('.')>0){
             //top.location.href='#!My/'+rootlabel+'/1/';
             //#region Page permanent link
             
             var page_url='';
             if (permanent_url.indexOf('.')>0) {
                //Get page URL
                
                page_url=permanent_url.replace(profileInfo.ownerWadjaID+'.','');
               //#jsHelper.cachedData.My
                    var rLABELLIST = MyLabelList;
                    var rLABELFOUND=false;
                    for (i = 0; i < rLABELLIST.length; i++) {
                        
                        if (rLABELLIST[i].labelName.toLowerCase() == decodeURI(page_url).toLowerCase()) {
                            this.Current.LabelID = rLABELLIST[i].labelID;
                            rLABELFOUND=true;
                            break;
                        }
                    }
                    if (!rLABELFOUND)
                        this.Current.LabelID = rootlabel;
                    
             }
             //#endregion
             //top.location.href=profileInfo.ownerWadjaID+'#!My/'+this.Current.LabelID+'/1/';
        }
        //Go to root label
        if (this.Current.LabelID==0)
            this.Current.LabelID = rootlabel;
        //#Get label feeds-here
        if (pushstart == 0) {        
            //#Ground Zero-Everything starts from here...
            /* if not more then reset timeline */
            if (this.Current.Page==1)
            {
                $('dvStream').empty();
                $('dvMore_top').addClass('dnd');
            }
            if ($('dvMore_loading'))
                $('dvMore_loading').removeClass('dnd');
            if($('dvMore'))
                $('dvMore').addClass('dnd');

            beforeload=(new Date()).getTime();
            wjxProfile.send('GetFeeds', this.Current.DetailsID, this.Current.Category, this.Current.LabelID, this.Current.Filter, this.Current.Page, this.Current.Per_Page, 0, wProfile.Render.Start);
        }        
    }
}
//#Feeds actions
var feedActions = {
    markRead: function (ofeedID, ofeedConversationID) {
        wjxProfile.send('Inbox', ofeedConversationID, function (res) {
            if (res.error) return;
            if ($('feed_' + ofeedID))//#remove class-unread
            {
                $('feed_' + ofeedID).removeClass('unread');
                $('list_replies_' + ofeedID).removeClass('bolt');
                $('replies_counter_' + ofeedID).removeClass('reply_comments_unread');
                $('replies_counter_' + ofeedID).addClass('reply_comments');
              
            }
        });
    },
    openPopup: function (ofeedID, ofeedContentType, ofeedConversationID, ownerID) {
       bootloader.load('/user/thumb.js', function () {
            UIThumb.openpopup(ofeedID, ofeedContentType, ofeedConversationID, ownerID);
        });
    },
    deliveryReportsOn: function (info) {
        if ($('delivery_report')) {
            $('delivery_report').set('html', '<span class=\"closePopDelivery cursor lnk\" onclick=\"feedActions.deliveryReportsOff();\" id=\"close_delivery_report\">' + T_CLOSE + '</span><div class=\"openPopDelivery\"><div class="pad5 b_r bolt coloredBackground mar5 tal">' + T_DELIVERYREPORTSUPPER + '</div><div id=\"delivery_report_info\" class=\"tal mar5\"></div></div>');
            if ($('delivery_report_info'))
                $('delivery_report_info').set('html', info);

            feedHover = $('delivery_report');
            feedHover.set('opacity', 0);
            feedHover.setStyle('display', 'block').fade('in');
            feedHover.removeClass('dndD');

            var pos = $('a_delivery_report').getCoordinates();

            feedHover.setStyles({
                top: pos.top + 150 + 'px',
                left: -270 + 'px',
                position: 'absolute',
                zindex: '1100',
                //width: '100%',
                height: '100%'
            });
            //#Make draggable
            //$('feed_viewer').makeDraggable();
        }
    },
    deliveryReportsOff: function () {
        if ($('delivery_report')) {
            var feedHover = $('delivery_report');
            feedHover.fade('out');
            feedHover.setStyles({
                zindex: '-1'
            });
            feedHover.addClass('dndD');
        }
    },
    viewOff: function () {

    //if($('grayOverlay'))
       //$('grayOverlay').addClass('dnd');
       if($('replyTxt'))
       {
          //fixing the bug for comments in change textareaid for emoticons
        forCommentEmoticonbug = true;
        handleTextareaID = 'text_body_quick5';

        }
        var feedHover = $('feed_viewer');

        //refresh google ads
        RefreshGoogleAds();
        

        feedHover.fade('out');
        feedHover.setStyles({
            zindex: '-1'
        });

        //            if($('thumb_html_popup') && Browser.Engine.trident)
        //                $('thumb_html_popup').fade('out');
        //            if($('first_reply_text') && Browser.Engine.trident)
        //                $('first_reply_text').fade('out');
        //$('thumb_html_popup').empty();
        if ($('aNewComments') && $('aNewComments').getStyle('display') == 'block') {
            var newCommentsNo = parseInt($('aNewComments').getElement('span').innerHTML);
            if (newCommentsNo > 0)
                UIThumb.increaseRepliesCounter(feed.feedID, newCommentsNo);
        }

        feedHover.addClass('dndD');
        clearInterval(commentsTimer);

        //pushstart=0;
    },
    viewHTML: function (oHTML) {
   
    if($('grayOverlay')) {
        $('grayOverlay').removeClass('dnd');
        $('grayOverlay').removeClass('grayOverlayThird');
        $('grayOverlay').addClass('grayOverlayComment');
        }

       
     

        if ($('feed_viewer')) {
            //--- start window
            if ($('feed_viewer_content'))
            {}
            else
                $('feed_viewer').set('html', '<span class="closePop cursor" onclick="feedActions.viewOff();CloseOverlay();" id="closePopFeed"></span><div class="openPop"><div id="feed_viewer_content" class="thumb_view_profile_full marB20"></div><div class="padT20">&nbsp;</div></div>'); //<div id=\"vScroll\">wtf!</div><div id="vBar"><div id="vKnob"></div></div>
  

            feedHover = $('feed_viewer');
            //feedHover.set('opacity', 0);
            feedHover.setStyle('display', 'block').fade('in');
            feedHover.removeClass('dndD'); /*top: '0',*/
            feedHover.setStyles({
                zindex: '1000'
                //left: '0',
                //width: '100%'
            });
            //#Make draggable
            //#$('feed_viewer').makeDraggable();
        }

    },
    openCompose: function (oHTML) {
    if($('grayOverlay'))
        $('grayOverlay').removeClass('dnd');
        if ($('compose_viewer')) {

        var pageSize = window.getSize(); 
        var pageScroll = window.getScroll();
        $('compose_viewer').setStyle('top', pageScroll.y - 15 + 'px');

//            //--- start window
//            if ($('compose_viewer_content'))
//            {}
//            else
//                $('compose_viewer').set('html', '<span class=\"closePop cursor\" onclick=\"feedActions.viewOff();\" id=\"closePopCompose\">' + T_CLOSE + '</span><div class=\"openPop\"><div id=\"compose_viewer_content\" class=\"thumb_view_profile_full marB20\"></div><div class=\"padT20\" >&nbsp;</div></div>');
//  

            composeHover = $('compose_viewer');
            //feedHover.set('opacity', 0);
            composeHover.setStyle('display', 'block').fade('in');
            composeHover.removeClass('dnd'); /*top: '0',*/
            composeHover.setStyles({
                zindex: '1000'
                //left: '0',
                //width: '100%'
            });
            //#Make draggable
            //#$('feed_viewer').makeDraggable();
        }

    },
    composeOff: function () {

    //if($('grayOverlay'))
        //$('grayOverlay').addClass('dnd');
        CloseOverlay();
        var composeHover = $('compose_viewer');

        //refresh google ads
        RefreshGoogleAds();

        composeHover.fade('out');
        composeHover.setStyles({
            zindex: '-1'
        });

        composeHover.addClass('dnd');
    },
     openNotifications: function (oHTML) {
    //if($('grayOverlay'))
        //$('grayOverlay').removeClass('dnd');
        if ($('NotificationsDropdown')) {
        //alert(oHTML);
        NotificationDropDown();
        var pageSize = window.getSize(); 
        var pageScroll = window.getScroll();
        $('NotificationsDropdown').setStyle('top', pageScroll.y - 15 + 'px');

            NotificationHover = $('NotificationsDropdown');           
            NotificationHover.setStyle('display', 'block').fade('in');
            NotificationHover.removeClass('dnd'); /*top: '0',*/
            NotificationHover.setStyles({
                zindex: '1000'
            });
        }

    },
    notificationsOff: function () {
        CloseOverlay();
        var NotificationHover = $('NotificationsDropdown');

        //refresh google ads
        RefreshGoogleAds();

        NotificationsDropdown.fade('out');
        NotificationsDropdown.setStyles({
            zindex: '-1'
        });

        NotificationsDropdown.addClass('dnd');
    },
    NewLabel: function (labelName) {
        return labelName;
    },
    LabelFilter: function (filterID) {
    /*
        if (filterID == '0')
            $('inOut_sp').set('html', 'In/Out');
        else if (filterID == '1')
            $('inOut_sp').set('html', 'Ougoing');
        else if (filterID == '2')
            $('inOut_sp').set('html', 'Incoming');
        else if (filterID == '3')
            $('inOut_sp').set('html', 'Block');
*/
        //
        wProfile.Current.Filter = filterID;
        wProfile.Helper.Loaded = [];
        wProfile.Helper.Pending = [];
        wProfile.Current.FeedsPending = 0;

        wProfile.Load(wProfile.Current.DetailsID, wProfile.Current.Category, wProfile.Current.LabelID, wProfile.Current.Page, false);
        //
    }, /**/
    plusLabel: function (feedID) {

        var plsButton = $('feed_pluslabel_' + feedID);
        var plsDropdown = $('feed_pluslabel_' + feedID + 'Dropdown');
        //#set current drop-down
        currentDropdown = 'feed_pluslabel_' + feedID + 'Dropdown'; //so it can be closed
        //#hid all other opened drop-downs
        MyMenu.hideAll('');
        plsDropdown.toggleClass('dndD');

        if (jsHelper.cachedData.PLDropdown.trim() == '')
            GetLabelistData.PLDropdown(feedID);
        
        var ul_values = '';
        try {
            ul_values = jsHelper.cachedData.PLDropdown.replaceAll('##', feedID);
        }
        catch (errUL) {

        }

        //#Start dropdown
        var plsHTML;

        var plsHTML_div = new Element('div', { 'class': ' ddlMenuTop ddlsProfile applyDropDown', 'id': 'ApplyDropdown' });

        var plsHTML_div_arrow = new Element('div', { 'class': 'share-arrow-left' });
        var plsHTML_div_div = new Element('div', { 'class': 'dropLines' });
        var plsHTML_ul_auto = new Element('span', { 'class': 'sub shadow', 'html': '<div><input type="text" id="feed_pluslabel_auto_' + feedID + '" autocomplete="off" maxlength="30" /></div>' });
        var plsHTML_ul_new = new Element('span', { 'id': 'feed_pluslabel_new_wrapper_' + feedID, 'class': 'sub shadow dnd', 'html': '<span class=\"subdropNew dnb\"><span id="feed_pluslabel_new_' + feedID + '" class="wrb bolt cursor" ></span> <span id="feed_pluslabelLnk_new_' + feedID + '" class=\"lnk\" title=\"' + T_CLICK_TO_CREATE + '\" >'+PL_CREATE_NEW+'</span></span>' });
        var plsHTML_ul_value = new Element('ul', { 'class': 'sub ulLblApply', 'id': 'ulLblApply_' + feedID, 'html': ul_values });


        plsHTML_div_div.appendChild(plsHTML_ul_auto);
        plsHTML_div_div.appendChild(plsHTML_ul_new);
        plsHTML_div_div.appendChild(plsHTML_ul_value);
        plsHTML_div.appendChild(plsHTML_div_arrow);
        plsHTML_div.appendChild(plsHTML_div_div);
        plsDropdown.empty(); //empty before redrawing
        plsDropdown.appendChild(plsHTML_div);

        //Stop click event from propagating to the body click handler
        if ($('feed_pluslabel_auto_' + feedID)) {
            try {
                $('feed_pluslabel_auto_' + feedID).focus();
                
            }
            catch (errIE) {
                //#IE not working
            }
        }

        $('feed_pluslabel_auto_' + feedID).addEvent('click', function (e) {
            var event = e || window.event;
            if (event.stopPropagation) {
                event.stopPropagation();
            } else {
                event.cancelBubble = true;
            }
        });

        //#end dropdown
        //feed_pluslabel_auto_' + feedID

        //-attach autocomplete-meio
        if (jsHelper.cachedData.MyViewer.trim() == '')
            GetLabelistData.MyViewer();

        //#-plus label -------------------------------------
        bootloader.load('/user/pluslabel.js', function () {
            manageLabelAC('ul#ulLblApply_' + feedID, 'feed_pluslabel_auto_' + feedID);
        });
        //#-end of plus label ------------------------------
    },
    plusLabelPopup: function (feedID) {
        var plsButton = $('feed_pluslabel_popup_' + feedID);
        var plsDropdown = $('feed_pluslabel_dropdown_popup_' + feedID);

        currentDropdown = 'feed_pluslabel_dropdown_popup_' + feedID; //so it can be closed
        MyMenu.hideAll('');
        plsDropdown.toggleClass('dndD');
        if (jsHelper.cachedData.PLDropdown.trim() == '')
            GetLabelistData.PLDropdown(feedID);
        var ul_values = '';
        try {
            ul_values = jsHelper.cachedData.PLDropdown.replaceAll('##', feedID);
        }
        catch (errUL) {

        }

        var plsHTML;
        var plsHTML_div = new Element('div', { 'class': ' ddlMenuTop ddlsProfile applyDropDown', 'id': 'ApplyDropdown_popup' });
        var plsHTML_div_arrow = new Element('div', { 'class': 'share-arrow-left' });
        var plsHTML_div_div = new Element('div', { 'class': 'dropLines' });
        var plsHTML_ul_auto = new Element('span', { 'class': 'sub shadow', 'html': '<div><input type="text" id="feed_pluslabel_auto_popup_' + feedID + '" autocomplete="off" maxlength="30" /></div>' });
        var plsHTML_ul_new = new Element('span', { 'id': 'feed_pluslabel_new_wrapper_popup_' + feedID, 'class': 'sub shadow dnd', 'html': '<div id="feed_pluslabel_new_popup_' + feedID + '" class="subdropNew bolt cursor" ></div><div><span id="feed_pluslabel_new_popupLnk_' + feedID + '" class=\"lnk\" title='+T_CLICK_TO_CREATE+' >'+PL_CREATE_NEW+'</span></div>' });

        var plsHTML_ul_value = new Element('ul', { 'class': 'sub ulLblApply', 'id': 'ulLblApply_popup_' + feedID, 'html': ul_values });

        plsHTML_div_div.appendChild(plsHTML_ul_auto);
        plsHTML_div_div.appendChild(plsHTML_ul_new);
        plsHTML_div_div.appendChild(plsHTML_ul_value);
        plsHTML_div.appendChild(plsHTML_div_arrow);
        plsHTML_div.appendChild(plsHTML_div_div);

        plsDropdown.empty(); //empty before redrawing
        plsDropdown.appendChild(plsHTML_div);
        //Stop click event from propagating to the body click handler
        if ($('feed_pluslabel_auto_popup_' + feedID)) {
            try {
                $('feed_pluslabel_auto_popup_' + feedID).focus();
            }
            catch (errIE) {
                //#IE not working
            }
        }

        $('feed_pluslabel_auto_popup_' + feedID).addEvent('click', function (e) {
            var event = e || window.event;
            if (event.stopPropagation) {
                event.stopPropagation();
            } else {
                event.cancelBubble = true;
            }
        });
        //#end dropdown

        if (jsHelper.cachedData.MyViewer.trim() == '')
            GetLabelistData.MyViewer();
        //#-plus label -------------------------------------
        bootloader.load('/user/pluslabel.js', function () {
            plusLabelAC('ul#ulLblApply_popup_' + feedID, 'feed_pluslabel_auto_popup_' + feedID);
        });
        //#-end of plus label ------------------------------
    },
    plusLabel_apply: function (feedID, labelID, labelName, labelStyle, labelIcon, labelFollowers) {
        //feedActions.plusLabel(feedID);
        feedActions.apply(feedID, labelID, labelName, labelStyle, labelIcon, labelFollowers);
    },
    apply: function (feedID, labelID, labelName, labelStyle, labelIcon, labelFollowers) {
        wjxLabel.send('Apply', feedID, labelID, function (res) {
            Notify.spinnerOff(T_LABELAPPLIED, 1);
            if (!res.error) {
                var r = JSON.decode(res.value);
                if (!r) {
                    Notify.topBarOn(T_DUPLICATELABEL, 'red', 6)
                }
                else {
                    wjxLabel.send('GetInfo', labelID, profileInfo.ownerID, function (res) {
                        if (!res.error) {
                            if (labelStyle == '') {
                                var labelInfo = JSON.decode(res.value);
                                if (labelInfo.StyleID > 0) {
//                                    if (labelInfo.bgColor.length > 0)
//                                        labelStyle = labelStyle + 'background-color:' + labelInfo.bgColor;

                                    if (labelInfo.fontColor.length > 0) {
                                        if(labelInfo.fontColor.toLowerCase() != "#fff" && labelInfo.fontColor.toLowerCase() != "#ffffff")
                                            labelStyle = 'color:' + labelInfo.fontColor + ' !important';
                                        else
                                            labelStyle = 'color:#0000ff !important';
                                    }
                                    else { labelStyle = 'color:#000 !important';}

                                    if (labelInfo.fontFamily.length > 0)
                                        labelStyle = labelStyle + ';font-family:' + labelInfo.fontFamily;
                                }
                                //                            else
                                //                             labelStyle ='lbl'+labelName;
                            }

                            if (labelName == '')
                                labelName = labelInfo.name;
                            //#--
                            var dvFeedTemp = $('attachedlabel_spot_' + feedID);
                            var dvFeedTempViewmode = $('feed_labels_' + feedID); //thumb view mode
                            var dvFeedTempViewPopup = $('feed_labels_v_' + feedID); //pop-up
                            var dvFeedLabelname = labelName;
                            var wheellabel = '';      
                            var wheellabeldropdown = '';
                            var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + labelID + '&o=' + profileInfo.ownerID + '&n="></script>'; 
                           
                            // wheel dropdown - Ariana
                            wheellabeldropdown += '<div class="subWheelPr marT20" id="attachedlabellink_' + feedID + '_' + profileInfo.ownerID + '_' + labelID + 'Dropdown">';
                            wheellabeldropdown += '<div class="share-arrow-left">&nbsp;</div>';
                            wheellabeldropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                            wheellabeldropdown += '<ul>';
                            wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_GO_TO_PAGE+'</span><a href=\"http://'+ profileInfo.networkDomain+'/'+profileInfo.ownerWadjaID+'#!My/'+labelID+'/1\">http://'+ profileInfo.networkDomain+'/'+profileInfo.ownerWadjaID+'.'+labelName+'</a></li>';
                            wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+labelID+'_' +feedID +'" onclick="this.focus();this.select();" value="http://'+ profileInfo.networkDomain+'/'+profileInfo.ownerWadjaID+'.'+labelName+'"/></li>';
                            wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+labelID+'_' +feedID +'" class="textBoxSmall" onclick="this.focus();this.select();" /></li>';
                            
                            if(((profileInfo.ownerID == 0) || profileInfo.ownerID == profileInfo.viewerID)) {
                                wheellabeldropdown += '<li onclick="feedActions.remove(' + feedID + ',' + labelID + ',\'' + labelName.replace("\'", "\\'") + '\');"><span>'+DEF_DELETE_TO_THIS+'</span></li>';
                            }
                            wheellabeldropdown += '</ul></div></div>';
                        
                            // #wheel - Interest info - Ariana
//                            if((gl_label_privacy == 3 || gl_label_privacy == 2) && profileInfo.ownerID != profileInfo.viewerID)
//                                wheellabel='';
//                            else {
//                                wheellabel = '<span id="Wheel_' + labelID + '_' + feedID + '" style="' + labelStyle + '" class="wheel_labels dropdown psRel inactiveWheel" onclick="var event = arguments[0] || window.event;if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble = true;} MyMenu.DropDown(\'Wheel_' + labelID + '_' + feedID + '\',\'\',\'\',\'Wheel_' + labelID + '_' + feedID + 'Dropdown\',\'\',\'\');">&nbsp;</span>';
//                            }

                            if (labelName.indexOf("'") > 0)
                                dvFeedLabelname = escape(labelName);
                            else if (labelName.indexOf("%27") > 0)
                                labelName = unescape(labelName);

                            if (dvFeedTempViewPopup) {
                                dvFeedTempViewPopup.appendChild(new Element('span', { 'id': 'attachedlabel_v_' + feedID + '_' + profileInfo.viewerID + '_' + labelID, 'rel': labelName.replace("\'", "\\'"), 'class': 'showApply psRel f_l ', 'html':'<span class=\"f_l\">'+ wheellabeldropdown+'</span><a href="/'+profileInfo.viewerWadjaID+'#!' + wProfile.Current.Category + '/' + labelID + '/1" class="lblBox f_l" style="' + labelStyle + '" >' + labelName + '</a>', 'style': labelStyle }));
                                //dvFeedTempViewPopup.appendChild(new Element('span', {'html': wheellabeldropdown , 'class':'f_l'}));
                            }
                            if (UIView == 0) {
                                if (dvFeedTempViewmode)
                                    dvFeedTempViewmode.appendChild(new Element('span', { 'id': 'attachedlabel_' + feedID + '_' + profileInfo.viewerID + '_' + labelID, 'rel': labelName.replace("\'", "\\'"), 'class': 'showApply psRel f_l', 'html':'<span class=\"f_l\">'+wheellabeldropdown+'</span><a href="/'+profileInfo.viewerWadjaID+'#!' + wProfile.Current.Category + '/' + labelID + '/1" class="lblBox f_l" style="' + labelStyle + '" >' + labelName + '</a>', 'style': labelStyle }));
                                else{
                                    dvFeedTemp.appendChild(new Element('span', { 'id': 'attachedlabel_' + feedID + '_' + profileInfo.viewerID + '_' + labelID, 'rel': labelName.replace("\'", "\\'"), 'class': 'showApply psRel f_l', 'html':'<span class=\"f_l\">'+ wheellabeldropdown+'</span><a href="/'+profileInfo.viewerWadjaID+'#!' + wProfile.Current.Category + '/' + labelID + '/1"  class="lblBox f_l" style="' + labelStyle + '" >' + labelName + '</a>', 'style': labelStyle }));
                                }
                            }
                            //.appendChild(new Element('span', {'html': wheellabeldropdown , 'class':'f_l'}));
                            //#IF STAR THEN ON:feedID, labelID
                            if (labelID == 4) {

                                if ($('toolstar_' + feedID))//list
                                {
                                    $('toolstar_' + feedID).removeClass('applyStarOff');
                                    $('toolstar_' + feedID).addClass('applyStar');
                                }
                                if ($('star_v_' + feedID))//thumb
                                {
                                    $('star_v_' + feedID).removeClass('applyStarToolsOff');
                                    $('star_v_' + feedID).addClass('applyStarTools');
                                }
                                if ($('star_popup_' + feedID))//pop-up
                                {
                                    $('star_popup_' + feedID).removeClass('applyStarToolsOff');
                                    $('star_popup_' + feedID).addClass('applyStarTools');
                                }
                            }

                            if ($('feed_pluslabel_dropdown_v_' + feedID))
                                $('feed_pluslabel_dropdown_v_' + feedID).addClass('dndD');
                            if ($('feed_pluslabel_dropdown_popup_' + feedID))
                                $('feed_pluslabel_dropdown_popup_' + feedID).addClass('dndD');
                            if ($('feed_pluslabel_dropdown_' + feedID))
                                $('feed_pluslabel_dropdown_' + feedID).addClass('dndD');
                            //followers
                            //icon
                            var tlcounter = 0;
                            if ($('label_count_hidden_' + feedID))
                                tlcounter = parseInt($('label_count_hidden_' + feedID).value);
                            tlcounter++;
                            $('label_count_hidden_' + feedID).value = tlcounter;
                            //#--

                        }
                    });

                }
            }
            else {
                Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [apply label #' + Error + '</p>', 'Ok', 'red');
            }
        });
    },
    remove: function (feedID, labelID, labelName) {// remove attached label
        //remove label contact:label id 5
        labelName = unescape(labelName);
        var messageText = '<div class=\'pad10\'>' + T_AREYOUSUREYOUWANT.replace('#X', '#' + labelName) + ' </div>';

        if (labelID == 5)
            messageText = '<div class=\'pad10\'>' + T_AREYOUSUREYOUWANT.replace('#X', '#' + labelName) + ' <br/><br/>' + T_PERMANENTDELETE + '</div>';
        //#count total labels
        var tlcounter = 0;
        if ($('label_count_hidden_' + feedID))
            tlcounter = parseInt($('label_count_hidden_' + feedID).value);
            
        //#on last feed-label delete feed
        if (labelID == 5)
            messageText = '<div class=\'pad10\'>' + T_AREYOUSUREYOUWANT.replace('#X', '#' + labelName) + '<br/><br/>' + T_PERMANENTDELETE + '</div>';
        else if (tlcounter == 1)
            messageText = '<div class=\'pad10\'>' + T_AREYOUSUREYOUWANT.replace('#X', '#' + labelName) + '<br/><br/>' + T_PERMANENTDELETE_FEED + '</div>';
        /*if (tlcounter == 1) {
        if (labelID == 5)
        messageText = '<div class=\'pad10\'>' + T_AREYOUSUREYOUWANT.replace('#X', '#' + labelName) + '<br/><br/>' + T_PERMANENTDELETE + '</div>';
        else
        messageText = '<div class=\'pad10\'>' + T_AREYOUSUREYOUWANT.replace('#X', '#' + labelName) + ' </div>';
        }*/

        var alertBox = new Facebox({
            title: T_REMOVELABEL,
            message: messageText,
            cancelValue: T_CANCEL,
            submitFunction: function () {
                // AJAX Request -
                wjxLabel.send('Remove', feedID, labelID, function (res) {
                    Notify.spinnerOff(T_LABELHASBEENMOVED.replace('#X', '#' + labelName), 1);
                    if (!res.error) {
                        var tlcounter = 0;
                        if ($('label_count_hidden_' + feedID))
                            tlcounter = parseInt($('label_count_hidden_' + feedID).value);
                        tlcounter--;
                        $('label_count_hidden_' + feedID).value = tlcounter;

                        if (labelID == 4) {
                            if ($('toolstar_' + feedID))//list
                            {
                                $('toolstar_' + feedID).addClass('applyStarOff');
                                $('toolstar_' + feedID).removeClass('applyStar');
                            }
                            if ($('star_v_' + feedID))//thumb
                            {
                                $('star_v_' + feedID).addClass('applyStarToolsOff');
                                $('star_v_' + feedID).removeClass('applyStarTools');
                            }
                            if ($('star_popup_' + feedID))//pop-up
                            {
                                $('star_popup_' + feedID).addClass('applyStarToolsOff');
                                $('star_popup_' + feedID).removeClass('applyStarTools');
                            }
                        }
                       
                        if ($('attachedlabel_' + feedID + '_' + profileInfo.viewerID + '_' + labelID)) {
                            //if feed's label is equal to the current label's feed then remove feed
                            if (wProfile.Current.LabelID == labelID || tlcounter <= 0) {

                                //remove with transition
                                Notify.remove('feed_' + feedID, 1);
                                (function () {
                                    //destroy element
                                    if ($('feed_' + feedID))
                                        $('feed_' + feedID).destroy();
                                    //#pop-up destroy feed
                                    if ($('feed_v_' + feedID)) {
                                        $('feed_v_' + feedID).destroy();
                                    }
                                }).delay(3 * 1000);
                                feedActions.viewOff();
                                CloseOverlay();
                            }
                            else {
                                //just remove the label badge

                                //#IF STAR THEN OFF:feedID, labelID

                                //remove with transition
                              
                                MyElement.dissolve($('attachedlabel_' + feedID + '_' + profileInfo.viewerID + '_' + labelID));
                                //destroy element
                                $('attachedlabel_' + feedID + '_' + profileInfo.viewerID + '_' + labelID).destroy();
                                //#pop-up remove label
                            }
                        }
                        if ($('attachedlabel_v_' + feedID + '_' + profileInfo.viewerID + '_' + labelID)) {
                            $('attachedlabel_v_' + feedID + '_' + profileInfo.viewerID + '_' + labelID).destroy();
                        }
                    }
                    else {
                        Notify.alert('Javascript error', '<div class=\'pad10\'>Javascript error while [remove page] #' + Error + '</div>', 'Ok', 'red');
                    }
                });

                alertBox.close();
            },
            //ajaxErrorMessage: message to display when an ajax error occurs.
            //ajaxDelay: minimum time to display the loading message. (In milliseconds. Defaults to 0)
            submitValue: T_YES,
            submitFocus: T_NO//If true, the submit button will be focused. (Pressing enter will activate it)
        });
        alertBox.show();
    },
    trashAll: function (labelId) {

        var alertBox = new Facebox({
            title: T_MOVEFEEDSTOTRASH,
            message: '<div class=\'pad10\'>' + T_ALLFEEDSWILLBE + ' </div>',
            cancelValue: T_CANCEL,
            submitFunction: function () {
            var locHref = location.href;
               if (locHref.endsWith('/'))
            locHref = locHref.substring(0, locHref.length - 1);
                // AJAX Request -
                wjxLabel.send('DeleteAll', labelId, function (res) {
                    Notify.spinnerOff('All feeds ', 1);
                    if (!res.error) {
                    if ((locHref.endsWith(profileInfo.ownerWadjaID) || locHref.endsWith(profileInfo.ownerWadjaID.replaceAll(profileInfo.ownerNetworkDomain, ''))) && profileInfo.ownerWadjaID != ''   && locHref.indexOf('#!') < 0 && profileInfo.ownerNetworkDomain != profileInfo.ownerWadjaID && locHref.indexOf('followers') < 0 && locHref.indexOf('?u=no') < 0) {
                    
                    }
                    else {
                   
                        Notify.remove('dvStream', 1);
                        (function () {
                        if($('dvStream'))
                            $('dvStream').empty();
                        }).delay(5 * 1000);
                        }
                    }
                    else {
                        Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [trash all page\'s feeds] #' + Error + '</p>', 'Ok', 'red');
                    }
                });
                // end of AJAX
                alertBox.close();
            },
            //ajaxErrorMessage: message to display when an ajax error occurs.
            //ajaxDelay: minimum time to display the loading message. (In milliseconds. Defaults to 0)
            submitValue: T_YES,
            submitFocus: T_NO//If true, the submit button will be focused. (Pressing enter will activate it)
        });
        alertBox.show();

    },
    emptyTrash: function () {
        var alertBox = new Facebox({
            title: T_DELFOREVER,
            message: '<div class=\'pad10\'>' + T_ALLFEEDSWILLBEDEL + ' </div>',
            cancelValue: T_CANCEL,
            submitFunction: function () {
                // AJAX Request -
                wjxLabel.send('EmptyTrash', function (res) {
                    Notify.spinnerOff('All feeds ', 1);
                    if (!res.error) {
                        Notify.remove('dvStream', 1);
                        (function () {
                            $('dvStream').empty();
                            
                        }).delay(5 * 1000);
                    }
                    else {
                        Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [empty trash] #' + Error + '</p>', 'Ok', 'red');
                    }
                });
                // end of AJAX
                alertBox.close();
            },
            //ajaxErrorMessage: message to display when an ajax error occurs.
            //ajaxDelay: minimum time to display the loading message. (In milliseconds. Defaults to 0)
            submitValue: T_YES,
            submitFocus: T_NO//If true, the submit button will be focused. (Pressing enter will activate it)
        });
        alertBox.show();

    }, // trash feeds
    trash: function (feedID, labelID) {
        var alertBox = new Facebox({
            title: T_MOVEFEEDSTOTRASH,
            message: '<div class=\'pad10\'>' + T_AREYSUREYWANTTOMOVETHISFEED + ' </div>',
            cancelValue: T_CANCEL,
            submitFunction: function () {
                // AJAX Request -
                wjxLabel.send('Apply', feedID, labelID, function (res) {
                    Notify.spinnerOff(T_HASBEENMOVED, 5);
                    if (!res.error) {
                        if ($('feed_' + feedID)) {
                            Notify.remove('feed_' + feedID, 1);
                            (function () {
                                //destrot element
                                $('feed_' + feedID).destroy();
                                if ($('feed_v_' + feedID)) {
                                    $('feed_v_' + feedID).destroy();
                                    feedActions.viewOff();
                                    CloseOverlay();
                                }

                            }).delay(5 * 1000);
                        }
                    }
                    else {
                        Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [trash feed] #' + Error + '</p>', 'Ok', 'red');
                    }
                });
                // end of AJAX
                alertBox.close();
            },
            //ajaxErrorMessage: message to display when an ajax error occurs.
            //ajaxDelay: minimum time to display the loading message. (In milliseconds. Defaults to 0)
            submitValue: T_YES,
            submitFocus: T_NO//If true, the submit button will be focused. (Pressing enter will activate it)
        });
        alertBox.show();

    },
    deleteComment: function (commentID, feedid, detailsID) {
        var alertBox = new Facebox({
            title: T_DELETECOMMENT,
            message: '<div class=\'pad10\'>' + T_PERMANETDELETECOMMENT + '</div>',
            cancelValue: T_CANCEL,
            submitFunction: function () {
                // AJAX Request -
                wjxLabel.send('DeleteComment', commentID, function (res) {
                    Notify.spinnerOff(T_CONFIRMDELETECOMMENT, 5);
                    if (!res.error) {
                        if ($('comment_' + commentID)) {
                            Notify.remove('comment_' + commentID, 1);

                            (function () {
                                //destroy element
                                if ($('comment_' + commentID))
                                    $('comment_' + commentID).destroy();

                                var tempArray = $$('.commentUserID_' + detailsID);
                                var commentNo = tempArray.length;

                                if (commentNo == 0) {
                                if($('inconversation_img_' + detailsID))
                                    $('inconversation_img_' + detailsID).destroy();
                                    //new Fx.Reveal($('inconversation_img_' + detailsID), { duration: 750 }).dissolve();
                                }
                            }).delay(1 * 1000);
                            UIThumb.decreaseRepliesCounter(feedid, detailsID);
                        }
                    }
                    else {
                        Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [delete feed] #' + Error + '</p>', 'Ok', 'red');
                    }
                });
                // end of AJAX
                alertBox.close();
            },
            submitValue: T_YES,
            submitFocus: T_NO//If true, the submit button will be focused. (Pressing enter will activate it)
        });
        alertBox.show();
    },
    trash_deleteFeed: function (feedID, typeID,labelID ) {
        var text = T_DELETEFEED_PER_TRASH;
        if (typeID == 6)
            text = T_DELETEFEED_PERCONTACT_TRASH;
            alertBox = new Facebox({
            width: 606,
            title: T_DELETEFEED + '<span class="closePop cursor" onclick="javascript:alertBox.close()">&nbsp;</span>',
            message: text,
            cancelValue: T_CANCEL,
            classNameTitle: 'faceboxTitleWhite psRel',
            classFooter: 'faceboxFooterDelete',
            classFooterLink: 'faceboxDeletePermanently',
            footerLink: true, // adds a link before submit buttons
            footerLinkHref: '',
            footerLinkText: '<a id="deleteLink_'+feedID+'" href=\"#1\" title=\"'+T_CANNOT_UNDO+'\" onclick=\"DeleteFeed('+feedID+');\" onmouseover="Tip.doTipLbl(\'deleteLink_'+feedID+'\' ,\''+ T_DELETEFOREVER +'\',\'12\',\'6\');" onmouseout="Tip.doTipOff(\'deleteLink_'+feedID+'\');">'+ T_DELETEFOREVER + '</a>',
            submitValue: T_TRASHFEED,
            submitFunction: function () {
                // AJAX Request -
                wjxLabel.send('Apply', feedID, labelID, function (res) {
                    Notify.spinnerOff(T_HASBEENMOVED, 5);
                    if (!res.error) {
                        if ($('feed_' + feedID)) {
                            Notify.remove('feed_' + feedID, 1);

                            (function () {
                                //destrot element
                                $('feed_' + feedID).destroy();
                                if ($('feed_v_' + feedID)) {
                                    $('feed_v_' + feedID).destroy();
                                    feedActions.viewOff();
                                    CloseOverlay();
                                }

                            }).delay(5 * 1000);
                        }
                    }
                    else {
                        Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [trash feed] #' + Error + '</p>', 'Ok', 'red');
                    }
                });

                // end of AJAX
                alertBox.close();
            },
            //ajaxErrorMessage: message to display when an ajax error occurs.
            //ajaxDelay: minimum time to display the loading message. (In milliseconds. Defaults to 0)
            submitFocus: T_NO//If true, the submit button will be focused. (Pressing enter will activate it)
        });
        alertBox.show();

    },
    deleteFeed: function (feedID, typeID) {
        var text = T_DELETEFEED_PER;
        if (typeID == 6)
            text = T_DELETEFEED_PERCONTACT;
        var alertBox = new Facebox({
            width: 606,
            title: T_DELETEFOREVER,
            message: text,
            cancelValue: T_CANCEL,
            classNameTitle: 'faceboxTitleWhite',
            submitFunction: function () {
                // AJAX Request -
                wjxLabel.send('DeleteFeed', feedID, function (res) {
                    Notify.spinnerOff(T_PERMANENTFEEDDELETE, 5);
                    if (!res.error) {
                        if ($('feed_' + feedID)) {
                            Notify.remove('feed_' + feedID, 1);

                            (function () {
                                //destroy element
                                $('feed_' + feedID).destroy();
                                if ($('feed_v_' + feedID)) {
                                    $('feed_v_' + feedID).destroy();
                                    //feedActions.viewOff();
                                }
                            }).delay(3 * 1000);
                            feedActions.viewOff();
                            CloseOverlay();
                        }
                    }
                    else {
                        Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [delete feed] #' + Error + '</p>', 'Ok', 'red');
                    }
                });
                // end of AJAX
                alertBox.close();
            },
            //ajaxErrorMessage: message to display when an ajax error occurs.
            //ajaxDelay: minimum time to display the loading message. (In milliseconds. Defaults to 0)
            submitValue: T_YES,
            submitFocus: T_NO//If true, the submit button will be focused. (Pressing enter will activate it)
        });
        alertBox.show();

    },
    star: function (feedID, labelID, labelName, labelStyle) {
        wjxLabel.send('Apply', feedID, labelID, function (res) {
            Notify.spinnerOff(T_DONE, 1);
            if (!res.error) {
                // attach star label 
                var r = JSON.decode(res.value);
                if (!r) {
                    //disable:ON/OFF Notify.topBarOn(T_DUPLICATELABEL, 'red', 6)
                    feedActions.remove(feedID, labelID, 'Starred'); //SET OFF
                }
                else {
                    var dvFeedTemp = $('attachedlabel_spot_' + feedID);
                    var dvFeedTempViewmode = $('feed_labels_' + feedID);
                    var dvFeedTempViewPopUp = $('feed_labels_v_' + feedID);
                    var wheellabel = '';  
                    var wheellabeldropdown = '';
                    var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + labelID + '&o=' + profileInfo.ownerID + '&n="></script>'; 
                   
                    // wheel dropdown - Ariana
                    wheellabeldropdown += '<div class="subWheelPr" id="attachedlabellink_' + feedID + '_' + profileInfo.viewerID + '_' + labelID + 'Dropdown">';
                    wheellabeldropdown += '<div class="share-arrow-left">&nbsp;</div>';
                    wheellabeldropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                    wheellabeldropdown += '<ul>';
                    wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_GO_TO_PAGE+'</span><a href=\"http://'+ profileInfo.networkDomain+'/'+profileInfo.ownerWadjaID+'#!My/'+labelID+'/1\">http://'+ profileInfo.networkDomain+'/'+profileInfo.ownerWadjaID+'.'+labelName+'</a></li>';
                    wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+labelID+'_' +feedID +'" onclick="this.focus();this.select();" value="http://'+ profileInfo.networkDomain+'/'+profileInfo.ownerWadjaID+'.'+labelName+'"/></li>';
                    wheellabeldropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+labelID+'_' +feedID +'" class="textBoxSmall" onclick="this.focus();this.select();" /></li>';
                    
                    if(((profileInfo.ownerID == 0) || profileInfo.ownerID == profileInfo.viewerID)) {
                        wheellabeldropdown += '<li onclick="feedActions.remove(' + feedID + ',' + labelID + ',\'' + labelName.replace("\'", "\\'") + '\');"><span>'+DEF_DELETE_TO_THIS+'</span></li>';
                    }
                    
                    wheellabeldropdown += '</ul></div></div>';
                        
                    // #wheel - Interest info - Ariana
//                    if((gl_label_privacy == 3 || gl_label_privacy == 2) && profileInfo.ownerID != profileInfo.viewerID)
//                        wheellabel='';
//                    else {
//                        wheellabel = '<span id="Wheel_' + labelID + '_' + feedID + '" class="wheel_labels dropdown psRel inactiveWheel" onclick="var event = arguments[0] || window.event;if (event.stopPropagation) {event.stopPropagation();} else {event.cancelBubble = true;} MyMenu.DropDown(\'Wheel_' + labelID + '_' + feedID + '\',\'\',\'\',\'Wheel_' + labelID + '_' + feedID + 'Dropdown\',\'\',\'\');">&nbsp;</span>';
//                    }

                    if (dvFeedTempViewPopUp) {
                        dvFeedTempViewPopUp.appendChild(new Element('span', { 'id': 'attachedlabel_v_' + feedID + '_' + profileInfo.viewerID + '_' + labelID, 'rel': labelName.replace("'", "\'"), 'class': 'showApplyThumb psRel f_l padT5', 'html':wheellabeldropdown+'<a href="/'+profileInfo.viewerWadjaID+'#!' + wProfile.Current.Category + '/' + labelID + '/1" class="lblBox" style="padding:3px 5px 3px 0 !important;">' + labelName + '</a>'}));
                        //dvFeedTempViewPopUp.appendChild(new Element('span', {'html': wheellabeldropdown , 'class':'f_l'}));
                    }
                    if (UIView == 0) {
                        if (dvFeedTempViewmode) //thumb view mode
                            dvFeedTempViewmode.appendChild(new Element('span', { 'id': 'attachedlabel_' + feedID + '_' + profileInfo.viewerID + '_' + labelID, 'rel': labelName.replace("'", "\'"), 'class': 'showApply psRel f_l', 'html': wheellabeldropdown+'<a href="/'+profileInfo.viewerWadjaID+'#!' + wProfile.Current.Category + '/' + labelID + '/1" class="lblBox" >' + labelName + '</a>'}));
                        else //list view mode
                            dvFeedTemp.appendChild(new Element('span', { 'id': 'attachedlabel_' + feedID + '_' + profileInfo.viewerID + '_' + labelID, 'rel': labelName.replace("'", "\'"), 'class': 'showApply psRel f_l', 'html':wheellabeldropdown+ '<a href="/'+profileInfo.viewerWadjaID+'#!' + wProfile.Current.Category + '/' + labelID + '/1" class="lblBox" >' + labelName + '</a>'}));
                    }
                    //dvFeedTemp.appendChild(new Element('span', {'html': wheellabeldropdown , 'class':'f_l'}));
                    if ($('toolstar_' + feedID))//list
                    {
                        $('toolstar_' + feedID).removeClass('applyStarOff');
                        $('toolstar_' + feedID).addClass('applyStar');
                    }
                    if ($('star_popup_' + feedID))//pop-up
                    {
                        $('star_popup_' + feedID).removeClass('applyStarToolsOff');
                        $('star_popup_' + feedID).addClass('applyStarTools');
                    }

                    if ($('star_v_' + feedID))//thumb
                    {
                        $('star_v_' + feedID).removeClass('applyStarToolsOff');
                        $('star_v_' + feedID).addClass('applyStarTools');
                    }


                    var tlcounter = 0;
                    if ($('label_count_hidden_' + feedID))
                        tlcounter = parseInt($('label_count_hidden_' + feedID).value);
                    tlcounter++;
                    $('label_count_hidden_' + feedID).value = tlcounter;
                }
            }
            else {
                Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [star page feed] #' + Error + '</p>', 'Ok', 'red');
            }
        });
    },
    pushPin: function (feedid, value) {
        //        var value=false;
        //        if($('push_pin_'+feedid).className == 'applyPin_on')
        //            value=false;
        //        else
        //           value=true;
        var wadjax_Labels = new WADJAX('Labels', { statusBar: false });
        wadjax_Labels.send('UpdatePushpin', feedid, value, function (res) {
            if (res.error != null) return;
            if (res.value == '1') {
                if (!value) {
                    Notify.topBarOn(T_FEEDNOTARCHIVED, '', 4)
                    if ($('push_pin_' + feedid)) {
                        $('push_pin_' + feedid).removeClass('applyPin_on');
                        $('push_pin_' + feedid).addClass('applyPin_off');
                        $('push_pin_' + feedid).set('title', T_CLICKTOARCHIVE);
                        $('push_pin_' + feedid).set('href', 'javascript:feedActions.pushPin(' + feedid + ',' + !value + ');');
                    }
                    //#thumb view
                    if ($('push_pin_v_' + feedid)) {
                        $('push_pin_v_' + feedid).removeClass('applyPin_on');
                        $('push_pin_v_' + feedid).addClass('applyPin_off');
                        $('push_pin_v_' + feedid).set('title', T_CLICKTOARCHIVE);
                        //$('push_pin_v_'+feedid).set('onclick', 'feedActions.pushPin(' + feedid +',' + !value + ');');
                        $('push_pin_v_' + feedid).onclick = new Function('feedActions.pushPin(' + feedid + ',' + !value + ');');
                    }
                    //#popup
                    if ($('push_pin_popup_' + feedid)) {
                        $('push_pin_popup_' + feedid).removeClass('applyPin_on');
                        $('push_pin_popup_' + feedid).addClass('applyPin_off');
                        $('push_pin_popup_' + feedid).set('title', T_CLICKTOARCHIVE);
                        //$('push_pin_popup_'+feedid).set('click', new Function('feedActions.pushPin(' + feedid +',' + !value + ');'));
                        $('push_pin_popup_' + feedid).onclick = new Function('feedActions.pushPin(' + feedid + ',' + !value + ');');
                    }
                }
                else {
                    Notify.topBarOn(T_ARCHIVED, '', 4)
                    if ($('push_pin_' + feedid)) {
                        $('push_pin_' + feedid).removeClass('applyPin_off');
                        $('push_pin_' + feedid).addClass('applyPin_on');
                        $('push_pin_' + feedid).set('title', T_ARCHIVEDDEL);
                        $('push_pin_' + feedid).set('href', 'javascript:feedActions.pushPin(' + feedid + ',' + !value + ');');
                    }
                    //#thumb view
                    if ($('push_pin_v_' + feedid)) {
                        $('push_pin_v_' + feedid).removeClass('applyPin_off');
                        $('push_pin_v_' + feedid).addClass('applyPin_on');
                        $('push_pin_v_' + feedid).set('title', T_ARCHIVEDDEL);
                        $('push_pin_v_' + feedid).set('onclick', new Function('feedActions.pushPin(' + feedid + ',' + !value + ');'));
                        $('push_pin_v_' + feedid).onclick = new Function('feedActions.pushPin(' + feedid + ',' + !value + ');');
                    }
                    //#popup
                    if ($('push_pin_popup_' + feedid)) {
                        $('push_pin_popup_' + feedid).removeClass('applyPin_off');
                        $('push_pin_popup_' + feedid).addClass('applyPin_on');
                        $('push_pin_popup_' + feedid).set('title', T_ARCHIVEDDEL);
                        //$('push_pin_popup_'+feedid).set('click', new Function('feedActions.pushPin(' + feedid +',' + !value + ');'));
                        $('push_pin_popup_' + feedid).onclick = new Function('feedActions.pushPin(' + feedid + ',' + !value + ');');
                    }
                }
            }

        });
    },
    plusOne: function (feedid,labelAr, fromPopup) {
        var like = false;
        var labelArray=labelAr.substring(0,labelAr.lastIndexOf(','));

        if(fromPopup) {
            if($('FeedLikeButton_popup_' + feedid) && $('FeedLikeButton_popup_' + feedid).hasClass('cursor')) {
                like = true;
            }
        }
        else {
            if($('FeedLikeButton_' + feedid) && $('FeedLikeButton_' + feedid).hasClass('plusOne')) {
                like = true;
            }
        }
        if(like) {
            wjxShhProfile.send('Like', feedid,labelArray, function (res) {
                if(res.error != null) return;                
                if(res.value == '1') {                
                //success
                    if($('FeedLikeButton_popup_' + feedid)) {
                        $('FeedLikeButton_popup_' + feedid).removeClass('cursor');
                        $('FeedLikeButton_popup_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeButton_popup_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeButton_popup_' + feedid).addClass('bold_black');
                        $('FeedLikeButton_popup_' + feedid).addClass('bold_black');
                        
                        //$('FeedLikeButton_popup_' + feedid).addClass('minusOne');
                        //$('FeedLikeButton_popup_' + feedid).set('html', '-1');
                    }
                    if($('FeedLikeButton_' + feedid)) {
                        $('FeedLikeButton_' + feedid).removeClass('cursor');
                        $('FeedLikeButton_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeCounter_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeButton_' + feedid).addClass('bold_black');
                        $('FeedLikeCounter_' + feedid).addClass('bold_black');
                        //$('FeedLikeButton_' + feedid).addClass('minusOne');
                        //$('FeedLikeButton_' + feedid).set('html', '-1');
                    }
                    if($('FeedLikeButton_popup_' + feedid)) {
                   // alert(1);
                    
                       if($('FeedLikeButton_popup_')){
                      // alert('existtttttt');
                        var count = parseInt($('FeedLikeButton_popup_' + feedid).get('html'));
                      //  alert(count);
                        if (count != NaN)
                            count++;
                        else
                            count = 0;
                        $('FeedLikeButton_popup_' + feedid).set('html', '<span id="plus_one_spPopUp_'+ feedid +'" class="psAbs" style="top: 2px; left: -20px;">'+count+'</span>');
                        }
                    else{
                               
                                 if(fromPopup) {
                                var count = parseInt($('plus_one_spPopUp_' + feedid).get('html'));
                               // alert('kkkkkkkkkkkkkkkkkkkkk '+count);
                                if (count != NaN)
                                    count++;
                                else
                                    count = 0;
                                $('FeedLikeButton_popup_' + feedid).set('html', '<span id="plus_one_spPopUp_'+ feedid +'" class="psAbs" style="top: 2px; left: -20px;">'+count+'</span>');
                               
                                }



                        }
                    }
                    if($('FeedLikeCounter_' + feedid)) {
                        var count = parseInt($('FeedLikeCounter_' + feedid).get('html'));
                        if (count != NaN)
                            count++;
                        else
                            count = 0;
                        $('FeedLikeCounter_' + feedid).set('html', count);
                    }
                }
            });
        }
        else {
         if($('FeedLikeButton_popup_' + feedid)) {
                        $('FeedLikeButton_popup_' + feedid).removeClass('cursor');
                        $('FeedLikeButton_popup_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeButton_popup_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeButton_popup_' + feedid).addClass('bold_black');
                        $('FeedLikeButton_popup_' + feedid).addClass('bold_black');
         }
         if($('FeedLikeButton_' + feedid)) {
                        $('FeedLikeButton_' + feedid).removeClass('cursor');
                        $('FeedLikeButton_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeCounter_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeButton_' + feedid).removeClass('blueLightColor');
                        $('FeedLikeCounter_' + feedid).removeClass('blueLightColor');
         }
        }
//        else {
//             wjxShhProfile.send('Unlike', feedid, function (res) {
//                if(res.error != null) return;
//                if(res.value == '1') {
//                //success
//                    if($('FeedLikeButton_popup_' + feedid)) {
//                        $('FeedLikeButton_popup_' + feedid).removeClass('minusOne');
//                        $('FeedLikeButton_popup_' + feedid).addClass('plusOne');
//                        $('FeedLikeButton_popup_' + feedid).set('html', '+1');
//                    }
//                    if($('FeedLikeButton_' + feedid)) {
//                        $('FeedLikeButton_' + feedid).removeClass('minusOne');
//                        $('FeedLikeButton_' + feedid).addClass('plusOne');
//                        $('FeedLikeButton_' + feedid).set('html', '+1');
//                    }
//                    if($('FeedLikeCounter_popup_' + feedid)) {
//                        var count = parseInt($('FeedLikeCounter_popup_' + feedid).get('html'));
//                        if (count != NaN)
//                            count--;
//                        else
//                            count = 0;
//                        if(count < 0 ) count = 0;
//                        $('FeedLikeCounter_popup_' + feedid).set('html', count);
//                    }
//                    if($('FeedLikeCounter_' + feedid)) {
//                        var count = parseInt($('FeedLikeCounter_' + feedid).get('html'));
//                        if (count != NaN)
//                            count--;
//                        else
//                            count = 0;
//                        if(count < 0 ) count = 0;
//                        $('FeedLikeCounter_' + feedid).set('html', count);
//                    }
//                }
//            });
//        }
    },
    block_unblock: function (feedid, contactID, value) {
        //      var value=0;
        //      if($('block_unblock_'+feedid).hasClass('block_contact'))
        //        {
        //             value=0;
        //        }
        //        else
        //        {
        //             value=1;
        //        }
        wjxContacts.send('BlockContact', profileInfo.ownerID, contactID, value, function (res) {
            if (res.error != null) return;
            if (res.value == "true") {
                //#Update auto suggest
                //                wjxShhProfile.send('UpdateAutoSuggest', function (res) {
                //                    if (res.error != null) return;
                //                    wProfile.Compose.AutoSuggest.Results = res.value;
                //                    jsHelper.handleAutosuggest();
                //                });
                if ($('block_unblock_' + feedid)) {
                    if ($('block_unblock_' + feedid).hasClass('block_contact')) {
                        $('block_unblock_' + feedid).addClass('unblock_contact');
                        $('block_unblock_' + feedid).removeClass('block_contact');
                        $('block_unblock_' + feedid).set('title', T_BLOCKUSER);
                        Notify.topBarOn(T_CONTACTUNBLOCKED, '', 4)
                    }
                    else {
                        $('block_unblock_' + feedid).addClass('block_contact');
                        $('block_unblock_' + feedid).removeClass('unblock_contact');
                        $('block_unblock_' + feedid).set('title', T_UNBLOCKUSER);
                        Notify.topBarOn(T_CONTACTBLOCKED, '', 4)
                    }
                    (function () {
                        //destroy element
                        $('feed_' + feedid).destroy();
                    }).delay(1 * 1000);
                }

                //#pop-up
                if ($('block_unblock_popup_' + feedid)) {
                    if ($('block_unblock_popup_' + feedid).hasClass('block_contact')) {
                        $('block_unblock_popup_' + feedid).addClass('unblock_contact');
                        $('block_unblock_popup_' + feedid).removeClass('block_contact');
                        $('block_unblock_popup_' + feedid).set('title', T_BLOCKUSER);
                        Notify.topBarOn(T_CONTACTUNBLOCKED, '', 4)
                    }
                    else {
                        $('block_unblock_popup_' + feedid).addClass('block_contact');
                        $('block_unblock_popup_' + feedid).removeClass('unblock_contact');
                        $('block_unblock_popup_' + feedid).set('title', T_UNBLOCKUSER);
                        Notify.topBarOn(T_CONTACTBLOCKED, '', 4)
                    }
                }
            }
        });
    },
    setProfilepic: function (mediaURL, mediaID) {
        try {

            Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);

            oWUser.send('UpdateProfileImage', mediaID, function (res) {
                if ($('profile_pic'))
                    $('profile_pic').set('src', 'http://photos.wadja.com/' + mediaURL.replace('_o.', '_t.'));

                if ($('profile_pic_big'))
                    $('profile_pic_big').set('src', 'http://photos.wadja.com/' + mediaURL.replace('_o.', '_t.'));


                if ($('contact_name_over'))
                    $('contact_name_over').set('src', 'http://photos.wadja.com/' + mediaURL.replace('_o.', '_t.'));

                if($('imgUsrProfilePic'))
                    $('imgUsrProfilePic').set('src', 'http://photos.wadja.com/' + mediaURL.replace('_o.', '_s.'));

                if ($('navigation1_detailsProfilepic'))
                    $('navigation1_detailsProfilepic').set('src', 'http://photos.wadja.com/' + mediaURL.replace('_o.', '_t.'));
//                $$('.changeprofpic_' + profileInfo.ownerID).each(function (element, index) {
//                    var photoPath = 'url("http://photos.wadja.com/' + mediaURL.replace('_o.', '_n.') + '")';
//                    element.setStyle('background-image', photoPath);
//                });
                $$('.sender_image_class_' + profileInfo.ownerID).each(function (element, index) {
                    var photoPath = 'http://photos.wadja.com/' + mediaURL.replace('_o.', '_n.');
                    element.set('src', photoPath);
                });
                if ($('sender_pic_' + profileInfo.ownerID)) {
                    var photoPath = 'http://photos.wadja.com/' + mediaURL.replace('_o.', '_n.');
                    $('sender_pic_' + profileInfo.ownerID).set('src', photoPath);
                }
                Notify.spinnerOff(T_DONE, 5);
            });
        }
        catch (Error) {
            Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error [function:setProfilepic] #' + Error + '</p>', 'Ok', 'red');
        }
    },
    reply: function (feed) {
        //$('txtBody').value = '';
        var text = '';
        if (profileInfo.viewerID != feed.DetailsID)
            text = '' + feed.WadjaID;
        //$('txtBody').value = '@' + feed.WadjaID;

        for (var i = 0; i < feed.Recipients.length; i++) {
            if (feed.Recipients[i].DetailsID != profileInfo.viewerID)
                text += ' ' + feed.Recipients[i].Name;
            //$('txtBody').value += ' ' + feed.Recipients[i].Name;
        }

        //        while ($('txtBody').value.indexOf(' ') == 0) {
        //            $('txtBody').value = $('txtBody').value.substring(1);
        //        }
        while (text.indexOf(' ') == 0) {
            text = text.substring(1);
        }
        text += ' ';
        //$('txtBody').value += ' ';
        //$('txtBody').focus();
        SetTextBox(text);
        if ($('feed_viewer_content')) {
            feedActions.viewOff();
            CloseOverlay();
            }
    },
    forward: function (txt) {
        if ($('txtBodyHTML5')) {
            $('txtBodyHTML5').removeClass('type_message');
            //$('footer_textarea').removeClass('dnd');
            $('txtBodyHTML5').set('html', '\n----- ' + T_FORWAREDTEXT + ' -----\n' + txt);
        }
        if ($('feed_viewer_content')) {
            feedActions.viewOff();
            CloseOverlay();
            }
    },
    print: function () {
        //
    },
    loadSUGGESTInterests: function (ownerID) {
        if (mp_metrix) mpmetrics.track('Refresh suggested labels');
        var ret = '';        
        $('loadSuggested').addClass('dndD');
        $('loadingSuggested').removeClass('dndD');        
        oWUser.send('InterestedIn', ownerID, function (res) {     
    
            if ($('left_whattofollow_container')) {
                $('left_whattofollow_container').set('html', res.value);
            }  
             $('loadingSuggested').addClass('dndD');
             $('loadSuggested').removeClass('dndD');          
        });
    }
}


/// #Privacy-functions
function ChangePrivacy(NewPrivacyID) {

    try {
        var oWadjaX = new WADJAX('labels', { statusBar: false });
        Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
        oWadjaX.send('Update', wProfile.Current.LabelID, '', NewPrivacyID, function (res) {
            if (!res.error) {
                Notify.spinnerOff(T_DONE, 1);
                var errorTemp = res.value.split('s@l@i@t');
                if (errorTemp.length > 1) {
                    Notify.alert('', errorTemp[1], 'red', T_OK);
                }

                LabelPrivacyIcon(NewPrivacyID);
                ManageFollowLink(NewPrivacyID);
            }
            else {
                Notify.spinnerOff(T_DONE, 1);
                Notify.alert('', res.error, 'red', T_OK);
            }
        });
    }
    catch (Error) { Notify.alert('No network', ERROR_FROM_NETWORK, 'red', 'ok'); }

}

function LabelPrivacyIcon(privacy) {
    if (privacy == '-1') {
    //if ($('label_edit'))
        //$('label_edit').addClass('dnd');
    if ($('label_privacy')) {
        $('label_privacy').addClass('dndD');
            
            //$('share_label').removeClass('dndD');
        }

        //if ($('link_attach_twitter'))
        //    $('link_attach_twitter').addClass('dnd');
        if ($('CCDv'))
            $('CCDv').addClass('dnd');
        return ''; //#stop here
    }

    //#disabled: twitter:, message:2, trash:3
    if (wProfile.Current.LabelID != '2' && wProfile.Current.LabelID != '3' && profileInfo.ownerID == profileInfo.viewerID) {
//       if(wProfile.Current.Category == 'My') {     
//            if ($('label_privacy')) {
//                $('label_privacy').removeClass('dndD');                 
//                privacy += ''; //Converts privacy from int to string
//                $('privacyicon').set('html', '&nbsp;&#183;&nbsp;<span class=\"lnk\">'+privacy.replace("1", "No one").replace("2", "Only me").replace("3", "Only followers").replace("4", "Everyone") + ' (privacy)</span>&nbsp;&#183;&nbsp;');
//                $('privacyicon').set('title', privacy.replace("1", "No one").replace("2", "Only me").replace("3", "Only followers").replace("4", "Everyone"));           
//            }
//        }
        //#toggle twitter button
        if (privacy != 4 && wProfile.Current.Category != 'My') {
        if ($('CCDv'))
            $('CCDv').addClass('dnd');
        }
        else if (wProfile.Current.Category != 'My') {
            if ($('updateTwitterStatus'))
                $('updateTwitterStatus').addClass('dnd');
        }
        else if (privacy != 4) {
            if ($('updateTwitterStatus'))
                $('updateTwitterStatus').addClass('dnd');
        }
        else {
              if ($('CCDv'))
                  $('CCDv').removeClass('dnd');
        }
    }
    else {
        if ($('label_privacy')) {
            $('label_privacy').addClass('dndD');
        //if ($('label_edit'))
            //$('label_edit').addClass('dnd');
            //$('share_label').removeClass('dndD');
        }
    }
}

/// #Follow-functions
function InitLabelInfo(oLabelID) {
    ///GET LABEL INFORMATION
    try {
        if (wProfile.Current.LabelID > 0) {
            setLABEL.info(profileInfo.ownerID,wProfile.Current.LabelID);
            wjxLabel.send('GetInfo', oLabelID, profileInfo.ownerID, function (res) {
                if (!res.error) {
                    LabelInfo = JSON.decode(res.value);
                    if(LabelInfo == null)
                        return;
                    //#current label name
                    selectedLabelName = LabelInfo.name;

                       //if the user has clicked compose in profcard or left wheel, redirect to tha page eith open quickcompose //&cmp=1
                    if (window.location.hash.indexOf('&cmp=1') > 0)
                    {
                        $('text_body_quick5').focus();
                        $('page_post_lnk').set('html', selectedLabelName);
                    }  
                    //selectedLabelTO =  LabelInfo.OwnerWadjaID;
                    //#load privacy dropdown
                    LabelPrivacyIcon(LabelInfo.privacy);
                    //#load followers
                    if (profileInfo.ownerWadjaID != 'wadja')
                        ManageFollowLink();

                    //...Like buttons
                    jsHelper.likeButtons();
                }
            });
        }
        else {
            if (profileInfo.ownerWadjaID != 'wadja')
                ManageFollowLink();
            //#Hide privacy
            LabelPrivacyIcon('-1');
            //...Like buttons
            jsHelper.likeButtons();
        }

    }
    catch (Error) {
        Notify.alert('Javascript error', '<div class="pad10">Javascript error while loading method InitLabelInfo#<b>' + Error + '</b>.</div>', 'OK', 'red');
    }
}

function GetLabelFollowers_Online_pulse(){
    if (profileInfo.isLoggedIn && wProfile.Current.LabelID>0)
    {
        GetLabelFollowers_Online(wProfile.Current.LabelID,gl_label_name, gl_label_owner_id,gl_label_owner_wadjaid);
    }
}

//Function to get all followers

function GetAllFollowers(labelID, OwnerID, viewerID, days, resultsPerPage, currentPage) {
            var retDATA = '';
            var followAjax = new WADJAX('labels', { statusBar: false });//#followers ajax handler

            followAjax.send('GetManageFollowersImages', labelID, OwnerID, viewerID, 'Small', days, resultsPerPage, currentPage, function (res) {
                if (res.error != null) {
                    retDATA = 'oops! something went wrong.';
                    if (console)
                        console.log(retDATA);
                }
                else {
                    var result = res.value.split('s@p@l@i@t');
                    var html = '';
                    var rows = '';

                    if (result.length == 2) {
                        html = result[1];
                        rows = parseInt(result[0]);
                    }
                    else {
                        html = res.value;
                        rows = 0;
                    }
                    $('followerslinkLiIcons').set('html',html);
                }
                
            });

        }

//END

function GetLabelFollowers_Online (LabelID, LabelName, LabelOwnerID, LabelOwnerWadjaID){ 
   
 ///Periodical...every 60 sec
  var wtfX = new WADJAX('labels', { statusBar: false });
  ///loading...
  ///debug:alert('ohh! '+LabelID+','+LabelOwnerID+','+profileInfo.viewerID+','+LabelName+','+LabelOwnerWadjaID);
  wtfX.send('GetLabelFollowers_Online', LabelID,LabelOwnerID, profileInfo.viewerID, LabelName,LabelOwnerWadjaID, function (res) {
    if (res.error)
    {
            $('div_qp_followers_online').empty();
            $('div_qp_followers_online').appendChild(new Element('div', { 'class': 'marT10 marL5','style':'color:red', 'html':'oops! '+res.error}));
    }
    else
    {
        
        var tempArray = res.value.split('s@l@i@t');
        $('followers_icon_pop').empty();
        if ($('div_qp_followers_online'))
        {
            if(wProfile.Current.LabelID != 11 && wProfile.Current.LabelID !=98474 && wProfile.Current.LabelID > 0 && wProfile.Current.LabelID !=76211) {
            $('div_qp_followers_online').empty();            
            if (tempArray[1]!='0')
            {
                $('div_qp_followers_online').appendChild(new Element('div', { 'class': 'marL5 f_l', 'html': tempArray[0] , 'style':''}));                
                //0
                //not following
                //no one online
                //Display maximum up to 5 
             if(gl_label_followers != 0){
                $('div_qp_followers_online').appendChild(new Element('div', { 'class': 'f_l','style':'', 'html': '<span><span id=\"followerDef\" title=\"'+PROF_FOLLOWERS_NUMBER+'\"  class=\"followers_online\" >'+gl_label_followers+'</span><span class="dib marB2">'+DEF_PEOPLEFOLLOWTHIS+'</span></span>'})); 
                  }else{
                  if($('plusFollowerIcons'))
                     $('plusFollowerIcons').addClass('dndD');
                     // $('div_qp_followers_online').appendChild(new Element('div', { 'class': 'f_l', 'style':'', 'html': '<span><span id=\"followerDef\" class=\"followers_online\" ></span><span class=\"dib marB2\">'+F_PAGEWITHNOFOLLOWERS+'</span></span></span>'}));
                  }
                   $('followers_icon_pop').appendChild(new Element('div',{'class':'followers_icon', 'html':'&nbsp;'}));
                $('followers_icon_pop').onclick = new Function('followersjs.loadFollowersVIEW('+LabelID+','+ LabelOwnerID+','+ profileInfo.viewerID+',\''+ LabelName.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                $('followers_icon_pop').onmouseout = new Function('Tip.doTipOff(\'followers_icon_pop\');');
                $('followers_icon_pop').onmouseover = new Function('Tip.doTipLbl(\'followers_icon_pop\',\''+PROF_FOLLOWERS_NUMBER+'\',\'-5\',\'-2\');');
            
            //tha fugei
            //alert(2);
//            if($('follower_icon'))
//             $('follower_icon').onclick = new Function('followersjs.loadFollowersVIEW('+LabelID+','+ LabelOwnerID+','+ profileInfo.viewerID+',\''+ LabelName.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                
                if($('followerslinkLi'))
                {
                //alert('exists3');
                            
                    $('followerslinkLi').set('html', '<span id="linkforthefollowers" class="lnk">'+gl_label_followers+ ' people follow this page</span>');
                    $('followersNumber').set('html',gl_label_followers);
                    $('linkforthefollowers').set('onclick', 'followersjs.loadFollowersVIEW(\''+LabelID+'\','+ LabelOwnerID+','+ profileInfo.viewerID+',\''+ LabelName.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                    $('followersNumber').set('onclick', 'followersjs.loadFollowersVIEW(\''+LabelID+'\','+ LabelOwnerID+','+ profileInfo.viewerID+',\''+ LabelName.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                    GetAllFollowers(LabelID,LabelOwnerID , profileInfo.viewerID, 2, 4, 1);      

                        
                }  
            }
            else {
                if(wProfile.Current.LabelID == 0) {
                    if ($('video_btn'))
                        $('video_btn').addClass('dnd');
                }
                else {
                   
               }
               if(gl_label_followers != 0){
                  $('div_qp_followers_online').appendChild(new Element('div', { 'class': 'f_l', 'style':'', 'html': '<span><span id=\"followerDef\" class=\"followers_online\" >'+gl_label_followers+'</span><span class=\"dib marB2\">'+DEF_PEOPLEFOLLOWTHIS+'</span></span></span>'}));
                  }else{
                  if($('plusFollowerIcons'))
                     $('plusFollowerIcons').addClass('dndD');
                     // $('div_qp_followers_online').appendChild(new Element('div', { 'class': 'f_l', 'style':'', 'html': '<span><span id=\"followerDef\" class=\"followers_online\" ></span><span class=\"dib marB2\">'+F_PAGEWITHNOFOLLOWERS+'</span></span></span>'}));
                  }
                  
                  $('followers_icon_pop').appendChild(new Element('div',{'class':'followers_icon', 'html':'&nbsp;'}));
                  $('followers_icon_pop').onclick = new Function('followersjs.loadFollowersVIEW('+LabelID+','+ LabelOwnerID+','+ profileInfo.viewerID+',\''+ LabelName.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                  $('followers_icon_pop').onmouseout = new Function('Tip.doTipOff(\'followers_icon_pop\');');
                  $('followers_icon_pop').onmouseover = new Function('Tip.doTipLbl(\'followers_icon_pop\',\''+PROF_FOLLOWERS_NUMBER+'\',\'-5\',\'-2\');');
               
//                                     if($('follower_icon'))
//                                    $('follower_icon').onclick = new Function('followersjs.loadFollowersVIEW(\''+LabelID+'\','+ LabelOwnerID+','+ profileInfo.viewerID+',\''+ LabelName.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
//                

                    if($('followerslinkLi'))
                    {
                   
                        //alert('4');
                        $('followerslinkLi').set('html', '<span id="linkforthefollowers" class="lnk">'+gl_label_followers+ ''+DropDownpeople+'</span><span class="grayColor">'+DropDownFollothispage+'</span>');
                        $('followersNumber').set('html',gl_label_followers);
                        $('linkforthefollowers').set('onclick', 'followersjs.loadFollowersVIEW(\''+LabelID+'\','+ LabelOwnerID+','+ profileInfo.viewerID+',\''+ LabelName.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                        $('followersNumber').set('onclick', 'followersjs.loadFollowersVIEW(\''+LabelID+'\','+ LabelOwnerID+','+ profileInfo.viewerID+',\''+ LabelName.replace("\'", "\\'")+'\',\''+gl_label_followers+'\',\'AR\');');
                        GetAllFollowers(LabelID,LabelOwnerID , profileInfo.viewerID, 2, 4, 1);      
                            if($('norecordsForDropDown')){
                            //alert('exists');
                            }
                        
                    }  
            }				
        }
      }
    }
  });
}
function followingToggle() {
    MyElement.toggleReveal('followers_list');
}
function ManageFollowLink(labelPrivacy) {
 try {
   
                oWUser.send('GetPhotos', profileInfo.ownerID, function (res) {
                $('dvPhotos').empty();
                    if (res.error) { }//#
                  
                     
                     if(res.value == 'null') { 
                     $('rightFourPhotos').addClass('dnd');
                     $('leftProfilePic').addClass('marR5');
                    }else{
                        var r = JSON.decode(res.value);        
                  
                    
                     
                          
                    if(r != null && r != '') {
                  
                    if (r.length > 0) {
                    
                        dvPHOTOSROW1 = new Element('div', { 'class': 'tar' });
                        var w = '';
                        var h = '';
                      
                        for (i = 0; i < r.length; i++) {
                            if (i == 0)
                            { w = 55; h = 55; }
                            else {
                                w = 55; h = 55;
                            }
                          
                   
                              dvPHOTOSROW1.appendChild(new Element('div', { 'html': '<div id=\"load_photo_1\" class=\"f_l cursor\"><img onclick="\PhotoCardviewer(\'' + r[i].Original + '\', \''+r.length+'\', \''+i+'\');"\ style=\"padding:1px;\" src=\"' + r[i].Original + '\" width=\"' + w + '\" height=\"' + h + '\"/></div>' }));
                                
                        
                            if (i == 3)
                                break;
                        }
                        $('dvPhotos').appendChild(dvPHOTOSROW1);
                        $('dvPhotos').appendChild(new Element('div', { 'html': '', 'class': 'clearboth' }));                      
                    }
                    else {
                        //alert('upload more');
                    }
                   }
                   }
                });
            //}
     
        setLABEL.info(profileInfo.ownerID,wProfile.Current.LabelID);
        var locHref = location.href;
        if(locHref.indexOf('!search') > 0) {}
        else {
        if ($('compose_box')) 
            $('compose_box').removeClass('dnd');
       // if ($('arrowFeed')) 
         //   $('arrowFeed').removeClass('dnd');    
        if(wProfile.Current.LabelID == rootlabel) {        
            if($('label_text'))
            $('label_text').addClass('dnd');
            if ($('bio_feed')) 
                $('bio_feed').removeClass('dnd');
                if($('bio_feed').hasClass('dnd')) {
                    $('showBioArrow').addClass('arrowOn_black');
                    $('showBioArrow').removeClass('arrowOff_black');
                }
                else {
                    $('showBioArrow').addClass('arrowOff_black');
                    $('showBioArrow').removeClass('arrowOn_black');
                }   
        }
        else {        
            if($('label_text'))
                $('label_text').removeClass('dnd');
            if ($('bio_feed')) 
                $('bio_feed').addClass('dnd');
            if($('bio_feed').hasClass('dnd')) {
                $('showBioArrow').addClass('arrowOn_black');
                $('showBioArrow').removeClass('arrowOff_black');
            }
            else {
                $('showBioArrow').addClass('arrowOff_black');
                $('showBioArrow').removeClass('arrowOn_black');
            }   
        }
        }
  
        if (profileInfo.isLoggedIn)
          {
                       // if ($('video_btn')) {
                            if(!gl_label_issystem) {
                                
                                if( $('video_btn')){
                                $('video_btn').removeClass('dnd');
                                $('video_btn').set('html','<span  id="btn_joinroom"  class=\"f12 video_chat\" onclick="followersjs.loadOpentok('+gl_label_id+','+gl_label_owner_id+',\''+ gl_label_name.replace("\'", "\\'") +'\');"><span>Video chat</span></span>');
                                var btexitroom = new Element('span', { 'id':'btn_exitroom','html': '<span>Video chat</span>', 'class': 'f12 video_rec dndD' });
                                btexitroom.onclick = new Function('disconnect();');
                                $('video_btn').appendChild(btexitroom);
                                }
                             }
                             else if(gl_label_issystem && gl_label_id != rootlabel)
                             {
                           
                                //maria hiding compose followers in homepage for system labels
                                if($('plusFollowerIcons')){
                                 $('plusFollowerIcons').addClass('dndD');
                                }
                                if($('follower_icon'))
                                $('follower_icon').addClass('dnd');
                                //hide compose
                                $('outText').addClass('dndD');
                                //hide invite fiends
                                if($('inviteLbl')){
                                 $('inviteLbl').destroy();   
                                }
                                //hide the space after system label name
                               if($('compose_box')){
                               $('compose_box').addClass('dndD');
                               }
                              
                              // if($('arrowFeed')){
                              // $('arrowFeed').addClass('dndD');
                              // }
                             }
                       // }  
                    }
        if (wProfile.Current.LabelID > 0 && (wProfile.Current.LabelID != 11 && wProfile.Current.LabelID != 98474)) { 
      
            if(!gl_label_issystem) {
        //  alert('2 onlyOnceEmbed '+onlyOnceEmbed);
        if(onlyOnceEmbed=='false'){ //maria stopping re-embed

        //hide old preview bio for pages only
            if($('authorHeader'))
                $('authorHeader').addClass('dnd');
               
                 if($('name_dv_2'))
                $('name_dv_2').addClass('dnd');
               
                if($('showBioArrow'))
                $('showBioArrow').addClass('dnd');  
                
             if ($('showRestBio'))
                 $('showRestBio').addClass('dnd'); 
                 if(wantToemptyTheDescr=='true'){
              //  $('label_about_info').empty();  //swstooooooooooo maria hide to ebale se sxolia //se send de thelw na xanetai
               $('label_about_body').empty(); 
               }
             
              //  $('label_about_info').removeClass('dnd');
               
               
                //maria for  label conten  
                $('label_content_info').empty(); 
                $('label_content_info').removeClass('dnd');  
                try{
              
                 var aboutArray = JSON.decode(LabelInfo.About);
           
                 var contentPage = aboutArray.content;
              
                   if(aboutArray.type=='Photo'){//case of photo append the photo
                    
                     var label_content = new Element('div', { 'id':'label_content_body',  'html': '<img src=\"'+aboutArray.content+'" onclick="\PhotoCardPageView(\'' + aboutArray.content + '\');"\ class=\"imgFromJason\"/>', 'class':'cursor closed photoBody'})
                  
                    
                    }else if(aboutArray.type=='Text'){
                     var label_content = new Element('span', { 'id':'label_content_body',  'html': aboutArray.content, 'class':'cursor closed'})
                    }else if(aboutArray.type=='Video'){
                     
                     fromjason = 'true';
                     if (aboutArray.content.indexOf('youtube.com') >= 0) {
                        var video_id = aboutArray.content.split('v=')[1];
                        var ampersandPosition = video_id.indexOf('&');
                        if (ampersandPosition != -1) {
                            video_id = video_id.substring(0, ampersandPosition);
                            }
                         var label_content = new Element('span', { 'id':'label_content_body',  'html': '<object id="yvideo' +LabelInfo.id+ '" width="625" height="350"><param name="movie" value="' + aboutArray.content + '&hl=en_US&fs=1"></param><param name="allowFullScreen" value="true"></param> <param name="wmode" value="opaque" /><param name="allowscriptaccess" value="always"></param><embed src="' + aboutArray.content + '&hl=en_US&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="605" height="350"  wmode="opaque"></embed></object>', 'class':'thumb_view_photo marL0 padT7'})
                        if(onlyOnceEmbed=='false'){
                         ytube.embedvideo(video_id, LabelInfo.id);
                         }
                        $('label_content_info').addClass('padT7');
                        $('label_content_info').removeClass('padL10');
                        $('label_content_info').removeClass('padR10');

                        }//case youtube video

                           /*maria for vimeo*/
                    if (aboutArray.content.indexOf('vimeo.com') >= 0) {
                         
                        var video_idSplit = aboutArray.content.split('/');
                        //maria get the video vimeo id
                        video_id = video_idSplit[3];
                     
                        var label_content = new Element('span', { 'id':'label_content_body',  'html': '<object id="vimvideo' +LabelInfo.id+ '" width="605" height="350"><param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id=' + video_id + '&autoplay=0"></param><param name="allowFullScreen" value="true"></param> <param name="wmode" value="opaque" /><param name="allowscriptaccess" value="always"></param><embed src="http://www.vimeo.com/moogaloop.swf?clip_id=' + video_id + '&autoplay=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="605" height="350"  wmode="opaque"></embed></object>', 'class':'thumb_view_photo marL0 padT7'})
                         vimeo.embedvideo(video_id, LabelInfo.id);
                          $('label_content_info').addClass('padT7');
                    }//case vimeo video

             }//case video
                    if(aboutArray.type=="Text"){
                
                          $('label_content_info').addClass('dndD');
                         if(aboutArray.description==''){
                      //   alert(1);
                        //  $('label_about_info').addClass('dnd'); //swstoooooo
                          if($('label_about_body'))
                           $('label_about_body').addClass('dndD');
                         }else{
                        //  alert(2);
                           // if($('label_about_info').hasClass('dnd')) //swstooooo
                           //     $('label_about_info').removeClass('dnd');
                           if($('label_about_body')){
                             if($('label_about_body').hasClass('dnd')) 
                               $('label_about_body').removeClass('dnd');
                               }
                         }
                      
                       }else{
                      // alert(3);
                       if($('label_content_info').hasClass('dndD')){
                      //  alert(4);
                            $('label_content_info').removeClass('dndD');
                            $('label_content_info').appendChild(label_content);

                            if(aboutArray.description==''){
                       //      alert(5);
                            $('label_about_info').addClass('dnd'); //swstoooo
                          // $('label_about_body').addClass('dnd'); 
                            }else{
                         //    alert(6);
                           if($('label_about_info').hasClass('dnd')) //swstoooooooo
                                $('label_about_info').removeClass('dnd');
                       
                            // if($('label_about_body').hasClass('dnd'))
                            //    $('label_about_body').removeClass('dnd');
                            }
                         }else{
                        // alert(7);
                             $('label_content_info').appendChild(label_content);
                       
                            if(aboutArray.description==''){
                        //     alert(8);
                             $('label_about_info').addClass('dnd'); //swstoooo
                            //$('label_about_body').addClass('dnd');
                            }else{
                       //     alert(9);
                            if($('label_about_info').hasClass('dnd'))  //swstooooooo
                             $('label_about_info').removeClass('dnd');
                           //  if($('label_about_body').hasClass('dnd'))  
                            // $('label_about_body').removeClass('dnd');
                            }

                         }
                        }

                //description page
                    if(aboutArray.type!="Photo"){
                    // alert('10');
            
                         // $('label_about_info').empty(); //swstoooooo

                         if($('label_about_body')){
                            $('label_about_body').destroy();
                            }
                           if($('byPageOwnerSpan')){
                      
                            $('byPageOwnerSpan').destroy();
                            }

                          if(aboutArray.description!=''){
                     //    alert('11');
                            // $('label_about_info').empty();
                               if($('label_about_body')){
                      
                            $('label_about_body').empty();
                            }
                           if($('byPageOwnerSpan')){
                            $('byPageOwnerSpan').empty();
                            }
                             if($('label_about_info')){   
                  
                                    if($('label_about_info').hasClass('dnd'))
                                        $('label_about_info').removeClass('dnd');
                                }
                               
                                var label_about = new Element('span', { 'id':'label_about_body',  'html': aboutArray.description , 'class':'cursor closed'});
                                if(ownerName!=''){
                                    var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' &mdash; by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor">"'+ownerName+'"</span>'});
                                  }else{
                                  var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':'  &mdash; by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor"></span>'});
                                  }
                              if($('label_about_body')){
             
                                    if($('label_about_body').hasClass('dndD'))
                                        $('label_about_body').removeClass('dndD');
                                }
                            }else{ //empty descr
                                 if($('label_about_info')){
                                   
                                    if($('label_about_info').hasClass('dnd'))
                                        $('label_about_info').removeClass('dnd');
                                }
                         
                             if(ownerName!=''){
                                    var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor">"'+ownerName+'"</span>'});
                             }else{
                                  var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor"></span>'});
                             }
                             if($('label_about_body')){
                           
                                 if(!$('label_about_body').hasClass('dndD'))
                                    $('label_about_body').addClass('dndD');
                                }
                            }
                        if(aboutArray.description!=''){
                        label_about.onclick = new Function('toggle_label_about_body();');
                        }
                         if(aboutArray.description!=''){
                         
                        $('label_about_info').appendChild(label_about);
                        }
                        $('label_about_info').appendChild(byPageOwnerSpan);
                        
                       // }

                    }else{
                    //  alert('13');
               
                     $('label_about_info').empty(); //swstoooooo
                 
               //  $('label_about_body').empty();
               //    $('byPageOwnerSpan').empty();
                    if(aboutArray.description!=''){
                     var label_about = new Element('span', { 'id':'label_about_body',  'html': aboutArray.description, 'class':'cursor closed marR5'});
                       if(ownerName!=''){
                          var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' &mdash; by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor">"'+ownerName+'"</span>'});
                        }else{
                          var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' &mdash; by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor"></span>'});
                       }
                       }else{
                        var label_about = new Element('span', { 'id':'label_about_body',  'html': aboutArray.description, 'class':'cursor closed marR5'});
                        if(ownerName!=''){
                            var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor">"'+ownerName+'"</span>'});
                            }else{
                            var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor"></span>'});
                        }
                       
                       } 
                        label_about.onclick = new Function('toggle_label_about_body();');
                        $('label_content_info').appendChild(label_about);
                         $('label_content_info').appendChild(byPageOwnerSpan);
                     //   }
                    }

               }catch (eR) {
           
             
                    //case old pages without content
                    if(LabelInfo.About.toString() == '') {
                  // alert('16');
                    if($('label_content_info'))
                        $('label_content_info').addClass('dndD');

                        $('label_about_info').empty();    //swstooooo
                       
                        if(ownerName!=''){
                           var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor">"'+ownerName+'"</span>'});
                         }else{
                            var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor"></span>'});
                         }
                          $('label_about_info').appendChild(byPageOwnerSpan);
                      //  }
                        if($('label_content_info'))
                        $('label_content_info').addClass('dndD');

                       
                            if($('label_about_info').hasClass('dnd'))
                                $('label_about_info').removeClass('dnd');
                    }
                    else
                    {
                  //  alert('17');
                     
                    $('label_about_info').empty(); //swstoooooo
                   
                        if(LabelInfo.About!=''){
                                var label_about = new Element('span', { 'id':'label_about_body',  'html': LabelInfo.About +' </span', 'class':'cursor closed'});
                                 if(ownerName!=''){
                                    var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' &mdash; by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor">"'+ownerName+'"</span>'});
                                  }else{
                                  var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' &mdash; by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor"></span>'});
                                  }
                            }else{
                             var label_about = new Element('span', { 'id':'label_about_body',  'html': LabelInfo.About, 'class':'cursor closed'});
                              if(ownerName!=''){
                                    var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor">"'+ownerName+'"</span>'});
                                  }else{
                                  var byPageOwnerSpan = new Element('span', {'id':'byPageOwnerSpan', 'html':' by <span id="byPageWadjaOwner" class="lnk" onclick="showHideBio();">'+gl_label_owner_wadjaid+'</span> <span id="byPageFullname" class="grayColor"></span>'});
                                  }
                            }
                        if(LabelInfo.About!=''){
                        label_about.onclick = new Function('toggle_label_about_body();');
                        $('label_about_info').appendChild(label_about);
                        }
                          $('label_about_info').appendChild(byPageOwnerSpan);
                      //  }
                        if($('label_content_info'))
                        $('label_content_info').addClass('dndD');

                       
                            if($('label_about_info').hasClass('dnd'))
                                $('label_about_info').removeClass('dnd');
                        
                    }
                }
                  
}//maria not re-embed


                if($('borderLight'))
                    $('borderLight').set('style','border-top:2px solid '+LabelInfo.fontColor);

                if ($('stop_follow_label')) 
                    $('stop_follow_label').removeClass('dndD'); 
                // $('stop_follow_label').onmouseout = new Function('alert(\'h\');');
                //  $('stop_follow_label').onmouseover = new Function('ChangeTextToUnfollow(); ');
                // Check privacy before inviting friends - Ariana
                if(!profileInfo.profileBelongsToViewer || wProfile.Current.Category == 'Follow') {
                    if(gl_label_viewerIsFollowing && gl_label_privacy != 2) {
                        $('inviteLbl').removeClass('dndD');
                        $('inviteLbl').set('onclick', 'javascript:promoteInterestLinkjs.getpromoteInterestLink('+profileInfo.ownerID+','+gl_label_id+',\''+gl_label_name.replace("\'", "\\'")+'\',\'1\'); '); 
                    
                    }
                    else if(!gl_label_viewerIsFollowing && (gl_label_privacy == 3 || gl_label_privacy == 2)) {
                        $('inviteLbl').addClass('dndD');                         
                        }
                 } 
                 else {
                    if(gl_label_privacy != 2) { 
                        $('inviteLbl').removeClass('dndD');              
                        $('inviteLbl').set('onclick', 'javascript:promoteInterestLinkjs.getpromoteInterestLink('+profileInfo.ownerID+','+gl_label_id+',\''+gl_label_name.replace("\'", "\\'")+'\',\'1\'); ');   
                    }
                    else {                       
                      $('inviteLbl').addClass('dndD');
                    }               
                 }


                /*maria if is not login invitefriends only with span*/
                 if(!profileInfo.isLoggedIn) {
                 $('inviteLbl').removeClass('dndD');
                 $('inviteLbl').set('onclick', 'javascript:promoteInterestLinkjs.getpromoteInterestLink('+profileInfo.ownerID+','+gl_label_id+',\''+gl_label_name.replace("\'", "\\'")+'\',\'1\');');
                }
          
           
            }
            else {     
               $('label_about_info').empty(); //swstooo    // maria hide to ebala se sxolia
             //   $('label_about_body').empty(); 
                if ($('stop_follow_label')) 
                    $('stop_follow_label').addClass('dndD');
                if ($('inviteLbl')) {
                    $('inviteLbl').removeClass('dndD');
                    $('inviteLbl').set('onclick', 'javascript:promoteInterestLinkjs.getpromoteInterestLink('+profileInfo.ownerID+',\'\',\'\',\'1\');');              
                }
            }            
        }  
        else {  
        if ($('aFollow')) {
                                var all_my_home = 'all_labels_home';
                                var all_my_fe = 'all_labels_fe';
                                var bold_link_post = 'nonbolt';
                                var bold_link_photos = 'nonbolt';
                                if(wProfile.Current.LabelID != 11 && wProfile.Current.LabelID != 98474) {
                                    if (wProfile.Current.Category == 'My') {
                                        all_my_home = 'all_labels_home';
                                        all_my_fe = 'all_labels_fe';
                                        bold_link_photos = 'nonbolt';
                                        bold_link_post = 'nonbolt';
                                    }
                                    else if (wProfile.Current.Category == 'Follow') {
                                        all_my_home = 'all_labels_fe';
                                        all_my_fe = 'all_labels_home';
                                        bold_link_photos = 'nonbolt';
                                        bold_link_post = 'nonbolt';
                                    }
                                }
                                else if(wProfile.Current.LabelID == 11){
                                all_my_home = 'all_labels_fe';
                                all_my_fe = 'all_labels_fe';
                                bold_link_photos = 'bolt';
                                bold_link_post = 'nonbolt';
                                }
                                else if (wProfile.Current.LabelID == 98474){
                                all_my_home = 'all_labels_fe';
                                all_my_fe = 'all_labels_fe';
                                bold_link_photos = 'nonbolt';
                                bold_link_post = 'bolt';
                                }
                                $('aFollow').removeClass('dnd');
                                
                                ///#If messages interest then display messages
                                if (wProfile.Current.LabelID=='2')
                                {
                                    $('aFollow').set('html','<span id=\"messages_sp\" class=\"marL5\">Messages</span>');
                                    $('aFollow').removeClass('top-lnk-noarrow');
                                  
                                }
                                else
                                    $('aFollow').set('html', '<span class=\"' + all_my_home + ' marR15 dib\" onclick=\'top.location.href="' + profileInfo.ownerWadjaID + '#!My/0/1";\'>' + T_ALL_MY + '</span><span onclick=\'top.location.href="' + profileInfo.ownerWadjaID + '#!Follow/0/1";\' class=\"'+all_my_fe+' marR15 dib\">' + T_ALL_FOLLOW + '</span><span class=\"lnk f13 marR15 dib '+bold_link_post+'\" onclick=\'top.location.href="/' + profileInfo.ownerWadjaID + '#!My/98474/1";\'>'+D_UPPOST+'</span><span class=\"lnk f13 marR15 dib '+bold_link_photos+'\" onclick=\'top.location.href="/' + profileInfo.ownerWadjaID + '#!My/11/1";\'>'+D_UPHOTOS +'</span>');
                                
                                $('aFollow').onmouseout ="";
                                $('aFollow').onmouseover = "";
                               }
          $('label_about_info').empty();  //swstoooooo   //maria hide to ebala se sxolia
       //  $('label_about_body').empty();
            if ($('inviteLbl')) {
                $('inviteLbl').removeClass('dndD');
                $('inviteLbl').set('onclick', 'javascript:promoteInterestLinkjs.getpromoteInterestLink('+profileInfo.ownerID+',\'\',\'\',\'1\');');
            }
        }  
                     
        if (profileInfo.profileBelongsToViewer) {
    
            if (wProfile.Current.LabelID > 0) {
                //# EVERY .......................................................................................
                if (wProfile.Current.Category == 'Every') {
                    var oWadjaX = new WADJAX('labels', { statusBar: false });
                    if (LabelInfo.Owner_ID > 0)
                        LabelOwner = LabelInfo.Owner_ID.toString();
                    else
                        LabelOwner = profileInfo.ownerID;
                    if ($('aFollow'))
                        $('aFollow').addClass('dnd');
                    if ($('stop_follow_label'))
                    {
                        $('stop_follow_label').addClass('dnd');           
                        $('stop_follow_label').removeClass('first');       
                        if ($('share_email'))
                            $('share_email').addClass('first');    
                    }
                }
                else {
               
                    //# MY .......................................................................................
                    if (wProfile.Current.Category != 'Follow' && wProfile.Current.Category != 'Every') {
                  
                        //INVITE TO FOLLOW
                        /// Change "Post" labelID to 98474 for local or 98474 for live
                        if (wProfile.Current.LabelID != 2 && wProfile.Current.LabelID != 3 && wProfile.Current.LabelID != 11 && wProfile.Current.LabelID != 98474 && wProfile.Current.LabelID != 76211) {
                        
                            if (labelPrivacy !== undefined)
                                LabelInfo.privacy = labelPrivacy;
                            if (LabelInfo.privacy == 2)//#LABEL SET TO PRIVATE
                            {
                         
                                $('aFollow').removeClass('dnd');                                
                                $('aFollow').set('html', '<span onclick=\"editAnInterestjs.getEditAnInterest('+profileInfo.viewerID+', '+wProfile.Current.LabelID.toString()+',0);\" class=\"f18em editLabel\" id=\"privateTip\" title=\"#' + LabelInfo.name + ' ' + T_SETTOPRIVATE + '\">' + LabelInfo.name + '</span>');
                                $('stop_follow_label').addClass('dnd');                   
                                $('stop_follow_label').removeClass('first');        
                                if ($('share_email'))
                                    $('share_email').addClass('first');        
                            }
                            else {
                                $('aFollow').removeClass('dnd');
                               
                                $('aFollow').set('html', '<span class=\"f18em editLabel\" onclick=\"editAnInterestjs.getEditAnInterest('+profileInfo.viewerID+', '+wProfile.Current.LabelID.toString()+',0);\" id=\"inviteTip\">' + LabelInfo.name + '</span>');
                                $('stop_follow_label').addClass('dnd');                   
                                $('stop_follow_label').removeClass('first');        
                                if ($('share_email'))
                                    $('share_email').addClass('first');        
                            }
                        }
                        else {
                                if ($('stop_follow_label'))
                                {
                                    $('stop_follow_label').addClass('dnd');                               
                                    $('stop_follow_label').removeClass('first');    
                                    if ($('share_email'))
                                        $('share_email').addClass('first');
                                }
                        }
                    }
                    else {

                    if(!gl_label_viewerIsFollowing) {
                            if ($('aFollow')) {
                                $('aFollow').removeClass('dnd');
                                    if (LabelInfo.privacy == 4) {
                                    $('aFollow').set('html', '<span class=\"inviteLink f18em\">' + gl_label_name + '</span>');
                                    $('aFollow').onmouseout = '';
                                    $('aFollow').onmouseover = '';
                                }
                                else {$('aFollow').set('html', '<span class=\"f18em\">' + gl_label_name + '</span>');}                                      
                                
                                var arrow_dropdown = '<span onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'arrow_follow_drop\', \'\', \'\', \'arrow_follow_dropDropdown\', \'\', \'\');\" id=\"arrow_follow_drop\" class=\"arrow_follow dropdown\">&nbsp;</span>';
                                var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + gl_label_id + '&o=' + gl_label_owner_id + '&n="></script>';            
                                // wheel dropdown - Ariana
                                arrow_dropdown += '<div class="clearboth"></div><div class="subWheelPrTop dndD" id=\"arrow_follow_dropDropdown\">';
                                arrow_dropdown += '<div class="share-arrow-wheel">&nbsp;</div>';
                                arrow_dropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                                arrow_dropdown += '<ul>';                                    
                                arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+gl_label_id+'" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" value="http://'+ profileInfo.networkDomain+'/'+gl_label_owner_wadjaid.toLowerCase()+'.'+gl_label_name.replace("\'", "\\'")+'"/></li>';
                                arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+gl_label_id+'" class="textBoxSmall" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" /></li></ul>';      
                                if($('stop_follow_label')) {
                                    $('stop_follow_label').removeClass('dnd');
                                    $('stop_follow_label').set('html', '<span id=\"stopfollowTip\" class=\"\"><span id=\"interesting_sp\" class=\"stop\"><span class=\"sp_follow_stop\" onclick=\'StopFollowingLabel();\' >&nbsp;</span>'+ arrow_dropdown+'</span></span>');
                                   
                                 
                                  
                                    $('stop_follow_label').onmouseout = new Function('Tip.doTipOff(\'stop_follow_label\');');
                                    $('stop_follow_label').onmouseover = new Function('Tip.doTipLbl(\'stop_follow_label\',\''+T_STOPFOLLOWING_TIP+'\',\'2\',\'2\');');
                                    }                                      
                            }
                            FollowLink = 2;                    
                    }
                    else {
                            if ($('aFollow')) {
                                $('aFollow').removeClass('dnd');    
                                if (LabelInfo.privacy == 4) { 
                                    $('aFollow').set('html', '<span  class=\"inviteLink f18em\">' + gl_label_name + '</span>');
                                    $('aFollow').onmouseout = '';
                                    $('aFollow').onmouseover = '';                                        
                                }
                                else {
                                $('aFollow').set('html', '<span class=\"f18em\">' + gl_label_name + '</span>');
                                }
                                if ($('noFeeds'))
                                    if (gl_label_privacy == 3) {
                                        if ($('noFeedsContainer_blank')) {
                                            $('noFeedsContainer_blank').removeClass('dnd');
                                            $('noFeedsContainer_blank').set('html', T_PRIVATELLABEL);
                                        }
                                        if ($('noFeedsContainer'))
                                            $('noFeedsContainer').addClass('dnd');
                                        }
                                if (gl_label_privacy == 4) {
                                    var arrow_dropdown = '<span onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'arrow_follow_drop\', \'\', \'\', \'arrow_follow_dropDropdown\', \'\', \'\');\" id=\"arrow_follow_drop\" class=\"arrow_follow dropdown\">&nbsp;</span>';
                                    var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + gl_label_id + '&o=' + gl_label_owner_id + '&n="></script>';            
                                    // wheel dropdown - Ariana
                                    arrow_dropdown += '<div class="clearboth"></div><div class="subWheelPrTop dndD" id=\"arrow_follow_dropDropdown\">';
                                    arrow_dropdown += '<div class="share-arrow-wheel">&nbsp;</div>';
                                    arrow_dropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                                    arrow_dropdown += '<ul>';                                    
                                    arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+gl_label_id+'" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" value="http://'+ profileInfo.networkDomain+'/'+gl_label_owner_wadjaid.toLowerCase()+'.'+gl_label_name.replace("\'", "\\'")+'"/></li>';
                                    arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+gl_label_id+'" class="textBoxSmall" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" /></li></ul>';  

                                    if($('stop_follow_label')) {
                                        $('stop_follow_label').removeClass('dnd');
                                        //$('stop_follow_label').set('html', '<span  id=\"stopfollowTip\" class=\"\"><span class=\"follow\"><span onclick=\"FollowLabel();\" class=\"sp_follow_stop\">&nbsp;</span>'+arrow_dropdown+'</span>'+arrow_dropdown+'</span>');
                                       $('stop_follow_label').set('html', '<span  id=\"stopfollowTip\" class=\"\"><span id=\"newfollow\" class=\"follow\"><span onclick=\"FollowLabel();\" class=\"sp_follow_stop\">&nbsp;</span></span></span>');
                                        
                                        $('stop_follow_label').onmouseout = new Function('Tip.doTipOff(\'stop_follow_label\');');
                                        $('stop_follow_label').onmouseover = new Function('Tip.doTipLbl(\'stop_follow_label\',\''+T_FOLLOW_TOOLTIP+'\',\'2\',\'2\');');
                                    }                                
                                }
                            }
                            FollowLink = 1;                    
                    }
                  }
                }
            }
            else {
                    if ($('stop_follow_label'))
                        $('stop_follow_label').addClass('dnd');
            }
        }
        else {
            if (profileInfo.isLoggedIn) {
            
                if (wProfile.Current.LabelID > 0 && wProfile.Current.LabelID != 2 && wProfile.Current.LabelID != 98474 && wProfile.Current.LabelID != 11) {
                
                    $('aFollow').removeClass('dnd');   
                     if (gl_label_privacy == 4) {
                                    $('aFollow').set('html', '<span  class=\"inviteLink f18em\">' + gl_label_name + '</span>');
                                    $('aFollow').onmouseout = '';
                                    $('aFollow').onmouseover = '';
                                }
                                else {
                                    $('aFollow').set('html', '<span class=\"f18em\">' + gl_label_name + '</span>');
                                }
                                 
                                FollowLink = 1;

                                if ($('noFeeds'))
                                    if (gl_label_privacy == 3) {
                                        if ($('noFeedsContainer_blank')) {
                                            $('noFeedsContainer_blank').removeClass('dnd');                                            
                                            $('noFeedsContainer_blank').set('html', T_PRIVATELLABEL);
                                        }
                                        if ($('noFeedsContainer'))
                                            $('noFeedsContainer').addClass('dnd');
                                     }
                                 if (gl_label_privacy == 4) {
                                 if(!gl_label_viewerIsFollowing) {
                                    var arrow_dropdown = '<span onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'arrow_follow_drop\', \'\', \'\', \'arrow_follow_dropDropdown\', \'\', \'\');\" id=\"arrow_follow_drop\" class=\"arrow_follow dropdown\">&nbsp;</span>';
                                    var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + gl_label_id + '&o=' + gl_label_owner_id + '&n="></script>';            
                                    // wheel dropdown - Ariana
                                    arrow_dropdown += '<div class="clearboth"></div><div class="subWheelPrTop dndD" id=\"arrow_follow_dropDropdown\">';
                                    arrow_dropdown += '<div class="share-arrow-wheel">&nbsp;</div>';
                                    arrow_dropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                                    arrow_dropdown += '<ul>';                                    
                                    arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+gl_label_id+'" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" value="http://'+ profileInfo.networkDomain+'/'+gl_label_owner_wadjaid.toLowerCase()+'.'+gl_label_name.replace("\'", "\\'")+'"/></li>';
                                    arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+gl_label_id+'" class="textBoxSmall" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" /></li></ul>';  
                                    if($('stop_follow_label')) {
                                                $('stop_follow_label').removeClass('dnd');
                                              //  $('stop_follow_label').set('html', '<span id=\"stopfollowTip\" class=\"\"><span class=\"follow\"><span onclick=\"FollowLabel();\"  class=\"sp_follow_stop\">&nbsp;</span>'+arrow_dropdown+'</span></span>');
                                               $('stop_follow_label').set('html', '<span id=\"stopfollowTip\" class=\"\"><span id=\"newfollow\" class=\"follow\"><span onclick=\"FollowLabel();\"  class=\"sp_follow_stop\">&nbsp;</span></span></span>');
                                                             
                                                $('stop_follow_label').onmouseout = new Function('Tip.doTipOff(\'stop_follow_label\');');
                                                $('stop_follow_label').onmouseover = new Function('Tip.doTipLbl(\'stop_follow_label\',\''+T_FOLLOW_TOOLTIP+'\',\'2\',\'2\');');
                                                }
                                        }
                                    else {
                                        var arrow_dropdown = '<span onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'arrow_follow_drop\', \'\', \'\', \'arrow_follow_dropDropdown\', \'\', \'\');\" id=\"arrow_follow_drop\" class=\"arrow_follow dropdown\">&nbsp;</span>';
                                        var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + gl_label_id + '&o=' + gl_label_owner_id + '&n="></script>';            
                                        // wheel dropdown - Ariana
                                        arrow_dropdown += '<div class="clearboth"></div><div class="subWheelPrTop dndD" id=\"arrow_follow_dropDropdown\">';
                                        arrow_dropdown += '<div class="share-arrow-wheel">&nbsp;</div>';
                                        arrow_dropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                                        arrow_dropdown += '<ul>';                                    
                                        arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+gl_label_id+'" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" value="http://'+ profileInfo.networkDomain+'/'+gl_label_owner_wadjaid.toLowerCase()+'.'+gl_label_name.replace("\'", "\\'")+'"/></li>';
                                        arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+gl_label_id+'" class="textBoxSmall" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" /></li></ul>';  
                                        if($('stop_follow_label')) {
                                        $('stop_follow_label').removeClass('dnd');
                                        $('stop_follow_label').set('html', '<span onclick=\'StopFollowingLabel();\' id=\"stopfollowTip\" class=\"\"><span id=\"interesting_sp\"  class=\"stop\"><span onclick=\"StopFollowingLabel();\" class=\"sp_follow_stop\">&nbsp;</span>'+arrow_dropdown+'</span></span>');
                                      
                                     $('stop_follow_label').onmouseout = new Function('ChangeTextTofollow();');
                                      //  $('stop_follow_label').onmouseover = new Function('ChangeTextToUnfollow(); ');

                                        $('stop_follow_label').onmouseout = new Function('Tip.doTipOff(\'stop_follow_label\');');
                                        $('stop_follow_label').onmouseover = new Function('Tip.doTipLbl(\'stop_follow_label\',\''+T_STOPFOLLOWING_TIP+'\',\'2\',\'2\');');
                                        }
                                    }
                               }

                        }  
            }
            else {
                //ANONYMOUS USER
                if (wProfile.Current.LabelID > 0 && wProfile.Current.LabelID != 2) {
                    $('aFollow').addClass('dnd');
                   if (LabelInfo.privacy == 4)
                      $('signedOutFollow').set('html', '<a class=\"signedOut_Interest \" href="/sessions/landingpage.aspx?labelid=' + wProfile.Current.LabelID.toString() + '&ownerID=' + profileInfo.ownerID + '"\'>' + gl_label_name + '</a>');                      
                   else {
                      $('signedOutFollow').set('html', ' <span id=\"aFollow\" class=\"cursor\" onclick=\"publicFollowjs.getPublicFollowForm(\''+wProfile.Current.LabelID.toString()+'\',\''+ profileInfo.ownerID +'\');\" >' + gl_label_name +' </span>');
                      /*maria  call the signedOutFollowCard.js the js to appear the new landing page for signout in popup  */
                      //$('signedOutFollow').set('html', ' <span id=\"aFollow\" class=\"cursor\"  onclick=\"signedOutFollowCardjs.getsignedOutFollowCard(\''+ wProfile.Current.LabelID.toString()+'\',\''+profileInfo.ownerID +'\');\">' + selectedLabelName+  '</span>');
                      /*maria */
                    }
                  //  document.title = document.title + '.' + gl_label_name;
                    if (LabelInfo.privacy == 4) {
                    var arrow_dropdown = '<span onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'arrow_follow_drop\', \'\', \'\', \'arrow_follow_dropDropdown\', \'\', \'\');\" id=\"arrow_follow_drop\" class=\"arrow_follow dropdown\">&nbsp;</span>';
                    var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + gl_label_id + '&o=' + gl_label_owner_id + '&n="></script>';            
                    // wheel dropdown - Ariana
                    arrow_dropdown += '<div class="clearboth"></div><div class="subWheelPrTop dndD" id=\"arrow_follow_dropDropdown\">';
                    arrow_dropdown += '<div class="share-arrow-wheel">&nbsp;</div>';
                    arrow_dropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                    arrow_dropdown += '<ul>';                                    
                    arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+gl_label_id+'" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" value="http://'+ profileInfo.networkDomain+'/'+gl_label_owner_wadjaid.toLowerCase()+'.'+gl_label_name.replace("\'", "\\'")+'"/></li>';
                    arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+gl_label_id+'" class="textBoxSmall" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" /></li></ul>';  
                    if($('stop_follow_label')) {
                       $('stop_follow_label').removeClass('dnd');

                       $('stop_follow_label').set('html', '<span class=\"\"><span class=\"follow\"><a href="/sessions/landingpage.aspx?labelid=' + wProfile.Current.LabelID.toString() + '&ownerID=' + profileInfo.ownerID + '" id=\"stopfollowTip\" onmouseover=\"Tip.doTipLbl(\'stopfollowTip\',\''+T_FOLLOW_TOOLTIP+'\',\'2\',\'2\');\" onmouseout=\"Tip.doTipOff(\'stopfollowTip\');\" class=\"sp_follow_stop\">&nbsp;</a>'+arrow_dropdown+'</span></span>');
                           
                      }
                    }
                    FollowLink = 1;         
                    // Ariana - check for privacy before displaying the promote page
                    if ((LabelInfo.privacy == 3 || LabelInfo.privacy == 2) && !profileInfo.profileBelongsToViewer) {
                    if($('noFeeds')) 
                       $('noFeeds').removeClass('dnd');   
                       $('master_feeds_container').addClass('dnd');            
                          if ($('noFeedsContainer_blank')) {
                              $('noFeedsContainer_blank').removeClass('dnd');
                              $('noFeedsContainer_blank').set('html', T_PRIVATELLABEL);
                          }
                          if ($('noFeedsContainer'))
                              $('noFeedsContainer').addClass('dnd');
                    }
                }
                else {
                    if (wProfile.Current.Category == 'My')
                        FollowLink = 1;

                    $('aFollow').addClass('dnd');                    
                    $('signedOutFollow').set('html', '<a class=\"signedOut_Interest \" href=\"/sessions/landingpage.aspx?labelid=' + MyLocationID + '&ownerID=' + profileInfo.ownerID + '"\'>' + MyLocationName + '</a>');
                    /*maria  call the signedOutFollowCard.js the js to appear the new landing page for signout in popup */
                    //$('signedOutFollow').set('html', '<span id=\"aFollow\" class=\"cursor\" onclick=\"signedOutFollowCardjs.getsignedOutFollowCard(\''+ MyLocationID +'\',\''+profileInfo.ownerID +'\');\">#' + MyLocationName+  '</span>');
                    /*maria*/
                    var arrow_dropdown = '<span onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'arrow_follow_drop\', \'\', \'\', \'arrow_follow_dropDropdown\', \'\', \'\');\" id=\"arrow_follow_drop\" class=\"arrow_follow dropdown\">&nbsp;</span>';
                    var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + gl_label_id + '&o=' + gl_label_owner_id + '&n="></script>';            
                    // wheel dropdown - Ariana
                    arrow_dropdown += '<div class="clearboth"></div><div class="subWheelPrTop dndD" id=\"arrow_follow_dropDropdown\">';
                    arrow_dropdown += '<div class="share-arrow-wheel">&nbsp;</div>';
                    arrow_dropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                    arrow_dropdown += '<ul>';                                    
                    arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+gl_label_id+'" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" value="http://'+ profileInfo.networkDomain+'/'+gl_label_owner_wadjaid.toLowerCase()+'.'+gl_label_name.replace("\'", "\\'")+'"/></li>';
                    arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+gl_label_id+'" class="textBoxSmall" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" /></li></ul>';  
                    if($('stop_follow_label')) {
                       $('stop_follow_label').removeClass('dnd');

                       $('stop_follow_label').set('html', '<span class=\"\"><span class=\"follow\"><a href="/sessions/landingpage.aspx?labelid=' + MyLocationID + '&ownerID=' + profileInfo.ownerID + '" id=\"stopfollowTip\" onmouseover=\"Tip.doTipLbl(\'stopfollowTip\',\''+T_FOLLOW_TOOLTIP+'\',\'2\',\'2\');\" onmouseout=\"Tip.doTipOff(\'stopfollowTip\');\" class=\"sp_follow_stop\">&nbsp;</a>'+arrow_dropdown+'</span></span>');
                                    
                    }
                }
            }   
        }
    }
    catch (Error) {
        //Notify.alert('Javascript error', '<div class="pad10">Javascript error while loading method ManageFollowLink#<b>' + Error + '</b>.</div>', 'OK', 'red');
   // alert(1);
    }

    try {
        if (justFollowed)
            $('aFollow').addClass('dnd');
    }
    catch (Error) { }

    try {
        /* initialize LABEL info values for public use */
        //setLABEL.info(LabelInfo.Owner_ID,wProfile.Current.LabelID);
    }
    catch (Error) { 
    
    }
    //#1.get followers counter
    try {
        //GetLabelFollowers(wProfile.Current.LabelID, LabelInfo.name, LabelInfo.Owner_ID, LabelInfo.OwnerWadjaID);
        GetLabelFollowers_Online(wProfile.Current.LabelID, LabelInfo.name, LabelInfo.Owner_ID, LabelInfo.OwnerWadjaID);
    }
    catch (Error) {
        //#IF NULL NO CALL:Notify.alert('Javascript error', '<div class="pad10">Javascript error while loading method GetLabelFollowers() #<b>' + Error + '</b>.</div>', 'OK', 'red');
    }
}

//#the function that is called when the user clicks on the follow link on the suggested labels
//whattofollow is the number of the div 1 or 2
//otheLabelID is the label id of the other div so that we don't fetch the same label
function FollowSuggestedLabel (labelName, labelID, ownerID, whattofollow, otherLabelID, otherLabelOwnerID, otherLabelName, source, wadjaOwnerId) {
    var oWadjaX = new WADJAX('labels', { statusBar: false });
    Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
    oWadjaX.send('Follow', labelID, ownerID, profileInfo.viewerID.toString(), '', function (res) {
        if (!res.error) {
            Notify.spinnerOff(T_DONE, 1);
            var startText = T_YOUARENOWFOLLOWING +" <b>" + labelName.replaceAll(/\"/g, '\'')+"</b>";

           // Notify.topBarOn(startText, '', 6);
          // GetNewWhatToFollow (labelName, labelID, ownerID, whattofollow, otherLabelID, otherLabelOwnerID, otherLabelName, source);
           isFollowFromRight = 'true';
           if($('nowFollowing_'+labelID)){
                $('nowFollowing_'+labelID).removeClass('dnd');
           }
            if($('whatspn_'+labelID)){
                if(!$('whatspn_'+labelID).hasClass('dnd'))
                    $('whatspn_'+labelID).addClass('dnd');
            if($('whatspn_'+ labelID +'_1').getParents('.whatSugg'))
                $('whatspn_'+ labelID +'_1').getParents('.whatSugg').addClass('nowFollowing');
           }
        }
    });
}
function closeChangeTheRandomWhatToFollowPage (labelName, labelID, ownerID, whattofollow, otherLabelID, otherLabelOwnerID, otherLabelName, source){
    GetNewWhatToFollow (labelName, labelID, ownerID, whattofollow, otherLabelID, otherLabelOwnerID, otherLabelName, source);
}

function GetNewWhatToFollow (labelName, labelID, ownerID, whattofollow, otherLabelID, otherLabelOwnerID, otherLabelName, source) {
//    wjxShhProfile.send('GetWhatToFollow', otherLabelID, otherLabelOwnerID, whattofollow, source, function(r) {
//        if(r.value) {
//            var tempArray = r.value.split('s@l@i@t');
//            if($('whatLabel' + whattofollow +'_' + source))         
//                $('whatLabel' + whattofollow +'_' + source).set('html', tempArray[0]);
//            if($('aWhatFollow_' + otherLabelID +'_'+source)) {            
//                var otherwhattofollow;
//                if (whattofollow == 1)
//                    otherwhattofollow = 2;
//                if (whattofollow == 2)
//                    otherwhattofollow = 3;
//                if (whattofollow == 3)
//                    otherwhattofollow = 4;
//                if (whattofollow == 4) 
//                    otherwhattofollow = 5;
//                if (whattofollow == 5)
//                    otherwhattofollow = 1;
//                var tempArray2 = tempArray[1].split('|');
//                var newotherLabelID = tempArray2[0];
//                var newotherLabelOwnerID = tempArray2[1];
//                var newotherLabelName = tempArray2[2];
//                $('aWhatFollow_' + otherLabelID +'_'+source).set('href', 'javascript:FollowSuggestedLabel (\'' + otherLabelName.replaceAll(/\"/g, '\'') + '\',' + otherLabelID + ',' + otherLabelOwnerID + ',' + otherwhattofollow + ',' + newotherLabelID + ',' + newotherLabelOwnerID + ',\'' + newotherLabelName.replaceAll(/\"/g, '\'') + '\',\''+source+'\');');
//            }
//        }
//    });

feedActions.loadSUGGESTInterests(ownerID);
}

function FollowLabel(lName, lID, lOwnerID, lOverlay) {
    var elabelName;
    var elabelID;
    var elabelOwnerID;

    if (lOverlay !== undefined) {
        elabelName = lName;
        elabelID = lID;
        elabelOwnerID = lOwnerID;
    }
    else {
        try {
            elabelName = LabelInfo.name;
            elabelID = wProfile.Current.LabelID.toString();
            if (LabelInfo.Owner_ID > 0)
                elabelOwnerID = LabelInfo.Owner_ID.toString();
            else
                elabelOwnerID = profileInfo.ownerID;
        }
        catch (Error) {
            elabelName = MyLocationName;
            elabelID = MyLocationID;
            elabelOwnerID = profileInfo.ownerID;
        }
    }


    var oWadjaX = new WADJAX('labels', { statusBar: false });
    oWadjaX.send('Follow', elabelID, elabelOwnerID, profileInfo.viewerID.toString(), '', function (res) {
        if (!res.error) {

            if (lOverlay !== undefined) {

                $('ol_invite_' + elabelID).set('html', T_YOUARENOWFOLLOWING);
                $('ol_invite_' + elabelID).removeClass('share-footer');
                $('ol_invite_' + elabelID).addClass('coloredBlueBackground');
                $('ol_invite_' + elabelID).addClass('whiteColor');
                //maria new follow btn
               
            }
            else {
                $('aFollow').removeClass('dnd');     
                if (LabelInfo.privacy == 4) {          
                    //$('aFollow').set("html", "<span  class=\"lnk inviteLink\" onclick =\'InviteToFollow_share(" +elabelID+ "," + elabelOwnerID + ");\'>" + elabelName + "</span>");
                    $('aFollow').set("html", "<span  class=\"inviteLink f18em\">" + elabelName + "</span>");
                    $('aFollow').onmouseout = '';
                    $('aFollow').onmouseover = '';
                }
                else
                 $('aFollow').set("html", "<span class=\"f24\">" + elabelName + "</span>");
                FollowLink = 2;               
                if($('stop_follow_label')) {
                   Tip.doTipOff('stop_follow_label');
                   var arrow_dropdown = '<span onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'arrow_follow_drop\', \'\', \'\', \'arrow_follow_dropDropdown\', \'\', \'\');\" id=\"arrow_follow_drop\" class=\"arrow_follow dropdown\">&nbsp;</span>';
                   var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + gl_label_id + '&o=' + gl_label_owner_id + '&n="></script>';            
                   // wheel dropdown - Ariana
                   arrow_dropdown += '<div class="clearboth"></div><div class="subWheelPrTop dndD" id=\"arrow_follow_dropDropdown\">';
                   arrow_dropdown += '<div class="share-arrow-wheel">&nbsp;</div>';
                   arrow_dropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                   arrow_dropdown += '<ul>';                                    
                   arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+gl_label_id+'" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" value="http://'+ profileInfo.networkDomain+'/'+gl_label_owner_wadjaid.toLowerCase()+'.'+gl_label_name.replace("\'", "\\'")+'"/></li>';
                   arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+gl_label_id+'" class="textBoxSmall" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" /></li></ul>';  

                   $('stop_follow_label').removeClass('dnd');
                   $('stop_follow_label').set("html", "<span id=\"stopfollowTip\" ><span id=\"interesting_sp\" class=\"stop\"><span onclick=\"StopFollowingLabel();\" class=\"sp_follow_stop\">&nbsp;</span></span></span>");
                   
                   $('stop_follow_label').onmouseout = new Function('Tip.doTipOff(\'stop_follow_label\');');
                   $('stop_follow_label').onmouseover = new Function('Tip.doTipLbl(\'stop_follow_label\',\''+T_STOPFOLLOWING_TIP+'\',\'2\',\'2\');');
                  }
                var startText = T_YOUARENOWFOLLOWING +" <b>" + elabelName.replaceAll(/\"/g, '\'')+"</b>";
               /*edw tha prepei allaksei onoma*/
                if($('interesting_sp')){
              //  alert('heyyyyy');
                //$('interesting_sp').set('html','Following');
                }
                Notify.topBarOn(startText, '', 6);
               
                //for following from followers popcorn
                if ($('followerDef')) {
                    var q = parseInt($('followerDef').get('html'));
                        q = q + 1;
                        gl_label_followers = q;
                        $('followerDef').set('html', q + " ");
                             
               }
            }
            //#reload follow labels
            GetLabelistData.FollowViewer();
          
            //#2.reload followers counter
            try {
                //GetLabelFollowers(elabelID, elabelName, LabelInfo.Owner_ID, LabelInfo.OwnerWadjaID);
                GetLabelFollowers_Online(wProfile.Current.LabelID, LabelInfo.name, LabelInfo.Owner_ID, LabelInfo.OwnerWadjaID);
            }
            catch (Error) {
                //#IF NULL NO CALL:Notify.alert('Javascript error', '<div class="pad10">Javascript error while loading method GetLabelFollowers() #<b>' + Error + '</b>.</div>', 'OK', 'red');
            }

        }
    });
}

function StopFollowingLabel(wadjaOwnerId) {
    try {
    
        LabelName = LabelInfo.name;
        LabelID = wProfile.Current.LabelID.toString();
        if (LabelInfo.Owner_ID > 0)
            LabelOwner = LabelInfo.Owner_ID.toString();
        else
            LabelOwner = profileInfo.ownerID;
    }
    catch (Error) {
        LabelName = 'Home'
        LabelOwner = profileInfo.ownerID;
        LabelID = '8';
    }

    var oWadjaX = new WADJAX('labels', { statusBar: false });
    oWadjaX.send('StopFollowingLabel', LabelID, LabelOwner, profileInfo.viewerID.toString(), '', '', function (res) {
        if (!res.error) {
            $('aFollow').removeClass('dnd');     
            if (LabelInfo.privacy == 4) {       
                //$('aFollow').set("html", "<span  class=\"lnk inviteLink\" onclick =\'InviteToFollow_share(" +LabelID+ "," + LabelOwner + ");\'>" + LabelName + "</span>");
                $('aFollow').set("html", "<span  class=\"inviteLink f18em\">" + LabelName + "</span>");
                $('aFollow').onmouseout = '';
                $('aFollow').onmouseover = '';
            }
            else {$('aFollow').set("html", "<span class=\"f24\">" + LabelName + "</span>");}

            FollowLink = 2;           
           if (LabelInfo.privacy == 4) {
                var arrow_dropdown = '<span onclick=\"var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; } MyMenu.DropDown(\'arrow_follow_drop\', \'\', \'\', \'arrow_follow_dropDropdown\', \'\', \'\');\" id=\"arrow_follow_drop\" class=\"arrow_follow dropdown\">&nbsp;</span>';
                var embed_value = '<div id="badgecanvas"></div><script type="text/javascript" src="http://' + profileInfo.networkDomain + '/share/badges/hbadge.ashx?i=' + gl_label_id + '&o=' + gl_label_owner_id + '&n="></script>';            
                // wheel dropdown - Ariana
                arrow_dropdown += '<div class="clearboth"></div><div class="subWheelPrTop dndD" id=\"arrow_follow_dropDropdown\">';
                arrow_dropdown += '<div class="share-arrow-wheel">&nbsp;</div>';
                arrow_dropdown += '<div id="navBlack" class="borderDropdown wheeldropdown">';
                arrow_dropdown += '<ul>';                                    
                arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_LINK_TO_THIS+'</span><input type="text" class="textBoxSmall" id="textlink_'+gl_label_id+'" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" value="http://'+ profileInfo.networkDomain+'/'+gl_label_owner_wadjaid.toLowerCase()+'.'+gl_label_name.replace("\'", "\\'")+'"/></li>';
                arrow_dropdown += '<li class="colored tal"><span class="dib">'+DEF_EMBED_TO_THIS+'</span><input value=\''+embed_value+'\' type="text" id="textembedlink_'+gl_label_id+'" class="textBoxSmall" onclick="this.focus();this.select();var event = arguments[0] || window.event; if (event.stopPropagation) { event.stopPropagation(); } else { event.cancelBubble = true; }" /></li></ul>';  
                if($('stop_follow_label')) {
                $('stop_follow_label').removeClass('dnd');
               // $('stop_follow_label').set("html", "<span  id=\"stopfollowTip\"><span class=\"follow\"><span onclick=\"FollowLabel();\" class=\"sp_follow_stop\">&nbsp;</span>"+ arrow_dropdown+"</span></span>");
               $('stop_follow_label').set("html", "<span  id=\"stopfollowTip\"><span id=\"newfollow\" class=\"follow\"><span onclick=\"FollowLabel();\" class=\"sp_follow_stop\">&nbsp;</span></span></span>");
                     
                $('stop_follow_label').onmouseout = new Function('Tip.doTipOff(\'stop_follow_label\');');
                $('stop_follow_label').onmouseover = new Function('Tip.doTipLbl(\'stop_follow_label\',\''+T_FOLLOW_TOOLTIP+'\',\'2\',\'2\');');
                }
            }
            else {
                if($('stop_follow_label'))
                    $('stop_follow_label').addClass('dnd');}
            var stopText = T_STOPPEDFOLLOWING + " <b>"+ LabelName+"</b>";
            Notify.topBarOn(stopText, '', 6);
            if ($('followerDef')) {
                    var m = parseInt($('followerDef').get('html'));
                    if (m > 0) {
                        m = m - 1;
                        gl_label_followers = m;
                        $('followerDef').set('html', m + " ");
                      
                       
                    }
               }
            //#reload follow labels
            GetLabelistData.FollowViewer();
            //#3.reload followers counter
        
            try {
                //GetLabelFollowers(LabelID, LabelName, LabelInfo.Owner_ID, LabelInfo.OwnerWadjaID);
                GetLabelFollowers_Online(LabelID, LabelName, LabelInfo.Owner_ID, LabelInfo.OwnerWadjaID);
            }
            catch (Error) {
                //#IF NULL NO CALL:Notify.alert('Javascript error', '<div class="pad10">Javascript error while loading method GetLabelFollowers() #<b>' + Error + '</b>.</div>', 'OK', 'red');
            }
        }
    });
}

function FollowSpecificLabel(pLblId, pLblName, pOwnerId, pOwnerStringID) {

    var oWadjaX = new WADJAX('labels', { statusBar: false });
    oWadjaX.send('Follow', pLblId, pOwnerId, profileInfo.viewerID.toString(), '', function (res) {
        if (!res.error) {
            //#transition starts here...
            $('dvRandomFeed_' + pLblId.toString()).setStyle('display', 'block').fade('out');
            (function () {
                $('dvRandomFeed_' + pLblId.toString()).setStyle('display', 'block').fade('in');
                $('dvRandomFeed_' + pLblId.toString()).set('class', 'tac randomfeed_follow clearboth');
                $('dvRandomFeed_' + pLblId.toString()).set('html', '<div class=\"grayColor textShadow pad5 f11 dnb\">' + T_YOUARENOWFOLLOWING + ' <a href=\"/' + pOwnerStringID + '#!My/' + pLblId + '/1\">#' + pLblName.replaceAll(/\"/g, '\'') + '</a></div>');
            }).delay(1 * 1000);
            //#transition ends here.

            var suggestedLabelList = $('dvRndLabelsContainer').getChildren('div');
            var allSuggestedAreHidden = true;
            for (var i = 0; i < suggestedLabelList.length; i++) {
                if (!suggestedLabelList[i].hasClass('dnd')) {
                    allSuggestedAreHidden = false;
                    break;
                }
            }
            if (allSuggestedAreHidden) {
                //#hide suggested labels?
            }
        }
    });
}

function ClosenoFeed() {
    if ($('neverShow').checked)
        CloseNews('1');
    else {
        $('noFeeds').addClass('dnd');
        //$('master_feeds_container').removeClass('dnd');
    }

}

function CloseNews(action) {
    //action:0:turn off  per label, 1: turn off for all labels
    if (action == 0)
        elementID = gl_label_name;
    else if (action == 1)
        elementID = 'off';

    Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
    var oWadjaX = new WADJAX('Misc', { statusBar: false });

    oWadjaX.send('CloseProfileNews', elementID, function (res) {
        if (!res.error)
            Notify.spinnerOff(T_DONE, 1);
        else
            Notify.spinnerOff(T_DONE, 1);
    });
    MyElement.dissolve('noFeeds');
}

///Retrieve external feeds-youtube,twitter,lastFM
var GetExternalFeeds = function () {
    if (profileInfo.profileBelongsToViewer) {
        //wjxShhProfile.send('GetExternalFeeds', profileInfo.ownerID, 1, wProfile.Current.LabelID, function (res) { }); //Digg
        if (wProfile.Current.LabelID>0){
            wjxShhProfile.send('GetExternalFeeds', profileInfo.ownerID, 2, wProfile.Current.LabelID, function (res) { }); //Twitter
            wjxShhProfile.send('GetExternalFeeds', profileInfo.ownerID, 3, wProfile.Current.LabelID, function (res) { }); //LastFM
            wjxShhProfile.send('GetExternalFeeds', profileInfo.ownerID, 4, wProfile.Current.LabelID, function (res) { }); //Youtube
        }
    }
}

function setTxtBodyText() {
    if ($('txtBodyHTML5')) {
        /**/
        if ($('txtBodyHTML5').hasClass('type_message')) {

        }
        else {
            if ($('txtBodyHTML5').get('value').length > 0) {
                /*
                ITFFB = new Facebox({
                title: 'Are you sure you want to leave this page?',
                message: '<div class=\"pad5\">Your post has not been sent.</div>',
                submitValue: 'Discard post',
                submitFunction: function () {
                $('txtBodyHTML5').addClass('type_message');
                $('txtBodyHTML5').set('html',T_CLICKHERETOTYPEYOURMESSAGE);
                },
                cancelValue:'Continue editing'
                });
                ITFFB.show();
                */
            }
            else {
                $('txtBodyHTML5').addClass('type_message');
                settxtBodyHTML5();
                //$('txtBodyHTML5').set('html',T_CLICKHERETOTYPEYOURMESSAGE);
            }

        }
    }

    if ($('dvCounter') && $('txtBodyHTML5')) {
        maxchar = 5000;
        $('dvCounter').addClass('dnd');
        $('dvCounter').innerHTML = maxchar - $('txtBodyHTML5').get('value').length;
    }

    if ($('smsFromDDL'))
        $('smsFromDDL').innerHTML = '';

    if ($('txtTo')) {
        var selectedLabelID = parseInt(wProfile.Current.LabelID);
        var postVar = GetUserAndLabel(selectedLabelID);
        var txtToValue = postVar;
        if (!profileInfo.profileBelongsToViewer && postVar == '') {
            postVar = '' + profileInfo.ownerWadjaID + ' ';
            txtToValue = postVar;
        }
        else if (profileInfo.profileBelongsToViewer && postVar == '')
            postVar = '';
        var smsVar = '+';
        if (!profileInfo.profileBelongsToViewer && profileInfo.ownerVerified === 'true')
            smsVar = '+' + profileInfo.ownerWadjaID + ' ';

        if (selectedLabelID == 0 && profileInfo.profileBelongsToViewer) {
            //LABEL:MESSAGE/POST
            $('txtTo_title').set('html','To:');
            $('txtTo_edit').removeClass('dnd');
           // $('txtTo_edit').set('html','<a href=\"javascript:EditMode();\">Add/Edit</a>&nbsp;(or <a href=\"javascript:EditMode();SetTO(\'+\',1);\">SMS</a>)');
           $('txtTo_edit').set('html','<a href=\"javascript:EditMode();\"> '+ T_ADDEDIT + '</a>&nbsp;(or <a href=\"javascript:EditMode();SetTO(\'+\',1);\">SMS</a>)');
            //attach event
            if($('composeResetTxtTo'))
               $('composeResetTxtTo').addClass('dndD');
            if($('composeClearTxtTo'))
               $('composeClearTxtTo').addClass('dndD');
                  
            $('txtTo').value = '' + profileInfo.ownerWadjaID + ' #' + MyLocationName; //prev:T_TYPEOR;
            $('txtTo').addClass('txtTOLabel');
            // Ariana  - add span
            //$('txtTo').addClass('type_message_post');
            $('txtTo').addClass('dnd');
            $('spnTo').removeClass('dnd');
            $('spnTo').set('text','' + profileInfo.ownerWadjaID + ' #' + MyLocationName);
            $('txtTo').removeClass('type_message');
            //
            ComposeOverlay.Hide();
            $('dvFound').getElement('span').innerHTML = "<a class=\"blueSms\" href=\"javascript:SetTextBox('" + postVar + "');\">" + T_POST + "()</a>" + T_OR + "<a class=\"greenSms\" href=\"javascript:SetTextBox('" + smsVar + "');\">SMS (+)</a>";
        }
        else {
            //LABEL:MESSAGE/POST
            $('txtTo_title').set('html','To:');
            $('txtTo_edit').removeClass('dnd');
            if($('composeResetTxtTo'))
                $('composeResetTxtTo').addClass('dndD');
            if($('composeClearTxtTo'))
                $('composeClearTxtTo').addClass('dndD');
            //$('txtTo_edit').set('html','<a href=\"javascript:EditMode();\">Add/Edit</a>&nbsp;(or <a href=\"javascript:EditMode();SetTO(\'+\',1);\">SMS</a>)');//attach event
            $('txtTo_edit').set('html','<a href=\"javascript:EditMode();\">'+ T_ADDEDIT + '</a>&nbsp;(or <a href=\"javascript:EditMode();SetTO(\'+\',1);\">SMS</a>)');//attach event
            // Ariana - add span...not empty text when on  my profile viewing My messages , same as when i'm not in my profile 
            if(selectedLabelID == 2) {
                $('txtTo').value = '' + profileInfo.ownerWadjaID + ' ';
                $('spnTo').set('text','' + profileInfo.ownerWadjaID);
                }
            else {
                $('txtTo').value = GetUserAndLabel(selectedLabelID);
                 $('spnTo').set('text',GetUserAndLabel(selectedLabelID));
                }
            // Ariana - add span
            //$('txtTo').addClass('type_message_post');
            $('txtTo').addClass('dnd');
            $('spnTo').removeClass('dnd');

            $('txtTo').removeClass('type_message');
            //
            if ($('txtTo').value != '')
                ;//wjxShhProfile.send('WdjThnk', $('txtBodyHTML5').value, $('txtTo').value, wProfile.Compose.WadjaThinking);
            else
                $('dvFound').getElement('span').innerHTML = "<a class=\"blueSms\" href=\"javascript:SetTextBox('" + postVar + "');\">" + T_POST + "()</a>" + T_OR + "<a class=\"greenSms\" href=\"javascript:SetTextBox('" + smsVar + "');\">SMS (+)</a>";
        }
    }

    //    if(!$('txtTo').hasClass('dndD')) {
    //        
    //        if ($('txtTo')) {
    //            $('txtTo').value = GetUserAndLabel(selectedLabelID);
    //            if ($('txtTo').value != '')
    //                wjxShhProfile.send('WdjThnk', $('txtBody').value, $('txtTo').value, wProfile.Compose.WadjaThinking);
    //            else {
    //                
    //                
    //            }
    //        }
    //    }
    //    else {
    //        var selectedLabelID = parseInt(wProfile.Current.LabelID);
    //        var postVar = GetUserAndLabel(selectedLabelID);
    //        if (!profileInfo.profileBelongsToViewer && postVar == '')
    //            postVar = '@' + profileInfo.ownerWadjaID + ' ';
    //        else if (profileInfo.profileBelongsToViewer && postVar == '')
    //            postVar = '@';
    //        var smsVar = '+';
    //        if (!profileInfo.profileBelongsToViewer && profileInfo.ownerVerified === 'true')
    //            smsVar = '+' + profileInfo.ownerWadjaID + ' ';
    //        $('dvFound').getElement('span').innerHTML = "<a class=\"blueSms\" href=\"javascript:SetTextBox('" + postVar + "');\">Post (@)</a> or <a class=\"greenSms\" href=\"javascript:SetTextBox('" + smsVar + "');\">SMS (+)</a>";    
    //    }
}

function GetUserAndLabel(labelID) {
    var res = '';
    var labelname = '';
    var labelowner = '';
  
    if (labelID == 2) return '';

    if (wProfile.Current.Category == 'My')
        res = JSON.decode(jsHelper.cachedData.My);

    if (wProfile.Current.Category == 'Follow')
        res = JSON.decode(jsHelper.cachedData.Follow);

    if (res == null) return '';

    for (var i = 0; i < res.length; i++) {
        if (res[i].labelID == labelID) {
            labelname = res[i].labelName;
            labelowner = res[i].OwnerWadjaID;
            break;
        }
    }

    if (profileInfo.ownerID == wProfile.Current.ViewerID && labelname == '' && wProfile.Current.Category == 'My')
    {
        //alert('cA:'+labelID+selectedLabelName);
        return '';
    }   
    else if (profileInfo.ownerID == wProfile.Current.ViewerID && wProfile.Current.Category == 'My')
        return '' + profileInfo.ownerWadjaID + ' #' + labelname + ' ';
    //    else if (profileInfo.ownerID == wProfile.Current.ViewerID && labelname == '' && wProfile.Current.Category == 'My')
    //        return '@' + profileInfo.ownerWadjaID + ' ';
    //    else if (profileInfo.ownerID != wProfile.Current.ViewerID && labelname == '' && wProfile.Current.Category == 'My')
    //        return '@' + profileInfo.ownerWadjaID + ' ';
    else if (profileInfo.ownerID != wProfile.Current.ViewerID && labelname != '' && wProfile.Current.Category == 'My')
        return '' + profileInfo.ownerWadjaID + ' #' + labelname + ' ';
    else if (wProfile.Current.Category == 'Follow' && labelowner != '')
        return '' + labelowner + ' #' + labelname + ' ';
    else if (!profileInfo.profileBelongsToViewer && labelID == 0)
        return '' + profileInfo.ownerWadjaID + ' #' + MyLocationName + ' ';
    else
    {
        //alert('cB:'+labelID);
        return '';
    }  

}
function SetTO(text, flag) {
    if (text == '+') {
        if (flag == 1) {
            if (profileInfo.ownerID != profileInfo.viewerID) {
                SetTextBox('+' + profileInfo.ownerWadjaID);
            }
            else {
                SetTextBox('+');
            }
        }
      
        ///Autocomplete tip bar...
        $('autocomplete_tip_bar').set('html',T_TYPESMS);
    }
    else if (text == '@') {
        if (flag == 1) {
            if (profileInfo.ownerID != profileInfo.viewerID)
                SetTextBox('@' + profileInfo.ownerWadjaID);
            else
                SetTextBox('@');
        }
        
        ///Autocomplete tip bar...
        $('autocomplete_tip_bar').set('html',T_TYPESMS);
    }
    else if (text == '#') {
        if (flag == 1) {
            //MY
            //FOLLOW
            //EVERY
            if (wProfile.Current.LabelID > 0)
                SetTextBox(GetUserAndLabel(wProfile.Current.LabelID));
            else
                SetTextBox('@' + profileInfo.ownerWadjaID + ' #' + ViewerLocationName);
        }
        ///Autocomplete tip bar...
        $('autocomplete_tip_bar').set('html',T_TYPESMS);
    }
}
function SetTextBox(text) {
    if ($('txtTo')) {
        $('txtTo').removeClass('type_message');

        $('txtTo').value = text;
        //        if (!($('txtTo').value == '' || $('txtTo').value == '@' || $('txtTo').value == '+'))
        //            wjxShhProfile.send('WdjThnk', $('txtBody').value, $('txtTo').value , wProfile.Compose.WadjaThinking);
        //        else {
        //            if($('txtTo').value == '@') {
        //                $('sendNote').innerHTML = 'Post to: ';
        //            }
        //            else if($('txtTo').value == '+') {
        //                $('sendNote').innerHTML = 'SMS to: ';
        //            }
        //            else {
        //                $('sendNote').innerHTML = '<a class=\"blueSms\" href=\"javascript:SetTextBox(\'@\');\">Post (@)</a> or <a  class=\"greenSms\" href=\"javascript:SetTextBox(\'+\');\">SMS (+)</a>';
        //            }
        //            $('smsFromDDL').innerHTML = '';
        //}
        $('txtTo').focus();
        $('txtTo').setCaretPosition('end');

    }
}

var helpTooltips = {
    On: function () {
        var randomnumber = Math.floor(Math.random() * 2)
        var tip = "Example: #home Hello world check out my home label.";
        //+
        //#
        //@
        if (randomnumber == 0)
            tip = 'Example: #home Hello world check out my HOME profile label.';
        else if (randomnumber == 1)
            tip = 'Example: mary #iphone I like your blog post about the new iPhone.';
        else if (randomnumber == 2)
            tip = 'Example: +tom Call me when you receive this SMS';

        Tip.doTipOn_('profile_compose_send', 'Example: #home Hello world check out my home label.', '10');
    },
    Off: function () {
        Tip.doTipOff('profile_compose_send');
    }
}


var ITFFB = null;
function InviteToFollow() {
    LabelID = wProfile.Current.LabelID.toString();
    ITFFB = new Facebox({
        url: '/contacts/invite/iframe.aspx?oid=' + profileInfo.ownerID + '&vid=' + profileInfo.viewerID + '&labelid=' + LabelID,
        width: 520,
        height: 380,
        title: T_INVITETOFOLLOW,
        submitValue: T_SENDINVITES,
        submitFunction: function () {
            var inviteSent = document.getElementById('frame_file').contentWindow.SendInvitations();
        },
        cancelValue: T_CANCEL,
        cancelFunction: function () {
            ITFFB.close();
        }
    });
    ITFFB.show();
}
function InviteToFollow_share(shlabelid, shlabelOwnerID) {
    LabelID = wProfile.Current.LabelID.toString();
    ITFFB = new Facebox({
        url: '/contacts/invite/iframe.aspx?oid=' + shlabelOwnerID + '&vid=' + profileInfo.viewerID + '&labelid=' + shlabelid + '&share=1',
        width: 520,
        height: 380,
        title: T_INVITETOFOLLOW,
        submitValue: T_SENDINVITES,
        submitFunction: function () {
            //alert(profileInfo.ownerID + "---" + shlabelOwnerID);
            if (profileInfo.ownerID == shlabelOwnerID && profileInfo.viewerID == shlabelOwnerID)
                var inviteSent = document.getElementById('frame_file').contentWindow.SendInvitations();
            else
                var inviteSent = document.getElementById('frame_file').contentWindow.SendInvitationsForOther();
        },
        cancelValue: T_CANCEL,
        cancelFunction: function () {
            ITFFB.close();
        }
    });
    ITFFB.show();
}
function InviteToFollow_invite(shlabelid, shlabelOwnerID) {
    LabelID = wProfile.Current.LabelID.toString();
    ITFFB = new Facebox({
        url: '/contacts/invite/iframe.aspx?oid=' + shlabelOwnerID + '&vid=' + profileInfo.viewerID + '&labelid=' + shlabelid + '&share=0',
        width: 520,
        height: 380,
        title: T_INVITETOFOLLOW,
        submitValue: T_SENDINVITES,
        submitFunction: function () {
            //alert(profileInfo.ownerID + "---" + shlabelOwnerID);
            if (profileInfo.ownerID == shlabelOwnerID && profileInfo.viewerID == shlabelOwnerID)
                var inviteSent = document.getElementById('frame_file').contentWindow.SendInvitations();
            else
                var inviteSent = document.getElementById('frame_file').contentWindow.SendInvitationsForOther();
        },
        cancelValue: T_CANCEL,
        cancelFunction: function () {
            ITFFB.close();
        }
    });
    ITFFB.show();
}
///SEARCH FILTERS
var searchFilter = {
    by: function (filterID) {
        //handle on/off
        if($('label_text'))
            $('label_text').addClass('dnd');
         if ($('bio_feed')) 
             $('bio_feed').addClass('dnd');
        if ($('compose_box')) 
            $('compose_box').addClass('dnd');
        $(filterID).addClass('filter_on');
        $(filterID).removeClass('filter_off');
        //sfilter:no existent class, used by the js only
        $$('.sfilter').each(function (element, index) {
            var filters = element.get('id');

            if (filterID.toLowerCase() != filters.toLowerCase()) {
                $(filters).addClass('filter_off');
                $(filters).removeClass('filter_on');
            }
        });
        //load filter results here
        // - type your code here -
        wProfile.CurrentSearch.Page = 1;
        if (filterID.toLowerCase() == 'filter_search_all') {
            wProfile.CurrentSearch.Category = 'feeds';
            //wProfile.Search(wProfile.CurrentSearch.Category, wProfile.CurrentSearch.Keyword);
            top.location.hash = '!search?searchType=' + '&searchFor=' + wProfile.CurrentSearch.Keyword;
        }
        else if (filterID.toLowerCase() == 'filter_search_people') {
            wProfile.CurrentSearch.Category = 'contacts';
            //wProfile.Search(wProfile.CurrentSearch.Category, wProfile.CurrentSearch.Keyword);
            top.location.hash = '!search?searchType=contacts' + '&searchFor=' + wProfile.CurrentSearch.Keyword;
        }
        else if (filterID.toLowerCase() == 'filter_search_labels') {
            wProfile.CurrentSearch.Category = 'labels';
            //wProfile.Search(wProfile.CurrentSearch.Category, wProfile.CurrentSearch.Keyword);
            top.location.hash = '!search?searchType=labels' + '&searchFor=' + wProfile.CurrentSearch.Keyword;
        }
        else if (filterID.toLowerCase() == 'filter_search_web') {
            wProfile.CurrentSearch.Category = 'web';
            wProfile.Search(wProfile.CurrentSearch.Category, wProfile.CurrentSearch.Keyword);
        }
    }
}

///HASH.JS
/*!
* Copyright (c) 2009 Andreas Blixt <andreas@blixt.org>
* Contributors: Aaron Ogle <aogle@avencia.com>,
*               Matti Virkkunen <mvirkkunen@gmail.com>
* This and more JavaScript libraries: http://blixt.org/js
* MIT License: http://www.opensource.org/licenses/mit-license.php
* 
* History handler
* Keeps track of the history of changes to the hash part in the address bar.
*/
/* WARNING for Internet Explorer 7 and below:
* If an element on the page has the same ID as the hash used, the history will
* get messed up.
*
* Does not support history in Safari 2 and below.
* 
* Example:
*     function handler(newHash, initial) {
*         if (initial)
*             alert('History is "' + newHash + '"');
*         else
*             alert('History changed to "' + newHash + '"');
*     }
*     History.init(handler, document.getElementById('hidden-iframe'));
*     History.go('abc123');
* 
* Updated by Matti Virkkunen (mvirkkunen@gmail.com) on 2009-11-16:
*   - Added second argument to callback that indicated whether the callback is due
*     to initial state (true) or due to an actual change to the hash (false).
* 
* Updated by Aaron Ogle (aogle@avencia.com) on 2009-08-11:
*   - Fixed bug where Firefox automatically unescapes location.hash but no other
*     browsers do. Always get the hash by parsing location.href and never use
*     location.hash.
*/

var History = (function () {
    var 
    // Import globals
window = this,
documentMode = document.documentMode,
history = window.history,
location = window.location,
    // Plugin variables
callback, hash,
    // IE-specific
iframe,

getHash = function () {
    // Internet Explorer 6 (and possibly other browsers) extracts the query
    // string out of the location.hash property into the location.search
    // property, so we can't rely on it. The location.search property can't be
    // relied on either, since if the URL contains a real query string, that's
    // what it will be set to. The only way to get the whole hash is to parse
    // it from the location.href property.
    //
    // Another thing to note is that in Internet Explorer 6 and 7 (and possibly
    // other browsers), subsequent hashes are removed from the location.href
    // (and location.hash) property if the location.search property is set.
    //
    // Via Aaron: Firefox 3.5 (and below?) always unescape location.hash which
    // causes poll to fire the hashchange event twice on escaped hashes. This is
    // because the hash variable (escaped) will not match location.hash
    // (unescaped.) The only consistent option is to rely completely on
    // location.href.
    var index = location.href.indexOf('#');
    return (index == -1 ? '' : location.href.substr(index + 1));
},

    // Used by all browsers except Internet Explorer 7 and below.
poll = function () {
    var curHash = getHash();
    if (curHash != hash) {
        hash = curHash;
        callback(curHash, false);
    }
},

    // Used to create a history entry with a value in the iframe.
setIframe = function (newHash) {
    try {
        var doc = iframe.contentWindow.document;
        doc.open();
        doc.write('<html><body>' + newHash + '</body></html>');
        doc.close();
        hash = newHash;
    } catch (e) {
        setTimeout(function () { setIframe(newHash); }, 10);
    }
},

    // Used by Internet Explorer 7 and below to set up an iframe that keeps track
    // of history changes.
setUpIframe = function () {
    // Don't run until access to the iframe is allowed.
    try {
        iframe.contentWindow.document;
    } catch (e) {
        setTimeout(setUpIframe, 10);
        return;
    }

    // Create a history entry for the initial state.
    setIframe(hash);
    var data = hash;

    setInterval(function () {
        var curData, curHash;

        try {
            curData = iframe.contentWindow.document.body.innerText;
            if (curData != data) {
                data = curData;
                location.hash = hash = curData;
                callback(curData, true);
            } else {
                curHash = getHash();
                if (curHash != hash) setIframe(curHash);
            }
        } catch (e) {
        }
    }, 50);
};

    return {
        init: function (cb, ifr) {
            // init can only be called once.
            if (callback) return;

            callback = cb;

            // Keep track of the hash value.
            hash = getHash();
            cb(hash, true);

            // Run specific code for Internet Explorer.
            if (window.ActiveXObject) {
                if (!documentMode || documentMode < 8) {
                    // Internet Explorer 5.5/6/7 need an iframe for history
                    // support.
                    iframe = ifr;
                    setUpIframe();
                } else {
                    // Internet Explorer 8 has onhashchange event.
                    window.attachEvent('onhashchange', poll);
                }
            } else {
                // Change Opera navigation mode to improve history support.
                if (history.navigationMode) history.navigationMode = 'compatible';

                setInterval(poll, 50);
            }
        },

        go: function (newHash) {
            // Cancel if the new hash is the same as the current one, since there
            // is no cross-browser way to keep track of navigation to the exact
            // same hash multiple times in a row. A wrapper can handle this by
            // adding an incrementing counter to the end of the hash.
            if (newHash == hash) return;
            if (iframe) {
                setIframe(newHash);
            } else {
                location.hash = hash = newHash;
                callback(newHash, false);
            }
        }
    };
})();


///NOT IN USE???
function handler(newHash, initial) {
    clearInterval(refTimer);
    if ($('aNewFeeds')) {
        //old line:new Fx.Reveal($('aNewFeeds'), { duration: 500 }).dissolve();
        //new line below-
        $('aNewFeeds').addClass('dnd');
        if ($('head_notifications_dropdown_feeds')) {
            $('head_notifications_dropdown_feeds').addClass('dndD');
            if ($('head_notifications_dropdown_message')) {
                if ($('head_notifications_dropdown_message').hasClass('dndD'))
                    $('head_notifications').addClass('dnd');
            }
            else
                $('head_notifications').addClass('dnd');
        }
    }
    //wHtmlCanvas.empty();
    if (initial && newHash == "") {
        if (isDomReady) {
            wProfile.Load(wProfile.Current.DetailsID, "My", 0, 1, true);
        }
    }
    else if (newHash.indexOf('!inbox') == 0) {
        var oQ = newHash.substring(1).split('/');
        wProfile.Inbox(oQ[1]);
    }
    else if (newHash.indexOf('!followpage') == 0) {
       alert('load follow page');
    }
    else if (newHash.indexOf('!feed') == 0) {
//        setTimeout("setTxtBodyText()", 2500);
//        setTimeout("settxtBodyHTML5()", 2000);
        var oQ = newHash.substring(1).split('/');
        pushstart = 1;
        wProfile.Feed(oQ[1]);
    }
    else if (newHash.indexOf('!listfeeds') == 0) {
//        setTimeout("setTxtBodyText()", 2500);
//        setTimeout("settxtBodyHTML5()", 2000);
        var oQ = newHash.substring(1).split('/');
        pushstart = 1;
        wProfile.Feeds(unescape(oQ[1]), oQ[2]);
    }
    else if (newHash.indexOf('!search') == 0) {
        var oQ = newHash.substring(1).split('?');
        var qsValues = oQ[1].parseQueryString();
        //fanis
        var keyword = qsValues.searchFor.toLowerCase();
        var filter = qsValues.searchType.toLowerCase();
        if (keyword.indexOf('interest:') == 0) {
            filter = 'feeds';
            if ($('filter_search_people'))
                $('filter_search_people').addClass('dndD');
            if ($('filter_search_labels'))
                $('filter_search_labels').addClass('dndD');
        }
        else {
            if ($('filter_search_people'))
                $('filter_search_people').removeClass('dndD');
            if ($('filter_search_labels'))
                $('filter_search_labels').removeClass('dndD');
        }
        //set search filters
        var filterID = '';
        switch (filter) {
            case '':
            case 'feeds':
                filterID = 'filter_search_all';
                break;
            case 'contacts':
                filterID = 'filter_search_people';
                break;
            case 'labels':
                filterID = 'filter_search_labels';
                break;
        }
        $(filterID).addClass('filter_on');
        $(filterID).removeClass('filter_off');
        //sfilter:no existent class, used by the js only
        $$('.sfilter').each(function (element, index) {
            var filters = element.get('id');
            if (filterID.toLowerCase() != filters.toLowerCase()) {
                $(filters).addClass('filter_off');
                $(filters).removeClass('filter_on');
            }
        });
        wProfile.Helper.Loaded = [];
        wProfile.Search(filter, keyword);
    } else if (newHash.indexOf('!') == 0) {
        setTimeout("setTxtBodyText()", 2500);
        setTimeout("settxtBodyHTML5()", 2000);
        var oQ = newHash.substring(1).split('/');
        if (isDomReady) {
            wProfile.Load(wProfile.Current.DetailsID, oQ[0], oQ[1], oQ[2], true);
        }
        else {   //#When refreshing page on a selected label and domready is not ready wait for 5 sec and load feeds
            (function () { wProfile.Load(wProfile.Current.DetailsID, oQ[0], oQ[1], oQ[2], true); }).delay(2 * 1000);
        }
    }
}

History.init(handler, $('ajax-hidden-iframe'));

function AttachPhoto(mID) {
    Notify.spinnerOff('Done!', 1);
    if ($('photo_attached')) {
        $('photo_attached').removeClass('dnd');
        $('link_attach_photo').removeClass('uploadMedia');
        $('link_attach_photo').addClass('uploadMediaAtt');
    }
    mediaID = mID;
    if ($('profile_compose_send')) {
        $('profile_compose_send').set('value', T_UPLOADANDSEND);
    }

    if ($('txtBodyHTML5') && ($('txtBodyHTML5').hasClass('type_message') || $('txtBodyHTML5').value == '')) {
        if (!$('txtBodyHTML5').hasClass('type_message'))
            $('txtBodyHTML5').addClass('type_message')
        $('txtBodyHTML5').value = T_CAPTIONPHOTO;
    }
}

function DeletePhoto() {
    if ($('photo_attached')) {
        $('photo_attached').addClass('dnd');
        $('link_attach_photo').removeClass('uploadMediaAtt');
        $('link_attach_photo').addClass('uploadMedia');
    }
    if ($('profile_compose_send')) {
        $('profile_compose_send').set('value', T_SEND);
    }
    mediaID = 0;

    settxtBodyHTML5();

    oWUser.send('DeletePhoto', mediaID, function (res) {
        if (res.error) return;
        if (res.value == '1') {

            mediaID = 0;
        }
    });
}


///#GetMeta info
var MetaTags = {
    reset: function () {
        //#share feeds
        var m_edit = JSON.decode(MetaInfoValue);
        //no thumb
        //title
        //description
        var n_thumb, n_title, n_desc;

        if ($('metainfo_choose_thumb_nothmub').checked)
            n_thumb = '';
        else
            n_thumb = m_edit.thumb;

        if ($('metainfo_title_txt')) {

        }
        else {
            if ($('metainfo_title').get('html').trim() != m_edit.title.trim())
                n_title = $('metainfo_title').get('html').replaceAll('"', '&ldquo;').replaceAll('\'', '&#39;');
            else
                n_title = m_edit.title;
        }

        if ($('metainfo_description_txt')) {

        }
        else {
            if ($('metainfo_descrpition').get('html').trim() != m_edit.description.trim())
                n_desc = $('metainfo_descrpition').get('html').replaceAll('"', '&ldquo;').replaceAll('\'', '&#39;');
            else
                n_desc = m_edit.description;
        }

        MetaInfoValue = '';
        MetaInfoValue += '{';
        MetaInfoValue += 'thumb:"' + n_thumb + '",';
        MetaInfoValue += 'description:"' + n_desc + '",';
        MetaInfoValue += 'title:"' + n_title + '",';
        MetaInfoValue += 'embed:"' + m_edit.embed + '",';
        MetaInfoValue += 'url:"' + m_edit.url + '",';
        MetaInfoValue += 'author_name:"' + m_edit.author_name + '",';
        MetaInfoValue += 'author_url:"' + m_edit.author_url + '"';
        MetaInfoValue += '}';
    },
    editTagsOn: function (elementID) {
        if (elementID == 'title') {

            if ($('metainfo_title_txt'))
            { }
            else
                $('metainfo_title').set('html', '<input class=\"f11\" type=\"text\" style="width:350px;"  id=\"metainfo_title_txt\" value=\"' + $('metainfo_title').get('html') + '\" />');
        }

        if (elementID == 'desc') {

            if ($('metainfo_description_txt'))
            { }
            else
                $('metainfo_descrpition').set('html', '<textarea style="width:350px;" class=\"f11\"  type=\"text\" id=\"metainfo_description_txt\">' + $('metainfo_descrpition').get('html') + '</textarea>');
        }
    },
    editTagsOff: function (elementID) {
        if (elementID == 'title') {
            if ($('metainfo_title_txt')) {
                $('metainfo_title').set('html', $('metainfo_title_txt').get('value'));
                MetaTags.reset();
            }
        }

        if (elementID == 'desc') {
            if ($('metainfo_description_txt')) {
                $('metainfo_descrpition').set('html', $('metainfo_description_txt').get('value'));
                MetaTags.reset();
            }
        }

    },
    nothumb: function () {
        if ($('metainfo_choose_thumb_nothmub').checked) {
            $('metainfo_choose_thumb_nav').addClass('dnd');
            $('metainfo_image_div').addClass('dnd');
            MetaTags.reset();
        }
        else {
            $('metainfo_choose_thumb_nav').removeClass('dnd');
            $('metainfo_image_div').removeClass('dnd');
        }
    },
    get: function (URL, URLType, URLTitle, URLDesc, URLThumb) {
        var validURL = false;
        if (URLType == '1') {
            if (URL.indexOf('http://') >= 0 && !MetaInfo)//#manual
                validURL = true;
            else {
                //alert(MetaInfo);
                Notify.alert('Invalid URL', '<div class=\"pad5\">' + T_URLMUSTSTART + '</div>', T_OK, 'red');
                return;
            }
        }
        else if (URLType == '2')//#auto-complete
        {
            if (URL.indexOf('http://') >= 0 && !MetaInfo)
                validURL = true;

        }

        //#URLType: When you click attach link
        if (validURL)//&& (profileInfo.ownerWadjaID=='argyris' || profileInfo.ownerWadjaID=='alex' || profileInfo.ownerWadjaID=='vfarad')
        {

            //#Hide attach: youtube, link icons
            $('preview_metainfo').removeClass('dnd');
            $('load_metainfo').removeClass('dnd');

            oWUser.send('GetMeta', URL, function (res) {
                if (!res.error) {
                    try {
                        //MyElement.dissolve('load_metainfo');
                        //MyElement.reveal('metainfo_container');
                        $('load_metainfo').addClass('dnd');
                        $('metainfo_container').removeClass('dnd');

                        //debug:Notify.alert('WDzilla!',res.value.trim(),'ok', 'red');
                        var metaJSON = JSON.decode(res.value.trim());
                        //#reset
                        MetaInfoValue = '';
                        if (metaJSON.youtubeEmbed != null && metaJSON.youtubeEmbed != "") {
                            //#video url
                            $('metainfo_link').set('html', metaJSON.link);
                            $('metainfo_link').set('href', metaJSON.link);
                            //#site_name
                            $('sitename').set('html', 'Youtube video');
                            //#title
                            $('metainfo_title').set('html', '<a href=\"' + metaJSON.youtubeEmbed.author_url + '">' + metaJSON.youtubeEmbed.author_name + '</a>  - ' + metaJSON.youtubeEmbed.title);
                            //#description
                            $('metainfo_descrpition').set('html', metaJSON.description);
                            //#video thumb
                            $('metainfo_image').set('src', metaJSON.youtubeEmbed.thumbnail_url);
                            $('metainfo_image_div').removeClass('dnd');
                            
                            //#share feeds
                            MetaInfoValue += '{';
                            MetaInfoValue += 'thumb:"' + metaJSON.youtubeEmbed.thumbnail_url + '",';
                            MetaInfoValue += 'description:"' + metaJSON.description + '",';
                            MetaInfoValue += 'title:"' + metaJSON.youtubeEmbed.title + '",';
                            MetaInfoValue += 'embed:"' + metaJSON.youtubeEmbed.html.replace(/\"/g, '\'') + '",';

                            MetaInfoValue += 'url:"' + metaJSON.link + '",';
                            MetaInfoValue += 'author_name:"' + metaJSON.youtubeEmbed.author_name + '",';
                            MetaInfoValue += 'author_url:"' + metaJSON.youtubeEmbed.author_url + '"';
                            MetaInfoValue += '}';
                        }
                        else {
                            //#share feeds
                            MetaInfoValue += '{';
                           
                            if (metaJSON.image != null) {
                                //metainfo_choose_thumb
                                var image_array = '';
                                image_array = metaJSON.image.split(",");
                                MetaThumb = '';
                                
                                if (image_array.length > 0 && image_array[0] != '') {
                                    //#declare some variable
                                    MetaThumb = image_array[0];
                                    MetaThumblist = 1;
                                    //#set first thumb
                                    var dummythumb=MetaThumb;
                                    dummythumb = ytube.thumb(dummythumb);
                                    $('metainfo_image').set('src', dummythumb);
                                    $('metainfo_image_div').removeClass('dnd');
                                    //#show hide-choose thumb
                                    if (image_array.length > 1) {
                                        $('metainfo_choose_thumb').removeClass('dnd');
                                        $('metainfo_choose_thumb_text').set('html', '1 of ' + image_array.length);
                                        /// THUMBNAIL NAVIGATION
                                        var prevthumb = function (e) {
                                            if (MetaThumblist > 1) {
                                                MetaThumblist = MetaThumblist - 1;
                                                var dummythumb= image_array[MetaThumblist - 1];
                                                //#hack youtube-thumb
                                                dummythumb = ytube.thumb(dummythumb);

                                                $('metainfo_choose_thumb_text').set('html', MetaThumblist + ' of ' + image_array.length + ' ');
                                                $('metainfo_image').set('src', dummythumb);

                                                var dummy = JSON.decode(MetaInfoValue);

                                                MetaInfoValue = ''; //#reset json
                                                MetaInfoValue += '{';
                                                MetaInfoValue += 'thumb:"' + dummythumb + '",';
                                                MetaInfoValue += 'description:"' + dummy.description + '",';
                                                MetaInfoValue += 'title:"' + dummy.title + '",';
                                                MetaInfoValue += 'embed:"",';

                                                MetaInfoValue += 'url:"' + dummy.url + '",';
                                                MetaInfoValue += 'author_name:"' + dummy.author_name + '",';
                                                MetaInfoValue += 'author_url:"' + dummy.author_url + '"';
                                                MetaInfoValue += '}';
                                            }
                                            else if (MetaThumblist == 1) {
                                               
                                                var dummy = JSON.decode(MetaInfoValue);
                                                var dummythumb= image_array[MetaThumblist - 1];
                                                //#hack youtube-thumb
                                                dummythumb = ytube.thumb(dummythumb);
                                                
                                                $('metainfo_choose_thumb_text').set('html', MetaThumblist + ' of ' + image_array.length + ' ');
                                                $('metainfo_image').set('src', dummythumb);
                                                
                                                MetaInfoValue = ''; //#reset json
                                                MetaInfoValue += '{';
                                                MetaInfoValue += 'thumb:"' + dummythumb + '",';
                                                MetaInfoValue += 'description:"' + dummy.description + '",';
                                                MetaInfoValue += 'title:"' + dummy.title + '",';
                                                MetaInfoValue += 'embed:"' + dummy.description.replace(/\"/g, '\'') + '",';

                                                MetaInfoValue += 'url:"' + dummy.url + '",';
                                                MetaInfoValue += 'author_name:"' + dummy.author_name + '",';
                                                MetaInfoValue += 'author_url:"' + dummy.author_url + '"';
                                                MetaInfoValue += '}';
                                                //#disable previous
                                            }
                                        };
                                        var nextthumb = function (e) {
                                            if (MetaThumblist < image_array.length) {
                                                ++MetaThumblist;
                                                var dummythumb = image_array[MetaThumblist - 1];
                                                //#hack youtube-thumb
                                                dummythumb = ytube.thumb(dummythumb);

                                                $('metainfo_choose_thumb_text').set('html', MetaThumblist + ' of ' + image_array.length + ' ');
                                                $('metainfo_image').set('src', dummythumb);

                                                var dummy = JSON.decode(MetaInfoValue);

                                                MetaInfoValue = ''; //#reset json
                                                MetaInfoValue += '{';
                                                MetaInfoValue += 'thumb:"' + dummythumb + '",';
                                                MetaInfoValue += 'description:"' + dummy.description + '",';
                                                MetaInfoValue += 'title:"' + dummy.title + '",';
                                                MetaInfoValue += 'embed:"",';

                                                MetaInfoValue += 'url:"' + dummy.url + '",';
                                                MetaInfoValue += 'author_name:"' + dummy.author_name + '",';
                                                MetaInfoValue += 'author_url:"' + dummy.author_url + '"';
                                                MetaInfoValue += '}';


                                            }
                                            else if (MetaThumblist == image_array.length) {
                                                var dummythumb = image_array[MetaThumblist - 1];
                                                //#hack youtube-thumb
                                                dummythumb = ytube.thumb(dummythumb);

                                                $('metainfo_choose_thumb_text').set('html', MetaThumblist + ' of ' + image_array.length + ' ');
                                                $('metainfo_image').set('src', dummythumb);

                                                var dummy = JSON.decode(MetaInfoValue);

                                                MetaInfoValue = ''; //#reset json
                                                MetaInfoValue += '{';
                                                MetaInfoValue += 'thumb:"' + dummythumb + '",';
                                                MetaInfoValue += 'description:"' + dummy.description + '",';
                                                MetaInfoValue += 'title:"' + dummy.title + '",';
                                                MetaInfoValue += 'embed:"",';

                                                MetaInfoValue += 'url:"' + dummy.url + '",';
                                                MetaInfoValue += 'author_name:"' + dummy.author_name + '",';
                                                MetaInfoValue += 'author_url:"' + dummy.author_url + '"';
                                                MetaInfoValue += '}';

                                                //#disable next
                                            }
                                        };

                                        $('metainfo_choose_thumb_next').removeEvents('click');
                                        $('metainfo_choose_thumb_next').addEvent('click', nextthumb);

                                        $('metainfo_choose_thumb_prev').removeEvents('click');
                                        $('metainfo_choose_thumb_prev').addEvent('click', prevthumb);

                                    }
                                }
                                else {
                                    $('metainfo_image_div').addClass('dnd');
                                    //?$('metainfo_choose_thumb').addClass('dnd');
                                }
                                var dummythumb = image_array[MetaThumblist - 1];
                                //#hack youtube-thumb
                                dummythumb = ytube.thumb(dummythumb);
                                MetaInfoValue += 'thumb:"' + dummythumb + '",';
                            }
                            else {
                                $('metainfo_image_div').addClass('dnd');
                                 var dummythumb = image_array[MetaThumblist - 1];
                                //#hack youtube-thumb
                                dummythumb = ytube.thumb(dummythumb);
                                MetaInfoValue += 'thumb:"' + dummythumb + '",';
                            }

                            if (metaJSON.description != null) {
                                $('metainfo_descrpition').set('html', metaJSON.description);
                                MetaInfoValue += 'description:"' + metaJSON.description + '",';
                            }
                            else
                                MetaInfoValue += 'description:"",';

                            if (metaJSON.title != null) {
                                var title = metaJSON.title;
                                if (title.trim() == '')
                                    title = "External link";

                                $('metainfo_title').set('html', title);
                                MetaInfoValue += 'title:"' + title + '",';
                            }
                            else {
                                $('metainfo_title').set('html', 'External link');
                                MetaInfoValue += 'title:"External link",';
                            }

                            MetaInfoValue += 'embed:"",';

                            if (metaJSON.link != null) {
                                $('metainfo_link').set('html', metaJSON.link);
                                $('metainfo_link').set('href', metaJSON.link);
                                MetaInfoValue += 'url:"' + metaJSON.link + '",';
                            }
                            else {
                                MetaInfoValue += 'url:"",';
                            }

                            if (metaJSON.site_name != null && metaJSON.site_name != '') {
                                $('sitename').set('html', metaJSON.site_name);
                                MetaInfoValue += 'author_name:"' + metaJSON.site_name + '",';
                            }
                            else {
                                $('sitename').set('html', 'External link');
                                MetaInfoValue += 'author_name:"' + metaJSON.youtubeEmbed.author_name + '",';
                            }
                            if (metaJSON.link != null)
                                MetaInfoValue += 'author_url:"' + metaJSON.link + '"';
                            else
                                MetaInfoValue += 'author_url:""';
                            MetaInfoValue += '}';
                        }
                        MetaInfo = true;
                        //Hide form
                        if ($('attach_canvas_main'))
                            $('attach_canvas_main').addClass('dnd');
                    }
                    catch (Error) {
                        //#debug:Notify.alert('Javascript error', '<div class=\"pad5\">Javascript error while using [GetMeta:'+Error+'] #' + res.value + '</div>', 'Ok', 'red');
                        MetaTags.remove();
                        attachCanvas.toggle('close');
                        //#Notify.alert('Link', '<div class=\"f11 pad5\">This content is not currently available.</div>', 'Ok', '');return;
                    }
                }
                else {
                    MetaInfo = false;
                    MyElement.dissolve('load_metainfo');
                    MyElement.dissolve('metainfo_container');

                    //debug:
                    Notify.alert('Javascript error', 'Javascript error while using [aj.GetMeta] #' + res.error, 'Ok', 'red');
                }
            });
        }
    },
    remove: function () {
        $('preview_metainfo').addClass('dnd');
        $('metainfo_container').addClass('dnd');
        $('load_metainfo').addClass('dnd');

        //#Display attach: link, youtube
        //$('link_attach_link').removeClass('dnd');
        //$('link_attach_song').removeClass('dnd');
        //$('link_attach_youtube').removeClass('dnd');
        //$('link_attach_photo').removeClass('dnd');
        if ($('CCDv'))
            $('CCDv').removeClass('dnd');
        //$('link_attach_twitter').removeClass('dnd');
        //#clr previous values
        MetaInfoValue = '';
        MetaThumblist = 0;
        MetaInfo = false;
        if ($('metainfo_choose_thumb_nothmub'))
            $('metainfo_choose_thumb_nothmub').checked = false;
        $('metainfo_choose_thumb_nav').removeClass('dnd');
        //#disabled:if ($('txtBody'))
        //    $('txtBody').select();
    }
}

var attachCanvas = {
    toggle: function (act) {
        if (act !== undefined) {
            if (act == 'close') {
            if ($('attach_canvas_main'))
                $('attach_canvas_main').addClass('dnd');
                //#show toolbar: link,youtube
                //$('link_attach_link').removeClass('dnd');
                //$('link_attach_song').removeClass('dnd');
                //$('link_attach_youtube').removeClass('dnd');
                //$('link_attach_photo').removeClass('dnd');
                //$('link_attach_twitter').removeClass('dnd');
                //$('link_attach_tumblr').removeClass('dnd');
                if ($('CCDv'))
                    $('CCDv').removeClass('dnd');
            }
            else if (act == 'show' || act == '')
            if ($('attach_canvas_main'))
                $('attach_canvas_main').removeClass('dnd');
        }
        else {
            if ($('attach_canvas_main'))
                $('attach_canvas_main').removeClass('dnd');
        }
    },
    twitter: function () {
        //#set canvas info
        attachCanvas.setinfo(T_TWITTERCONNECT, 'attach_twitter_form');
        //#show toolbar: link,youtube
        //$('link_attach_link').addClass('dnd');
        //$('link_attach_song').addClass('dnd');
        //$('link_attach_youtube').addClass('dnd');
        //$('link_attach_photo').addClass('dnd');
        //$('link_attach_twitter').addClass('dnd');
        //$('link_attach_tumblr').addClass('dnd');
        //if ($('CCDv'))
            //$('CCDv').addClass('dnd');
    },
    tumblr: function() {
        //#set canvas info
        attachCanvas.setinfo(T_TUMBLRCONNECT, 'attach_tumblr_form');
        //#show toolbar: link,youtube
        //$('link_attach_link').addClass('dnd');
        //$('link_attach_song').addClass('dnd');
        //$('link_attach_youtube').addClass('dnd');
        //$('link_attach_photo').addClass('dnd');
        //$('link_attach_twitter').addClass('dnd');
        //$('link_attach_tumblr').addClass('dnd');
        //if ($('CCDv'))
            //$('CCDv').addClass('dnd');
    },
    twitteraction: function () {

    },
    atphoto: function () {
        //#load upload photo
        $('frameAttachUpload').set('src', '/user/views/upload.aspx?noprofilepic=0');
        //#set canvas info
        attachCanvas.setinfo(T_ATTACHPHOTO, 'attach_photo_form');
        //$('link_attach_link').addClass('dnd');
        //$('link_attach_song').addClass('dnd');
        //$('link_attach_youtube').addClass('dnd');
        //$('link_attach_photo').addClass('dnd');
        //$('link_attach_twitter').addClass('dnd');
        //$('link_attach_tumblr').addClass('dnd');
        //if ($('CCDv'))
            //$('CCDv').addClass('dnd');
    },
    atphotoaction: function () {
        //Hide form
        if ($('attach_canvas_main'))
            $('attach_canvas_main').addClass('dnd');
        //#show toolbar: link,youtube
        //$('link_attach_link').removeClass('dnd');
        //$('link_attach_song').removeClass('dnd');
        //$('link_attach_youtube').removeClass('dnd');
        //$('link_attach_photo').removeClass('dnd');
        //$('link_attach_twitter').removeClass('dnd');
        //$('link_attach_tumblr').removeClass('dnd');
        if ($('CCDv'))
            $('CCDv').removeClass('dnd');
    },
    link: function () {
        //#set canvas info
        attachCanvas.setinfo(T_ATTACHLINK, 'attach_link_form');
        $('attach_link_value').set('value', '');
        $('attach_link_value').focus();
        MetaInfoValue = '';
        //#show toolbar: link,youtube
        //$('link_attach_link').addClass('dnd');
        //$('link_attach_youtube').addClass('dnd');
        //$('link_attach_photo').addClass('dnd');
        //$('link_attach_twitter').addClass('dnd');
        //$('link_attach_tumblr').addClass('dnd');
        //if ($('CCDv'))
            //$('CCDv').addClass('dnd');
    },
    linkaction: function () {
        var dummy = $('attach_link_value').get('value');
        MetaTags.get(dummy, '1', '', '', -1); //#retrieve url

        //#validate url-message to user: Notify.alert('Attach link', 'Please', 'Ok', 'red');
    },
    song: function () {
        //#set canvas info
        attachCanvas.setinfo(T_SEARCHASONG, 'attach_song_form');
        MetaInfoValue = '';
        //#show toolbar: link,youtube
        //$('link_attach_link').addClass('dnd');
        //$('link_attach_song').addClass('dnd');
        //$('link_attach_youtube').addClass('dnd');
        //$('link_attach_photo').addClass('dnd');
        //$('link_attach_twitter').addClass('dnd');
        //$('link_attach_tumblr').addClass('dnd');
        //if ($('CCDv'))
            //$('CCDv').addClass('dnd');
    },
    SearchSongs: function () {
        var eKeyword = $('attach_song_value').get('value');
        var eSearchResultsCanvas = $('tiny_song_list');
        var eSearchResultsUI = new Element('div');

        //#build song list
        //#retrieve json
        //#loop-res
        var sTitle, sURL, sArtist;
        eSearchResultsUI.appendChild(new Element('span', { 'class': 'btn_submit', 'html': '<img onclick=\"top.location.href=\'' + sURL + '\';\" class=\"cursor\" src=\"/s3.images/compose/play-tiny.png\"/>' }));
        eSearchResultsUI.appendChild(new Element('span', { 'class': 'song_details', 'html': '<span class=\"song_title\">' + sTitle + '</span><br /><span class=\"song_artist\">' + sArtist + '</span>' }));
        eSearchResultsUI.appendChild(new Element('span', { 'class': 'attach_song', 'html': '<span onclick=\"attachCanvas.attachSong(\'' + sTitle + '\',\'' + sURL + '\',\'' + sArtist + '\');\" class=\"btn_submit\">' + T_ATTACH + '</span>' }));

        eSearchResultsCanvas.appendChild(eSearchResultsUI);
        //#more button
        //#attach song button

    },
    attachSong: function (sTitle, sURL, sArtist) {
        //#close div
        //#display attached song
        alert(sTitle + '-' + sURL + '-' + sArtist);
    },
    youtube: function () {
        //#set canvas info
        attachCanvas.setinfo(T_ATTACHYOUTUBE, 'attach_video_form');
        $('attach_video_value').set('value', '');
        $('attach_video_value').focus();
        MetaInfoValue = '';
        //#show toolbar: link,youtube
        //$('link_attach_link').addClass('dnd');
        //$('link_attach_song').addClass('dnd');
        //$('link_attach_youtube').addClass('dnd');
        //$('link_attach_photo').addClass('dnd');
        //$('link_attach_twitter').addClass('dnd');
        //$('link_attach_tumblr').addClass('dnd');
        //if ($('CCDv'))
            //$('CCDv').addClass('dnd');
    },
    youtubeaction: function () {
        var dummy = $('attach_video_value').get('value');
        MetaTags.get(dummy, '1', '', '', -1); //#retrieve url

        //#validate url-message to user: Notify.alert('Attach link', 'Please', 'Ok', 'red');
    },
    sms: function () {
        //#set canvas info
        attachCanvas.setinfo(T_SELECTYOURSMSPROVIDER, 'attach_sms_form');
    },
    location: function () {
        //#set canvas info
        attachCanvas.setinfo(T_CHECKIN, 'attach_location_form');
    },
    setinfo: function (title, form) {
        //#title atformOff,atformOn
        //#show canvas
        $('attach_canvas_title').set('html', title);

        if (form == 'attach_link_form') {
            //#show container
//            if ($('attach_canvas_main').hasClass('dnd'))
                if ($('attach_canvas_main'))
                $('attach_canvas_main').removeClass('dnd');
//            else
//                $('attach_canvas_main').addClass('dnd');

            //#show form
            $(form).removeClass('dnd');
            $('attach_song_form').addClass('dnd');
            $('attach_video_form').addClass('dnd');
            $('attach_photo_form').addClass('dnd');
            $('attach_twitter_form').addClass('dnd');
            $('attach_tumblr_form').addClass('dnd');
        }

        if (form == 'attach_song_form') {
            //#show container
            if ($('attach_canvas_main').hasClass('dnd'))
                $('attach_canvas_main').removeClass('dnd');
            else
                $('attach_canvas_main').addClass('dnd');

            //#show form
            $(form).removeClass('dnd');
            $('attach_link_form').addClass('dnd');
            $('attach_video_form').addClass('dnd');
            $('attach_photo_form').addClass('dnd');
            $('attach_twitter_form').addClass('dnd');
            $('attach_tumblr_form').addClass('dnd');
        }

        if (form == 'attach_video_form') {
            //#show container
//            if ($('attach_canvas_main').hasClass('dnd'))
                if ($('attach_canvas_main'))
                $('attach_canvas_main').removeClass('dnd');
//            else
//                $('attach_canvas_main').addClass('dnd');

            //#show form
            $(form).removeClass('dnd');
            $('attach_link_form').addClass('dnd');
            $('attach_song_form').addClass('dnd');
            $('attach_photo_form').addClass('dnd');
            $('attach_twitter_form').addClass('dnd');
            $('attach_video_form').removeClass('dnd');
            $('attach_tumblr_form').addClass('dnd');
        }

        if (form == 'attach_photo_form') {
            //#show container
//            if ($('attach_canvas_main').hasClass('dnd'))
                $('attach_canvas_main').removeClass('dnd');
//            else
//                $('attach_canvas_main').addClass('dnd');

            //#show form
            $(form).removeClass('dnd');
            $('attach_song_form').addClass('dnd');
            $('attach_video_form').addClass('dnd');
            $('attach_link_form').addClass('dnd');
            $('attach_twitter_form').addClass('dnd');
            $('attach_tumblr_form').addClass('dnd');
        }
        if (form == 'attach_twitter_form') {
            //#show container
//            if ($('attach_canvas_main').hasClass('dnd'))
                $('attach_canvas_main').removeClass('dnd');
//            else
//                $('attach_canvas_main').addClass('dnd');

            //#show form
            $(form).removeClass('dnd');
            $('attach_song_form').addClass('dnd');
            $('attach_photo_form').addClass('dnd');
            $('attach_video_form').addClass('dnd');
            $('attach_link_form').addClass('dnd');
            $('attach_tumblr_form').addClass('dnd');
        }

        if (form == 'attach_tumblr_form') {
            //#show container
//            if ($('attach_canvas_main').hasClass('dnd'))
                $('attach_canvas_main').removeClass('dnd');
//            else
//                $('attach_canvas_main').addClass('dnd');

            //#show form
            $(form).removeClass('dnd');
            $('attach_song_form').addClass('dnd');
            $('attach_video_form').addClass('dnd');
            $('attach_photo_form').addClass('dnd');
            $('attach_twitter_form').addClass('dnd');
        }
    }
}

//#Loading label drop-downs upon request
function LabelDropDown(CategoryID) {
    var wjxDDL = new WADJAX('labels', { statusBar: false });
    var Hades = false;
    //#load once
    if ($(CategoryID + 'labelsDropdown').get('html').trim().length == 0)
        Hades = true;

    if (Hades) {
        $(CategoryID + 'labelsDropdown').set('html', '<div class=\"loadingDropdown\"><ul class="sub"><li><span class="loadingTop">&nbsp;</span></li></ul></div>');
        wjxDDL.send('GerLabelsDropdowns', profileInfo.ownerID, CategoryID, profileInfo.viewerID, function (res) {
            if (res.error) return;
            else {
                $(CategoryID + 'labelsDropdown').set('html', res.value)
                //#Attach autocomplete
                LabelsDropDown_Events();
                if ($(CategoryID + 'labelstextbox')) {
                    $(CategoryID + 'labelstextbox').focus();
                    $(CategoryID + 'labelstextbox').value = '';
                }

                //#Scrollbars
                // vertical scrollbar --
                // makeScrollbar($('scroll'+CategoryID), $('bar'+CategoryID), $('handle'+CategoryID));
            }
        });
    }

    //MylabelsDropdown
    //FollowlabelsDropdown
    //EverylabelsDropdown
}

function LabelsDropDown_Events() {
    //---------
    //#Handle main drop-downs automplete (My, Follow, Everyone)
    //#My
    if ($('Mylabelstextbox')) {
        var tempData = JSON.decode(jsHelper.cachedData.My);
        new Meio.Autocomplete.Select($('Mylabelstextbox'), tempData, {
            selectOnTab: false, 	//
            minChars: 0,  			// The minimum number of characters the user has to input before the list of options to select is shown. 
            maxVisibleItems: 10,    // Defines the height of the list. If its 10 the list will have its height adjusted to show 10 options, but you can scroll to the other of course.
            onSelect: function (elements, value) {
                $('ulLblMy').removeClass('dnd');
                //$('subAllMy').removeClass('dnd');
                if ($('subTrashMy'))
                    $('subTrashMy').removeClass('dnd');
                $('Mylabelstextbox').value = '';

                MyMenu.DropDown('Mylabels', 'inactiveMylabels', 'activeMylabels', 'MylabelsDropdown', '', '');
                //load feeds
                document.location.hash = '#!My/' + value.labelID + '/1';

            }, // this event is fired when you select an option 
            onDeselect: function (elements) {
                $('ulLblMy').addClass('dnd');
                //$('subAllMy').addClass('dnd');

                if ($('subTrashMy'))
                    $('subTrashMy').addClass('dnd');
                if ($('subNew')) {
                    $('subNew').addClass('dnd');
                }
            }, // this event is fired when you deselect an option
            onNoItemToList: function (elements) {
                elements.field.node.highlight('#ff0000');
                $('ulLblMy').addClass('dnd');
                //$('subAllMy').addClass('dnd');
                //if ($('subTrashMy'))
                //    $('subTrashMy').removeClass('dnd');

                if ($('subNew')) {
                    $('subNew').removeClass('dnd');
                    $('subNewtext').set('html', '' + $('Mylabelstextbox').get('value'));
                }
            },
            filter: {
                type: 'contains',
                path: 'labelName'
            }/*,
            listOptions: {
                width: 300
            }*/
        }, autocompleteValues);
    }
    //#Follow
    if ($('Followlabelstextbox')) {
        var tempFData = JSON.decode(jsHelper.cachedData.Follow);
        new Meio.Autocomplete.Select($('Followlabelstextbox'), tempFData, {
            selectOnTab: false, 	//
            minChars: 0,  			// The minimum number of characters the user has to input before the list of options to select is shown. 
            maxVisibleItems: 10,    // Defines the height of the list. If its 10 the list will have its height adjusted to show 10 options, but you can scroll to the other of course.
            onSelect: function (elements, value) {
                $('ulLblFollow').removeClass('dnd');
                //$('subAllFollow').removeClass('dnd');
                $('Followlabelstextbox').value = '';
                MyMenu.DropDown('Followlabels', 'inactiveFollowlabels', 'activeFollowlabels', 'FollowlabelsDropdown', '', '');
                //load feeds
                document.location.hash = '#!Follow/' + value.labelID + '/1';
            }, // this event is fired when you select an option 
            onDeselect: function (elements) {
                $('ulLblFollow').addClass('dnd');
                //$('subAllFollow').addClass('dnd');
            }, // this event is fired when you deselect an option
            onNoItemToList: function (elements) {
                elements.field.node.highlight('#ff0000');
                $('ulLblFollow').removeClass('dnd');
                //$('subAllFollow').removeClass('dnd');
            },
            filter: {
                type: 'contains',
                path: 'labelName'
            },
            category: 'Follow'
        }, autocompleteValues);
    }
    //#Everyone
    if ($('Everylabelstextbox')) {

        var tempEData = JSON.decode(jsHelper.cachedData.Every);
        new Meio.Autocomplete.Select($('Everylabelstextbox'), tempEData, {
            selectOnTab: false, 	//
            minChars: 0,  			// The minimum number of characters the user has to input before the list of options to select is shown. 
            maxVisibleItems: 10,     // Defines the height of the list. If its 10 the list will have its height adjusted to show 10 options, but you can scroll to the other of course.
            onSelect: function (elements, value) {
                $('ulLblEvery').removeClass('dnd');
                //$('subAllEvery').removeClass('dnd');
                $('Everylabelstextbox').value = '';
                MyMenu.DropDown('Everylabels', 'inactiveEverylabels', 'activeEverylabels', 'EverylabelsDropdown', '', '');
                //load feeds
                document.location.hash = '#!Every/' + value.labelID + '/1';
                //hide menu


            }, // this event is fired when you select an option 
            onDeselect: function (elements) {
                $('ulLblEvery').addClass('dnd');
                //$('subAllEvery').addClass('dnd');

            }, // this event is fired when you deselect an option
            onNoItemToList: function (elements) {
                elements.field.node.highlight('#ff0000');
                $('ulLblEvery').removeClass('dnd');
                // $('subAllEvery').removeClass('dnd');
            },
            filter: {
                type: 'contains',
                path: 'labelName'
            }
        }, autocompleteValues);
    }
}
function BitLy(s) {
    if (s.indexOf('imgYouTube') > 0)
        return s; ///exclude feed content
    else {
        var initialString = s;
        var myregexp = new RegExp(/((((https?)|(ftps?)):\/\/)|(www.))[a-zA-Z0-9+&@#\/%=~\-_|$?!:.,\Z]+[.][a-zA-Z0-9+&@#\/%=~\-_|$?!:.,\Z]*[a-zA-Z0-9/]+/ig);
        var result = '';         // my match (valid url)

        var finalString = ''; //initialString;
        var temp = '';
        var startPoint = 0;
        var endPoint = 0;
        var tempString = '';
        var i = 0;
        var initialStringArray = initialString.split(' ');

        for (i = 0; i < initialStringArray.length; i++) {
            //result = myregexp.exec(initialStringArray[i]); 
            result = initialStringArray[i].match(myregexp);

            if (result != null) {
                temp = result[0].substring(0, 4).toLowerCase(); // check if http exists at start of result[0], if not add it to the url
                startPoint = initialStringArray[i].indexOf(temp, 0);
                tempString = initialStringArray[i].substring(startPoint - 6, startPoint);
                var tmp = '';
                if (tempString != 'href=\"') {
                    if (temp == 'http') {
                        tmp = result[0];
                    }
                    else {
                        tmp = 'http://' + result[0];
                    }
                    BitlyClient.shorten(tmp, 'BitlyCB.myShortenCallback');
                }
            }
        }
    }
}
//#Load Labels-My,Follow,Every
var GetLabelistData = {
    My: function () {
        var wjxGetData = new WADJAX('labels', { statusBar: false });
        try {
            wjxGetData.send('GetLabelsListData', profileInfo.ownerID, 'My', profileInfo.viewerID, function (res) {
                if (res.error) return;
                else {
                    jsHelper.cachedData.My = res.value;
                }
            });
        }
        catch (Error) { alert('load data: ' + Error); }
    },
    MyViewer: function () {//#for plust label when on other profiles
        var wjxGetData = new WADJAX('labels', { statusBar: false });
        try {
            wjxGetData.send('GetLabelsListData', profileInfo.viewerID, 'My', profileInfo.viewerID, function (res) {
                if (res.error) return;
                else {
                    jsHelper.cachedData.MyViewer = res.value;
                }
            });
        }
        catch (Error) { alert('load data: ' + Error); }
    },
    SEDropdown: function () {//#for plus label drop-down values
   
        if (profileInfo.isLoggedIn)
        {
            if (jsHelper.cachedData.SEDropdown=='')
            {
                var wjxGetData = new WADJAX('labels', { statusBar: false });
                try {
                    wjxGetData.send('GetSearchLabelsListUL', profileInfo.viewerID,profileInfo.ownerID, function (res) {
                        if (res.error) return;
                        else
                            jsHelper.cachedData.SEDropdown = res.value;
                           $('loadSearch').addClass('dnd');
                        if ($('wdul_load'))
                            $('wdul_load').destroy();
                        if ($('wdul_canvas'))
                            $('wdul_canvas').appendChild(new Element('ul', { 'id': 'wdul', 'html':jsHelper.cachedData.SEDropdown}));
                        ////autocomplete
                        bootloader.load('/user/pluslabel.js', function () {
                            search_autocomplete('ul#wdul');
                        });
                    });
                }
                catch (Error) { alert('load data: ' + Error); }
            }
            else
            {
                if ($('wdul_load'))
                    $('wdul_load').destroy();
                if ($('wdul_canvas'))
                    $('wdul_canvas').appendChild(new Element('ul', { 'id': 'wdul', 'html':jsHelper.cachedData.SEDropdown}));
                ////autocomplete
                bootloader.load('/user/pluslabel.js', function () {
                    search_autocomplete('ul#wdul');
                });
            }
        }
        else
        {
            ///do nothing
            if ($('wdul_load'))
                $('wdul_load').destroy();
            if ($('wdul_canvas'))
                $('wdul_canvas').appendChild(new Element('ul', { 'id': 'wdul', 'html':jsHelper.cachedData.SEDropdown}));
               
            
                /// Search sign-out on profile
                 ////autocomplete
                bootloader.load('/s3.scripts/classes/search.js', function () {  
                });
                ////autocomplete
                bootloader.load('/user/pluslabel.js', function () {
                search_autocomplete('ul#wdul');
                });

                
                
        }
    },
    PLDropdown: function (fID) {//#for plus label drop-down values
        var wjxGetData = new WADJAX('labels', { statusBar: false });
        try {
            wjxGetData.send('GetLabelsListUL', profileInfo.viewerID, 'My', profileInfo.viewerID, fID, function (res) {

                if (res.error) return;
                else
                    jsHelper.cachedData.PLDropdown = res.value;
            });
        }
        catch (Error) { alert('load data: ' + Error); }
    },
    Follow: function () {
        var wjxGetData = new WADJAX('labels', { statusBar: false });
        try {
            wjxGetData.send('GetLabelsListData', profileInfo.ownerID, 'Follow', profileInfo.viewerID, function (res) {
                if (res.error) return;
                else
                    jsHelper.cachedData.Follow = res.value;
            });
        }
        catch (Error) { alert('load data: ' + Error); }
    },
    FollowViewer: function () {
        var wjxGetData = new WADJAX('labels', { statusBar: false });
        try {
            wjxGetData.send('GetLabelsListData', profileInfo.viewerID, 'Follow', profileInfo.viewerID, function (res) {
                if (res.error) return;
                else
                    jsHelper.cachedData.FollowViewer = res.value;
            });
        }
        catch (Error) { alert('load data: ' + Error); }
    },
    Every: function () {
        var wjxGetData = new WADJAX('labels', { statusBar: false });
        try {
            wjxGetData.send('GetLabelsListData', profileInfo.ownerID, 'Every', profileInfo.viewerID, function (res) {
                if (res.error) return;
                else
                    jsHelper.cachedData.Every = res.value;
            });
        }
        catch (Error) { alert('load data: ' + Error); }
    }
}

//#Contacts
var Contacts = {
    Add: function (uID, wadjaID) {
    var addcc = new Facebox({
            title: T_LABELASCONTACT.replace('#X', wadjaID),
            message: '<div class=\"pad5\">' + wadjaID + ' ' + T_WILLADDED + '</div>',
            submitValue: T_ADDLABEL,
            submitFunction: function () {
                Contacts.AddEvent(uID, wadjaID);
                addcc.close();
            },
            cancelValue: T_CANCEL,
            cancelFunction: function () {
                addcc.close();
            }
        });
        addcc.show();
    },
    AddEvent: function (uID, wadjaID) {
        wjxContacts.send('AddContact', uID, function (res) {
            if (res.error) return;
            else {
                if (res.value == 'true') {
                    if ($('contacts_link'))
                    $('contacts_link').set('html', '');
                        //$('contacts_link').set('html', '<span onclick=\"javascript:Contacts.Remove(\'' + uID + '\', \'' + wadjaID + '\');">' + T_REMOVEFROMCONTACTS + '</span>');
                    if ($('contacts_link_about')) {
                        $('contacts_link_about').set('html', '<span onclick=\"javascript:Contacts.Remove(\'' + uID + '\', \'' + wadjaID + '\');" title=\"' + T_REMOVEFROMCONTACTS + '\">&nbsp;</span>');
                        $('contacts_link_about').addClass('checkediconabout');
                        $('contacts_link_about').removeClass('addiconabout');
                        }
                    if ($('add_remove_contact')) {
                        $('add_remove_contact').set('html', '<span title=\"' + T_REMOVECONTACT + '\" onclick="javascript:Contacts.Remove(\'' + uID + '\', \'' + wadjaID + '\');">&nbsp;</span>');
                        $('add_remove_contact').addClass('checkedicon');
                        $('add_remove_contact').removeClass('addicon');
                    }
                }
                else {
                    var classTitle = 'faceboxTitleRed';
                    var classBorder = 'faceboxRed';
                    privacyBox = new Facebox({
                        title: T_PRIVACY,
                        //message: '<div class="pad5">' + wadjaID + ' ' + T_HASSETPRIVACY_CONTACT + '  <br/><a href=\"javascript:SetTextBox(\'' + wadjaID + '\');privacyBox.close();Postsetfocus();\">' + T_CLICKHERELINK_MESSAGE + '</a> ' +   + '</div>',
                        message: '<div class="pad5">' + wadjaID + ' ' + T_HASSETPRIVACY_CONTACT + '  <br/><a href=\"javascript:SetTextBox(\'' + wadjaID + '\');privacyBox.close();Postsetfocus();\">' + T_CLICKHERELINK_TOMESSAGE + '</div>',
                        cancelValue: T_OK,
                        classNameTitle: classTitle,
                        classNameBorder: classBorder
                    });
                    privacyBox.show();
                    //Notify.alert('Privacy', '<div class="pad5">'+profileInfo.ownerWadjaID + ' has set privacy to not be labeled as a <b>#Contact</b>. <br/><a href=\"javascript:SetTextBox(\''+wadjaID+'\');parent.alertBox.close();\">Click here</a> to send a message to this person.</div>', 'Ok', 'red');

                }
            }
        });
    },
    Remove: function (uID, wadjaID) {

        var delcc = new Facebox({
            //title: 'Remove label contact from ' + wadjaID + '?',
            title: T_REMOVECONTACT,
            message: '<div class=\"pad5\">' + T_AREYOUWANTTOREMOVECONTACT + '</div>',
            submitValue: T_YESREMOVELABEL,
            submitFunction: function () {
                Contacts.RemoveEvent(uID, wadjaID);
                delcc.close();
            },
            cancelValue: T_CANCEL,
            cancelFunction: function () {
                delcc.close();
            }
        });
        delcc.show();
    },
    RemoveEvent: function (uID, wadjaID) {
        wjxContacts.send('RemoveContact', uID, function (res) {
            if (res.error) return;
            else {
                if (res.value == 'true') {
                    
                    $('contacts_link').set('html', '<span onclick="javascript:Contacts.Add(\'' + uID + '\', \'' + wadjaID + '\');">' + T_ADDTOCONTACTS + '</span>');
                     if($('contacts_link_about')) {
                        $('contacts_link_about').set('html', '<span onclick="javascript:Contacts.Add(\'' + uID + '\', \'' + wadjaID + '\');" title=\"' + T_ADDTOCONTACTS + '\">&nbsp;</span>');
                        $('contacts_link_about').removeClass('checkediconabout');
                        $('contacts_link_about').addClass('addiconabout');
                    }
                    $('add_remove_contact').set('html', '<span title=\"' + T_ADDCONTACT + '\"  onclick="javascript:Contacts.Add(\'' + uID + '\', \'' + wadjaID + '\');">&nbsp;</span>');
                    $('add_remove_contact').removeClass('checkedicon');
                    $('add_remove_contact').addClass('addicon');
                }
                else {
                    Notify.alert('Privacy', '<div class="pad5">' + wadjaID + ' ' + T_DOESNOTACCEPT + ' ' + wadjaID + '</div>', T_OK, 'red');
                }
            }
        });
    },
    AddFromSearch: function (contactWadjaID, contactDetailsID) {
        var addfc = new Facebox({
            title: '+ ' + T_ADDCONTACT,
            //title: 'Label ' + contactWadjaID + ' as Contact?',
            message: '<div class=\"pad5\">' + contactWadjaID + ' ' + T_WILLBEADDED + '</div>',
            submitValue: T_ADDLABEL,
            submitFunction: function () {
                Contacts.AddFromSearchEvent(contactDetailsID);
                addfc.close();
            },
            cancelValue: T_CANCEL,
            cancelFunction: function () {
                addfc.close();
            }
        });
        addfc.show();
    },
    AddFromSearchEvent: function (contactDetailsID) {
        wjxContacts.send('AddContact', contactDetailsID, true, function (res) {
            if (res.error) return;
            else {
                var contactWadjaID = res.value.split('s@p@l@t')[2];
                var contactID = res.value.split('s@p@l@t')[1];
                var oRes = JSON.decode(res.value.split('s@p@l@t')[0]);
                if (oRes == true) {
                    $('addContact_' + contactID).addClass('dndD');

                }

                else {
                    Notify.alert('Privacy', '<div class="pad5">' + contactWadjaID + ' ' + T_DOESNOTACCEPT + ' ' + contactWadjaID + '</div>', T_OK, 'red');
                }
            }
        });
    },
    ShowAddContactForm: function (email, mobile) {

        var contact_form = "";
        contact_form += '<div class=\"contact_form\"><div><span class=\"contact_info\">' + T_FIRSTNAME + '</span><input id=\"contact_firstname\" type=\"text\" class=\"textBoxSmall\" /></div>';
        contact_form += '<div><span class=\"contact_info\">' + T_LASTNAME + '</span><input id=\"contact_lastname\" type=\"text\" class=\"textBoxSmall\" /></div>';
        contact_form += '<div><span class=\"contact_info\">' + T_DATEOFBIRTH + '</span>';
        contact_form += '<select class=\"select\" id=\"contact_day\">';
        for (var d = 1; d <= 31; d++) {
            contact_form += '<option value=\"' + d + '\">' + d + '</option>';
        }
        contact_form += '</select> ';
        contact_form += '<select class=\"select\" id=\"contact_month\">';
        for (var m = 1; m <= 12; m++) {
            contact_form += '<option value=\"' + m + '\">' + m + '</option>';
        }
        contact_form += '</select> ';
        contact_form += '<select class=\"select\" id=\"contact_year\">';
        var year = new Date().getFullYear();
        for (var y = year; y >= year - 101; y--) {
            contact_form += '<option value=\"' + y + '\">' + y + '</option>';
        }
        contact_form += '</select></div>';

        contact_form += '<div><span class=\"contact_info\">' + T_GENDER + '</span>';
        contact_form += '<select class=\"select\" id=\"contact_gender\">';
        contact_form += '<option value=\"Male\">' + T_MALE + '</option><option value=\"Female\">' + T_FEMALE + '</option>';
        contact_form += '</select></div>';
        contact_form += '<div><span class=\"contact_info\">' + T_URL + '</span><input id=\"contact_url\" type=\"text\" class=\"textBoxSmall\" value=\"http://\" /></div>';
        contact_form += '<div><span class=\"contact_info\">' + T_EMAIL + '</span><input id=\"contact_email\" type=\"text\" class=\"textBoxSmall\" value=\"' + email + '\"/></div>';
        contact_form += '<div><span class=\"contact_info\">' + T_MOBILE + '</span><input id=\"contact_mobile\" type=\"text\" class=\"textBoxSmall\" value=\"' + mobile + '\"/></div>';


        var addcc = new Facebox({
            title: T_ADDCONTACT,
            message: contact_form,
            width: 560,
            submitValue: T_ADDCONTACT,
            submitFunction: function () {
                if (Contact.SaveNew())
                    addcc.close();
            },
            cancelValue: T_CLOSE,
            cancelFunction: function () {
                addcc.close();
            }
        });
        addcc.show();
    },
    EditContact: function (feedID) {

    }
}
//#Compose
function ToggleSenderID(action) {
    if (action == 0) {
        if (senderID == 0) {
            if (senderUID_number != '') {
                senderID = 1;
                $('compose_from_senderID').set('html', senderUID_number);
                wProfile.Compose.SetFrom(1, senderUID_number);
                senderUID_current = senderUID_number;
            }
            else {
                var vermob = new Facebox({
                    title: T_VERIFRYMOBILENUM,
                    message: '<div class=\"pad5\">' + T_PLEASEVERIFY + '</div>',
                    submitValue: T_OK,
                    submitFunction: function () {
                        window.location.href = '/account/mobile/';
                    },
                    cancelValue: T_CANCEL,
                    cancelFunction: function () {
                        vermob.close();
                    }
                });
                vermob.show();
            }
        }
        else {
            senderID = 0;
            $('compose_from_senderID').set('html', senderUID);
            wProfile.Compose.SetFrom(0, senderUID);
            senderID_number = senderUID;
        }
    }
    else if (action == 1) {
        //#When sending SMS
        $('compose_from_senderID_tip').removeClass('dnd');

    }
    else {
        $('compose_from_senderID_tip').addClass('dnd');
    }
}

//#Helper functions-Place below this line all "helper" functions and variables
var jsHelper = {
    handlePlusLabel:function(){
     GetLabelistData.PLDropdown('##');
    },
    pulse:function(){
         var pulseChkAjx = new WADJAX('misc', { statusBar: false });
                pulseChkAjx.send('pulseChkAjx', function (res) {
                   /* set cookie */
                    if (res.value=='false' &&profileInfo.isLoggedIn)
                       popcorn.open('pulse','<div class=\"pad10\">Oops! It seems that your session has expired. Click here <a href="/sessions/login.aspx">click here</a> to Sign in.</div>','Sign in','');
                   });
    },
    cook:function(elID,ckName,ckVal){
        if ($(elID))
        {
            $(elID).destroy();
            if (profileInfo.isLoggedIn)
            {
                if (ckVal=='')
                    ckVal=profileInfo.viewerID;
                var bakeryAjx = new WADJAX('misc', { statusBar: false });
                bakeryAjx.send('helpCookie',ckVal,ckName, function (res) {
                   /* set cookie */
                   });
            }
        }
      // $('arrowFeed').addClass('marB3');
    },
    handlePopcornWindows:function(){
            $$('.jspopcornwindow').each(function (element, index) {        
                if (element.get('id') != null) { 
                    var pc=element.get('id').replace('popcorn_','');
                    popcorn.close(pc);///#close all popup viewers
                }
            }
        );
    },
    refresh: function () {
        /* refresh drop-downs */
        GetLabelistData.My();
        GetLabelistData.Every();
        GetLabelistData.Follow();
        /* refresh all my labels */
        wProfile.Load(wProfile.Current.DetailsID, "My", 0, 1, true);
    },
    isNetworkUser: function () {
       ///?
    },
    likeButtons: function () {
     var  shareSOURCE=profileInfo.networkDomain.toLowerCase();
     var  shareTEXT='Type post or message here...';

     if (profileInfo.networkDomain.toLowerCase().indexOf('wadja.com')>=0)
        host_fb = profileInfo.networkDomain.toLowerCase().replaceAll('wadja.com','wadja.co');/* fb hack */
     
     host = profileInfo.networkDomain.toLowerCase();

    // var  shareURL = 'http://' + host + '/' + profileInfo.ownerWadjaID + '#!' + wProfile.Current.Category + '/' + wProfile.Current.LabelID + '/' + wProfile.Current.Page;
     var  shareURL = 'http://' + host + '/' + profileInfo.ownerWadjaID + '.' + gl_label_name;
     
    // var  shareURL_fb = 'http://' + host_fb + '/' + profileInfo.ownerWadjaID + '#!' + wProfile.Current.Category + '/' + wProfile.Current.LabelID + '/' + wProfile.Current.Page;
     
     var  shareURL_fb = 'http://' + host_fb + '/' + profileInfo.ownerWadjaID + '.' +  gl_label_name;
     
     if ($('share_twitter'))
     {
         $('share_twitter').set('href','http://twitter.com/intent/tweet?source='+shareSOURCE+'&text='+shareTEXT+'&url='+shareURL);
         $('share_facebook').set('href','http://www.facebook.com/sharer.php?u='+shareURL_fb);
         $('share_linkedin').set('href','http://www.linkedin.com/shareArticle?summary=&url='+shareURL+'&source='+shareSOURCE+'&title='+shareTEXT+'&mini=true');
         $('share_stumbleupon').set('href','http://www.stumbleupon.com/submit?url='+shareURL);
         //$('share_buzz').set('href','http://www.google.com/buzz/post?url='+shareURL);
         //$('share_email').set('href','mailto:mailto:?subject='+shareTEXT+'&amp;body='+shareURL);
     }
    },
    //#Handles logo link
    logolink: function () {
        if ($('home_logo')) {
            $('home_logo').set('href', '/');
        }
    },
    //#Handle message attachments:Text, Youtube, Photos, Links, Twitter, SMS
    attachments: function () {
    if ($('link_attach_link')) {
            $('link_attach_link').addEvent('click', function (event) {
                attachCanvas.link();
            });
        }
        if ($('text_attach')) {
            $('text_attach').addEvent('click', function (event) {
                attachCanvas.toggle('close');
            });
        }

        if ($('attach_link_button')) {
            $('attach_link_button').addEvent('click', function (event) {
                attachCanvas.linkaction();
            });
        }

        if ($('attach_link_value')) {
            $('attach_link_value').addEvents({
                'focus': function (e) {
                    if ($('attach_link_value').get('value').trim() == 'http://') {
                        $('attach_link_value').set('value', '');
                        $('attach_link_value').removeClass('grayColor');
                    }
                    else {
                        $('attach_link_value').removeClass('grayColor');
                    }
                },
                'blur': function (e) {
                    if ($('attach_link_value').get('value').trim() == '') {
                        $('attach_link_value').set('value', 'http://');
                        $('attach_link_value').addClass('grayColor');
                    }
                }
            });
        }

        if ($('link_attach_song')) {
            $('link_attach_song').addEvent('click', function (event) {
                attachCanvas.song();
            });
        }

        if ($('attach_song_button')) {
            $('attach_song_button').addEvent('click', function (event) {
                attachCanvas.SearchSongs();
            });
        }

         if ($('twitter_checkbox')) {
            $('twitter_checkbox').addEvent('click', function (event) {
                jsHelper.handleTwitterCon(); //!Handle twitter connections
                event.preventDefault();
                attachCanvas.twitter();

            });
        }

         if ($('tumblr_checkbox')) {
            $('tumblr_checkbox').addEvent('click', function (event) {
                jsHelper.handleTumblrCon(); //!Handle tumblr connections
                event.preventDefault();
                attachCanvas.tumblr();
                return false;
            });
        }

//        if ($('link_attach_twitter')) {
//            $('link_attach_twitter').addEvent('click', function (event) {
//                attachCanvas.twitter();
//            });
//        }

//         if ($('link_attach_tumblr')) {
//            $('link_attach_tumblr').addEvent('click', function (event) {
//                attachCanvas.tumblr();
//            });
//        }

        if ($('link_attach_youtube')) {
            $('link_attach_youtube').addEvent('click', function (event) {
                attachCanvas.youtube();
            });
        }

        if ($('attach_youtube_button')) {
            $('attach_youtube_button').addEvent('click', function (event) {
                attachCanvas.youtubeaction();
            });
        }

        /*
        if ($('link_attach_photo') && wProfile.Current.DetailsID == profileInfo.viewerID) {
        $('link_attach_photo').addEvent('click', function (event) {
        attachCanvas.photos();
        });
        }
        if ($('link_attach_sms') && wProfile.Current.DetailsID == profileInfo.viewerID) {
        $('link_attach_sms').addEvent('click', function (event) {
        attachCanvas.sms();
        });
        }
        if ($('link_attach_location') && wProfile.Current.DetailsID == profileInfo.viewerID) {
        $('link_attach_location').addEvent('click', function (event) {
        attachCanvas.location();
        });
        }
        */
        if ($('attach_canvas_close')) {
            $('attach_canvas_close').addEvent('click', function (event) {
                attachCanvas.toggle('close')
            });
        }
        //#Open pop-up window for sharing photos
        if ($('link_attach_photo') && wProfile.Current.DetailsID == profileInfo.viewerID) {
            $('link_attach_photo').removeClass('dnd');
            $('link_attach_photo').addEvent('click', function (event) {
                /*PicFB = new Facebox({
                url: '/user/views/upload.aspx?noprofilepic=0',
                width: 400,
                height: 200,
                title: 'Attach a photo to this post',
                submitValue: 'Attach',
                submitFunction: function () {
                Notify.spinnerOn("Loading...", "Still loading...", 5);
                $i('framePhotoUpload').getElementById('formPhotoUpload').submit();
                },
                cancelValue: 'Cancel',
                cancelFunction: function () {
                PicFB.close();
                }
                });
                PicFB.show();*/
                //#use frame
                attachCanvas.atphoto();

            });
        }
        // attach youtube link when no feeds
        if ($('attach_youtube_nofeeds')) {
            $('attach_youtube_nofeeds').addEvent('click', function (event) {
                attachCanvas.youtube();
            });
        }
        // upload pic when no feeds
        if ($('upload_pic_nofeeds')) {
            $('upload_pic_nofeeds').addEvent('click', function (event) {
                attachCanvas.atphoto();

            });
        }
        //---------
        // change pic when no feeds
        if ($('change_pic_nofeeds')) {
            $('change_pic_nofeeds').addEvent('click', function (event) {
                PicFB = new Facebox({
                    url: '/user/views/upload.aspx',
                    width: 400,
                    height: 200,
                    title: T_CHANGEPROPIC,
                    submitValue: T_UPLOAD,
                    submitFunction: function () {
                        Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
                        $i('framePhotoUpload').getElementById('formPhotoUpload').submit();
                    },
                    cancelValue: T_CANCEL,
                    cancelFunction: function () {
                        PicFB.close();
                    }
                });
                PicFB.show();
            });
        }
    },
    handleNotifications: function(){
        ///#NOTIFICATIONS
        if (typeof (profileInfo) !== 'undefined' && profileInfo.isLoggedIn) {
            if ($('head_notifications_counter')) {
                //Get new notifications every 30 sec!
                /*
                Temporary disable notifications
                ---
                clearInterval(notificationsTimer);
                notificationsTimer = setInterval(function () {
                    notificationsAlerts.update();
                }, 30 * 1000);

                */
            }
        }
        else {
            if ($('head_notifications_counter')) {
                $('head_notifications_counter').addClass('dndD');
            }
            if ($('head_notifications_counter_pop')) {
                $('head_notifications_counter_pop').addClass('dndD');
            }
        }
    },
    //#Handle new feeds bar-events e.t.c
    handlePushfeedbar: function () {
        if ($('aNewFeeds')) {
            $('aNewFeeds').addEvent('click', function (event) {
                //old line:new Fx.Reveal($('aNewFeeds'), { duration: 500 }).dissolve();
                //new line below-
                $('aNewFeeds').addClass('dnd');

                if ($('head_notifications_dropdown_feeds')) {
                    $('head_notifications_dropdown_feeds').addClass('dndD');
                    if ($('head_notifications_dropdown_message')) {
                        if ($('head_notifications_dropdown_message').hasClass('dndD'))
                            $('head_notifications').addClass('dnd');
                    }
                    else
                        $('head_notifications').addClass('dnd');
                }
                wProfile.Render.Start(wProfile.Helper.Pending, true);
            });
        }
    },
    //#Handle compose form send button-events e.t.c
    handleSendButton: function () {
        if ($('profile_compose_send')) {
            $('profile_compose_send').addEvents({
                'click': function () {
                    feedActions.composeOff();
                    try {
                        var countBodyCharacters = maxchar - $('txtBodyHTML5').get('value').length;
                        if (countBodyCharacters < 0) {
                            Notify.alert(T_MANYCHARACTERS, T_MANYCHARACTERSMESSAGE.replace('#X', maxchar), T_OK, '');
                            return;
                        }
                        else{
                        
                        }
                    }
                    catch (jsErr) {
                        /// Javascript error message
                        Notify.alert('Ooops!', T_OOPSMESSAGE, T_OK, 'red');
                        return;
                    }

                    try {
                        /// Send/Post messages and feeds
                        wProfile.Compose.Send();
                    }
                    catch (jsError) {
                        /// Javascript error message
                        Notify.alert('Javascript error', 'Javascript error while using [send button] #' + jsError, T_OK, 'red');
                    }
                },
                'mousedown': function () {
                    /// Set button style active-clicked
                    $(this.id).addClass('btn_active_submit');
                },
                'mouseup': function () {
                    /// Set button style back to active
                    $(this.id).removeClass('btn_active_submit');
                }
            });
        }
    },
    //#Handle twitter icon-show/hide
    handleTwitterButton: function () {
        if ($('CCDv') && profileInfo.viewerID == profileInfo.ownerID) {
            $('CCDv').removeClass('dnd');
        }
    },
    //#Handle wadja thinking
    handleWadjaThinking: function () {
        if ($('txtTo')) {
            $('txtTo').addEvent('keyup', function (event) {
                wProfile.Compose.Type(event);
            });
            $('txtTo').addEvent('focus', function (event) {
                showAutocompleteBubble = true;
                //disabled: $('autocomplete_tip_bar').removeClass('dnd');
                if ($('txtTo')) {
                    if ($('txtTo').hasClass('type_message')) {
                        $('txtTo').removeClass('type_message');
                        // Ariana - add span
                        //$('txtTo').removeClass('type_message_post');
                        $('txtTo').removeClass('dnd');
                        $('spnTo').addClass('dnd');

                        $('txtTo').value = '';
                    }
                    else {
                        $('txtTo').setCaretPosition('end');
                        // Ariana - add span
                        //$('txtTo').removeClass('type_message_post');
                        $('txtTo').removeClass('dnd');
                        $('spnTo').addClass('dnd');

                        //if ($('txtTo').value != '')
                        //    wjxShhProfile.send('WdjThnk', $('txtBodyHTML5').get('value'), $('txtTo').value, wProfile.Compose.WadjaThinking);
                    }
                    if($('composeResetTxtTo'))
                        $('composeResetTxtTo').removeClass('dndD');
                    if($('composeClearTxtTo'))
                        $('composeClearTxtTo').removeClass('dndD');
                    if($('txtTo_edit'))
                        $('txtTo_edit').addClass('dnd');
                }
            });

            $('txtTo').addEvent('blur', function (event) {
                if ($('txtTo') && $('txtTo').value.trim() == '') {
                    $('txtTo').addClass('type_message');
                    $('txtTo').value = T_TYPEOR;
                    $('autocomplete_tip_bar').addClass('dnd');
                }
                //disabled:ComposeOverlay.Hide();
            });
        }
        if ($('txtBodyHTML5')) {
            $('txtBodyHTML5').addEvent('keyup', function (event) {
                wProfile.Compose.BodyType(event);
            });
           
            $('txtBodyHTML5').addEvent('focus', function (event) {
                if ($('txtBodyHTML5')) {
                    if ($('txtBodyHTML5').hasClass('type_message')) {
                        $('txtBodyHTML5').removeClass('type_message');
                        //$('footer_textarea').removeClass('dnd');
                        $('txtBodyHTML5').set('value', '');
                        $('txtBodyHTML5').setStyle('height', '46px');
                        //$('txtBody_tools').removeClass('dnd');
                        //RandomLabelsObj.barOff();
                    }
                    else {
                        $('txtBodyHTML5').setCaretPosition('end');
                        //$('footer_textarea').removeClass('dnd');
                    }
                }
            });
            /*
            $('txtBodyHTML5').addEvent('blur', function (event) {
            if ($('txtBodyHTML5') && $('txtBodyHTML5').get('value').trim() == '') {
            $('txtBodyHTML5').addClass('type_message');
            $('txtBodyHTML5').set('value',T_CLICKHERETOTYPEYOURMESSAGE);
            $('txtBodyHTML5').setStyle('height', '16px');
            $('txtBody_x').addClass('dnd');
            }
            });
            */
        }
    },
    //#Handle search requests
    handleSearch: function () {
        var qString = window.location.search.substring(1); 	//!For search
        var qsValues = qString.parseQueryString(); 		//!For search
        //---------
        if (qsValues.searchFor != null && qsValues.searchFor.length > 0) {
            wProfile.Search(qsValues.searchType, qsValues.searchFor);
        }
    },
    //#Handle external feeds-from third party APIs
    handleExternalFeeds: function () {
       GetExternalFeeds.periodical(121000); /* Every 2 min */
    },
    handleOnlineFollowers: function(){
        GetLabelFollowers_Online_pulse.periodical(60000);
    },
    //#Handle compose form autosuggest
    handleAutosuggest: function () {
        if (profileInfo.isLoggedIn) {
            ///(function () {
                var autcomp = new WADJAX('User', { statusBar: false });    
                autcomp.send('Autocomp', function (res) {
                    wProfile.Compose.AutoSuggest.Results = JSON.decode(res.value);
                    
                    if ($('compose_loading'))
                        $('compose_loading').addClass('dnd');
                });
            ///}).delay(5 * 1000);
        }
    },
    //#Handle compose form autosuggest-search
    handleAutosuggestSearch: function () {
      GetLabelistData.SEDropdown();
        //#-end of plus label ------------------------------
    },
    //#Handle tumblr connections
    handleTumblrCon: function () {
        ///load tumblr connection
        if ($('TumblrList') && profileInfo.viewerID == profileInfo.ownerID) {
             bootloader.load('/s3.scripts/classes/tumblrcon.js', function () { 
                //load tumblr connections from external js-class
            });
        }
    },
    //#Handle twitter connections
    handleTwitterCon: function () {
        ///load twitter connections
        if ($('TwitterList') && profileInfo.viewerID == profileInfo.ownerID) {
             bootloader.load('/s3.scripts/classes/twittercon.js', function () { 
                //load twitter connections from external js-class
            });
        }
    },
    //#Handle label dropdowns-autocomplete
    handleLabelDropdowns: function () {
        //#load My data-once ondomready
        if (jsHelper.cachedData.My.trim() == '')
            GetLabelistData.My();

        if (jsHelper.cachedData.Every.trim() == '')
            GetLabelistData.Every();

        if (jsHelper.cachedData.Follow.trim() == '')
            GetLabelistData.Follow();
    },
    //#Handle scroll load more
    handleScrollMore:function(){
        scrollmorejs.listentoscroll(); 
    },
    //#Handle first time feeds
    handleStart: function () {
        if (isDomReady && !document.location.hash.Contains('!')) {
            //#star from #home
            wProfile.Load(wProfile.Current.DetailsID, "My", 0, 1, true);
        }
    },
    //#Stores label's dropdown values for autocomplete ondomready
    cachedData: {
        My: '',
        MyViewer: '',
        PLDropdown: '', //#li values of the plus label drop-down
        SEDropdown: '',//#li values for search
        Follow: '',
        FollowViewer: '',
        Every: ''
    },
    //#Resend email verfication
    ResendConfirm: function () {
        try {
            Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
            oWUser.send('ResendConfirmation', function (res) {
                Notify.spinnerOff(T_DONE, 1);
                Notify.topBarOn(res.value, '', 6);
            });
        }
        catch (Error) {
            Notify.alert('Javascript error', '<div class="pad10">ResendConfirm, #error:' + Error + '</div>', 'Ok', 'red');
        }
    },
    //#Set dropdowns active-My, Follow, Every
    handleDropDowns: function () {
        //#Make active/inactive accordingly
        $$('.labelDDL').each(function (element, index) {
            if (element.get('id').toLowerCase().indexOf(wProfile.Current.Category.toLowerCase()) >= 0)
                $(element.get('id')).addClass('top-sel');
            else
                $(element.get('id')).removeClass('top-sel');
        });

        //#Make active/inactive the all labels icon
        $$('.iconLbl').each(function (element, index) {
            if (element.get('id').toLowerCase().indexOf(wProfile.Current.Category.toLowerCase()) >= 0) {
                $(element.get('id')).addClass('all_labels_active');
                $(element.get('id')).removeClass('all_labels_icon');
            }
            else {
                $(element.get('id')).removeClass('all_labels_active');
                $(element.get('id')).addClass('all_labels_icon');
            }
        });

        if (wProfile.Current.Category == 'My') {
            if (profileInfo.profileBelongsToViewer) {
                $('dvFilters').removeClass('dnd');
                $('dvFilters_sender').removeClass('dnd');
            }
            else
            {
                if ($('dvFilters_sender'))
                    $('dvFilters_sender').addClass('dnd');
            }
        }
        //#stopped:else
        //#stopped:$('dvFilters').addClass('dnd'); 
    },
    //#Handle custom profile settings
    handleCustomprofiles: function () {
        if (profileInfo.ownerWadjaID == 'wadja') {
            //#hides drop-downs My, Follow, Every
            if ($('Mylabels'))
                $('Mylabels').addClass('dnd'); $('Followlabels').addClass('dnd'); $('spaceFollowlabels').addClass('dnd'); $('Everylabels').addClass('top-sel');
            //$('Followlabels_all').addClass('dnd'); $('Mylabels_all').addClass('dnd');
        }
    },
    //#Reset search elements
    resetSearchElements: function () {
        $('srch_feeds').empty(); $('srch_labels').empty(); $('srch_users').empty(); $('srch_web').empty(); $('master_feeds_container').removeClass('dnd'); $('search_feeds_container').addClass('dnd'); $('dvFilters_search').addClass('dnd');
    },
    //#Reset filters
    resetFilters: function () {
//        if ($('privacyicon_1'))
//            $('privacyicon_1').set('class', 'tofromImageDr');
        wProfile.Current.Filter = 0;
    }
}

/* String Prototype Overrides */
String.prototype.replaceAll = function (s, r) { return (r === undefined ? this : this.split(s).join(r)); } /* Replace all instances in String */

//#Handles Contact functions
var Contact = {
    Save: function (contactID) {
        var firstname = '';
        var lastname = '';
        var url = '';
        var email = '';
        var mobile = '';
        var gender = '';
        var dob;
        if ($('contact_firstname_' + contactID))
            firstname = $('contact_firstname_' + contactID).value;
        if ($('contact_lastname_' + contactID))
            lastname = $('contact_lastname_' + contactID).value;
        if ($('contact_url_' + contactID))
            url = $('contact_url_' + contactID).value;
        if ($('contact_email_' + contactID))
            email = $('contact_email_' + contactID).value;
        if ($('contact_mobile_' + contactID))
            mobile = $('contact_mobile_' + contactID).value;
        if ($('contact_day_' + contactID) && $('contact_month_' + contactID) && $('contact_year_' + contactID)) {
            dob = $('contact_year_' + contactID).value + '/' + $('contact_month_' + contactID).value + '/' + $('contact_day_' + contactID).value;
        }
        if ($('contact_gender_' + contactID))
            gender = $('contact_gender_' + contactID).value;
        wjxContacts.send('Update', contactID, firstname, lastname, email, dob, gender, mobile, url, function (res) {
            if (res.error != null) return;

            var oRes = JSON.decode(res.value);
            if (oRes.DetailsID > 0) {
                Notify.topBarOn(T_YOURCONTACTHASBEEN, '', 5);

                var feedText = '';
                var location = '&nbsp;-&nbsp;' + oRes.Location.LocationString;
                var name = oRes.Name;

                var m = oRes.Birthday.match(/^\/Date\(([-+])?(\d+)([-+]\d\d)?(\d\d)\)\/$/);
                var date = null;
                if (m) {
                    var sign = 1;
                    if (m[1] != undefined && m[1] == '-')
                        sign = -1;
                    var timestamp = m[2];
                    var timezone = 0;
                    if (m[3] == undefined)
                        timestamp += m[4];
                    else
                        timezone = 3600000 * m[3] + 60000 * m[4]
                    var dt = sign * timestamp + timezone;
                    //date = new Date(dt).format('%B %d, %Y');
                    date = new Date(dt);
                    var m_names = new Array(T_JAN, T_FEB, T_MAR,
                        T_APR, T_MAY, T_JUN, T_JUL, T_AUG, T_SEP,
                        T_OCT, T_NOV, T_DEC);
                    var dateMonth = m_names[date.getMonth()];
                    var stringDate = dateMonth + ' ' + date.getDate() + ', ' + date.getFullYear();
                }

                var born = '&nbsp;-&nbsp;' + stringDate;
                var url = '';
                if (oRes.URL != null)
                    url = '&nbsp;-&nbsp;' + wProfile.Render.Links(oRes.URL);

                var email = '';
                if (email != null && email.length != 0)
                    feedText = '<span class=\" \">' + name + '</span><span class=\" \">' + born + '</span><span class=\"\">' + location + '</span><span class=\" \">' + url + '</span><span class=\"\">&nbsp;-&nbsp;<a href=\"' + email + '\" target=\"_blank\">' + email + '</a></span>';
                else
                    feedText = '<span class=\" \">' + name + '</span><span class=\" \">' + born + '</span><span class=\"\">' + location + '</span><span class=\" \">' + url + '</span>';
                if ($('spnText' + oRes.DetailsID))
                    $('spnText' + oRes.DetailsID).set('html', feedText);
                if ($('thumb_text_v_' + oRes.DetailsID))
                    $('thumb_text_v_' + oRes.DetailsID).set('html', feedText);
                if ($('thumb_text_' + oRes.DetailsID))
                    $('thumb_text_' + oRes.DetailsID).set('html', feedText);
            }
        });
    },

    SaveNew: function () {
        var firstname = '';
        var lastname = '';
        var url = '';
        var email = '';
        var mobile = '';
        var gender = '';
        var dob;
        if ($('contact_firstname'))
            firstname = $('contact_firstname').value;
        if ($('contact_lastname'))
            lastname = $('contact_lastname').value;
        if ($('contact_url'))
            url = $('contact_url').value;
        if ($('contact_email'))
            email = $('contact_email').value;
        if ($('contact_mobile'))
            mobile = $('contact_mobile').value;
        if ($('contact_day') && $('contact_month') && $('contact_year')) {
            dob = $('contact_year').value + '/' + $('contact_month').value + '/' + $('contact_day').value;
        }
        if ($('contact_gender'))
            gender = $('contact_gender').value;

        if (email == '') {
            Notify.topBarOn(T_YOUMUSTFILLYOUREMAIL, '', 5);
            return false;
        }

        wjxContacts.send('CreateContact', firstname, lastname, email, dob, gender, mobile, url, function (res) {
            if (res.error != null) return;

            var contactId = JSON.decode(res.value);
            if (contactId != "" && contactId > 0) {
                Notify.topBarOn(T_ANEWCONTACT, '', 5);
            }
        });

        return true;
    }
}

//#used by the compose form for counting rows
function countLines(strtocount, cols) {
    var text = strtocount.replace(/\s+$/g, "");
    var split = text.split("\n");
    return split.length;
}

//#Group drop-downs
var group = {
    label: function (labelID) {
        $('group_' + labelID).toggleClass('groupDown');
        $('group_' + labelID).toggleClass('groupUp');

        $$('.grouplist_' + labelID).each(function (element, index) {
            $(element.get('id')).toggleClass('dndD');
        });
        return;
    }
}


//#used by the get this conversation started form for posting a message
function firstPost() {
    if ($('txtTo')) {
        $('txtTo').removeClass('dndD');
        setTxtBodyText();
    }
    if ($('txtBodyHTML5')) {
        $('txtBodyHTML5').focus();
    }
}
function Postsetfocus() {
    if ($('txtBodyHTML5')) {
        $('txtBodyHTML5').focus();
    }
}

//switch view when on Card profile - Photos
// Remove thumb view - Ariana
//function SwitchViewPhotos(view) {
//$('dvView').removeClass('dnd');
//   UIView = view;
//    if (view == 0) {
//            $('thumbview').removeClass('dnd');
//            $('listview').addClass('dnd');
//    }
//    else {
//            $('listview').removeClass('dnd');
//            $('thumbview').addClass('dnd');
//    }

//    top.location.href = '/'+profileInfo.ownerWadjaID+'#!My/11/1';
//}
//#switch between views
//function SwitchView(view) {
//    UIView = view;
//    if (view == 0) {
//            $('thumbview').removeClass('dnd');
//            $('listview').addClass('dnd');
//    }
//    else {
//           
//            $('listview').removeClass('dnd');
//            $('thumbview').addClass('dnd');          
//    }
//    // #reload content in different view

//    var hash = (location.href.indexOf('#') == -1 ? '' : location.href.substr(location.href.indexOf('#') + 1));
//    if (hash.indexOf('!search') == 0) {
//        var oQ = hash.substring(1).split('?');
//        var qsValues = oQ[1].parseQueryString();
//        //set search filters
//        var filterID = '';
//        switch (qsValues.searchType.toLowerCase()) {
//            case '':
//            case 'feeds':
//                filterID = 'filter_search_all';
//                break;
//            case 'contacts':
//                filterID = 'filter_search_people';
//                break;
//            case 'labels':
//                filterID = 'filter_search_labels';
//                break;
//        }
//        $(filterID).addClass('filter_on');
//        $(filterID).removeClass('filter_off');
//        //sfilter:no existent class, used by the js only
//        $$('.sfilter').each(function (element, index) {
//            var filters = element.get('id');
//            if (filterID.toLowerCase() != filters.toLowerCase()) {
//                $(filters).addClass('filter_off');
//                $(filters).removeClass('filter_on');
//            }
//        });
//        wProfile.Search(qsValues.searchType, qsValues.searchFor);
//    }
//    else if (hash.indexOf('!feed') == 0) {
//        var oQ = hash.substring(1).split('/');
//        wProfile.Feed(oQ[1]);
//    }
//    else {
//        wProfile.Load(wProfile.Current.DetailsID, wProfile.Current.Category, wProfile.Current.LabelID, 1, true);
//    }
//}

function NoFollowingPopUp() {
    var NoFollowingPop = new Facebox({
        title: T_FOLLOWLABEL,
        width: 520,
        height: 380,
        cancelValue: T_CANCEL,
        url: '/user/views/randomlabels.aspx'

    });
    NoFollowingPop.show();
}

function URLEncode(tweetURL) {
    // The Javascript escape and unescape functions do not correspond
    // with what browsers actually do...
    var SAFECHARS = "0123456789" + 				// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" + // Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()"; 				// RFC2396 Mark characters
    var HEX = "0123456789ABCDEF";
    var plaintext = tweetURL;
    var encoded = "";

    for (var i = 0; i < plaintext.length; i++) {
        var ch = plaintext.charAt(i);
        if (ch == " ") {
            encoded += "+"; 			// x-www-urlencoded, rather than %20
        } else if (SAFECHARS.indexOf(ch) != -1) {
            encoded += ch;
        } else {
            var charCode = ch.charCodeAt(0);
            if (charCode > 255) {
                /*
                alert( "Unicode Character '" 
                + ch 
                + "' cannot be encoded using standard URL encoding.\n" +
                "(URL encoding only supports 8-bit characters.)\n" +
                "A space (+) will be substituted." );
                encoded +=encodeURI(ch);*/
            } else {
                encoded += "%";
                encoded += HEX.charAt((charCode >> 4) & 0xF);
                encoded += HEX.charAt(charCode & 0xF);
            }
        }
    } // for
    return encoded;
};

var Url = {

    // public method for url encoding
    encode: function (string) {
        return escape(this._utf8_encode(string));
    },

    // public method for url decoding
    decode: function (string) {
        return this._utf8_decode(unescape(string));
    },

    // private method for UTF-8 encoding
    _utf8_encode: function (string) {
        string = string.replace(/\r\n/g, "\n");
        var utftext = "";

        for (var n = 0; n < string.length; n++) {

            var c = string.charCodeAt(n);

            if (c < 128) {
                utftext += String.fromCharCode(c);
            }
            else if ((c > 127) && (c < 2048)) {
                utftext += String.fromCharCode((c >> 6) | 192);
                utftext += String.fromCharCode((c & 63) | 128);
            }
            else {
                utftext += String.fromCharCode((c >> 12) | 224);
                utftext += String.fromCharCode(((c >> 6) & 63) | 128);
                utftext += String.fromCharCode((c & 63) | 128);
            }

        }

        return utftext;
    },

    // private method for UTF-8 decoding
    _utf8_decode: function (utftext) {
        var string = "";
        var i = 0;
        var c = c1 = c2 = 0;

        while (i < utftext.length) {

            c = utftext.charCodeAt(i);

            if (c < 128) {
                string += String.fromCharCode(c);
                i++;
            }
            else if ((c > 191) && (c < 224)) {
                c2 = utftext.charCodeAt(i + 1);
                string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
                i += 2;
            }
            else {
                c2 = utftext.charCodeAt(i + 1);
                c3 = utftext.charCodeAt(i + 2);
                string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
                i += 3;
            }

        }

        return string;
    }

}

// Remove suggested labels 07/12/2010 Ariana
//#suggest labels
//var wjxRandomLabels = new WADJAX('Labels', { statusBar: false });        //# - 
//var RandomLabelsObj = {
//    barOn: function()
//    {
//        
//        MyElement.reveal('suggestedLabels');
//    },
//    barOff: function()
//    {
//        $('suggestedLabels').addClass('dnd');
//        MyElement.dissolve('suggestedLabels');
//    },
//    load:function(num){   
//       wjxRandomLabels.send('GetRandomLabels', num, RandomLabelsObj.loadUI);
//    }, 
//    loadUI:function(res)
//    {   
//        if (res.error != null)  return;
//        else
//        {
//            var divUI=$('suggestedLabels_content');
//            var HTMLUIString='';
//            var RandomLabelList = JSON.decode(res.value);
//            for (i = 0; i < RandomLabelList.length; i++) {
//               if (i==0)
//                    HTMLUIString = HTMLUIString + "<span>"+T_SUGGESTED+":</span>";
//               HTMLUIString = HTMLUIString + '<a href="/'+RandomLabelList[i].OwnerWadjaID+'#!My/'+RandomLabelList[i].id+'/1" class=\"b_r pad3\">#'+RandomLabelList[i].name+'</a>';
//            } //-- end of random label list --
//            divUI.set('html',HTMLUIString + '<span>'+T_SPONSORED+':</span> <a href=\"/alex@wadja#!My/70285/1\" class=\"b_r pad3\">#Feedback</a> ');
//            RandomLabelsObj.barOn();
//        }
//        
//    },
//    remove: function(elementID){
//        RandomLabelsObj.load(1);
//    }
//}

//#EDIT Feed
//#Sources: L=list view, P=Pop-up view
var editFeed = {
    edit: function (fid, source) {
        var elNameText = '';
        var elNameForm = '';
        var elNameEdit = '';
        var textarea_edit = '';
        var heightText = '';

        if (source == 'L') {
            elNameText = 'spnText';
            elNameForm = 'spnTextForm';
            elNameEdit = 'spnText_edit';
            textarea_edit = 'textarea_edit';
            heightText = 'h1p';
        }
        else if (source == 'P') {
            elNameText = 'thumb_text_v_';
            elNameForm = 'thumb_text_v_form_';
            elNameEdit = 'thumb_text_v_edit_';
            textarea_edit = 'textarea_edit_pop';
            heightText = 'h1p';
        }
        else if (source == 'C') {
            elNameText = 'spnComment';
            elNameForm = 'spnCommentForm';
            elNameEdit = 'spnComment_edit';
            textarea_edit = 'textarea_edit_com';
            heightText = 'h10p';
        }

        if ($(elNameEdit + fid)) {
            editFeed.cancel(fid, source);
            return;
        }
        //#remove edit button
       // if($('feed_edit_'+fid))
       //    $('feed_edit_'+fid).addClass('editing');           
      //  if($('comment_edit_popup_'+fid))
      //     $('comment_edit_popup_'+fid).addClass('dndD');
        //#remove edit button
//        if ($('feed_edit_' + fid))
//            $('feed_edit_' + fid).destroy();

        var gBody = $(elNameText + fid).get('html');
        var getBODY = '';

        getBODY = gBody;
      
        getBODY = getBODY.replaceAll('<BR>', '\n');
        getBODY = getBODY.replaceAll('<br>', '\n');

        // for title
        getBODY = getBODY.replace('<h6>', '//');
        getBODY = getBODY.replace('</h6>', '//');
        getBODY = getBODY.replace('<H6>', '//');
        getBODY = getBODY.replace('</H6>', '//');

        //for emoticons update edit feed 
        getBODY = getBODY.replace(/(<img id=)(")*(emoXticons_\d+_\d+)(.)(\s+)(alt=)(")*/ig, "");
        getBODY = getBODY.toString().replace(/(")*( src=)(")*(?!http:\/\/goo\.gl)*(\w+)*?(\/s3.images\/emoticons\/emoticon-)(\d+\-\w+)(\.gif)(")*(\s)*(>)/ig, ""); 
       //for emoticons update edit feed -end
     

        getBODY = getBODY.stripTags();

        if (navigator.userAgent.indexOf('MSIE') > 0) {
       
          var prwto = new RegExp(/(<img id=)(emoXticons_\d+_\d+)(\s+)(alt=)/ig);
          var match1= getBODY.match(prwto);
        
          if(match1!=null)
          {
            getBODY = getBODY.replace(prwto, "");
          }
          getBODY = getBODY.toString().replace(/(")*( src=)(")*(?!http:\/\/goo\.gl)*(\w+)*?(\/s3.images\/emoticons\/emoticon-)(\d+\-\w+)(\.gif)(")*(\s)*(>)/ig, ""); 
        }

        var btnBody = new Element('textarea', { 'id': (elNameEdit + fid), 'class': 'f_l ' + textarea_edit, 'value': getBODY });
        btnBody.onfocus = new Function("editFeed.elastic('" + elNameEdit + fid + "')");
        btnBody.onkeyup = new Function("editFeed.elasticOnKeyUp('" + elNameEdit + fid + "')");

        //var btnUpdate=new Element('input', {'type': 'button','value':'Update', 'class':'f_r btn_submit marT5 marR2'});
        var btnUpdate = new Element('input', { 'type': 'button', 'value': T_UPDATE_FEED, 'class': 'f_r btn_submit marT5 marR10 ' });
        btnUpdate.onclick = new Function("editFeed.update('" + fid + "',\'" + source + "\')");

        $(elNameText + fid).addClass('dndD');
        $(elNameForm + fid).removeClass('dndD');
        $(elNameForm + fid).appendChild(btnBody);
        //$('spnTextForm'+fid).appendChild(new Element('span', {'class': 'clearboth h1p','html':'&nbsp;'}));
        $(elNameForm + fid).appendChild(btnUpdate);
        //$(elNameForm + fid).appendChild(new Element('a', { 'href': 'javascript:editFeed.cancel(' + fid + ',\'' + source + '\');', 'html': T_CANCEL_FEED, 'class': 'f_r marT10 padR5 f11' }));
        $(elNameForm + fid).appendChild(new Element('span', { 'onclick': 'javascript:editFeed.cancel(' + fid + ',\'' + source + '\');', 'html': T_CANCEL_FEED, 'class': 'marT5 f_r btn_submit marR5' }));
  
        $(elNameForm + fid).appendChild(new Element('div', { 'class': 'clearboth ' + heightText, 'html': '&nbsp;' }));


    },
    over: function (fid, source) {
        var elNameText = '';
        if (source == 'L')
            elNameText = 'spnText';
        else if (source == 'P')
            elNameText = 'thumb_text_v_';
        else if (source == 'C')
            elNameText = 'spnComment';

        $(elNameText + fid).setStyle('background-color', '#EDEFF4');
    },
    out: function (fid, source) {
        var elNameText = '';
        if (source == 'L')
            elNameText = 'spnText';
        else if (source == 'P')
            elNameText = 'thumb_text_v_';
        else if (source == 'C')
            elNameText = 'spnComment';

        $(elNameText + fid).setStyle('background-color', 'transparent');
    },
    update: function (fid, source) {
        var elNameText = '';
        var elNameForm = '';
        var elNameEdit = '';
        var elAjax = 'EditFeed';

        if (source == 'L') {
            elNameText = 'spnText';
            elNameForm = 'spnTextForm';
            elNameEdit = 'spnText_edit';
        }
        else if (source == 'P') {
            elNameText = 'thumb_text_v_';
            elNameForm = 'thumb_text_v_form_';
            elNameEdit = 'thumb_text_v_edit_';
        }
        else if (source == 'C') {
            elNameText = 'spnComment';
            elNameForm = 'spnCommentForm';
            elNameEdit = 'spnComment_edit';
            elAjax = 'EditComment';
        }

        var getBODY_new = $(elNameEdit + fid).get('value').replaceAll('\n', '<br>');
        var wjxUpdateFeed = new WADJAX('labels', { statusBar: false });

        if ($(elNameEdit + fid).get('value').trim().length > 5000) {
            Notify.alert('Too many characters', T_MANYCHARACTERSMESSAGE.replace('#X', $(elNameEdit + fid).get('value').trim().length), 'OK', 'red');
            return;
        }

        wjxUpdateFeed.send(elAjax, fid, getBODY_new, function (res) {
        
            if (res.error) return;
            else {
          
                 getBODY_new = parseemos(getBODY_new);   
          
                $(elNameText + fid).set('html', wProfile.Render.Links(getBODY_new));
                if (source == 'P') {
                    if ($('spnText' + fid))
                        $('spnText' + fid).set('html', wProfile.Render.Links(getBODY_new));

                    if ($('thumb_text_' + fid))
                        $('thumb_text_' + fid).set('html', wProfile.Render.Links(getBODY_new));
                }
                editFeed.cancel(fid, source);                
            }
        });
        //#add edit button
       // if($('feed_edit_'+fid))
        //   $('feed_edit_'+fid).removeClass('editing');
            if($('comment_edit_popup_'+fid))
           $('comment_edit_popup_'+fid).removeClass('dndD');
        //var editButton = new Element('a', { 'id': 'feed_edit_' + fid, 'href': 'javascript:editFeed.edit(\'' + fid + '\',\'L\');', 'class': 'dib hoverNounderline grayColor f_l', 'html':'&nbsp;&#183;&nbsp;<span class="applyEdit">'+T_EDITFEED+'</span>', 'title': T_EDITFEED });
        //$('spnText' + fid).appendChild(editButton);
    },
    cancel: function (fid, source) {
        var elNameText = '';
        var elNameForm = '';
        var elNameEdit = '';

        if (source == 'L') {
            elNameText = 'spnText';
            elNameForm = 'spnTextForm';
            elNameEdit = 'spnText_edit';
        }
        else if (source == 'P') {
            elNameText = 'thumb_text_v_';
            elNameForm = 'thumb_text_v_form_';
            elNameEdit = 'thumb_text_v_edit_';
        }
        else if (source == 'C') {
            elNameText = 'spnComment';
            elNameForm = 'spnCommentForm';
            elNameEdit = 'spnComment_edit';
        }

        $(elNameText + fid).removeClass('dndD');
        $(elNameForm + fid).addClass('dndD');
        $(elNameForm + fid).empty();

        //#add edit button
        if($('feed_edit_'+fid))
           $('feed_edit_'+fid).removeClass('dndD');
        if($('comment_edit_popup_'+fid))
        $('comment_edit_popup_'+fid).removeClass('dndD');
        //var editButton = new Element('a', { 'id': 'feed_edit_' + fid, 'href': 'javascript:editFeed.edit(\'' + fid + '\',\'L\');','style':'display:inline-block;', 'class': 'applyEdit', 'html': T_EDITFEED, 'title': T_EDITFEED });
        //$('spnText' + fid).appendChild(editButton);
    },
    elastic: function (boxID) {
        var tLines = countLines($(boxID).get('value').trim(), 10);
        var tChars = $(boxID).get('value').trim().length;

        if (tLines <= 1) {
            if (tChars > 84) {
                if ((Math.round(tChars / 84)) > 1)
                    $(boxID).setStyle('height', ((((Math.round(tChars / 84)) - 1) * 15) + 46) + 'px');
            }
            else
                $(boxID).setStyle('height', '46px');
        }
        else if (tLines > 1)
            $(boxID).setStyle('height', (((tLines - 1) * 15) + 46) + 'px');


    },
    elasticOnKeyUp: function (boxID) {
        clearTimeout(BodyEditTimeout);
        BodyEditTimeout = setTimeout(function () {
            editFeed.elastic(boxID);
        }, 150);
    }
}

///
function setOverlaysOff() {
    var alertBox = new Facebox({
        title: T_OVERLAY_TITLE,
        message: '<div class=\'pad10\'>' + T_OVERLAY_DISABLE + '</div>',
        cancelValue: T_CANCEL,
        submitFunction: function () {
            // AJAX Request -
            wjxMisc.send("SetOverlaysOff", function (res) {
                if (res.error) return;
                ViewerOvelraysOn = false;
            });
            // end of AJAX
            alertBox.close();
        },
        //ajaxErrorMessage: message to display when an ajax error occurs.
        //ajaxDelay: minimum time to display the loading message. (In milliseconds. Defaults to 0)
        submitValue: T_YES,
        submitFocus: T_NO//If true, the submit button will be focused. (Pressing enter will activate it)
    });
    alertBox.show();
}

function settxtBodyHTML5() {
    var selectedLabelID = parseInt(wProfile.Current.LabelID);
    if ($('txtBodyHTML5') && $('txtBodyHTML5').hasClass('type_message')) {
        if (selectedLabelID == 11 || mediaID != 0)
            $('txtBodyHTML5').value = T_CAPTIONPHOTO;
        else if (selectedLabelID == 13)
            $('txtBodyHTML5').value = T_CAPTIONVIDEO;
        else
            $('txtBodyHTML5').value = T_CLICKHERETOTYPEYOURMESSAGE;

    }
}

function setInLabelSearch() {
    var selectedLabelID = parseInt(wProfile.Current.LabelID);
    if ($('text_search') && selectedLabelID > 0) {

        var labelname = '';
        var res = null;
        if (wProfile.Current.Category == 'My' && jsHelper.cachedData.My != null) {
            res = JSON.decode(jsHelper.cachedData.My);

            if (res == null) return '';

            for (var i = 0; i < res.length; i++) {
                if (res[i].labelID == selectedLabelID) {
                    labelname = res[i].labelName;
                    $('text_search').value = '' + labelname.replaceAll(' ', '+') + ' ';
                    break;
                }
            }
        }
    }
    else {
        if($('text_search'))
            $('text_search').value = 'Search';
    }
}

function DeleteFeed(feedID) {
    // AJAX Request -
    wjxLabel.send('DeleteFeed', feedID, function (res) {
        Notify.spinnerOff(T_PERMANENTFEEDDELETE, 5);
        if (!res.error) {
            if ($('feed_' + feedID)) {

                Notify.remove('feed_' + feedID, 1);

                (function () {
                    //destroy element
                    $('feed_' + feedID).destroy();
                    if ($('feed_v_' + feedID)) {
                        $('feed_v_' + feedID).destroy();
                        //feedActions.viewOff();
                    }
                }).delay(3 * 1000);
                feedActions.viewOff();
                CloseOverlay();
            }
        }
        else {
            Notify.alert('Javascript error', '<p class=\'pad5\'>Javascript error while [delete feed] #' + Error + '</p>', 'Ok', 'red');
        }
    });
        parent.alertBox.close();
}
///edit mode
///Add/Edit link next to TO box
function EditMode(){
    if($('composeResetTxtTo'))
        $('composeResetTxtTo').removeClass('dndD');
    if($('composeClearTxtTo'))
        $('composeClearTxtTo').removeClass('dndD');
    $('txtTo').removeClass('type_message');
    // Ariana - add span
    //$('txtTo').removeClass('type_message_post');
    
    $('spnTo').addClass('dnd');    
    $('txtTo').removeClass('dnd');
    $('txtTo').focus();
    $('txtTo').setCaretPosition('end');
    ///Remove Add/Edit link
    $('txtTo_edit').addClass('dnd');
}
///send message-MARK
function SendMessage(){
    //load MESSAGE
    //set to title: MESSAGE TO:
    top.location.href = '/'+profileInfo.ownerWadjaID+'#!My/2/1';
    //$('compose').removeClass('dndD');    
}
///clear TO
function clearpost(){
    $('txtTo').value = T_CLEAR_POST;
    if ($('txtTo').hasClass('type_message'))
    {}
    else
        $('txtTo').addClass('type_message');
}
///load bio-page
var bioBox;
function loadBIO(uid)
{
    ///facebox script
    bioBox = new Facebox({
            title: T_PROFILE_INFO,
            url: '/user/views/biopage.aspx?uid='+uid,
            width:500,
            cancelValue: T_CLOSE

        });
        bioBox.show();
}
//close box
function closeBIO(){
     bioBox.close();
}

//tpbbdo vote function
function vote(feedID) {
    Notify.spinnerOn('Voting...', 'Still voting...', 5);
    wjxShhProfile.send('Vote', feedID, function(res) {
        Notify.spinnerOff('done', 5);
        if (res.error != null) {
            //Notify.topBarOn(res.error, 'red', 6);
            return;
        }
        if (res.value == '1') {
            Notify.topBarOn('Done', '', 5);
            feedActions.viewOff();
            CloseOverlay();
            tpbbdo.contest(feedID);
        }

    });
}



function TongleAllLabels (category) {
    if (category.toLowerCase() == 'my') {
        if($('lblContent'))
            $('lblContent').removeClass('dndD');
        if($('lblSystemContent'))
            $('lblSystemContent').removeClass('dndD');
        if($('lblFollowingContent'))
            $('lblFollowingContent').addClass('dndD');
        if($('lblFollowingContentGroup'))
            $('lblFollowingContentGroup').addClass('dndD');   
        if($('myFollowing'))
            $('myFollowing').removeClass('active');
        if($('myWhats'))
            $('myWhats').addClass('active');
        
    }
    if (category.toLowerCase() == 'follow') {
        if($('lblContent'))
            $('lblContent').addClass('dndD');
        if($('lblSystemContent'))
            $('lblSystemContent').addClass('dndD');
        if($('lblFollowingContent'))
            $('lblFollowingContent').removeClass('dndD');
        if($('lblFollowingContentGroup'))
            $('lblFollowingContentGroup').removeClass('dndD');   
        if($('myFollowing'))
            $('myFollowing').addClass('active');
        if($('myWhats'))
            $('myWhats').removeClass('active');
    }
}

var AllLabelsActions = {
    DeleteLabel: function(LabelID,ownerID, source) {
        var LabelName = '';
        if($('allMyLabelsa_' + LabelID+'_'+ownerID))
            LabelName = $('allMyLabelsa_' + LabelID+'_'+ownerID).get('html');
        var alertBox = new Facebox({
            title: T_DELETELABELTITLE,
            message: '<div class=\"pad10\">' + T_DELETELABEL + '</div>',
            submitValue: T_YES, // submitValue: 'YES',
            cancelValue: T_NO, //cancelValue: 'NO',
            classNameTitle: 'faceboxTitleGray',
            classNameBorder: 'faceboxGray',
            cancelFunction: function () {
                alertBox.close();
            },
            submitFunction: function () {
                alertBox.close();
                var oWadjaX = new WADJAX('labels', { statusBar: false });
                Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
                oWadjaX.send('Delete', LabelID, function (res) {
                    Notify.spinnerOff(T_DONE, 1);
                    if (!res.error) {
                        if (res.value == '1') {
                  
                        eimastesediagrafi=true;

                         countAfterDelete=countAfterDelete-1;

                            if($('allMyLabelsDv_' + LabelID+'_'+ownerID)) 
                                Notify.remove('allMyLabelsDv_' + LabelID+'_'+ownerID, 2);

                                //maria for new profilecard
                                 if($('row_' + LabelID+'_'+ownerID)) 
                                Notify.remove('row_' + LabelID+'_'+ownerID, 2);

                              
                                //maria hide the link name left 
                                if($('top3list_'+LabelID))
                                {
                                    $('top3list_'+LabelID).addClass('dndD');                            
                                }
                               
                               if($('howmuschint')){
                           
                               $('howmuschint').set('html', countAfterDelete);
                                }
                                if(countAfterDelete==0){
                                    if($('inviteLbl')){
                                        $('inviteLbl').addClass('dndD');
                                    }
                                    
                                }
                            Notify.topBarOn(T_GREATYOURLABELDELETE, '', 5);
                            
                            if (source == 1) {
                           
                                popcorn.close('ne_' + LabelID);

                            }
                            if (window.location.hash.indexOf('!My/' + LabelID) > 0)
                            {
                             top.location.href='/'+ profileInfo.ownerWadjaID;
//                                if($('Close_Pop'))
//                                ($('Close_Pop')).set('html','<span onclick=\"top.location.href=\'/'+ profileInfo.ownerWadjaID+'#!My/0/1\'\">'+T_CLOSE+'</span>')
                            if($$('.closePop')) {
                                $$('.closePop').each(function (element, index) {
                                    var idLbl = element.get('id');
                                    if ($(idLbl))
                                        $(idLbl).set('html','<span onclick=\"top.location.href=\'/'+ profileInfo.ownerWadjaID+'\'\">'+T_CLOSE+'</span>');
                                });
                            }                            
                          }
                        }
                        else
                            Notify.topBarOn(res.value, 'red', 6);
                    }
                });
            }
        });
        alertBox.show();
    }, 
    EditLabel: function(labelID) {
        var previousLabelName = '';
        if($('allMyLabelsa_' + labelID))
            previousLabelName = $('allMyLabelsa_' + labelID).get('html');
        var editLabelBox = new Facebox({
            url: '/user/views/createlabel.aspx?labelID=' + labelID,
            title: G_EDIT_LABEL,
            width: 522,
            height: 250,
            cancelValue: G_CANCEL,
            submitFunction: function () {
                // get UpdateLabel params from Facebox's hidden DIVs
                var labelID = $('LabelIdValue').get('html');
                // if it's a system label, pass an empty string as label name, to avoid rename error checking
                var labelName = ($('newLabel').get('disabled') ? '' : $('newLabel').get('value'));
                // Disable privacy for MESSAGE,TRASH, HELP, POINTS
                var privacy = $('LabelPrivacyValue').get('html');
                // Disable privacy for MESSAGE,TRASH, HELP, POINTS, CONTACTS
                var isYouTube = $('LabelIsYoutube').get('html');
                var isTwitter = $('LabelIsTwitter').get('html');
                var isDigg = $('LabelIsDigg').get('html');
                var isLastFM = $('LabelIsLastFM').get('html');
                var isMeebo = 'false';
                var labelBackgroundColor = $('labelBackgroundColor').get('value');
                var labelFontColor = $('labelFontColor').get('value');
                if ($('yton_' + labelID)) {
                    if (isYouTube == 'true') {
                        $('yton_' + labelID).checked = true;
                    }
                    else
                        $('yton_' + labelID).checked = false;
                }
                if ($('twon_' + labelID)) {
                    if (isTwitter == 'true') {
                        $('twon_' + labelID).checked = true;
                    }
                    else
                        $('twon_' + labelID).checked = false;
                }
                if ($('lfmon_' + labelID)) {
                    if (isLastFM == 'true') {
                        $('lfmon_' + labelID).checked = true;
                    }
                    else
                        $('lfmon_' + labelID).checked = false;
                }
                if ($('privacyicon_' + labelID)) {
                    if ($('privacyicon_' + labelID).hasClass('lblPr_2')) {
                        $('privacyicon_' + labelID).removeClass('lblPr_2');
                    }
                    else if ($('privacyicon_' + labelID).hasClass('lblPr_3')) {
                        $('privacyicon_' + labelID).removeClass('lblPr_3');
                    }
                    else if ($('privacyicon_' + labelID).hasClass('lblPr_4')) {
                        $('privacyicon_' + labelID).removeClass('lblPr_4');
                    }
                    var privacyID = privacy.replace("Onlyme", "2").replace("Followers", "3").replace("Everyone", "4");
                    $('privacyicon_' + labelID).addClass('lblPr_' + privacyID);
                }

                UpdateLabel(labelID, labelName, privacy, isYouTube, isTwitter, isDigg, isLastFM, isMeebo, labelBackgroundColor, labelFontColor, 0);
                if(previousLabelName != labelName && previousLabelName != '') {
                    if($('allMyLabelsa_' + labelID))
                        $('allMyLabelsa_' + labelID).set('html' , labelName);
                }
                if($('allMyLabelsa_' + labelID)) {
                    $('allMyLabelsa_' + labelID).set('style' , 'color:' + labelFontColor + ' !important;overflow: hidden !important;');
                }
                editLabelBox.close();

            },
            submitValue: G_EDIT,
            submitFocus: 'Yes'//If true, the submit button will be focused. (Pressing enter will activate it)
        });
        editLabelBox.show();
    },
    Follow: function(labelID, ownerID, labelName,cardownerid, wadjaOwnerId) {
         var oWadjaX = new WADJAX('labels', { statusBar: false });
       
                 if($('profFollowInt_' + labelID + '_' + ownerID)){
                  if($('profFollowInt_' + labelID + '_' + ownerID).hasClass('stopfollowingLeft')) {
                    Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
                    oWadjaX.send('StopFollowingLabel', labelID, ownerID, profileInfo.viewerID.toString(), '', '', function (res) {
                        Notify.spinnerOff(T_DONE, 1);
                        if(!res.error) {
                            var stopText = T_STOPPEDFOLLOWING +" <b>" + labelName+"</b>";
                            Notify.topBarOn(stopText, '', 6);
                            $('profFollowInt_' + labelID + '_' + ownerID).removeClass('stopfollowingLeft');
                            $('profFollowInt_' + labelID + '_' + ownerID).addClass('startfollowingLeft');
                               $('profFollowInt_' + labelID + '_' + ownerID).set('html',L_PROF_CARD_FOLLOW);
                          
                          if ($('profFollowIntL_' + labelID + '_' + ownerID)){
                            $('profFollowIntL_' + labelID + '_' + ownerID).removeClass('stopfollowing');
                            $('profFollowIntL_' + labelID + '_' + ownerID).addClass('startfollowing');
                            $('profFollowIntL_' + labelID + '_' + ownerID).set('onmouseover','Tip.doTipLbl(\'profFollowIntL_' + labelID + '_' + ownerID + '\',\'' + T_FOLLOWLABEL + '\',\'2\',\'5\');');
                            }
                         }
                    });

                  
                           
                }
                else if($('profFollowInt_' + labelID + '_' + ownerID).hasClass('startfollowingLeft')) {
                    Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
                    oWadjaX.send('Follow', labelID, ownerID, profileInfo.viewerID.toString(), '', function (res) {
                        Notify.spinnerOff(T_DONE, 1);
                        if(!res.error) {
                            var startText = T_YOUARENOWFOLLOWING +" <b>"+ labelName+"</b>";
                            Notify.topBarOn(startText, '', 6);
                         
                            $('profFollowInt_' + labelID + '_' + ownerID).removeClass('startfollowingLeft');
                            $('profFollowInt_' + labelID + '_' + ownerID).addClass('stopfollowingLeft');
                            $('profFollowInt_' + labelID + '_' + ownerID).set('html', L_PROF_CARD_UNFOLLOW);
                            //$('profFollowInt_' + labelID + '_' + ownerID).set('onmouseover','Tip.doTipLbl(\'profFollowInt_' + labelID + '_' + ownerID + '\',\'' + T_STOPFOLLOWING + '\',\'2\',\'5\');');
                        
                        if ($('profFollowIntL_' + labelID + '_' + ownerID)){
                            $('profFollowIntL_' + labelID + '_' + ownerID).removeClass('startfollowing');
                            $('profFollowIntL_' + labelID + '_' + ownerID).addClass('stopfollowing');
                            $('profFollowIntL_' + labelID + '_' + ownerID).set('onmouseover','Tip.doTipLbl(\'profFollowIntL_' + labelID + '_' + ownerID + '\',\'' + T_STOPFOLLOWING + '\',\'2\',\'5\');');
                            }
                        }
                    });

              }
                   
       }
      
            /* malria new cool stuff */
             if($('profFollowCoolStuffInt_' + labelID + '_' + ownerID)) {
                if($('profFollowCoolStuffInt_' + labelID + '_' + ownerID).hasClass('stopfollowingLeft')) {
                    Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
                    oWadjaX.send('StopFollowingLabel', labelID, ownerID, profileInfo.viewerID.toString(), '', '', function (res) {
                        Notify.spinnerOff(T_DONE, 1);
                        if(!res.error) {
                            var stopText = T_STOPPEDFOLLOWING +" <b>" + labelName+"</b>";
                            Notify.topBarOn(stopText, '', 6);
                            $('profFollowCoolStuffInt_' + labelID + '_' + ownerID).removeClass('stopfollowingLeft');
                            $('profFollowCoolStuffInt_' + labelID + '_' + ownerID).addClass('startfollowingLeft');
                            $('profFollowCoolStuffInt_' + labelID + '_' + ownerID).set('html', L_PROF_CARD_FOLLOW);
                           
                           
                           
                           // $('profFollowCoolStuffInt_' + labelID + '_' + ownerID).set('onmouseover','Tip.doTipLbl(\'profFollowCoolStuffInt_' + labelID + '_' + ownerID + '\',\'' + T_FOLLOWLABEL + '\',\'2\',\'5\');');
                         }
                    });
                }
                else if($('profFollowCoolStuffInt_' + labelID + '_' + ownerID).hasClass('startfollowingLeft')) {
                    Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
                    oWadjaX.send('Follow', labelID, ownerID, profileInfo.viewerID.toString(), '', function (res) {
                        Notify.spinnerOff(T_DONE, 1);
                        if(!res.error) {
                            var startText = T_YOUARENOWFOLLOWING +" <b>" + labelName+"</b>";
                          
                            Notify.topBarOn(startText, '', 6);
                            $('profFollowCoolStuffInt_' + labelID + '_' + ownerID).removeClass('startfollowingLeft');
                            $('profFollowCoolStuffInt_' + labelID + '_' + ownerID).addClass('stopfollowingLeft');
                             $('profFollowCoolStuffInt_' + labelID + '_' + ownerID).set('html', L_PROF_CARD_UNFOLLOW);
                            //$('profFollowCoolStuffInt_' + labelID + '_' + ownerID).set('onmouseover','Tip.doTipLbl(\'profFollowCoolStuffInt_' + labelID + '_' + ownerID + '\',\'' + T_STOPFOLLOWING + '\',\'2\',\'5\');');
                        }
                    });
                }
            }

                   /* malria new cool stuff */
             if($('profFollowCoolStuffIntL_' + labelID + '_' + ownerID)) {
                if($('profFollowCoolStuffIntL_' + labelID + '_' + ownerID).hasClass('stopfollowing')) {
                    Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
                    oWadjaX.send('StopFollowingLabel', labelID, ownerID, profileInfo.viewerID.toString(), '', '', function (res) {
                        Notify.spinnerOff(T_DONE, 1);
                        if(!res.error) {
                            var stopText = T_STOPPEDFOLLOWING +" <b>"+ labelName+"</b>";
                            Notify.topBarOn(stopText, '', 6);
                            $('profFollowCoolStuffIntL_' + labelID + '_' + ownerID).removeClass('stopfollowing');
                            $('profFollowCoolStuffIntL_' + labelID + '_' + ownerID).addClass('startfollowing');
                            $('profFollowCoolStuffIntL_' + labelID + '_' + ownerID).set('onmouseover','Tip.doTipLbl(\'profFollowCoolStuffIntL_' + labelID + '_' + ownerID + '\',\'' + T_FOLLOWLABEL + '\',\'2\',\'5\');');
                         }
                    });
                }
                else if($('profFollowCoolStuffIntL_' + labelID + '_' + ownerID).hasClass('startfollowing')) {
                    Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
                    oWadjaX.send('Follow', labelID, ownerID, profileInfo.viewerID.toString(), '', function (res) {
                        Notify.spinnerOff(T_DONE, 1);
                        if(!res.error) {
                            var startText = T_YOUARENOWFOLLOWING +" <b>" + labelName+"</b>";
                         
                            Notify.topBarOn(startText, '', 6);
                            $('profFollowCoolStuffIntL_' + labelID + '_' + ownerID).removeClass('startfollowing');
                            $('profFollowCoolStuffIntL_' + labelID + '_' + ownerID).addClass('stopfollowing');
                            $('profFollowCoolStuffIntL_' + labelID + '_' + ownerID).set('onmouseover','Tip.doTipLbl(\'profFollowCoolStuffIntL_' + labelID + '_' + ownerID + '\',\'' + T_STOPFOLLOWING + '\',\'2\',\'5\');');
                        }
                    });
                }
            }

          
        //}
    },
    StopFollow: function(labelID, ownerID, labelName, followerID, wadjaOwnerId) {
    
        var oWadjaX = new WADJAX('labels', { statusBar: false });
        Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
        oWadjaX.send('StopFollowingLabel', labelID, ownerID, profileInfo.viewerID.toString(), '', '', function (res) {
            Notify.spinnerOff(T_DONE, 1);
            if(!res.error) {
                var stopText = T_STOPPEDFOLLOWING +" <b>" + labelName+"</b>";
                Notify.topBarOn(stopText, '', 6);
              
              /*old profile*/
                if($('allFollowLabelsDv_' + labelID + '_' + ownerID)) {
                    Notify.remove('allFollowLabelsDv_' + labelID + '_' + ownerID, 2);
                }

                if($('top3list_'+ labelID)){
                 Notify.remove('top3list_'+ labelID, 2);
                
                }

                //for unfollow from followers popcorn
                if ($('followerDef')) {
               
                    var q = parseInt($('followerDef').get('html'));
                    if (q > 0) {
                        q = q - 1;
                        gl_label_followers = q;
                        $('followerDef').set('html', q + " ");
                        if($('norecords_'+ followerID)){
                        Notify.remove('norecords_'+ followerID, 2);
                        
                        }/*
                        if($('interesting_sp')){
                        if($('interesting_sp').hasClass('stop')){
                        $('interesting_sp').removeClass('stop');
                        $('interesting_sp').addClass('follow');
                        }
                        
                        }*/
                       
                    }
               }
                
                /*maria for newprofile */
                 if($('row_' + labelID + '_' + ownerID)) {
                 countFolIntAfterDelete = countFolIntAfterDelete -1;
                 if($('howmuschintFol'))
                 {
              
                 $('howmuschintFol').set('html',countFolIntAfterDelete );
                 }
                  Notify.remove('row_' + labelID + '_' + ownerID, 2);
                  
                   
                }
            }
        });
    },
    ToggleGroup: function(labelName) {
        if($('AllFollowGroupArrow_' + labelName)) {
            if($('AllFollowGroupArrow_' + labelName).hasClass('rightnavdown')) {
                MyElement.toggleReveal('AllFollowGroup_' + labelName);
                $('AllFollowGroupArrow_' + labelName).removeClass('rightnavdown');
                $('AllFollowGroupArrow_' + labelName).addClass('rightnavup');
            }
            else if ($('AllFollowGroupArrow_' + labelName).hasClass('rightnavup')) {
                MyElement.toggleReveal('AllFollowGroup_' + labelName);
                $('AllFollowGroupArrow_' + labelName).removeClass('rightnavup');
                $('AllFollowGroupArrow_' + labelName).addClass('rightnavdown');
            }
        }
    },
    OpenFollowers: function(labelOwnerWadjaID, labelID) {
        var followersFaceBox = new Facebox({
        url: '/user/followers/followersIFrame.aspx?u=' + labelOwnerWadjaID + '&labelid=' + labelID,
        width: 600,
        height:388,
        title: T_PEOPLE_INTERESTED,
        cancelValue: T_OK,
        cancelFunction: function () {
            followersFaceBox.close();
        }
    });
    followersFaceBox.show();
    },
    EmailNotification: function(labelID, labelOwnerID) {
        var activate = 0;
           /*old profile card *//*
        if($('allFollowLabelsNotification_' + labelID + '_' + labelOwnerID)) {
            if($('allFollowLabelsNotification_' + labelID + '_' + labelOwnerID).hasClass('emailnotificationoff')) 
                activate = 1;
            var oWadjaX = new WADJAX('labels', { statusBar: false });
            Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
            oWadjaX.send('EmailNotifications', labelID, labelOwnerID, activate, function (res) {
                Notify.spinnerOff(T_DONE, 1);
                if (res.error != null) return;
                if(res.value) {
                    if(activate == 0) {
                        $('allFollowLabelsNotification_' + labelID + '_' + labelOwnerID).removeClass('emailnotificationon');
                        $('allFollowLabelsNotification_' + labelID + '_' + labelOwnerID).addClass('emailnotificationoff');
                        $('allFollowLabelsNotification_' + labelID + '_' + labelOwnerID).set('title',EMAILNOTIFICATIONSOFF);
                    }  
                    else {
                        $('allFollowLabelsNotification_' + labelID + '_' + labelOwnerID).removeClass('emailnotificationoff');
                        $('allFollowLabelsNotification_' + labelID + '_' + labelOwnerID).addClass('emailnotificationon');
                        $('allFollowLabelsNotification_' + labelID + '_' + labelOwnerID).set('title',EMAILNOTIFICATIONSON);
                    } 
                }
            });
            
        }
        */
        /*maria new profile card */
        if($('profEmailNInt_' + labelID + '_' + labelOwnerID))  {

            if($('profEmailNInt_' + labelID + '_' + labelOwnerID).hasClass('emailnotificationoffLeft') ) 
                activate = 1;
            var oWadjaX = new WADJAX('labels', { statusBar: false });

            Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
            oWadjaX.send('EmailNotifications', labelID, labelOwnerID, activate, function (res) {
                Notify.spinnerOff(T_DONE, 1);
                if (res.error != null) return;
                if(res.value) {
          
                    if(activate == 0) {
                        $('profEmailNInt_' + labelID + '_' + labelOwnerID).removeClass('emailnotificationonLeft');
                        $('profEmailNInt_' + labelID + '_' + labelOwnerID).addClass('emailnotificationoffLeft');   
                            Notify.topBarOn('Email Notifications off', '', 6);           
                    }  
                    else {
                        $('profEmailNInt_' + labelID + '_' + labelOwnerID).removeClass('emailnotificationoffLeft');
                        $('profEmailNInt_' + labelID + '_' + labelOwnerID).addClass('emailnotificationonLeft');   
                       Notify.topBarOn('Email Notifications on', '', 6);                             
                    } 
                }
            });
            
        }


        //left
             /*maria new profile card */
        if($('profEmailNIntL_' + labelID + '_' + labelOwnerID))  {
         
            if($('profEmailNIntL_' + labelID + '_' + labelOwnerID).hasClass('emailnotificationoff') ) 
                activate = 1;
            var oWadjaX = new WADJAX('labels', { statusBar: false });

            Notify.spinnerOn(T_LOADING, T_STILLLOADING, 5);
            oWadjaX.send('EmailNotifications', labelID, labelOwnerID, activate, function (res) {
                Notify.spinnerOff(T_DONE, 1);
                if (res.error != null) return;
                if(res.value) {
          
                    if(activate == 0) {
                        $('profEmailNIntL_' + labelID + '_' + labelOwnerID).removeClass('emailnotificationon');
                        $('profEmailNIntL_' + labelID + '_' + labelOwnerID).addClass('emailnotificationoff');
                        $('profEmailNIntL_' + labelID + '_' + labelOwnerID).set('onmouseover','Tip.doTipLbl(\'profEmailNIntL_' + labelID + '_' + labelOwnerID + '\',\'' + EMAILNOTIFICATIONSOFF + '\',\'8\',\'5\');');
                    }  
                    else {
                        $('profEmailNIntL_' + labelID + '_' + labelOwnerID).removeClass('emailnotificationoff');
                        $('profEmailNIntL_' + labelID + '_' + labelOwnerID).addClass('emailnotificationon');
                        $('profEmailNIntL_' + labelID + '_' + labelOwnerID).set('onmouseover','Tip.doTipLbl(\'profEmailNIntL_' + labelID + '_' + labelOwnerID + '\',\'' + EMAILNOTIFICATIONSON + '\',\'8\',\'5\');');
                    } 
                }
            });
            
        }

    }
}

function RefreshGoogleAds() {
    var a = document.getElementsByName('google_ads_frame');
    for(var i=0; i<a.length; i++) {
        if (a[i]) {
            a[i].src = a[i].src + '&' + new Date().getTime();
        }
    }
}

///#Youtubehack thumb
var ytube={
    thumb: function(param_path){
        ///ytube.thumb();
        var pathdomain='';
        var paththumb='';
      
        if (param_path.indexOf('i1.')>0)
            pathdomain = 'i1.';
        else if (param_path.indexOf('i2.')>0)
            pathdomain = 'i2.';
        else if (param_path.indexOf('i3.')>0)
            pathdomain = 'i3.';
        else if (param_path.indexOf('i4.')>0)
            pathdomain = 'i4.';
        else if (param_path.indexOf('i5.')>0)
            pathdomain = 'i5.';
        else if (param_path.indexOf('i6.')>0)
            pathdomain = 'i6.';
        else if (param_path.indexOf('i7.')>0)
            pathdomain = 'i7.';
        ///    
        if (pathdomain!='')
            paththumb ='http://'+ param_path.substring(param_path.indexOf(pathdomain),param_path.indexOf(pathdomain).length);
        else
            paththumb = param_path;

        return paththumb;
    },
    ///#Youtubehack thumb
    embedvideo: function(vdID,feedID){
     if(fromjason=='false' && fromPagejason != "true" ){
   
           bootloader.load('https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', function () {
                    // The video to load.
                    var videoID = vdID;
                    // Lets Flash from another domain call JavaScript
                    var params = { allowScriptAccess: "always", wmode: "transparent" };
                    // The element id of the Flash embed
                    var atts = { id: "ytPlayer" };
                    // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
                   // if($('label_content_body')){
                   
                    swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=player1", 
                                   "attach_embed_canvas_"+feedID, "596", "295", "8", null, null, params, atts);    
                    //               } 

                    // Show video div
                    if($("attach_embed_tr_"+feedID))
                    $("attach_embed_tr_"+feedID).removeClass('dnd');  
         });
     
    
    }  
     if(fromjason=='true' && fromPagejason != "true"){
        
   //  onlyOnceEmbed = 'true';
       bootloader.load('https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', function () {
                    // The video to load.
                    var videoID = vdID;
                    // Lets Flash from another domain call JavaScript
                    var params = { allowScriptAccess: "always", wmode: "transparent" };
                    // The element id of the Flash embed
                    var atts = { id: "ytPlayer" };
                    // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
                      if($('label_content_body')){
                    swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=player1", 
                                   "label_content_body", "625", "263", "8", null, null, params, atts); 
                                   }
                                   
                   
                    // Show video div
                    if($("attach_embed_tr_"+feedID))
                    $("attach_embed_tr_"+feedID).removeClass('dnd'); 
                         
                            
                
         });
     
    
    }
    if(fromPagejason == "true"){
     
      bootloader.load('https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', function () {
                    // The video to load.
                    var videoID = vdID;
                    // Lets Flash from another domain call JavaScript
                    var params = { allowScriptAccess: "always", wmode: "transparent" };
                    // The element id of the Flash embed
                    var atts = { id: "ytPlayer" };
                    // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
                     
                                   
                    if($('label_content_body2')){
                  // 
                    swfobject.embedSWF("http://www.youtube.com/v/" + videoID + "&enablejsapi=1&playerapiid=player1", 
                                   "label_content_video", "605", "340", "8", null, null, params, atts);
                                   }  
                    //stopping re-embed after post
                    // Show video div
                    if($("attach_embed_tr_"+feedID))
                    $("attach_embed_tr_"+feedID).removeClass('dnd');  
         });
    
    }
}
}
var vimeo={
    thumb: function(param_path){
        ///ytube.thumb();
        var pathdomain='';
        var paththumb='';
      
        if (param_path.indexOf('i1.')>0)
            pathdomain = 'i1.';
        else if (param_path.indexOf('i2.')>0)
            pathdomain = 'i2.';
        else if (param_path.indexOf('i3.')>0)
            pathdomain = 'i3.';
        else if (param_path.indexOf('i4.')>0)
            pathdomain = 'i4.';
        else if (param_path.indexOf('i5.')>0)
            pathdomain = 'i5.';
        else if (param_path.indexOf('i6.')>0)
            pathdomain = 'i6.';
        else if (param_path.indexOf('i7.')>0)
            pathdomain = 'i7.';
        ///    
        if (pathdomain!='')
            paththumb ='http://'+ param_path.substring(param_path.indexOf(pathdomain),param_path.indexOf(pathdomain).length);
        else
            paththumb = param_path;

        return paththumb;
    },
     embedvideo: function(vdID,feedID){
     if(fromjason=='false' && fromPagejason != "true" ){
           bootloader.load('https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', function () {
                    // The video to load.
                    var videoID = vdID;
                    // Lets Flash from another domain call JavaScript
                    var params = { allowScriptAccess: "always", wmode: "transparent" };
                    // The element id of the Flash embed
                    var atts = { id: "ytPlayerVim" };
                    // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
                    swfobject.embedSWF("http://www.vimeo.com/"+ videoID, "attach_embed_canvas_"+feedID, "596", "295", "8", null, null, params, atts);     
                    // Show video div
                    //$("attach_embed_tr_"+feedID).removeClass('dnd');  
         });
         }
         if(fromjason=='true' && fromPagejason != "true"){
        bootloader.load('https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', function () {
                    // The video to load.
                    var videoID = vdID;
                    // Lets Flash from another domain call JavaScript
                    var params = { allowScriptAccess: "always", wmode: "transparent" };
                    // The element id of the Flash embed
                    var atts = { id: "ytPlayerVim" };
                    // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
                       if($('label_content_body')){
                    swfobject.embedSWF("http://www.vimeo.com/"+ videoID, "attach_embed_canvas_"+feedID, "625", "263", "8", null, null, params, atts);     
                    }
                    // Show video div
                    //$("attach_embed_tr_"+feedID).removeClass('dnd');  
         });
      
      
      }
         if(fromPagejason == "true"){
          bootloader.load('https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js', function () {
                    // The video to load.
                    var videoID = vdID;
                    // Lets Flash from another domain call JavaScript
                    var params = { allowScriptAccess: "always", wmode: "transparent" };
                    // The element id of the Flash embed
                    var atts = { id: "ytPlayerVim" };
                    // All of the magic handled by SWFObject (http://code.google.com/p/swfobject/)
                       if($('label_content_body2')){
                      
                    swfobject.embedSWF("http://www.vimeo.com/"+ videoID, "attach_embed_canvas_"+feedID, "605", "340", "8", null, null, params, atts);     
                    }
                   //stopping re-embed after post
                    // Show video div
                    //$("attach_embed_tr_"+feedID).removeClass('dnd');  
         });
         }


    }
    }
///#TPBBDO-Remove after contest
var tpbbdo = {
    view: function(paramfeedID){
        feedActions.openPopup(paramfeedID,0,'null',profileInfo.ownerID);
    },
    loadconteststats: function(){
      //retrieve counters from cookie
      var printCookie = Cookie.read('tpbddo-print-'+profileInfo.viewerID);
      var videoCookie = Cookie.read('tpbddo-video-'+profileInfo.viewerID);
      var contestStatus='Ready to start!';

      if (printCookie==null)
      {
          ///#create-cookie
          printCookie = 3;
          Cookie.write('tpbddo-print-'+profileInfo.viewerID, profileInfo.viewerID+'-3', {duration: 1});
      }      
      else
      {
          printCookie = printCookie.replace(profileInfo.viewerID+'-','');
         
      }
      if (videoCookie==null)
      {
          ///#create-cookie
          videoCookie = 3;
          Cookie.write('tpbddo-video-'+profileInfo.viewerID, profileInfo.viewerID+'-3', {duration: 1});
      }      
      else
      {
          videoCookie = videoCookie.replace(profileInfo.viewerID+'-','');
      }
      
      if (printCookie==0 && videoCookie ==0)
      {
          $('tpbbdopanel').set('html','<span class=\"tac pad15 dnb\" style=\"color:#FE0000; font-size:24px;\">Cool! You\'ve just completed your entry. Good luck!</span>');
      }
      else
      {
          if (printCookie>0)
          {
              contestStatus = 'pending print ads '+printCookie;
          }
          else
          {
              contestStatus = '';
          }
          
          if (videoCookie>0)
          {
              contestStatus+=', pending video ads '+videoCookie;
          }
      }
      $('Span1').set('html',printCookie); 
      $('Span2').set('html',videoCookie); 
      $('Span3').set('html',contestStatus); 
    }, 
    contest: function(feedID){
        //Print
        if (feedID==48420892 || feedID==48424128 || feedID==48458695 || feedID==48421764 || feedID==48421746 || feedID==48421728 || feedID==48420921 || feedID==48420917 || feedID==48424272 || feedID==48424201 || feedID==48424187 || feedID==48424173 || feedID==48458675 || feedID==48458630 || feedID==48458600 || feedID==48458567 || feedID==48458733 || feedID==48424324 || feedID==48424301 || feedID==48424294)
        {
            ///#print ad
            var printCookie=Cookie.read('tpbddo-print-'+profileInfo.viewerID)
            printCookie = printCookie.replace(profileInfo.viewerID+'-','');
            if (printCookie>0)
            {
                ///#increment
                printCookie = parseInt(printCookie) - 1;
                Cookie.write('tpbddo-print-'+profileInfo.viewerID, profileInfo.viewerID+'-'+printCookie, {duration: 1});
            }
            else
            {
                //print ads completed
            }
        }
        else if (feedID== 48456245 || feedID==48456286 || feedID==48456353 || feedID==48456365 || feedID==48456390 || feedID==48456430 || feedID==48456442 || feedID==48456454 || feedID==48456470 || feedID==48456476)
        {
            ///#video ad
            var videoCookie=Cookie.read('tpbddo-video-'+profileInfo.viewerID)
            videoCookie = videoCookie.replace(profileInfo.viewerID+'-','');
            if (videoCookie>0)
            {
                ///#increment
                videoCookie = parseInt(videoCookie) - 1;
                Cookie.write('tpbddo-video-'+profileInfo.viewerID, profileInfo.viewerID+'-'+videoCookie, {duration: 1});
            }
            else
            {
                //video ads completed
            }
        }
        //reload stats
        tpbbdo.loadconteststats();
    }
}
if (profileInfo.networkID==295)
{
    $('tpbbdopanel').removeClass('dnd');
    tpbbdo.loadconteststats();
}
///#END-TPBBDO
///#FOLLOWERS LINES  
var followersjs={
    loadFollowersVIEW:function(labelID, OwnerID, viewerID, labelName,followersnum,view, ownerRightPageWadjaId){
        bootloader.load('/s3.scripts/classes/followers.js', function () {
            followClass.followers.loadVIEW(labelID, OwnerID, viewerID, labelName,followersnum,view, ownerRightPageWadjaId);
      });
    },
    //maria for relocate the signou user to follow an interest from my in profile card
    SignOutFollowProfCard:function(labelID, OwnerID){

    if($('profFollowSignOutInt_' + labelID + '_' + OwnerID + ''))
    {
        top.location.href = '/sessions/landingpage.aspx?labelid=' + labelID + '&ownerID=' + OwnerID;
    }
    else if ($('profFollowSignOutCoolStInt_' + labelID + '_' + OwnerID + ''))
    {
      top.location.href = '/sessions/landingpage.aspx?labelid=' + labelID + '&ownerID=' + OwnerID;
    }
    },
    removeFollower:function (LabelID, OwnerID, FollowerID)
    { 
        bootloader.load('/s3.scripts/classes/followers.js', function () {
            followClass.followers.remove(LabelID, OwnerID, FollowerID);
        });
    },
    loadOpentok:function(labelID,labelOwnerID,labelName){
        /*bootloader.load('http://staging.tokbox.com/v0.91/js/TB.min.js', function () {});
        bootloader.load('/s3.scripts/classes/opentok.js', function () {});*/
        $('video_chat').empty();        
        if($('bio_feed'))
           $('bio_feed').addClass('dnd');
        ///$('video_chat').appendChild(new Element('img', { 'src':'/s3.images/ajax/preloader.gif'}));
        if($('loadingVideo'))
           $('loadingVideo').removeClass('dnd');

       //    $('video_btn').set('html','</span><span id="btn_joinroom" class=\"f12 video_chat\" >Video chat</span>');
                            
          var openTOKAjx = new WADJAX('misc', { statusBar: false });
          openTOKAjx.send('opentokSessionID',labelID,labelOwnerID, function (res) {
            if (res.error) {
                popcorn.open('otok_err','<div class=\"pad10\">Oops! '+res.error+'. Try again later.','Video-chat error','');
                if($('loadingVideo'))
                $('loadingVideo').addClass('dnd');
           //      $('video_btn').set('html','</span><span id="btn_joinroom" class=\"f12 lnk video_chat\" onclick="followersjs.loadOpentok('+LabelID+','+LabelOwnerID+',\''+ LabelName +'\');">Video chat</span>');
                            
                }
            else
            {
                /* UX metrix */
                if(mp_metrix) mpmetrics.track("Load video chat", { "label name": labelName });
                var opentokdata=res.value.split(',');
                apiKey=opentokdata[0];
                sessionId=opentokdata[1];
                token='devtoken';/* replace token after testing */
                
                var req = new Request({
                method: 'get',
                url: '/user/views/opentok_videochat.htm',
                onRequest: function () {},
                onComplete: function (response) {
                    $('video_chat').empty();
                    $('video_chat').appendChild(new Element('div',{'html':response}));
                    // Un-comment either of the following to set automatic logging and exception handling.
                    // See the exceptionHandler() method below.
                    // TB.setLogLevel(TB.DEBUG);
                    TB.addEventListener("exception", exceptionHandler);

                    if (TB.checkSystemRequirements() != TB.HAS_REQUIREMENTS) {
                        alert("You don't have the minimum requirements to run this application."
                          + "Please upgrade to the latest version of Flash.");                         
                    } else {
                        // Initialize session
                        session = TB.initSession(sessionId);
                        // Add event listeners to the session
                        session.addEventListener('sessionConnected', sessionConnectedHandler);
                        session.addEventListener('sessionDisconnected', sessionDisconnectedHandler);
                        session.addEventListener('connectionCreated', connectionCreatedHandler);
                        session.addEventListener('connectionDestroyed', connectionDestroyedHandler);
                        session.addEventListener('streamCreated', streamCreatedHandler);
                        session.addEventListener('streamDestroyed', streamDestroyedHandler);
                        session.addEventListener("signalReceived", signalReceivedHandler);
                        // Initialize the layout container
			            OT_LayoutContainer.init("streamContainer", 605, 200); 
                        //maria hiding the link video chat
                      
                        // Establish connection
                        connect();
                        if ( $('btn_joinroom')){
                            if($('btn_joinroom').hasClass('lnk'))
                            {
                              $('btn_joinroom').removeClass('lnk');
                              $('btn_joinroom').removeEvents('click');
                            }
                        }                  
                    }
                    if ($('promote_link')) {
                    $('promote_link').addEvents({
                        'click': function () {
                           promoteInterestLinkjs.getpromoteInterestLink(labelOwnerID,labelID,labelName,source);
                            return false;
                        }
                    }); 
        }                
                }
              }).send();
            }
        });      
    }        
}
///#END OF FOLLOWERS LINES
///#PROFILE CARD LINES
var profilecardjs={
    loadUserCard:function(ownerID,cardview){
         bootloader.load('/s3.scripts/classes/profilecard.chirp.js', function () {
            followClass.loadCard(ownerID,profileInfo.viewerID,cardview);
        });
    }
}
///#END OF PROFILE CARD
///#SCROLL MORE
var scrollmorejs={ 
    listentoscroll:function(){
         bootloader.load('/s3.scripts/classes/scrollmore.js', function () {
            beginspyscroll();
        });
    }
}
///#END OF SCROLL MORE

///#Get embed code
var embedLabeljs={
    getEmbed:function(ownerID,labelID){
         bootloader.load('/s3.scripts/classes/embedlabel.js', function () {
            embedLabelClass.getEmbedCode(ownerID,labelID);
        });
    }
}
///#End of embed code

///#Get editInterest code
var editAnInterestjs={ 
    getEditAnInterest:function(ownerID, labelID,typedo){
            bootloader.load('/s3.scripts/classes/interest.js', function () {
            editAnInterestClass.buildCardEdit(ownerID, labelID, typedo);
        });
    }
}
///#End of new Interest code
///#Get promoteInterest code
var promoteInterestjs={
    getPromoteInterest:function(ownerID, labelID){
            bootloader.load('/s3.scripts/classes/interest.js', function () {
                promoteInterestClass.buildCard(ownerID, labelID);
        });
    }
}
///#End of  promoteInterest code
///#Get public Follow code
var publicFollowjs={
    getPublicFollowForm:function(labelID, ownerID){
            bootloader.load('/s3.scripts/classes/publicFollow.js', function () {
                publicFollowClass.getPublicFollowCode(labelID, ownerID);
        });
    }
}
///#End of public Follow code
///#show all interest code
var allInterestsjs={
    getAllInterests:function(ownerID,typedo){
            bootloader.load('/s3.scripts/classes/interest.js', function () {
                allInterestsClass.buildCardallInterests(ownerID, typedo);
        });
    }
}
///#End of all Interest code
///#show interested in code
var interestedInjs={ 
    getInterestedIn:function(ownerID, labelID, typedo){
            bootloader.load('/s3.scripts/classes/interest.js', function () {
                interestedInClass.buildCardInterestedIn(ownerID, labelID, typedo);
        });
    }
}
///#End of Interested in code
///#Compose class
///#call example: composejs.getCompose();
var composejs={ 
    getCompose:function(elemnt,intID,intName,intPrivacy,intOwner,intCard){
            /* for SMS card */
            var othercard='';
            if (intCard !== undefined)
                othercard = intCard;
            bootloader.load('/s3.scripts/classes/compose.js', function () {
                composeClass.buildCardCompose(intID,intName,intPrivacy,intOwner,othercard);
        });
    },
    getQuickpost:function(act){
        bootloader.load('/s3.scripts/classes/quickcompose.js', function () {
                quickComposeClass.initiateform(act);
        });
    }
}
///#End of compose class
///#call example: invitejs.getInvite(intOwner, labelID);
var invitejs={ 
    getInvite:function(intOwner, labelID){
            bootloader.load('/s3.scripts/classes/invite.js', function () {
                inviteClass.getInviteCode(intOwner, labelID);
        });
    },
    showHideContent:function(elementID, source)
    { 
        if(elementID =='link'){
            if(source == 1)
            var mySlideLink = new Fx.Slide('linkContent_1');   
            else
            var mySlideLink = new Fx.Slide('linkContent_0'); 
            mySlideLink.toggle();

          
        }
        else if(elementID =='embed'){
        if(source == 1)
            var mySlideEmbed = new Fx.Slide('embedContent_1');   
            else
            var mySlideEmbed = new Fx.Slide('embedContent_0'); 
            mySlideEmbed.toggle();
        }
        else if(elementID =='embedQR'){
        if(source == 1)
            var mySlideEmbedQr = new Fx.Slide('embedQRContent_1'); 
            else
              var mySlideEmbedQr = new Fx.Slide('embedQRContent_0');
            mySlideEmbedQr.toggle();
        }
    
    }
}
var promoteInterestLinkjs = { 
    getpromoteInterestLink:function(intOwner, labelID,labelName, source){
            bootloader.load('/s3.scripts/classes/promoteInterestLink.js', function () {     
                /* UX metrix */
                if (mp_metrix) mpmetrics.track("Load promote label form",{'Label':labelName});       
                promoteInterestLinkClass.getpromoteInterestLinkCode(intOwner, labelID,labelName, source);                
        });
    },
    getpromoteInterestLinkProfile:function(intOwner, labelID,labelName, source){
            bootloader.load('/s3.scripts/classes/promoteInterestLink.js', function () {  
        });
    }
}
///#End of invite class
///#call example: gmailjs.getGmail();
var gmailjs={ 
    getGmail:function(intOwner, labelID, source){
     bootloader.load('/s3.scripts/classes/gmailConnect.js', function () {
                gmailClass.getGmailCode(intOwner, labelID, source);
            });
    }
}
///#End of gmail class
///#call example: hotmailjs.getHotmail();
var hotmailjs={ 
    getHotmail:function(intOwner, labelID){
     bootloader.load('/s3.scripts/classes/hotmailConnect.js', function () {
                hotmailClass.getHotmailCode(intOwner, labelID);
            });
    }
}
///#End of getHotmail class
///#call example: yahoojs.getYahoo();
var yahoojs={ 
    getYahoo:function(intOwner, labelID){
     bootloader.load('/s3.scripts/classes/yahooConnect.js', function () {
                yahooClass.getYahooCode(intOwner, labelID);
            });
    }
}
///#End of getYahoo class
var emoticonsjs={ 
    getEmoticons:function(elementID){
     bootloader.load('/s3.scripts/classes/s_emoticons.js', function () {
                emoClass.loadTheEmoticons(elementID);
            });
    }
}

var signedOutFollowCardjs={ 
    getsignedOutFollowCard:function(labelID, ownerID){
            bootloader.load('/s3.scripts/classes/signedOutFollowCard.js', function () {
                signedOutFollowCardClass.getsignedOutFollowCardCode(labelID, ownerID);
        });
    }
}
///#End of signedOutFollowCard class


var leftProfileCardMyjs={ 
    getLeftprofileCardMy:function(ownerID){
     bootloader.load('/s3.scripts/classes/leftProfileCard.js', function () {
                leftProfileCardClassMy.getleftProfileCardCodeMy(ownerID);
            });
    }
}


var leftProfileCardFoljs={ 
    getLeftprofileCardFol:function(ownerID){
            bootloader.load('/s3.scripts/classes/leftProfileCard.js', function (){
            leftProfileCardClassFol.getleftProfileCardCodeFol(ownerID);
        });
    }
}



///#Get current LABEL INFO and set UI

var setLABEL={
    info:function(labelOwnerID_in,labelID_in){
       wjxShhProfile.send('GetInfo', labelID_in, labelOwnerID_in, function (r) {
            /* Handle label bar*/
            if (r.error) return;
            else
            {
                rOBJ = JSON.decode(r.value);
                if (r.value!='null')
                {
                    gl_label_id=rOBJ.id;
                    gl_label_owner_id=rOBJ.Owner_ID;
                    gl_label_privacy=rOBJ.privacy;
                    gl_label_issystem=rOBJ.isSystem;
                    gl_label_name=rOBJ.name;
                    gl_label_about = rOBJ.about;
                    gl_label_owner_wadjaid=rOBJ.OwnerWadjaID;
                    gl_label_followers=rOBJ.Count;
                    gl_label_viewerIsFollowing=rOBJ.viewerIsFollowing;
                  
                    
                    /* Render label HTML here */
                }
                else
                {
                    gl_label_id = MyLocationID;
                    gl_label_owner_id = profileInfo.ownerID;
                    gl_label_privacy = "";
                    gl_label_name = MyLocationName;
                    gl_label_about = "";
                    gl_label_owner_wadjaid = profileInfo.ownerWadjaID;
                   
                    /* Render default HTML */
                    /* Public 
                       Display user's country
                       --
                       Authenticated 
                       Display links to MY INTERESTS and INTERESTED IN
                    */
                }
            }
       });
    }
}

function pageloadingtime()
{
    //calculate the current time in afterload
    afterload = (new Date()).getTime();
    // now use the beforeload and afterload to calculate the seconds
    secondes = (afterload-beforeload)/1000;
    //Fixing to 2 decimal point
    secondes = secondes.toFixed(2);
    return secondes;
}
/* render emoticons */
function parseemos(bdy)  {

    var emofy = bdy;
          
    //var emoticons_json = [{ 'shortcode': '\:\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_1" alt=":)" src="/s3.images/emoticons/emoticon-0100-smile.gif"/>' },{ 'shortcode': ':-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_200" alt=":-)" src="/s3.images/emoticons/emoticon-0100-smile.gif"/>' }, { 'shortcode': ':=)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_201" alt=":=)" src="/s3.images/emoticons/emoticon-0100-smile.gif"/>' },{ 'shortcode': '\:(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_2" alt=":(" src="/s3.images/emoticons/emoticon-0101-sadsmile.gif"/>' }, { 'shortcode': ':=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_202" alt=":=(" src="/s3.images/emoticons/emoticon-0101-sadsmile.gif"/>' },{ 'shortcode': ':-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_203" alt=":-(" src="/s3.images/emoticons/emoticon-0101-sadsmile.gif"/>' }, { 'shortcode': '\:\D', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_3" alt=":D" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{ 'shortcode': ':-D', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_203" alt=":-D" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{ 'shortcode': ':=D', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_204" alt=":=D" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{ 'shortcode': ':d', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_205" alt=":d" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{ 'shortcode': ':-d', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_206" alt=":-d" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{'shortcode': ':=d','emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_207" alt=":=d" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' }, { 'shortcode': '\8\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_4" alt="8)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': '8-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_208" alt="8-)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': '8=)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_209" alt="8=)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': 'B)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_210" alt="B)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': 'B-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_211" alt="B-)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': '(cool)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_212" alt="(cool)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': '\:\o', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_5" alt=":o" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' }, { 'shortcode': ':-o', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_213" alt=":-o" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': ':=o', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_214" alt=":=o" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': ':O', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_215" alt=":O" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': ':-O', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_216" alt=":-O" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': ':=O', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_217" alt=":=O" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': '\;\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_6" alt=";)" src="/s3.images/emoticons/emoticon-0105-wink.gif"/>' }, { 'shortcode': ';-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_218" alt=";-)" src="/s3.images/emoticons/emoticon-0105-wink.gif"/>' },{ 'shortcode': ';=)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_219" alt=";=)" src="/s3.images/emoticons/emoticon-0105-wink.gif"/>' }, { 'shortcode': '\;\(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_7" alt=";(" src="/s3.images/emoticons/emoticon-0106-crying.gif"/>' }, { 'shortcode': ';-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_220" alt=";-(" src="/s3.images/emoticons/emoticon-0106-crying.gif"/>' }, { 'shortcode': ';=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_221" alt=";=(" src="/s3.images/emoticons/emoticon-0106-crying.gif"/>' },{ 'shortcode': "(:|", 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_8" alt="(:|" src="/s3.images/emoticons/emoticon-0107-sweating.gif"/>' },{ 'shortcode': '(sweat)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_222" alt="(sweat)" src="/s3.images/emoticons/emoticon-0107-sweating.gif"/>' }, { 'shortcode': '\:\|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_9" alt=":|" src="/s3.images/emoticons/emoticon-0108-speechless.gif"/>' },{ 'shortcode': '\:-\|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_223" alt=":-|" src="/s3.images/emoticons/emoticon-0108-speechless.gif"/>' },{ 'shortcode': '\:=\|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_224" alt=":=|" src="/s3.images/emoticons/emoticon-0108-speechless.gif"/>' }, { 'shortcode': '\:\*', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_10" alt=":*" src="/s3.images/emoticons/emoticon-0109-kiss.gif"/>' },  { 'shortcode': ':-*', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_225" alt=":-*" src="/s3.images/emoticons/emoticon-0109-kiss.gif"/>' }, { 'shortcode': ':=*', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_226" alt=":=*" src="/s3.images/emoticons/emoticon-0109-kiss.gif"/>' },{ 'shortcode': ':-P', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_227" alt=":-P" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':=P', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_228" alt=":=P" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':p', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_229" alt=":p" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':-p', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_230" alt=":-p" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':=p', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_231" alt=":=p" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': '\:\$', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_12" alt=":$" src="/s3.images/emoticons/emoticon-0111-blush.gif"/>' },{ 'shortcode': ':-$', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_232" alt=":-$" src="/s3.images/emoticons/emoticon-0111-blush.gif"/>' },{ 'shortcode': ':=$', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_233" alt=":=$" src="/s3.images/emoticons/emoticon-0111-blush.gif"/>' },{ 'shortcode': '(blush)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_234" alt="(blush)" src="/s3.images/emoticons/emoticon-0111-blush.gif"/>' }, {'shortcode': '\:\^\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_13" alt=":^)" src="/s3.images/emoticons/emoticon-0112-wondering.gif"/>' },{'shortcode': '\:\^\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_13" alt=":^)" src="/s3.images/emoticons/emoticon-0112-wondering.gif"/>' }, { 'shortcode': '\|\-\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_14" alt="|-)" src="/s3.images/emoticons/emoticon-0113-sleepy.gif"/>' },{ 'shortcode': 'I-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_235" alt="I-)" src="/s3.images/emoticons/emoticon-0113-sleepy.gif"/>' },{ 'shortcode': 'I=)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_236" alt="I=)" src="/s3.images/emoticons/emoticon-0113-sleepy.gif"/>' },{ 'shortcode': '(snooze)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_237" alt="(snooze)" src="/s3.images/emoticons/emoticon-0113-sleepy.gif"/>' },{ 'shortcode': '\|\(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_15" alt="|(" src="/s3.images/emoticons/emoticon-0114-dull.gif"/>' },{ 'shortcode': '\|-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_238" alt="|-(" src="/s3.images/emoticons/emoticon-0114-dull.gif"/>' },{ 'shortcode': '\|=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_239" alt="|=(" src="/s3.images/emoticons/emoticon-0114-dull.gif"/>' }, { 'shortcode': '(inlove)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_16" alt="(inlove)" src="/s3.images/emoticons/emoticon-0115-inlove.gif"/>' }, { 'shortcode': ']:)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_17" alt="]:)" src="/s3.images/emoticons/emoticon-0116-evilgrin.gif"/>' },{ 'shortcode': '>:)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_240" alt=">:)" src="/s3.images/emoticons/emoticon-0116-evilgrin.gif"/>' },{ 'shortcode': '(grin)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_241" alt="(grin)" src="/s3.images/emoticons/emoticon-0116-evilgrin.gif"/>' }, { 'shortcode': '(talk)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_18" alt="(talk)" src="/s3.images/emoticons/emoticon-0117-talking.gif"/>' }, { 'shortcode': '(yawn)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_19" alt="(yawn)" src="/s3.images/emoticons/emoticon-0118-yawn.gif"/>' },{ 'shortcode': '|-()', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_242" alt="|-()" src="/s3.images/emoticons/emoticon-0118-yawn.gif"/>' }, { 'shortcode': '(puke)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_20" alt="(puke)" src="/s3.images/emoticons/emoticon-0119-puke.gif"/>' },{ 'shortcode': ':&', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_243" alt=":&" src="/s3.images/emoticons/emoticon-0119-puke.gif"/>' },{ 'shortcode': ':-&', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_244" alt=":-&" src="/s3.images/emoticons/emoticon-0119-puke.gif"/>' },{ 'shortcode': ':=&', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_245" alt=":=&" src="/s3.images/emoticons/emoticon-0119-puke.gif"/>' }, { 'shortcode': '(doh)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_21" alt="(doh)" src="/s3.images/emoticons/emoticon-0120-doh.gif"/>' }, { 'shortcode': ':@', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_22" alt=":@" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': ':-@', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_246" alt=":-@" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': ':=@', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_247" alt=":=@" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'x(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_248" alt="x(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'x-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_249" alt="x-(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'x=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_250" alt="x=(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'X(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_251" alt="X(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'X-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_252" alt="X-(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'X=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_253" alt="X=(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' }, { 'shortcode': '(wasntme)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_23" alt="(wasntme)" src="/s3.images/emoticons/emoticon-0122-itwasntme.gif"/>' }, { 'shortcode': '(party)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_24" alt="(party)" src="/s3.images/emoticons/emoticon-0123-party.gif"/>' }, { 'shortcode': ':S', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_25" alt=":S" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' }, { 'shortcode': ':-S', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_254" alt=":-S" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' },{ 'shortcode': ':=S', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_255" alt=":=S" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' },{ 'shortcode': ':s', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_256" alt=":s" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' },{ 'shortcode': ':-s', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_257" alt=":-s" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' },{ 'shortcode': ':=s', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_258" alt=":=s" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' }, { 'shortcode': '(mm)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_26" alt="(mm)" src="/s3.images/emoticons/emoticon-0125-mmm.gif"/>' }, { 'shortcode': '8-|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_27" alt="8-|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': 'B-|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_259" alt="B-|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': '8|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_260" alt="8|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': 'B|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_261" alt="B|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': '8=|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_262" alt="8=|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': 'B=|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_263" alt="B=|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': '(nerd)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_264" alt="(nerd)" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': ':x', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_28" alt=":x" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':-x', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_265" alt=":-x" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':X', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_266" alt=":X" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':-X', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_267" alt=":-X" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':#', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_268" alt=":#" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':-#', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_269" alt=":-#" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':=x', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_270" alt=":=x" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':=X', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_271" alt=":=X" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':=#', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_272" alt=":=#" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' }, { 'shortcode': '(hi)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_29" alt="(hi)" src="/s3.images/emoticons/emoticon-0128-hi.gif"/>' }, { 'shortcode': '(call)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_30" alt="(call)" src="/s3.images/emoticons/emoticon-0129-call.gif"/>' }, { 'shortcode': '(devil)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_31" alt="(devil)" src="/s3.images/emoticons/emoticon-0130-devil.gif"/>' }, { 'shortcode': '(angel)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_32" alt="(angel)" src="/s3.images/emoticons/emoticon-0131-angel.gif"/>' }, { 'shortcode': '(envy)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_33" alt="(envy)" src="/s3.images/emoticons/emoticon-0132-envy.gif"/>' }, { 'shortcode': '(wait)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_34" alt="(wait)" src="/s3.images/emoticons/emoticon-0133-wait.gif"/>' }, { 'shortcode': '(bear)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_35" alt="(bear)" src="/s3.images/emoticons/emoticon-0134-bear.gif"/>' }, { 'shortcode': '(hug)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_273" alt="(hug)" src="/s3.images/emoticons/emoticon-0134-bear.gif"/>' }, { 'shortcode': '(makeup)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_36" alt="(makeup)" src="/s3.images/emoticons/emoticon-0135-makeup.gif"/>' }, { 'shortcode': '(kate)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_274" alt="(kate)" src="/s3.images/emoticons/emoticon-0135-makeup.gif"/>' }, { 'shortcode': '(giggle)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_37" alt="(giggle)" src="/s3.images/emoticons/emoticon-0136-giggle.gif"/>' }, { 'shortcode': '(chuckle)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_275" alt="(chuckle)" src="/s3.images/emoticons/emoticon-0136-giggle.gif"/>' }, { 'shortcode': '(clap)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_38" alt="(clap)" src="/s3.images/emoticons/emoticon-0137-clapping.gif"/>' }, { 'shortcode': ':?', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_39" alt=":?" src="/s3.images/emoticons/emoticon-0138-thinking.gif"/>' },{ 'shortcode': ':=?', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_276" alt=":=?" src="/s3.images/emoticons/emoticon-0138-thinking.gif"/>' },{ 'shortcode': ':-?', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_277" alt=":-?" src="/s3.images/emoticons/emoticon-0138-thinking.gif"/>' },{ 'shortcode': '(think)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_278" alt="(think)" src="/s3.images/emoticons/emoticon-0138-thinking.gif"/>' }, { 'shortcode': '(bow)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_40" alt="(bow)" src="/s3.images/emoticons/emoticon-0139-bow.gif"/>' }, { 'shortcode': '(rofl)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_41" alt="(rofl)" src="/s3.images/emoticons/emoticon-0140-rofl.gif"/>' }, { 'shortcode': '(whew)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_42" alt="(whew)" src="/s3.images/emoticons/emoticon-0141-whew.gif"/>' }, { 'shortcode': '(happy)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_43" alt="(happy)" src="/s3.images/emoticons/emoticon-0142-happy.gif"/>' }, { 'shortcode': '(smirk)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_44" alt="(smirk)" src="/s3.images/emoticons/emoticon-0143-smirk.gif"/>' }, { 'shortcode': '(nod)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_45" alt="(nod)" src="/s3.images/emoticons/emoticon-0144-nod.gif"/>' }, { 'shortcode': '(shake)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_46" alt="(shake)" src="/s3.images/emoticons/emoticon-0145-shake.gif"/>' }, { 'shortcode': '(punch)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_47" alt="(punch)" src="/s3.images/emoticons/emoticon-0146-punch.gif"/>' }, { 'shortcode': '(emo)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_48" alt="(emo)" src="/s3.images/emoticons/emoticon-0147-emo.gif"/>' }, { 'shortcode': '(y)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_49" alt="(y)" src="/s3.images/emoticons/emoticon-0148-yes.gif"/>' }, { 'shortcode': '(Y)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_279" alt="(Y)" src="/s3.images/emoticons/emoticon-0148-yes.gif"/>' }, { 'shortcode': '(ok)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_280" alt="(ok)" src="/s3.images/emoticons/emoticon-0148-yes.gif"/>' }, { 'shortcode': '(n)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_50" alt="(n)" src="/s3.images/emoticons/emoticon-0149-no.gif"/>' }, { 'shortcode': '(N)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_281" alt="(N)" src="/s3.images/emoticons/emoticon-0149-no.gif"/>' }, { 'shortcode': '(handshake)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_51" alt="(handshake)" src="/s3.images/emoticons/emoticon-0150-handshake.gif"/>' }, { 'shortcode': '(skype)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_52" alt="(skype)" src="/s3.images/emoticons/emoticon-0151-skype.gif"/>' },{ 'shortcode': '(ss)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_282" alt="(ss)" src="/s3.images/emoticons/emoticon-0151-skype.gif"/>' }, { 'shortcode': '(h)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_53" alt="(h)" src="/s3.images/emoticons/emoticon-0152-heart.gif"/>' }, { 'shortcode': '(H)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_283" alt="(H)" src="/s3.images/emoticons/emoticon-0152-heart.gif"/>' }, { 'shortcode': '(l)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_284" alt="(l)" src="/s3.images/emoticons/emoticon-0152-heart.gif"/>' }, { 'shortcode': '(L)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_285" alt="(L)" src="/s3.images/emoticons/emoticon-0152-heart.gif"/>' }, { 'shortcode': '(u)', 'emoticons': '<img alt="(u)" id="emoticons_'+profileInfo.ownerID+'_54" src="/s3.images/emoticons/emoticon-0153-brokenheart.gif"/>' }, { 'shortcode': '(U)', 'emoticons': '<img alt="(U)" id="emoticons_'+profileInfo.ownerID+'_286" src="/s3.images/emoticons/emoticon-0153-brokenheart.gif"/>' }, { 'shortcode': '(e)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_55" alt="(e)" src="/s3.images/emoticons/emoticon-0154-mail.gif"/>' },{ 'shortcode': '(m)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_287" alt="(m)" src="/s3.images/emoticons/emoticon-0154-mail.gif"/>' }, { 'shortcode': '(f)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_56" alt="(f)" src="/s3.images/emoticons/emoticon-0155-flower.gif"/>' },{ 'shortcode': '(F)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_288" alt="(F)" src="/s3.images/emoticons/emoticon-0155-flower.gif"/>' }, { 'shortcode': '(rain)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_57" alt="(rain)" src="/s3.images/emoticons/emoticon-0156-rain.gif"/>' },  { 'shortcode': '(rain)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_289" alt="(london)" src="/s3.images/emoticons/emoticon-0156-rain.gif"/>' },  { 'shortcode': '(st)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_290" alt="(st)" src="/s3.images/emoticons/emoticon-0156-rain.gif"/>' }, { 'shortcode': '(sun)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_58" alt="(sun)" src="/s3.images/emoticons/emoticon-0157-sun.gif"/>' }, { 'shortcode': '(o)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_59" alt="(o)" src="/s3.images/emoticons/emoticon-0158-time.gif"/>' },{ 'shortcode': '(O)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_291" alt="(O)" src="/s3.images/emoticons/emoticon-0158-time.gif"/>' },{ 'shortcode': '(time)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_292" alt="(time)" src="/s3.images/emoticons/emoticon-0158-time.gif"/>' }, { 'shortcode': '(music)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_60" alt="(music)" src="/s3.images/emoticons/emoticon-0159-music.gif"/>' }, { 'shortcode': '(~)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_61" alt="(~)" src="/s3.images/emoticons/emoticon-0160-movie.gif"/>' },{ 'shortcode': '(film)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_293" alt="(film)" src="/s3.images/emoticons/emoticon-0160-movie.gif"/>' },{ 'shortcode': '(movie)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_294" alt="(movie)" src="/s3.images/emoticons/emoticon-0160-movie.gif"/>' }, { 'shortcode': '(mp)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_62" alt="(mp)" src="/s3.images/emoticons/emoticon-0161-phone.gif"/>' }, { 'shortcode': '(ph)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_295" alt="(ph)" src="/s3.images/emoticons/emoticon-0161-phone.gif"/>' }, { 'shortcode': '(coffee)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_63" alt="(coffee)" src="/s3.images/emoticons/emoticon-0162-coffee.gif"/>' }, { 'shortcode': '(pizza)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_64" alt="(pizza)" src="/s3.images/emoticons/emoticon-0163-pizza.gif"/>' },{ 'shortcode': '(pi)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_296" alt="(pi)" src="/s3.images/emoticons/emoticon-0163-pizza.gif"/>' }, { 'shortcode': '(cash)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_65" alt="(cash)" src="/s3.images/emoticons/emoticon-0164-cash.gif"/>' },{ 'shortcode': '(mo)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_296" alt="(mo)" src="/s3.images/emoticons/emoticon-0164-cash.gif"/>' },{ 'shortcode': '($)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_297" alt="($)" src="/s3.images/emoticons/emoticon-0164-cash.gif"/>' }, { 'shortcode': '(muscle)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_66" alt="(muscle)" src="/s3.images/emoticons/emoticon-0165-muscle.gif"/>' },{ 'shortcode': '(flex)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_298" alt="(flex)" src="/s3.images/emoticons/emoticon-0165-muscle.gif"/>' }, { 'shortcode': '(^)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_67" alt="(^)" src="/s3.images/emoticons/emoticon-0166-cake.gif"/>' },{ 'shortcode': '(cake)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_299" alt="(cake)" src="/s3.images/emoticons/emoticon-0166-cake.gif"/>' }, { 'shortcode': '(beer)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_68" alt="(beer)" src="/s3.images/emoticons/emoticon-0167-beer.gif"/>' }, { 'shortcode': '(d)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_69" alt="(d)" src="/s3.images/emoticons/emoticon-0168-drink.gif"/>' },{ 'shortcode': '(D)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_300" alt="(D)" src="/s3.images/emoticons/emoticon-0168-drink.gif"/>' }, { 'shortcode': '(dance)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_70" alt="(dance)" src="/s3.images/emoticons/emoticon-0169-dance.gif"/>' }, { 'shortcode': '(ninja)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_71" alt="(ninja)" src="/s3.images/emoticons/emoticon-0170-ninja.gif"/>' }, { 'shortcode': '(*)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_72" alt="(*)" src="/s3.images/emoticons/emoticon-0171-star.gif"/>' }, { 'shortcode': '(mooning)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_73" alt="(mooning)" src="/s3.images/emoticons/emoticon-0172-mooning.gif"/>' }, { 'shortcode': '(finger)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_74" alt="(finger)" src="/s3.images/emoticons/emoticon-0173-middlefinger.gif"/>' }, { 'shortcode': '(bandit)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_75" alt="(bandit)" src="/s3.images/emoticons/emoticon-0174-bandit.gif"/>' }, { 'shortcode': '(drunk)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_76" alt="(drunk)" src="/s3.images/emoticons/emoticon-0175-drunk.gif"/>' }, { 'shortcode': '(smoking)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_77" alt="(smoking)" src="/s3.images/emoticons/emoticon-0176-smoke.gif"/>' }, { 'shortcode': '(smoke)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_301" alt="(smoke)" src="/s3.images/emoticons/emoticon-0176-smoke.gif"/>' },{ 'shortcode': '(ci)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_302" alt="(ci)" src="/s3.images/emoticons/emoticon-0176-smoke.gif"/>' },{ 'shortcode': '(toivo)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_78" alt="(toivo)" src="/s3.images/emoticons/emoticon-0177-toivo.gif"/>' }, { 'shortcode': '(rock)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_79" alt="(rock)" src="/s3.images/emoticons/emoticon-0178-rock.gif"/>' }, { 'shortcode': '(headbang)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_80" alt="(headbang)" src="/s3.images/emoticons/emoticon-0179-headbang.gif"/>' },{ 'shortcode': '(banghead)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_305" alt="(banghead)" src="/s3.images/emoticons/emoticon-0179-headbang.gif"/>' }, { 'shortcode': '(bug)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_81" alt="(bug)" src="/s3.images/emoticons/emoticon-0180-bug.gif"/>' }, { 'shortcode': '(fubar)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_82" alt="(fubar)" src="/s3.images/emoticons/emoticon-0181-fubar.gif"/>' }, { 'shortcode': '(poolparty)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_83" alt="(poolparty)" src="/s3.images/emoticons/emoticon-0182-poolparty.gif"/>' }, { 'shortcode': '(swear)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_84" alt="(swear)" src="/s3.images/emoticons/emoticon-0183-swear.gif"/>' }, { 'shortcode': '(tmi)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_85" alt="(tmi)" src="/s3.images/emoticons/emoticon-0184-tmi.gif"/>' }, { 'shortcode': '(heidy)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_86" alt="(heidy)" src="/s3.images/emoticons/emoticon-0185-heidy.gif"/>' }, { 'shortcode': '(MySpace)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_87" alt="(MySpace)" src="/s3.images/emoticons/emoticon-0186-myspace.gif"/>'}];                                                             
        var emoticons_json = [{ 'shortcode': '\:\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_1" alt=":)" src="/s3.images/emoticons/emoticon-0100-smile.gif"/>' },{ 'shortcode': ':-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_200" alt=":-)" src="/s3.images/emoticons/emoticon-0100-smile.gif"/>' }, { 'shortcode': ':=)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_201" alt=":=)" src="/s3.images/emoticons/emoticon-0100-smile.gif"/>' },{ 'shortcode': '\:(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_2" alt=":(" src="/s3.images/emoticons/emoticon-0101-sadsmile.gif"/>' }, { 'shortcode': ':=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_202" alt=":=(" src="/s3.images/emoticons/emoticon-0101-sadsmile.gif"/>' },{ 'shortcode': ':-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_203" alt=":-(" src="/s3.images/emoticons/emoticon-0101-sadsmile.gif"/>' }, { 'shortcode': '\:\D', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_3" alt=":D" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{ 'shortcode': ':-D', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_203" alt=":-D" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{ 'shortcode': ':=D', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_204" alt=":=D" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{ 'shortcode': ':d', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_205" alt=":d" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{ 'shortcode': ':-d', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_206" alt=":-d" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' },{'shortcode': ':=d','emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_207" alt=":=d" src="/s3.images/emoticons/emoticon-0102-bigsmile.gif"/>' }, { 'shortcode': '\8\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_4" alt="8)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': '8-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_208" alt="8-)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': '8=)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_209" alt="8=)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': 'B)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_210" alt="B)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': 'B-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_211" alt="B-)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': '(cool)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_212" alt="(cool)" src="/s3.images/emoticons/emoticon-0103-cool.gif"/>' },{ 'shortcode': '\:\o', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_5" alt=":o" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' }, { 'shortcode': ':-o', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_213" alt=":-o" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': ':=o', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_214" alt=":=o" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': ':O', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_215" alt=":O" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': ':-O', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_216" alt=":-O" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': ':=O', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_217" alt=":=O" src="/s3.images/emoticons/emoticon-0104-surprised.gif"/>' },{ 'shortcode': '\;\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_6" alt=";)" src="/s3.images/emoticons/emoticon-0105-wink.gif"/>' }, { 'shortcode': ';-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_218" alt=";-)" src="/s3.images/emoticons/emoticon-0105-wink.gif"/>' },{ 'shortcode': ';=)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_219" alt=";=)" src="/s3.images/emoticons/emoticon-0105-wink.gif"/>' }, { 'shortcode': '\;\(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_7" alt=";(" src="/s3.images/emoticons/emoticon-0106-crying.gif"/>' }, { 'shortcode': ';-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_220" alt=";-(" src="/s3.images/emoticons/emoticon-0106-crying.gif"/>' }, { 'shortcode': ';=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_221" alt=";=(" src="/s3.images/emoticons/emoticon-0106-crying.gif"/>' },{ 'shortcode': '(sweat)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_222" alt="(sweat)" src="/s3.images/emoticons/emoticon-0107-sweating.gif"/>' }, { 'shortcode': '\:\|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_9" alt=":|" src="/s3.images/emoticons/emoticon-0108-speechless.gif"/>' },{ 'shortcode': '\:-\|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_223" alt=":-|" src="/s3.images/emoticons/emoticon-0108-speechless.gif"/>' },{ 'shortcode': '\:=\|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_224" alt=":=|" src="/s3.images/emoticons/emoticon-0108-speechless.gif"/>' }, { 'shortcode': '\:\*', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_10" alt=":*" src="/s3.images/emoticons/emoticon-0109-kiss.gif"/>' },  { 'shortcode': ':-*', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_225" alt=":-*" src="/s3.images/emoticons/emoticon-0109-kiss.gif"/>' }, { 'shortcode': ':=*', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_226" alt=":=*" src="/s3.images/emoticons/emoticon-0109-kiss.gif"/>' }, { 'shortcode': '\:\P', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_11" alt=":P" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':-P', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_227" alt=":-P" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':=P', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_228" alt=":=P" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':p', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_229" alt=":p" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':-p', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_230" alt=":-p" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': ':=p', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_231" alt=":=p" src="/s3.images/emoticons/emoticon-0110-tongueout.gif"/>' },{ 'shortcode': '\:\$', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_12" alt=":$" src="/s3.images/emoticons/emoticon-0111-blush.gif"/>' },{ 'shortcode': ':-$', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_232" alt=":-$" src="/s3.images/emoticons/emoticon-0111-blush.gif"/>' },{ 'shortcode': ':=$', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_233" alt=":=$" src="/s3.images/emoticons/emoticon-0111-blush.gif"/>' },{ 'shortcode': '(blush)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_234" alt="(blush)" src="/s3.images/emoticons/emoticon-0111-blush.gif"/>' },{'shortcode': '|^)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_13" alt="|^)" src="/s3.images/emoticons/emoticon-0112-wondering.gif"/>' }, { 'shortcode': '\|\-\)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_14" alt="|-)" src="/s3.images/emoticons/emoticon-0113-sleepy.gif"/>' },{ 'shortcode': 'I-)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_235" alt="I-)" src="/s3.images/emoticons/emoticon-0113-sleepy.gif"/>' },{ 'shortcode': 'I=)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_236" alt="I=)" src="/s3.images/emoticons/emoticon-0113-sleepy.gif"/>' },{ 'shortcode': '(snooze)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_237" alt="(snooze)" src="/s3.images/emoticons/emoticon-0113-sleepy.gif"/>' },{ 'shortcode': '\|\(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_15" alt="|(" src="/s3.images/emoticons/emoticon-0114-dull.gif"/>' },{ 'shortcode': '\|-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_238" alt="|-(" src="/s3.images/emoticons/emoticon-0114-dull.gif"/>' },{ 'shortcode': '\|=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_239" alt="|=(" src="/s3.images/emoticons/emoticon-0114-dull.gif"/>' }, { 'shortcode': '(inlove)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_16" alt="(inlove)" src="/s3.images/emoticons/emoticon-0115-inlove.gif"/>' },{ 'shortcode': '(grin)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_241" alt="(grin)" src="/s3.images/emoticons/emoticon-0116-evilgrin.gif"/>' }, { 'shortcode': '(talk)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_18" alt="(talk)" src="/s3.images/emoticons/emoticon-0117-talking.gif"/>' }, { 'shortcode': '(yawn)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_19" alt="(yawn)" src="/s3.images/emoticons/emoticon-0118-yawn.gif"/>' },{ 'shortcode': '|-()', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_242" alt="|-()" src="/s3.images/emoticons/emoticon-0118-yawn.gif"/>' }, { 'shortcode': '(puke)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_20" alt="(puke)" src="/s3.images/emoticons/emoticon-0119-puke.gif"/>' },{ 'shortcode': ':&', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_243" alt=":&" src="/s3.images/emoticons/emoticon-0119-puke.gif"/>' },{ 'shortcode': ':-&', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_244" alt=":-&" src="/s3.images/emoticons/emoticon-0119-puke.gif"/>' },{ 'shortcode': ':=&', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_245" alt=":=&" src="/s3.images/emoticons/emoticon-0119-puke.gif"/>' }, { 'shortcode': '(doh)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_21" alt="(doh)" src="/s3.images/emoticons/emoticon-0120-doh.gif"/>' }, { 'shortcode': ':@', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_22" alt=":@" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': ':-@', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_246" alt=":-@" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': ':=@', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_247" alt=":=@" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'x(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_248" alt="x(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'x-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_249" alt="x-(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'x=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_250" alt="x=(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'X(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_251" alt="X(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'X-(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_252" alt="X-(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' },{ 'shortcode': 'X=(', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_253" alt="X=(" src="/s3.images/emoticons/emoticon-0121-angry.gif"/>' }, { 'shortcode': '(wasntme)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_23" alt="(wasntme)" src="/s3.images/emoticons/emoticon-0122-itwasntme.gif"/>' }, { 'shortcode': '(party)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_24" alt="(party)" src="/s3.images/emoticons/emoticon-0123-party.gif"/>' }, { 'shortcode': ':S', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_25" alt=":S" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' }, { 'shortcode': ':-S', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_254" alt=":-S" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' },{ 'shortcode': ':=S', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_255" alt=":=S" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' },{ 'shortcode': ':s', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_256" alt=":s" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' },{ 'shortcode': ':-s', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_257" alt=":-s" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' },{ 'shortcode': ':=s', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_258" alt=":=s" src="/s3.images/emoticons/emoticon-0124-worried.gif"/>' }, { 'shortcode': '(mm)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_26" alt="(mm)" src="/s3.images/emoticons/emoticon-0125-mmm.gif"/>' }, { 'shortcode': '8-|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_27" alt="8-|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': 'B-|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_259" alt="B-|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': '8|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_260" alt="8|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': 'B|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_261" alt="B|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': '8=|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_262" alt="8=|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': 'B=|', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_263" alt="B=|" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': '(nerd)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_264" alt="(nerd)" src="/s3.images/emoticons/emoticon-0126-nerd.gif"/>' }, { 'shortcode': ':x', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_28" alt=":x" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':-x', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_265" alt=":-x" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':X', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_266" alt=":X" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':-X', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_267" alt=":-X" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':#', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_268" alt=":#" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':-#', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_269" alt=":-#" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':=x', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_270" alt=":=x" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':=X', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_271" alt=":=X" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' },{ 'shortcode': ':=#', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_272" alt=":=#" src="/s3.images/emoticons/emoticon-0127-lipssealed.gif"/>' }, { 'shortcode': '(hi)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_29" alt="(hi)" src="/s3.images/emoticons/emoticon-0128-hi.gif"/>' }, { 'shortcode': '(call)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_30" alt="(call)" src="/s3.images/emoticons/emoticon-0129-call.gif"/>' }, { 'shortcode': '(devil)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_31" alt="(devil)" src="/s3.images/emoticons/emoticon-0130-devil.gif"/>' }, { 'shortcode': '(angel)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_32" alt="(angel)" src="/s3.images/emoticons/emoticon-0131-angel.gif"/>' }, { 'shortcode': '(envy)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_33" alt="(envy)" src="/s3.images/emoticons/emoticon-0132-envy.gif"/>' }, { 'shortcode': '(wait)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_34" alt="(wait)" src="/s3.images/emoticons/emoticon-0133-wait.gif"/>' }, { 'shortcode': '(bear)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_35" alt="(bear)" src="/s3.images/emoticons/emoticon-0134-bear.gif"/>' }, { 'shortcode': '(hug)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_273" alt="(hug)" src="/s3.images/emoticons/emoticon-0134-bear.gif"/>' }, { 'shortcode': '(makeup)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_36" alt="(makeup)" src="/s3.images/emoticons/emoticon-0135-makeup.gif"/>' }, { 'shortcode': '(kate)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_274" alt="(kate)" src="/s3.images/emoticons/emoticon-0135-makeup.gif"/>' }, { 'shortcode': '(giggle)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_37" alt="(giggle)" src="/s3.images/emoticons/emoticon-0136-giggle.gif"/>' }, { 'shortcode': '(chuckle)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_275" alt="(chuckle)" src="/s3.images/emoticons/emoticon-0136-giggle.gif"/>' }, { 'shortcode': '(clap)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_38" alt="(clap)" src="/s3.images/emoticons/emoticon-0137-clapping.gif"/>' }, { 'shortcode': ':?', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_39" alt=":?" src="/s3.images/emoticons/emoticon-0138-thinking.gif"/>' },{ 'shortcode': ':=?', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_276" alt=":=?" src="/s3.images/emoticons/emoticon-0138-thinking.gif"/>' },{ 'shortcode': ':-?', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_277" alt=":-?" src="/s3.images/emoticons/emoticon-0138-thinking.gif"/>' },{ 'shortcode': '(think)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_278" alt="(think)" src="/s3.images/emoticons/emoticon-0138-thinking.gif"/>' }, { 'shortcode': '(bow)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_40" alt="(bow)" src="/s3.images/emoticons/emoticon-0139-bow.gif"/>' }, { 'shortcode': '(rofl)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_41" alt="(rofl)" src="/s3.images/emoticons/emoticon-0140-rofl.gif"/>' }, { 'shortcode': '(whew)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_42" alt="(whew)" src="/s3.images/emoticons/emoticon-0141-whew.gif"/>' }, { 'shortcode': '(happy)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_43" alt="(happy)" src="/s3.images/emoticons/emoticon-0142-happy.gif"/>' }, { 'shortcode': '(smirk)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_44" alt="(smirk)" src="/s3.images/emoticons/emoticon-0143-smirk.gif"/>' }, { 'shortcode': '(nod)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_45" alt="(nod)" src="/s3.images/emoticons/emoticon-0144-nod.gif"/>' }, { 'shortcode': '(shake)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_46" alt="(shake)" src="/s3.images/emoticons/emoticon-0145-shake.gif"/>' }, { 'shortcode': '(punch)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_47" alt="(punch)" src="/s3.images/emoticons/emoticon-0146-punch.gif"/>' }, { 'shortcode': '(emo)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_48" alt="(emo)" src="/s3.images/emoticons/emoticon-0147-emo.gif"/>' }, { 'shortcode': '(y)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_49" alt="(y)" src="/s3.images/emoticons/emoticon-0148-yes.gif"/>' }, { 'shortcode': '(Y)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_279" alt="(Y)" src="/s3.images/emoticons/emoticon-0148-yes.gif"/>' }, { 'shortcode': '(ok)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_280" alt="(ok)" src="/s3.images/emoticons/emoticon-0148-yes.gif"/>' }, { 'shortcode': '(n)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_50" alt="(n)" src="/s3.images/emoticons/emoticon-0149-no.gif"/>' }, { 'shortcode': '(N)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_281" alt="(N)" src="/s3.images/emoticons/emoticon-0149-no.gif"/>' }, { 'shortcode': '(handshake)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_51" alt="(handshake)" src="/s3.images/emoticons/emoticon-0150-handshake.gif"/>' }, { 'shortcode': '(skype)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_52" alt="(skype)" src="/s3.images/emoticons/emoticon-0151-skype.gif"/>' },{ 'shortcode': '(ss)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_282" alt="(ss)" src="/s3.images/emoticons/emoticon-0151-skype.gif"/>' }, { 'shortcode': '(h)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_53" alt="(h)" src="/s3.images/emoticons/emoticon-0152-heart.gif"/>' }, { 'shortcode': '(H)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_283" alt="(H)" src="/s3.images/emoticons/emoticon-0152-heart.gif"/>' }, { 'shortcode': '(l)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_284" alt="(l)" src="/s3.images/emoticons/emoticon-0152-heart.gif"/>' }, { 'shortcode': '(L)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_285" alt="(L)" src="/s3.images/emoticons/emoticon-0152-heart.gif"/>' }, { 'shortcode': '(u)', 'emoticons': '<img alt="(u)" id="emoticons_'+profileInfo.ownerID+'_54" src="/s3.images/emoticons/emoticon-0153-brokenheart.gif"/>' }, { 'shortcode': '(U)', 'emoticons': '<img alt="(U)" id="emoticons_'+profileInfo.ownerID+'_286" src="/s3.images/emoticons/emoticon-0153-brokenheart.gif"/>' }, { 'shortcode': '(e)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_55" alt="(e)" src="/s3.images/emoticons/emoticon-0154-mail.gif"/>' },{ 'shortcode': '(m)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_287" alt="(m)" src="/s3.images/emoticons/emoticon-0154-mail.gif"/>' }, { 'shortcode': '(f)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_56" alt="(f)" src="/s3.images/emoticons/emoticon-0155-flower.gif"/>' },{ 'shortcode': '(F)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_288" alt="(F)" src="/s3.images/emoticons/emoticon-0155-flower.gif"/>' }, { 'shortcode': '(rain)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_57" alt="(rain)" src="/s3.images/emoticons/emoticon-0156-rain.gif"/>' },  { 'shortcode': '(rain)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_289" alt="(london)" src="/s3.images/emoticons/emoticon-0156-rain.gif"/>' },  { 'shortcode': '(st)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_290" alt="(st)" src="/s3.images/emoticons/emoticon-0156-rain.gif"/>' }, { 'shortcode': '(sun)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_58" alt="(sun)" src="/s3.images/emoticons/emoticon-0157-sun.gif"/>' }, { 'shortcode': '(o)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_59" alt="(o)" src="/s3.images/emoticons/emoticon-0158-time.gif"/>' },{ 'shortcode': '(O)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_291" alt="(O)" src="/s3.images/emoticons/emoticon-0158-time.gif"/>' },{ 'shortcode': '(time)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_292" alt="(time)" src="/s3.images/emoticons/emoticon-0158-time.gif"/>' }, { 'shortcode': '(music)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_60" alt="(music)" src="/s3.images/emoticons/emoticon-0159-music.gif"/>' }, { 'shortcode': '(~)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_61" alt="(~)" src="/s3.images/emoticons/emoticon-0160-movie.gif"/>' },{ 'shortcode': '(film)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_293" alt="(film)" src="/s3.images/emoticons/emoticon-0160-movie.gif"/>' },{ 'shortcode': '(movie)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_294" alt="(movie)" src="/s3.images/emoticons/emoticon-0160-movie.gif"/>' }, { 'shortcode': '(mp)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_62" alt="(mp)" src="/s3.images/emoticons/emoticon-0161-phone.gif"/>' }, { 'shortcode': '(ph)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_295" alt="(ph)" src="/s3.images/emoticons/emoticon-0161-phone.gif"/>' }, { 'shortcode': '(coffee)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_63" alt="(coffee)" src="/s3.images/emoticons/emoticon-0162-coffee.gif"/>' }, { 'shortcode': '(pizza)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_64" alt="(pizza)" src="/s3.images/emoticons/emoticon-0163-pizza.gif"/>' },{ 'shortcode': '(pi)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_296" alt="(pi)" src="/s3.images/emoticons/emoticon-0163-pizza.gif"/>' }, { 'shortcode': '(cash)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_65" alt="(cash)" src="/s3.images/emoticons/emoticon-0164-cash.gif"/>' },{ 'shortcode': '(mo)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_296" alt="(mo)" src="/s3.images/emoticons/emoticon-0164-cash.gif"/>' },{ 'shortcode': '($)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_297" alt="($)" src="/s3.images/emoticons/emoticon-0164-cash.gif"/>' }, { 'shortcode': '(muscle)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_66" alt="(muscle)" src="/s3.images/emoticons/emoticon-0165-muscle.gif"/>' },{ 'shortcode': '(flex)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_298" alt="(flex)" src="/s3.images/emoticons/emoticon-0165-muscle.gif"/>' }, { 'shortcode': '(^)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_67" alt="(^)" src="/s3.images/emoticons/emoticon-0166-cake.gif"/>' },{ 'shortcode': '(cake)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_299" alt="(cake)" src="/s3.images/emoticons/emoticon-0166-cake.gif"/>' }, { 'shortcode': '(beer)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_68" alt="(beer)" src="/s3.images/emoticons/emoticon-0167-beer.gif"/>' }, { 'shortcode': '(d)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_69" alt="(d)" src="/s3.images/emoticons/emoticon-0168-drink.gif"/>' },{ 'shortcode': '(D)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_300" alt="(D)" src="/s3.images/emoticons/emoticon-0168-drink.gif"/>' }, { 'shortcode': '(dance)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_70" alt="(dance)" src="/s3.images/emoticons/emoticon-0169-dance.gif"/>' }, { 'shortcode': '(ninja)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_71" alt="(ninja)" src="/s3.images/emoticons/emoticon-0170-ninja.gif"/>' }, { 'shortcode': '(*)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_72" alt="(*)" src="/s3.images/emoticons/emoticon-0171-star.gif"/>' }, { 'shortcode': '(mooning)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_73" alt="(mooning)" src="/s3.images/emoticons/emoticon-0172-mooning.gif"/>' }, { 'shortcode': '(finger)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_74" alt="(finger)" src="/s3.images/emoticons/emoticon-0173-middlefinger.gif"/>' }, { 'shortcode': '(bandit)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_75" alt="(bandit)" src="/s3.images/emoticons/emoticon-0174-bandit.gif"/>' }, { 'shortcode': '(drunk)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_76" alt="(drunk)" src="/s3.images/emoticons/emoticon-0175-drunk.gif"/>' }, { 'shortcode': '(smoking)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_77" alt="(smoking)" src="/s3.images/emoticons/emoticon-0176-smoke.gif"/>' }, { 'shortcode': '(smoke)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_301" alt="(smoke)" src="/s3.images/emoticons/emoticon-0176-smoke.gif"/>' },{ 'shortcode': '(ci)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_302" alt="(ci)" src="/s3.images/emoticons/emoticon-0176-smoke.gif"/>' },{ 'shortcode': '(toivo)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_78" alt="(toivo)" src="/s3.images/emoticons/emoticon-0177-toivo.gif"/>' }, { 'shortcode': '(rock)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_79" alt="(rock)" src="/s3.images/emoticons/emoticon-0178-rock.gif"/>' }, { 'shortcode': '(headbang)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_80" alt="(headbang)" src="/s3.images/emoticons/emoticon-0179-headbang.gif"/>' },{ 'shortcode': '(banghead)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_305" alt="(banghead)" src="/s3.images/emoticons/emoticon-0179-headbang.gif"/>' }, { 'shortcode': '(bug)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_81" alt="(bug)" src="/s3.images/emoticons/emoticon-0180-bug.gif"/>' }, { 'shortcode': '(fubar)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_82" alt="(fubar)" src="/s3.images/emoticons/emoticon-0181-fubar.gif"/>' }, { 'shortcode': '(poolparty)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_83" alt="(poolparty)" src="/s3.images/emoticons/emoticon-0182-poolparty.gif"/>' }, { 'shortcode': '(swear)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_84" alt="(swear)" src="/s3.images/emoticons/emoticon-0183-swear.gif"/>' }, { 'shortcode': '(tmi)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_85" alt="(tmi)" src="/s3.images/emoticons/emoticon-0184-tmi.gif"/>' }, { 'shortcode': '(heidy)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_86" alt="(heidy)" src="/s3.images/emoticons/emoticon-0185-heidy.gif"/>' }, { 'shortcode': '(MySpace)', 'emoticons': '<img id="emoXticons_'+profileInfo.ownerID+'_87" alt="(MySpace)" src="/s3.images/emoticons/emoticon-0186-myspace.gif"/>'}];   
    for (i = 0; i < emoticons_json.length; i++) {
        if (emofy.indexOf(emoticons_json[i].shortcode) >= 0) {
        inParseEmos = true;
            var finalShortCode = emoticons_json[i];
            emofy = emofy.replaceAll(emoticons_json[i].shortcode, emoticons_json[i].emoticons);
        
                       
        }
    }
    /* parse custom wadja tags 
       title: [t][/t]
        
    */
    //for fixing the bug with // of http in title
    //var regexpURL = new RegExp(/(?!http:\/\/goo\.gl)((((https?)|(ftps?)):\/\/)|(www.))[a-zA-Z0-9+&@#\/%=~\-_|$?!:.,\Z]+[.][a-zA-Z0-9+&@#\/%=~\-_|$?!:.,\Z]*[a-zA-Z0-9/]+/ig);
   var regexpURL = new RegExp(/(?!http:\/\/goo\.gl)((((https?)|(ftps?)):\/\/)|(www.))[a-zA-Z0-9+&@#\/%=~\-_|$?!:.,\Z]+[.][a-zA-Z0-9+&@#\/%=~\-_|$?!:.,\Z]*[a-zA-Z0-9/]+/ig);
    var foundURL = '';/// my match (valid url)
    foundURL = emofy.match(regexpURL);
    if(foundURL != null) {

        var truefalseLnk = emofy.indexOf(foundURL.toString())>=0;
        if (truefalseLnk == true)
        {

            if(emofy.indexOf("//")>=0 && emofy.lastIndexOf("//")>=0 && emofy.indexOf("//")!=emofy.lastIndexOf("//")) {
                
                emofy=emofy.replace("//","<h6>");/* first occurrence */
                emofy=emofy.replace("//","</h6>");
               
                if(emofy.indexOf("http:</h6>")>=0) { 
                    emofy=emofy.replace("//","</h6>"); 
                    emofy=emofy.replace("</h6>","//");/* last occurrence */ 
                }
                  if(emofy.indexOf("HTTP:</h6>")>=0) {     
                    emofy=emofy.replace("//","</h6>"); 
                    emofy=emofy.replace("</h6>","//");/* last occurrence */ 
                }
                if(emofy.indexOf("Http:</h6>")>=0) {   
                    emofy=emofy.replace("//","</h6>");
                    emofy=emofy.replace("</h6>","//");/* last occurrence */ 
                }
            }
        }
    }
    else
    {

        if (emofy.indexOf("//")>=0 && emofy.lastIndexOf("//")>=0 && emofy.indexOf("//")!=emofy.lastIndexOf("//"))
        {
        emofy=emofy.replace("//","<h6>");/* first occurrence */
        emofy=emofy.replace("//","</h6>");/* last occurrence */
        }
     } 
   
    emofy = emofy.replace("<h6>", "<h6><span class='lnkNoUnd'>");
    emofy = emofy.replace("</h6>", "</span></h6>");
    return emofy;   
}

//#Load twitter profile
var twittercardjs={ 
    profile:function(tweeturl,screename){
     //http://twitter.com/intent/screenname
     bootloader.load('/s3.scripts/classes/twittercard.chirp.js', function () {
                twitterCardClass.showCard(tweeturl.replace('twitter.com/','twitter.com/intent/user?screen_name='),screename);
            });
    },
    reply:function(){
        //http://twitter.com/intent/retweet?tweet_id=23423&lang=en
    },
    retweet: function(){
        //http://twitter.com/intent/tweet?in_reply_to=23423
        
    }
}

function showHideBio() {
  //maria for hide unhide bio
   if($('bio_feed')){
      
   if($('bio_feed').hasClass('dnd')) {
      $('bio_feed').removeClass('dnd');    
      //var mySlide = new Fx.Slide('bio_feed');  
      //mySlide.show();
    }
    else {$('bio_feed').addClass('dnd'); 
    //var mySlide = new Fx.Slide('bio_feed'); 
    //mySlide.hide();
    }
   }
   
    if($('bio_feed').hasClass('dnd')) {
        $('showBioArrow').addClass('arrowOn_black');
        $('showBioArrow').removeClass('arrowOff_black');
    }
    else {
        $('showBioArrow').addClass('arrowOff_black');
        $('showBioArrow').removeClass('arrowOn_black');
    }   

  }
  /* used for showing label's full description */
  function toggle_label_about_body(){
  var textofelement='';
  var el = $('label_about_body');
  textofelement =  $('label_about_body').get('html').clean();
 
    if (el.hasClass('closed')){
        el.removeClass('closed');
        //  textofelement = textofelement+'...';
       // $('label_about_body').set('html',textofelement);
        }
    else{
   
        el.addClass('closed');

        }
  }
  /*  */
  function Suggest_description(inuser,inlabel){
    $('suggest_description').empty();
    $('suggest_description').appendChild(new Element('span', { 'html': 'Suggest a description for '+profileInfo.ownerWadjaID+'\'s Label <b>'+gl_label_name+'</b> (ex:The game of football is any of several similar team sports, of similar origins which involve advancing a ball into a goal area in an attempt to score.)','class':'f12' }));
    if ($('text_body_quick5'))
        $('text_body_quick5').focus();

  } 
  function ChangeTextToUnfollow (){

   $('stop_follow_label').empty();
    $('stop_follow_label').set('html', '<span id=\"stopfollowTip\"  class=\"\"><span id=\"interesting_sp\" class=\"stop\"><span class=\"sp_follow_stop\" onclick=\'StopFollowingLabel();\' >&nbsp;</span></span></span>');                                
 
  }

 function ChangeTextTofollow(){

 
   $('stop_follow_label').set('html', '<span id=\"stopfollowTip\"  class=\"\"><span id=\"interesting_sp\" class=\"stop\"><span class=\"sp_follow_stop\" onclick=\'StopFollowingLabel();\' >&nbsp;</span></span></span>');
   
                                
}

//open photo from jason photo type page
function PhotoCardPageView(imgpath){
 var heightPopPhoto;
 heightPopPhoto = window.getSize().y +'px';
  var imgPageElement = new Element('img',{ 'src':imgpath, 'class':'cursor psRel', 'id':'img_Pos_Page', 'style':'max-width:606px;'});
     
   if (navigator.userAgent.indexOf('MSIE') < 0) {
   // style=\"height:'+heightPopPhoto+'\"
     popcorn.open('photoPagePos','<div class="PhotoPop" id="currentImage"><div id="dv_Pos_Page" ></div></div>','','');
        imgPageElement.addEvent('load',function() { 
            $('dv_Pos_Page').adopt(imgPageElement); 
            imgPos = $('img_Pos_Page').getSize().y; 

//            if(window.getSize().y > imgPos)  {    
//                $('img_Pos_Page').setStyles({
//                    top: (window.getSize().y / 2 - imgPos / 2) + 'px'                  
//                });            
//            }
//            else {
//            $('dv_Pos_Page').setStyles({           
//                    height: imgPos + 'px'                  
//                });
//            }
      });
    }
    else {
    //style=\"height:'+heightPopPhoto+'\" 
     popcorn.open('photoPagePos','<div class="PhotoPop" id="currentImage"><div id="dv_Pos_Page" ><img src=\"'+imgpath+'\" class=\"cursor psRel\" id=\"img_Pos_Page\" style=\"max-width:606px\"/></div></div>','','');
        imgPos = $('img_Pos_Page').getSize().y; 

//            if(window.getSize().y > imgPos)  {    
//                $('img_Pos_Page').setStyles({
//                    top: (window.getSize().y / 2 - imgPos / 2) + 'px'                  
//                });            
//            }
//            else {
//            $('dv_Pos_Page').setStyles({           
//                    height: imgPos + 'px'                  
//                });
//            }
    }
}


/* Custom lightbox */
var currentPosition=0;
var PhotoGalleryJSON='';
function PhotoCardviewer(imgpath, Photolength, curPos){
    var imgpathprev;
    var imgpathnext;
    var heightPopPhoto;
    var imgPos;
    heightPopPhoto = window.getSize().y +'px';
    currentPosition= parseInt(currentPosition);
    var imgElement = new Element('img',{ 'src':imgpath, 'class':'cursor psRel', 'id':'img_Pos_'+currentPosition, 'style':'max-width:606px;'});
     
    if (navigator.userAgent.indexOf('MSIE') < 0) {
        // style=\"height:'+heightPopPhoto+'\"
     popcorn.open('photo','<div class="PhotoPop" id="currentImage"><div id="dv_Pos_'+currentPosition+'" ></div></div>','','');
        imgElement.addEvent('load',function() { 
            $('dv_Pos_'+currentPosition).adopt(imgElement); 
            imgPos = $('img_Pos_'+currentPosition).getSize().y; 

//            if(window.getSize().y > imgPos)  {    
//                $('img_Pos_'+currentPosition).setStyles({
//                    top: (window.getSize().y / 2 - imgPos / 2) + 'px'                  
//                });            
//            }
//            else {
//            $('dv_Pos_'+currentPosition).setStyles({           
//                    height: imgPos + 'px'                  
//                });
//            }

        });
    }
    else {
    //style=\"height:'+heightPopPhoto+'\"
     popcorn.open('photo','<div class="PhotoPop" id="currentImage"><div id="dv_Pos_'+currentPosition+'" ><img src=\"'+imgpath+'\" class=\"cursor psRel\" id=\"img_Pos_'+currentPosition+'\" style=\"max-width:606px\"/></div></div>','','');
        imgPos = $('img_Pos_'+currentPosition).getSize().y; 

//            if(window.getSize().y > imgPos)  {    
//                $('img_Pos_'+currentPosition).setStyles({
//                    top: (window.getSize().y / 2 - imgPos / 2) + 'px'                  
//                });            
//            }
//            else {
//            $('dv_Pos_'+currentPosition).setStyles({           
//                    height: imgPos + 'px'                  
//                });
//            }

    }

        dvPHOTOSPOP= new Element('div', { 'class': 'tar psAbs z300 right20 top20' });
        var btnPhotoNext = new Element('input', { 'class': 'btn_right_middle next_arrow_btn' ,'type':'button', 'id':'btn_next' });
        var btnPhotoPrevious = new Element('input', {  'class': 'btn_left previous_arrow_btn', 'type':'button', 'id':'btn_prev' });
        dvPHOTOSPOP.appendChild(btnPhotoPrevious);
        dvPHOTOSPOP.appendChild(btnPhotoNext);
        $('popcorn_canvas_html_body_photo').appendChild(dvPHOTOSPOP);     
        oWUser.send('GetPhotos', profileInfo.ownerID, function (res) {
            if (res.error) { return; }//#
            var r = JSON.decode(res.value);
            if (r.length > 0) {
                PhotoGalleryJSON = r; 

                btnPhotoNext.onclick = new Function('PhotosNext('+curPos+');');
                btnPhotoPrevious.onclick = new Function('PhotosPrevious('+curPos+');');                
                  if(dvPHOTOSPOP){
                    document.addEvent('keyup', function (event) {
                    var keyCode = event.code ? event.code : event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
               
                        if (keyCode == 38 ) {
                        PhotosNext(curPos);
                         return false;
                        }
                       
                    });
                }

                 if(dvPHOTOSPOP){
                        document.addEvent('keyup', function (event) {
                        var keyCode = event.code ? event.code : event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
               
                        if (keyCode == 40 ) {
                        PhotosPrevious(curPos);  
                        return false;
                        }
                        
                    });  
                }             
            }
        });
        
  }

function PhotosNext(pos){
    if (pos==currentPosition){
        currentPosition=pos+1;
    }
    else
    {
        currentPosition=currentPosition+1;
    }
  
    if (currentPosition<PhotoGalleryJSON.length)
    {
        var heightPopPhotoN;
        var imgPosN;
        heightPopPhotoN = window.getSize().y + 'px';
        //var imgElement = new Element('span',{ 'html':'<img src=\"'+PhotoGalleryJSON[currentPosition].Original+'\" class=\"cursor psRel\" id=\"img_Pos_'+currentPosition+'\" style=\"max-width:606px\"/>' });
        var imgElement = new Element('img',{ 'src':PhotoGalleryJSON[currentPosition].Original, 'class':'cursor psRel', 'id':'img_Pos_'+currentPosition,  'style':'max-width:606px;'});
        
        if (navigator.userAgent.indexOf('MSIE') < 0) {
        //style=\"height:'+heightPopPhotoN+'\"
        $('currentImage').set('html','<div  id="dv_Pos_'+currentPosition+'"></div></div>');
            imgElement.addEvent('load',function() {        
                $('dv_Pos_'+currentPosition).adopt(imgElement);
                imgPosN = parseInt($('img_Pos_'+currentPosition).getSize().y);   
                 
//                if(window.getSize().y > imgPosN)  {
//                    $('img_Pos_'+currentPosition).setStyles({
//                        top: (window.getSize().y / 2 - imgPosN / 2) + 'px'                  
//                    });               
//                }
//                else {
//                    $('dv_Pos_'+currentPosition).setStyles({
//                            height: imgPosN + 'px'                  
//                        });
//                }

            });
        }
        else {
        // style=\"height:'+heightPopPhotoN+'\" 
        $('currentImage').set('html','<div id="dv_Pos_'+currentPosition+'"><img src=\"'+PhotoGalleryJSON[currentPosition].Original+'\" class=\"cursor psRel\" id=\"img_Pos_'+currentPosition+'\" style=\"max-width:606px\"/></div></div>');
                imgPosN = parseInt($('img_Pos_'+currentPosition).getSize().y); 
                   
//                if(window.getSize().y > imgPosN)  {
//                    $('img_Pos_'+currentPosition).setStyles({
//                        top: (window.getSize().y / 2 - imgPosN / 2)+ 'px'                  
//                    });               
//                }
//                else {
//                    $('dv_Pos_'+currentPosition).setStyles({
//                            height: imgPosN + 'px'                  
//                        });
//                }

       }
        $('btn_next').removeClass('prev_next_disable');
        $('btn_prev').removeClass('prev_next_disable');
    }
    else
    {
        currentPosition=PhotoGalleryJSON.length;
        //disable next
        $('btn_next').addClass('prev_next_disable');
    }
  
}

function PhotosPrevious(pos){
    if (pos==currentPosition){
        currentPosition=pos-1;
    }
    else{
        currentPosition=currentPosition-1;
    }
    
    if (currentPosition>=0)
    {
        var heightPopPhotoP;
        var imgPosP;
        heightPopPhotoP = window.getSize().y + 'px';
         var imgElement = new Element('span',{ 'html':'' });
        var imgElement = new Element('img',{ 'src':PhotoGalleryJSON[currentPosition].Original, 'class':'cursor psRel', 'id':'img_Pos_'+currentPosition, 'style':'max-width:606px;'});
       
        if (navigator.userAgent.indexOf('MSIE') < 0) {
        // style=\"height:'+heightPopPhotoP+'\"
         $('currentImage').set('html','<div id="dv_Pos_'+currentPosition+'"></div>');
            imgElement.addEvent('load',function() {            
                $('dv_Pos_'+currentPosition).adopt(imgElement);
                imgPosP = imgElement.getSize().y; 

//                if(window.getSize().y > imgPosP)  { 
//                    imgElement.setStyles({
//                        top: (window.getSize().y / 2 - imgPosP / 2)+ 'px'                  
//                    });                
//                }
//                else {       
//                    $('dv_Pos_'+currentPosition).setStyles({
//                            height: imgPosP + 'px'                  
//                        });
//                }

            });
        }
        else {
        // style=\"height:'+heightPopPhotoP+'\"
         $('currentImage').set('html','<div id="dv_Pos_'+currentPosition+'"><img src=\"'+PhotoGalleryJSON[currentPosition].Original+'\" class=\"cursor psRel\" id=\"img_Pos_'+currentPosition+'\" style=\"max-width:606px\" /></div>');
                imgPosP = $('img_Pos_'+currentPosition).getSize().y; 

//                if(window.getSize().y > imgPosP)  { 
//                    $('img_Pos_'+currentPosition).setStyles({
//                        top: (window.getSize().y / 2 - imgPosP / 2)+ 'px'                  
//                    });                
//                }
//                else {       
//                    $('dv_Pos_'+currentPosition).setStyles({
//                            height: imgPosP + 'px'                  
//                        });
//                }

        }
        $('btn_next').removeClass('prev_next_disable');
        $('btn_prev').removeClass('prev_next_disable');
    }
    else {
        currentPosition=0;
        //disable previous
        $('btn_prev').addClass('prev_next_disable');
    }
}

 
