var sDBFile,sVariables,imgpath,sNameDivErr,sNameDivMain,sProcessText,freezid;
var index;
var EzdiaUserDB = new Array();
var EzdiaConnection = new Array();
var SchoolProfile = new Array();
var CollegeProfile = new Array();
var CompanyProfile = new Array();
var CategorySelection = new Array();
var contentstr = new Array();
var contentListing = new Array();
var UserInfopopupDiv = new Array();
var UserInfoConnDiv = new Array();
var UserInfopopupCommonConnDiv = new Array();
var MyConnectionList =  new Array();
var ChatUsers =  new Array();
var MyQaListing = new Array();
var ExpertsList = new Array();
var ViewPopuponSearch = new Array();
var ViewPopuponSearch1 = new Array();
var fpmArray = new Array('rpm51','rpm5197','rpm97106','rpm106');
var fpmArrayValues = new Array('Up to $0.51','$0.51 - $0.97','$0.97 - $1.06','$1.06 and Up');
var ratingArray = new Array('rating1','rating14','rating45','rating5');
var ratingArrayValues = new Array('Up to 1 star','1 stars - 4 stars','4 stars - 5 stars','5 stars');
var profileparam;
var globalErrorMessageDiv;
var connectionflag;
var projectMessage;
var projectId="";
var userId="";
var contentComment="null";
var contentId="null";
var user_type="null";
var readdedComment=false;
var isKBActive;
var isEAActive;
var isProjActive;
////Class to hold search parameters.
function ContentSearchFilter()
{
    this.url = '';
    this.mainurl='';
    this.searchType = '';//Content or expert.
    this.searchSubType = '';
    this.categoryL1 = '';
    this.categoryL2 = '';
    this.categoryL3 = '';
    this.rating = '';
    this.domain = '';
    this.feePerMin = '';
    this.mainSearchPattern = '';
    var hmRPM = new Array();
    hmRPM['rpm51'] = 'Up to $0.51';
    hmRPM['rpm5197'] = '$0.51 - $0.97';
    hmRPM['rpm97106'] = '$0.97 - $1.06' ;
    hmRPM['rpm106'] ='$1.06 and Up';
    var hmRating = new Array();
    hmRating['rating1'] = 'Up to 1 star';
    hmRating['rating14'] = '1 stars - 4 stars';
    hmRating['rating45'] = '4 stars - 5 stars';
    hmRating['rating5'] = '5 stars';


    function formatSearchString()
    {
        var strSearchPattern = '';
        //        if(this.mainSearchPattern.length != 0)
        //        {
        //          strSearchPattern = "Result for " + this.mainSearchPattern.substr(this.mainSearchPattern.indexOf("=",0) + 1, this.mainSearchPattern.length);
        //        }
        if(this.categoryL1.length != 0)
        {
            strSearchPattern += '>&nbsp;' + this.categoryL1 ;
            if(this.categoryL2.length != 0)
            {
                strSearchPattern += '&nbsp;>&nbsp;' + this.categoryL2 ;
                if(this.categoryL3.length != 0)
                {
                    strSearchPattern += '&nbsp;>&nbsp;' + this.categoryL3;
                }
            }
            strSearchPattern += '<span class="action" onclick="searchFilters.clearCategory();performSearch(1);" style="align:right; color:#990000;">&nbsp;&nbsp; X Remove </span>';
        }

        if(this.feePerMin.length != 0)
        {
            strSearchPattern += '<br/>>&nbsp;'  + hmRPM[this.feePerMin];
            strSearchPattern += '<span class="action" onclick="searchFilters.clearRPM();performSearch();" style="align:right; color:#990000;">&nbsp;&nbsp; X Remove </span>';
        }
        if(this.rating.length != 0)
        {
            strSearchPattern += '<br/>>&nbsp;' + hmRating[this.rating];
            strSearchPattern += '<span class="action" onclick="searchFilters.clearRating();performSearch();" style="align:right; color:#990000;">&nbsp;&nbsp; X Remove </span>';

        }


        return unescape(strSearchPattern);
    }

    function getSearchString()
    {
        var strSearchPattern = ''
        if(this.mainSearchPattern.length != 0)
        {
            if(this.mainSearchPattern != "search=")
            {
                strSearchPattern = this.mainSearchPattern;
                //Check for searchSubType
                setSearchSubType(strSearchPattern);
            }
            else  //To handle when we are not searching any pattern
            {
                strSearchPattern = "search=";
            }
        }
        var category_str = '';
        if(this.categoryL1.length != 0)
        {
            category_str += this.categoryL1;
            if(this.categoryL2.length != 0)
            {
                category_str += '#' + this.categoryL2;
                if(this.categoryL3.length != 0)
                {
                    category_str += '#' + this.categoryL3;
                }
                else
                {
                    category_str += '#*';
                }
            }
            else
            {
                category_str += '#*#*';
            }
        }

        if(trim(category_str).length != 0)
        {
            strSearchPattern += '&categoryName=' + escape(trim(category_str));
        }
        //        strSearchPattern += category_str;

        if(this.rating.length != 0)
        {
            strSearchPattern += '&rating=' + this.rating;
        }
        if(this.feePerMin.length != 0)
        {
            strSearchPattern += '&rpm=' + this.feePerMin;
        }


        return strSearchPattern;
    }

    function setSearchSubType(querystr)
    {
        //Check for searchSubType
        var params = new Array();
        var pairs = querystr.split( "&" );
        for (var i in pairs )
        {
            var keyval = (pairs[ i ].toString()).split( "=" );
            params[ keyval[0] ] = keyval[1];
        }
        this.searchSubType = params["searchtype"];
    }

    function clearRPM()
    {
        this.feePerMin = '';
    }

    function clearRating()
    {
        this.rating = '';
    }

    function clearCategory()
    {
        this.categoryL1 = '';
        this.categoryL2 = '';
        this.categoryL3 = '';
    }

    function clearSearchType()
    {
        this.searchType = '';
        this.searchSubType = '';
    }

    function clearSearchSubType()
    {
        this.searchSubType = '';
    }

    this.getSearchString  = getSearchString;
    this.formatSearchString = formatSearchString;
    this.setSearchSubType = setSearchSubType;
    this.clearCategory = clearCategory;
    this.clearRating = clearRating;
    this.clearRPM = clearRPM;
    this.clearSearchType = clearSearchType;
    this.clearSearchSubType = clearSearchSubType;

}
//variable for Search Filters.
var searchFilters = new ContentSearchFilter();


function MyConn(username,name,groupname,connectionid,relation,tag,presence,email){
    this.username =username;
    this.name = name;
    this.groupname = groupname;
    this.connectionid = connectionid;
    this.relation =relation;
    this.tag = tag;
    this.presence = presence;
    this.email = email;
}

function ChatArray(userid,name,position,company,skypeid){
    this.userid= userid;
    this.name = name;
    this.position = position;
    this.company  = company;
    this.skypeid= skypeid;
}

function UserInfo(userid, firstname,photo,summary,expertise,country,reviews,rating,rpm,category,position,company,skypeid,presence){
    this.userid = userid;
    this.firstname = firstname;
    this.photo = photo;
    this.summary = summary;
    this.expertise = expertise;
    this.country = country;
    this.reviews = reviews;
    this.rating = rating;
    this.rpm = rpm;
    this.category = category;
    this.position = position;
    this.company = company;
    this.skypeid = skypeid;
    this.presence = presence;
}

function UserInfoDiv(divContent){
    this.divContent = divContent;
}
function UserInfo1(divContent){
    this.divContent = divContent;
}

function UserContent(contenturl){
    this.contenturl = contenturl;
}
function MyCategorySelection(categories){
    this.categories = categories;
}
function SchoolData(school,state,from,to){
    this.school = school;
    this.state = state;
    this.from = from;
    this.to=to;
}

function CollegeData(college, state,degree,major,from,to){
    this.college = college;
    this.state = state;
    this.degree = degree;
    this.major = major;
    this.from = from;
    this.to = to;
}

function CompanyData(company, state, position, industry, from, to){
    this.company = company;
    this.state = state;
    this.position = position;
    this.industry = industry;
    this.from = from;
    this.to = to;
}

function EzdiaUser(username, name, creationDate){
    this.username = username;
    this.name = name;
    this.creationDate = creationDate;
}

var month_name=new Array(13);
month_name[0]="January";
month_name[1]="February";
month_name[2]="March";
month_name[3]="April";
month_name[4]="May";
month_name[5]="June";
month_name[6]="July";
month_name[7]="August";
month_name[8]="September";
month_name[9]="October";
month_name[10]="November";
month_name[11]="December";
month_name[12]="Till Date";

function EzdiaConn(idconnection,fromuser,photo_thumbnail,firstname){
    this.idconnection = idconnection;
    this.fromuser=fromuser;
    this.photo_thumbnail = photo_thumbnail;
    this.firstname = firstname;
}
//function to store profile data
function SaveProfileData()
{
    var profilePage = document.getElementById("profilepagename").value;
    if(profilePage == 'general')
    {
        this.p_username = document.getElementById('gpusername').value;
        this.p_firstname = document.getElementById('firstname').value;
        this.p_lastname = document.getElementById('lastname').value;
        this.p_general_date = document.getElementById('general_date').value;
        this.p_general_month = document.getElementById('general_month').value;
        this.p_general_year = document.getElementById('general_year').value;
        this.p_streetaddress = document.getElementById('streetaddress').value;
        this.p_street2address = document.getElementById('street2address').value;
        this.p_city = document.getElementById('city').value;
        this.p_state = document.getElementById('state').value;
        this.p_country = document.getElementById('country').value;
        this.p_zip = document.getElementById('zip').value;
        this.p_language = document.getElementById('language').value;
        this.p_country_code = document.getElementById('country_code').value;
        this.p_code = document.getElementById('code').value;
        this.p_number = document.getElementById('number').value;
        this.p_extension = document.getElementById('extension').value;
    }
}


var search = '';
var userName;
var myuserid;
var pageId;
var noOfPages;
var startrecd;
var endrecd;
var mode;
var iCordX=0, iCordY=0;
var req;
var sHTMLSearchAnim = '<div align=center><img src="'+contextRoot+'/static/images/loading_animation_1.gif\" width=48 height=54><br>###</div>';
var sHTMLSearchAnimSmall = '<div align=center><img src="'+contextRoot+'/static/images/loading.gif\"><br>###</div>';
var tempX;
var tempY;
var workarea = '';
var subarea = '';
var timeout = 500;
var timeout2 = 1000;
var closetimer = 0;
var ddmenuitem = 0;
var wcsubsubcate='';
var id;
var showui;
var pid;
var nid;
var lid;
var useridvar=null;
var mangeuserid;
//var localhost = "http://98.195.196.183/"
var ulpv = 'ulpv';
var hiddenUserid;
//Worth calculator variable;
//////////////////////////////
//var jsonString = "";
var interest_area = "";
var area_category = "";
///////////////////////////////
//general Profile variable;
var p_username;
var p_firstname;
var p_lastname;
var p_general_date;
var p_general_month;
var p_general_year;
var p_streetaddress;
var p_street2address;
var p_city;
var p_state;
var p_zip;
var p_language;
var p_country_code;
var p_code;
var p_number;
var p_extension;
//
//content search variables
var queryString;
var contentdivname;
var contentpagesize = 3;   //content search pagesize
var contentactionname;
var contentpagenum;
var actiontype = 0;
var contentmaxpagenum = 0;
var contentmaxpagenextflag = 0;
var contentsearchstr ;
var connectionjsonstring;
var reg_username;
var reg_password;

var newIcordX = (screen.width) ? (screen.width-934)/2 : 0;
var requrl;

//window.dhtmlHistory.create();
var historyListener = function(newLocation, historyData) {
    if (newLocation.indexOf("/p/") == 0) {
        showProjectResult(contextRoot+'/jsp/RequirementsSearch.do?url='+escape(newLocation), 'middle_div',3);
    } else if (newLocation.indexOf("/k/") == 0) {
        showProjectResult(contextRoot+'/jsp/KBSearch.do?url='+escape(newLocation), 'middle_div',3);
    } else if (newLocation.indexOf("/e/") == 0) {
        showProjectResult(contextRoot+'/jsp/EzdiaSearch.do?url='+escape(newLocation), 'middle_div',3);
    } else{
        if(historyData == null) return;
        var fn = historyData[0];
        if (typeof fn == "function") {
            fn.apply(this,historyData[1]);
        }
    }
};
var historyIndex = 0;

function replaceAndRunEzscript(result) {
    var re = new RegExp(/<ezscript>([\s\S]*)<\/ezscript>/);
    var m = re.exec(result);
    if (m) {
        eval('('+m[1]+')');
        result = result.replace(re, "");
    }
    return result;
}

var AjaxHandler = function(){
    this.callback = null;
    this.errCallback = null;
    this.req = null;
    this.updateDiv = null;
    this.clearGlobalMessage = true;

    this.init = function(url) {
        this.req = getXHR();
        this.req.open("POST",url,true);
        this.setRequestHeader("X-Requested-With", "XMLHttpRequest");
    };

    this.setRequestHeader = function(header,value) {
        this.req.setRequestHeader(header,value);
    };

    this.setClearGlobalMessage = function(value) {
        this.clearGlobalMessage = value;
    };

    this.send = function(param) {
        //clear global message before next operation
        var gem = document.getElementById('globalErrorMessage');
        if(this.clearGlobalMessage && gem) {
            gem.innerHTML = '';
        }
        var _self = this;
        this.req.onreadystatechange = function() {

            switch(_self.req.readyState) {
                case 4:  //Completed
                    var s = _self.req.status.toString().split("");
                    /*Informational 1xx
                      Successful 2xx
                      Redirection 3xx
                      Client Error 4xx
                      Server Error 5xx */
                    switch(s[0])
                    {
                        case "2":
                            var fn = _self.callback[0];
                            _self.callback[0] = replaceAndRunEzscript(_self.req.responseText);
                            if ((BrowserDetect.browser == "Firefox") && (BrowserDetect.version >= 4)) {
                                //firefox 4 requires regular array
                                _self.callback = $.merge([],_self.callback);
                            }
                            fn.apply(this,_self.callback);
                            break;
                        case "4":
                            if(_self.req.status == 401) {
                                //popup login screen
                                //console.log("session timeout");
                                ModalPopup('NewLoginpopupdiv','');
                                //this.req.send(param);
                                break;
                            }
                        case "5":
                            if(_self.errcallback) {
                                fn = _self.errcallback[0];
                                _self.errcallback.shift();
                                fn.apply(this,_self.errcallback);
                            } else {
                                if (_self.updateDiv) {
                                    document.getElementById(_self.updateDiv).innerHTML = "Error while loading";
                                }
                            }
                            break;
                    }
                    break;
                case 0:  //Uninitialized
                case 1:  //Loading
                case 2:  //Loaded
                case 3:  //Interactive
                    if (_self.updateDiv) {
                        var d = document.getElementById(_self.updateDiv);
                        if(d) {
                            if(_self.updateDiv == 'requestTabhom'){
                                d.innerHTML=sHTMLSearchAnimSmall.replace("###", "");
                            }
                            else{
                                d.innerHTML=sHTMLSearchAnim.replace("###", "");
                            }

                            showDetails(_self.updateDiv);
                        }
                    }
            }
        };
        this.param = param;
        this.req.send(param);
    };

    this.addCallback = function() {
        this.callback = arguments;
    };

    this.addErrCallback = function(f) {
        this.errCallback = [].splice.call(arguments,0);
    };

    this.addUpdateDiv = function(d) {
        this.updateDiv = d;
    };
};
var browser;
var version;
var OS;
var BrowserDetect = {
    init: function () {
        this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
        this.version = this.searchVersion(navigator.userAgent)
            || this.searchVersion(navigator.appVersion)
            || "an unknown version";
        OS = this.searchString(this.dataOS) || "an unknown OS";
    },
    searchString: function (data) {
        for (var i=0;i<data.length;i++)	{
            var dataString = data[i].string;
            var dataProp = data[i].prop;
            this.versionSearchString = data[i].versionSearch || data[i].identity;
            if (dataString) {
                if (dataString.indexOf(data[i].subString) != -1)
                    return data[i].identity;
            }
            else if (dataProp)
                return data[i].identity;
        }
    },
    searchVersion: function (dataString) {
        var index = dataString.indexOf(this.versionSearchString);
        if (index == -1) return;
        return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
    },
    dataBrowser: [
        {
            string: navigator.userAgent,
            subString: "Chrome",
            identity: "Chrome"
        },
        {
            string: navigator.userAgent,
            subString: "OmniWeb",
            versionSearch: "OmniWeb/",
            identity: "OmniWeb"
        },
        {
            string: navigator.vendor,
            subString: "Apple",
            identity: "Safari"
        },
        {
            prop: window.opera,
            identity: "Opera"
        },
        {
            string: navigator.vendor,
            subString: "iCab",
            identity: "iCab"
        },
        {
            string: navigator.vendor,
            subString: "KDE",
            identity: "Konqueror"
        },
        {
            string: navigator.userAgent,
            subString: "Firefox",
            identity: "Firefox"
        },
        {
            string: navigator.vendor,
            subString: "Camino",
            identity: "Camino"
        },
        {		// for newer Netscapes (6+)
            string: navigator.userAgent,
            subString: "Netscape",
            identity: "Netscape"
        },
        {
            string: navigator.userAgent,
            subString: "MSIE",
            identity: "Explorer",
            versionSearch: "MSIE"
        },
        {
            string: navigator.userAgent,
            subString: "Gecko",
            identity: "Mozilla",
            versionSearch: "rv"
        },
        { 		// for older Netscapes (4-)
            string: navigator.userAgent,
            subString: "Mozilla",
            identity: "Netscape",
            versionSearch: "Mozilla"
        }
    ],
    dataOS : [
        {
            string: navigator.platform,
            subString: "Win",
            identity: "Windows"
        },
        {
            string: navigator.platform,
            subString: "Mac",
            identity: "Mac"
        },
        {
            string: navigator.platform,
            subString: "Linux",
            identity: "Linux"
        }
    ]

};
BrowserDetect.init();

/***
 * This following functions will check the typed search strings
 ***/
function ChangeInEzdiaSearchTextIndex()
{
    if (document.getElementById('search').value == document.getElementById('search').defaultValue)
    {
        document.getElementById('search').value = '';
        document.getElementById('search').className = 'bigSearchBarBlack';
    }
}

function ChangeInEzdiaSearchTextHome()
{
    if (document.getElementById('search').value == document.getElementById('search').defaultValue)
    {
        document.getElementById('search').value = '';
        document.getElementById('search').className = 'homeSearchBoxBlack';
    }
}
/***
 * This following functions will clear the global error message
 ***/
function clearErrorMessage(){
    document.getElementById("globalErrorMessage").style.display = 'none';
    document.getElementById("globalErrorMessage").innerHTML='';
}

/***
 * This following functions will set the global error message
 ***/
function setErrorMessage(msg,flag){
    var errorSpan = document.getElementById("errorSpan");
    if(errorSpan != null){
        errorSpan.innerHTML=msg;
    }else{
        errorSpan = document.createElement('span');
        errorSpan.id="errorSpan";
        errorSpan.style.color="Green";
        errorSpan.className="msgYellow";
        errorSpan.style.padding="2px 10px";
        errorSpan.innerHTML=msg;

        var globalErrorMessage = document.getElementById("globalErrorMessage");
        if(globalErrorMessage != null)
            globalErrorMessage.style.display = '';
        globalErrorMessage.appendChild(errorSpan);
    }
    hideSpan = "<span style='border: 1px solid #2DADE1; padding: 1px 3px; font-weight: normal; vertical-align: top; margin-left: 5px; font-size: 8px; background-color: white;' class='action' onclick='clearErrorMessage()'>X</span>";
    /*hideSpan = document.createElement('span');
    hideSpan.style.paddingLeft = '20px';
    hideSpan.innerHTML = 'Hide';
    hideSpan.className ='action';
    addEventHandler(hideSpan,"click",clearErrorMessage);*/
    var gem = document.getElementById("globalErrorMessage");
    if(gem != null) {
        gem.innerHTML += hideSpan;
    }
    if (flag == 1){
        window.setTimeout('clearErrorMessage("globalErrorMessage")',50000);
    }
    else if (flag == 2){
        window.setTimeout('clearErrorMessage("globalErrorMessage")',300000);
    }
    else {
        window.setTimeout('clearErrorMessage("globalErrorMessage")',9000);
    }
    //window.setTimeout("cleardiv('globalErrorMessage')",8000);
    //hideSpan.click()=cleardiv('globalErrorMessage');
}

/*
 * This function will store the global error message in a object
 */
function storeGlobalErrorMessage() {
    var gem = document.getElementById("globalErrorMessage");
    if(gem != null) {
        globalErrorMessageDiv  = gem.innerHTML;
    }
}

/*
 * This function will store the global error message in a object
 */
function reStoreGlobalErrorMessage() {
    var gem = document.getElementById("globalErrorMessage");
    if(gem != null) {
        gem.innerHTML = globalErrorMessageDiv;
    }
}

/***
 * This following function is event handler for all the dynamic events attached to the objects
 ***/
function addEventHandler(obj, eventName, handler) {
    if (document.attachEvent) {
        obj.attachEvent("on" + eventName, handler);
    }
    else if (document.addEventListener) {
        obj.addEventListener(eventName, handler, false);
    }
}


function closeAllFreezPopup(id){
    if(document.getElementById(id))
    {
        ModalPopup.Close(id,'1');
        document.getElementById(id).innerHTML='';
        document.getElementById(id).style.display='none';

        return;
    }
}

function addShareButton() {
    var shareId = document.getElementById("addThisShare"); //look for any add this share
    if(!shareId) return;
    var at_share = jQuery.extend(true,{},addthis_share);
    var url = shareId.getAttribute("url");
    if (url) {
        at_share.url = url;
    }
    var title = shareId.getAttribute("title");
    if (title) {
        at_share.title = title;
    }
    var description = shareId.getAttribute("description");
    if (description) {
        at_share.description = description;
    }
    //jQuery.extend(true,at_share,addthis_share);
    addthis.button(shareId,addthis_config,at_share);
}

function fblogin() {
    FB.login(function(response) {
        if (response.authResponse) {
            onFBLogin();
        }
    });
}

function onFBLogin(response) {
    var session = FB.getAuthResponse();
    //var session = response.session;
    //if (window.location.href.indexOf("jsp/Home.do") != -1) return; //already on home page
    if(session /*&& (document.referrer.indexOf("jsp/FBRegistration.do") == -1) &&
                  (document.referrer.indexOf("jsp/Home.do") == -1)*/) {
        //redirect to registration page
        var query = "fbId=" + session.userID + "&token="+ session.accessToken;
        var details_div = document.getElementById("login_details");
        if (details_div) {
            var details = details_div.value;
        }
        if (details) {
            query += "&details="+escape(details);
        }
        window.location.href = contextRoot+'/jsp/FBRegistration.do?' + query;
    }
}

function postToFBFeed(link,myname,bumpedname,title,action,event_id) {

    // calling the API ...
    if(action === 'shareSkill'){
        var obj = {
            method: 'feed',
            link: link,
            picture: 'http://www.ezdia.com/static/images/eZdia-logo.png',
            name: myname + " has added a new skill on ezdia.com" ,
            caption: title,
            description: "Looking for expert help or become an expert by adding your Skills on ezdia. "
        };

        function callback(response) {
            if (response && response.post_id) {
                //user shared the data with FB
                addTrackEvent('After Login', 'Post Skill', 'Social Sharing Page ' + (event_id || ""));
                $.ajax({
                  url: "UserFeedAction.do",
                  data: {
                      eventid:event_id,
                      remarks:"post_id="+response.post_id
                  },
                  success: function(points) {
                      updateTotalPoints(replaceAndRunEzscript(points));
                  }
                });
            }
        }
    }
    else if(action === 'shareSkillBump'){
        obj = {
            method: 'feed',
            link: link,
            picture: 'http://www.ezdia.com/static/images/bump-up.png',
            name: myname + " has Bumped " + bumpedname + "'s skill on ezdia.com" ,
            caption: title,
            description: "Find and bump more skills on ezdia. "
        };

        function callback(response) {
            if (response && response.post_id) {
                //user shared the data with FB
                addTrackEvent('After Login', 'Post Bump', 'Social Sharing Page ' + (event_id || ""));
                $.ajax({
                  url: "UserFeedAction.do",
                  data: {
                      eventid:event_id,
                      remarks:"post_id="+response.post_id
                  },
                  success: function(points) {
                      updateTotalPoints(replaceAndRunEzscript(points));
                  }
                });
            }
        }
    }
    else if(action === 'shareProject'){
        obj = {
            method: 'feed',
            link: link,
            picture: 'http://www.ezdia.com/static/images/eZdia-logo.png',
            name: myname + " is looking for expert help in " + bumpedname + " on ezdia.com" ,
            caption: title,
            description: myname + " has posted a new project on ezdia.com that may interest you to bid on the project."
        };

        function callback(response) {
            if (response && response.post_id) {
                //user shared the data with FB
                addTrackEvent('After Login', 'Post Project', 'Social Sharing Page ' + (event_id || ""));
                $.ajax({
                  url: "UserFeedAction.do",
                  data: {
                      eventid:event_id,
                      remarks:"post_id="+response.post_id
                  },
                  success: function(points) {
                      updateTotalPoints(replaceAndRunEzscript(points));
                  }
                });
            } else {
                //user clicked cancel
            }
        }
    }
    else if(action === 'shareService'){
        var obj = {
            method: 'feed',
            link: link,
            //picture: 'http://www.ezdia.com/static/images/eZdia-logo.png',
            name: "Trusted " + myname + " | Try it yourself",
            caption: myname
            //description: "Looking for expert help or become an expert by adding your Skills on ezdia. "
        };

        function callback(response) {
            if (response && response.post_id) {
                //user shared the data with FB
                addTrackEvent('After Login', 'Service Launch', 'Social Sharing Page ' + (event_id || ""));
                $.ajax({
                  url: "UserFeedAction.do",
                  data: {
                      eventid:event_id,
                      remarks:"post_id="+response.post_id
                  },
                  success: function(points) {
                      updateTotalPoints(replaceAndRunEzscript(points));
                  }
                });
            }
        }
    }
    FB.ui(obj, callback);
}

