function homePageHeaderTabs(myHeader){
    if(myHeader == 'mouse out'){
        if(isKBActive == 'ontabactive'){
            //document.getElementById("KB").className ="ontabactive";
            document.getElementById("EA").className ="ontab";
            //document.getElementById("Home").className ="ontab";
            proj = document.getElementById("Projects");
            if (proj) {
                proj.className ="ontab";
            }
        }
        else if(isEAActive == 'ontabactive'){
            //document.getElementById("KB").className ="ontab";
            document.getElementById("EA").className ="ontabactive";
            //document.getElementById("Home").className ="ontab";
            proj = document.getElementById("Projects");
            if (proj) {
                proj.className ="ontab";
            }
        }
        else if(isProjActive == 'ontabactive'){
            //document.getElementById("KB").className ="ontab";
            document.getElementById("EA").className ="ontab";
            //document.getElementById("Home").className ="ontab";
            proj = document.getElementById("Projects");
            if (proj) {
                proj.className ="ontabactive";
            }
        }
        else {
            //document.getElementById("Home").className ="ontabactive";
            document.getElementById("EA").className ="ontab";
            //document.getElementById("KB").className ="ontab";
            proj = document.getElementById("Projects");
            if (proj) {
                proj.className ="ontab";
            }
        }
    }

    if (myHeader=="Home"){
        //document.getElementById("Home").className ="ontabactive";
        document.getElementById("EA").className ="ontab";
        //document.getElementById("KB").className ="ontab";
        var proj = document.getElementById("Projects");
        if (proj) {
            proj.className ="ontab";
        }
    }
    else if (myHeader=="EA"){
        document.getElementById("EA").className ="ontabactive";
        //document.getElementById("Home").className ="ontab";
        //document.getElementById("KB").className ="ontab";
        proj = document.getElementById("Projects");
        if (proj) {
            proj.className ="ontab";
        }
    }
    else if(myHeader=="KB"){
        //document.getElementById("KB").className ="ontabactive";
        document.getElementById("EA").className ="ontab";
        //document.getElementById("Home").className ="ontab";
        proj = document.getElementById("Projects");
        if (proj) {
            proj.className ="ontab";
        }
    }
    else if(myHeader=="Projects"){
        document.getElementById("Projects").className ="ontabactive";
        document.getElementById("EA").className ="ontab";
    //document.getElementById("Home").className ="ontab";
    //document.getElementById("KB").className ="ontab";
    }
}

function selectSearchType(searchType){
    if(searchType == 'selExperts'){
        document.getElementById("currentOptionContainer").innerHTML = 'Search Experts <span class="arrow"></span>';
        document.getElementById("selExperts").className = 'searchOption selected';
        document.getElementById("selProjects").className = 'searchOption ';
        document.getElementById("selKnowledge").className = 'searchOption ';
        document.getElementById("searchtype").value = 'experts';
    } else if(searchType == 'selProjects'){
        document.getElementById("currentOptionContainer").innerHTML = 'Search Projects <span class="arrow"></span>';
        document.getElementById("selExperts").className = 'searchOption ';
        document.getElementById("selProjects").className = 'searchOption selected';
        document.getElementById("selKnowledge").className = 'searchOption ';
        document.getElementById("searchtype").value = 'projects';
    } else if(searchType == 'selKnowledge'){
        document.getElementById("currentOptionContainer").innerHTML = 'Search Knowledge <span class="arrow"></span>';
        document.getElementById("selExperts").className = 'searchOption ';
        document.getElementById("selProjects").className = 'searchOption ';
        document.getElementById("selKnowledge").className = 'searchOption selected';
        document.getElementById("searchtype").value = 'knowledge';
    } else {
        document.getElementById("currentOptionContainer").innerHTML = 'Search Experts <span class="arrow"></span>';
        document.getElementById("selExperts").className = 'searchOption selected';
        document.getElementById("selProjects").className = 'searchOption ';
        document.getElementById("selKnowledge").className = 'searchOption ';
        document.getElementById("searchtype").value = 'experts';
    }
    document.getElementById('optionListContainer').style.display = 'none';
    document.getElementById('currentOptionContainer').className = "currentOptionContainer";
}

function onEnterKey(event){
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {
        var searchstr = document.getElementById("search").value;
        var selectedSearch = document.getElementById("searchtype").value;
        if(selectedSearch == 'knowledge'){
            if(login_user == null || login_user == '' || !login_user ){
                window.location.href = contextRoot+'/knowledge?search='+searchstr;
            }
            else {
                jsonSearch(contextRoot+'/jsp/KBSearch.do','2','Content',2,'middle_div',searchstr,'','','ezdianw','header');
            }
        }
        else if(selectedSearch == 'experts'){
            if(login_user == null || login_user == '' || !login_user ){
                window.location.href = contextRoot+'/experts?search='+searchstr;
            }
            else {
                jsonSearch(contextRoot+'/jsp/EzdiaSearch.do','2','Expert',0,'middle_div',searchstr);
            }
        }
        else if(selectedSearch == 'projects'){
            if(login_user == null || login_user == '' || !login_user ){
                window.location.href = contextRoot+'/projects?search='+searchstr;
            }
            else {
                showProjectResult(contextRoot+'/jsp/RequirementsSearch.do?sortBy=posteddate&asExpertOrExplorer=null&uid='+login_user+'&category=&pagetype=index&projectInfoType=findProject&pageNo=0&search='+searchstr,'middle_div');
            }
        }
        else{
            if(login_user == null || login_user == '' || !login_user ){
                window.location.href = contextRoot+'/experts?search='+searchstr;
            }
            else {
                jsonSearch(contextRoot+'/jsp/EzdiaSearch.do','2','Expert',0,'middle_div',searchstr);
            }
        }
    }
    return false;
}

function showProjectResult(actionURL,invID){
    if(document.getElementById('search') == null){
        document.getElementById('search').value = 'Search by name';
    }
    isKBActive = 'ontab';
    isEAActive = 'ontab';
    isProjActive = 'ontabactive';
    type = 'Project';
    showResultWithQueryStr(actionURL, invID, callbackcommon, null,false);
    return true;
}

function showEasyResult(actionURL,invID){
    showResultWithQueryStr(actionURL, invID, easyCallBack, null,true);
    return true;
}

function easyCallBack(result,pid){
    document.getElementById(pid).style.display='';
    document.getElementById(pid).innerHTML = '';
    document.getElementById(pid).innerHTML=result;
}

function jsonSearchExpertAdvice(actionURL,domain,type,tabindex,divid,searchstr){
    if(searchstr!=null){
        search = searchstr;
    }
    document.getElementById("SearchSelection").value = 'Expert';
    isKBActive = 'ontab';
    isEAActive = 'ontabactive';
    isProjActive = 'ontab';
    if(searchstr == '<username>'){
        document.getElementById('search').value = 'Search by name';
    }
    pid = divid;
    var querystr='search=&searchtype=expertadvice&searchfrom1=expertsearch';
    var url = actionURL;
    token = '';
    tabindexer=tabindex;
    searchFilters.searchType = type;
    searchFilters.url = actionURL;
    searchFilters.mainurl = actionURL;
    searchFilters.mainSearchPattern = querystr;
    searchFilters.domain = domain;
    searchFilters.setSearchSubType(querystr);
    showResultWithQueryStr(url, divid, callbackcommonsearch, querystr,false,tabindex,null);
    addTrackEvent("search","expertadvice",searchstr);
}

function jsonSearch(actionURL,domain,type,tabindex,divid,searchstr,ignoreHistory,searchParam,searchfrom){
    if(searchstr == ''){
        document.getElementById('search').value = 'Search by name';
    }    
    isKBActive = 'ontabactive';
    isEAActive = 'ontab';
    isProjActive = 'ontab';
    if(type == 'Expert'){
        isKBActive = 'ontab';
        isEAActive = 'ontabactive';
        isProjActive = 'ontab';
    }
    else if(type == 'Content'){
        isKBActive = 'ontabactive';
        isEAActive = 'ontab';
        isProjActive = 'ontab';
    }
    pid = divid;
    if(!searchfrom){
        searchfrom = 'ezdianw';
    }
    if(ignoreHistory == 'fromContentPopUp'){
        javascript:ModalPopup.Close("ConnectionPopUp",1);
    jsonSearch('KBSearch.do','2','Content',0,'middle_div',escape(searchstr),'','','ezdianw')
        return false;
    }
    if(type=='Content' && domain == '2'){
        if(document.getElementById('Content'))
            document.getElementById('Content').innerHTML = '';
        if(document.getElementById('MyNetwork'))
            document.getElementById('MyNetwork').innerHTML = '';
        if(document.getElementById('MyOwn'))
            document.getElementById('MyOwn').innerHTML = '';
    }
    if(searchstr!=null){
        //if(searchstr != hiddenUserid)
        //  document.getElementById('search').value = search;
        var search = searchstr;
        if(searchParam == undefined) searchParam = "search";
        if(domain=='1'){
            search = checkForSplChars(search);
            querystr=searchParam+"="+encodeURIComponent(search)+"&searchtype=index&searchfrom="+searchfrom;
        }
        else{
            if(searchstr == login_user){
                querystr="search=&searchtype=myown&searchfrom="+searchfrom;
            }
            else{
                if (searchParam == "content_id") {
                    querystr="content_id="+encodeURIComponent(search)+"&searchtype=ezdianetwork&searchfrom="+searchfrom;
                } else {
                    querystr="search="+encodeURIComponent(search)+"&searchtype=ezdianetwork&searchfrom="+searchfrom;
                }
            }
        }
    }
    else{
        if(document.getElementById('search')){
            search= document.getElementById('search').value;
            search = checkForSplChars(search);
        }
        if(search.indexOf('Search by name')== -1){
            if(domain == 1){
                querystr="search="+encodeURIComponent(search)+"&searchtype=index&searchfrom="+searchfrom;

            }else{
                querystr="search="+encodeURIComponent(search)+"&searchtype=index&searchfrom="+searchfrom;
            }
        }
        else{
            querystr="search=&searchtype=index&searchfrom="+searchfrom;
            search='';
        }
    }
    var url = actionURL;
    token = search;
    tabindexer=tabindex;
    searchFilters.searchType = type;
    searchFilters.url = actionURL;
    searchFilters.mainurl = actionURL;
    searchFilters.mainSearchPattern = querystr;
    searchFilters.domain = domain;
    searchFilters.setSearchSubType(querystr);
    //    if (ignoreHistory == undefined) ignoreHistory = false;
    //    if (!ignoreHistory) {
    //        var arr = [jsonSearch];
    //        arr.push([actionURL,domain,type,tabindex,divid,search,true,tabindex,null]);
    //        jQuery.bbq.pushState("#" + historyIndex);
    //        ezHistory[historyIndex++] = arr;
    //            dhtmlHistory.add(historyIndex++,arr);
    //    }
    showResultWithQueryStr(url, divid, callbackcommonsearch, querystr, false,tabindex,null);
    addTrackEvent("search",type,search);
}


function jsonSearchNext(actionURL,domain,type,tabindex,divid,searchstr){
    var querystr=searchstr;
    if(domain == 2)
        querystr = searchstr;
    if(domain == 1)
        querystr = "search="+escape(search)+"&searchtype=index&pagetype=next&searchfrom=ezdianw";

    tabindexer=tabindex;
    searchFilters.searchType = type;
    //Set the current query string into a global variable for further access.
    searchFilters.url = actionURL;
    searchFilters.mainSearchPattern = querystr;
    searchFilters.domain = domain;
    searchFilters.setSearchSubType(querystr);
    if(type=='Content'){
        showResultWithQueryStr(actionURL, divid, callbackRefineJSONSearchResult, querystr,false,tabindex,null);
    }
    else if(type=='Expert'){
        showResultWithQueryStr(actionURL, divid, callbackRefineJSONSearchResult, querystr,false,tabindex,null);
    }
}


function assocaitedContent(actionURL,domain,type,tabindex,divid,searchStr){
    var querystr;
    if(type=='Content' && domain == '2'){
        if(type=='Content' && domain == '2'){
            if(document.getElementById('Content'))
                document.getElementById('Content').innerHTML = '';
            if(document.getElementById('MyNetwork'))
                document.getElementById('MyNetwork').innerHTML = '';
            if(document.getElementById('MyOwn'))
                document.getElementById('MyOwn').innerHTML = '';
        }
    }
    token = unescape(searchStr);
    if(searchStr!=null && searchStr == myuserid){
        search = searchStr;
        if(tabindex == 0){
            querystr="search=&searchtype=ezdianetwork&tab=no&searchfrom=ezdianw";
        }
        else
            querystr="search="+escape(search)+"&searchtype=myown&tab=no&searchfrom=ezdianw";
    }
    else{
        if(document.getElementById('search')){

            search= document.getElementById('search').value;
            if(tabindex == 0){
                if(search.indexOf('Search by name')== -1){
                    querystr="search="+escape(search)+"&searchtype=ezdianetwork&tab=no&searchfrom=ezdianw";
                }
                else{
                    querystr="search=&searchtype=ezdianetwork&tab=no&searchfrom=ezdianw";
                    search='';
                }
            }
            else{
                if(search.indexOf('Search by name')== -1){
                    querystr="search="+escape(search)+"&searchtype=myown&tab=no&searchfrom=ezdianw";
                }
                else{
                    querystr="search=&searchtype=myown&tab=no&searchfrom=ezdianw";
                    search='';
                }
            }

        }

    }
    var url = actionURL+'?'+querystr;
    tabindexer=tabindex;
    searchFilters.url = actionURL;
    searchFilters.mainurl = actionURL;
    searchFilters.searchType = type;
    searchFilters.domain = domain;
    searchFilters.mainSearchPattern = querystr;
    searchFilters.setSearchSubType(querystr);
    showResultWithQueryStr(url, divid, callbackcommonsearch, null,false,tabindex,null);
}


function MyContent(actionURL,domain,type,tabindex,divid,searchStr){
    var querystr;
    if(type=='Content' && domain == '2'){
        if(type=='Content' && domain == '2'){
            if(document.getElementById('Content'))
                document.getElementById('Content').innerHTML = '';
            if(document.getElementById('MyNetwork'))
                document.getElementById('MyNetwork').innerHTML = '';
            if(document.getElementById('MyOwn'))
                document.getElementById('MyOwn').innerHTML = '';
        }
    }
    
    if(searchStr == login_user){
        token = 'your profile';
        querystr="search="+escape(searchStr)+"&searchtype=myown&tab=no&searchfrom=myown&profileKB=true";
    }
    else{
        token = 'his profile';
        querystr="search="+escape(searchStr)+"&tab=no&searchfrom=networkkb&profileKB=true";
    }
    var url = actionURL+'?'+querystr;
    
    if(tabindex == 0){
        url+='&clickFrom=notFromHeader';
    }
    if(tabindex == 2){
        url+='&searchtype=myown';
    }
    tabindexer=tabindex;
    searchFilters.url = actionURL;
    searchFilters.mainurl = actionURL;
    searchFilters.searchType = type;
    searchFilters.domain = domain;
    searchFilters.mainSearchPattern = querystr;
    searchFilters.setSearchSubType(querystr);
    showResultWithQueryStr(url, divid, callbackcommonsearch, null,false,tabindex,null);
}

var search1='';

function networkKB(actionURL,domain,type,tabindex,divid,searchStr){
    pid=divid;
    token = unescape(searchStr);
    search =unescape(searchStr);
    if(type=='Content'&&domain=='2'){
        if(type=='Content' && domain == '2'){
            if(document.getElementById('Content'))
                document.getElementById('Content').innerHTML = '';
            if(document.getElementById('MyNetwork'))
                document.getElementById('MyNetwork').innerHTML = '';
            if(document.getElementById('MyOwn'))
                document.getElementById('MyOwn').innerHTML = '';
        }
    }
    var querystr;
    if(search!=myuserid){
        querystr ="search="+escape(search)+"&searchtype=connection&tab=no&searchfrom=networkkb";
    }
    else
        querystr ="search=&searchtype=connection&tab=no&searchfrom=networkkb";

    var url = actionURL+'?'+querystr;
    tabindexer=tabindex;
    searchFilters.searchType = type;
    //Set the current query string into a global variable for further access.
    searchFilters.url = actionURL;
    searchFilters.mainurl = actionURL;
    searchFilters.mainSearchPattern = querystr;
    searchFilters.searchType = type;
    searchFilters.domain = domain;
    searchFilters.setSearchSubType(querystr);
    showResultWithQueryStr(url, divid, callbackcommonsearch, null,false,tabindex,null,false,tabindex,null);
}

var contentName= new Array();
var token;
/*
 *Search expert on basis of userids.
 */
function getExpertsById(actionURL,user_ids,type,contentSelected)
{
    var querystr="search="+escape(user_ids.replace(","," ","g"));
    if(searchFilters.domain == 1){
        querystr = querystr+"&searchtype=index";
    }
    divid = 'getAssociatedUsers'+contentSelected;

    //        = actionURL+'?'+querystr+'&contentSelected='+contentSelected;
    //    searchFilters.searchType = type;
    //    searchFilters.url = actionURL;
    //    searchFilters.mainurl = actionURL;
    //    searchFilters.mainSearchPattern = querystr;
    //    searchFilters.setSearchSubType(querystr);
    document.getElementById('getAssociatedUsers'+contentSelected).style.display = '';
    if(type == 'Experts'){
        document.getElementById('viewMoreExpert'+contentSelected).style.display = '';
    }
    else{
        document.getElementById('viewMoreExplorer'+contentSelected).style.display = '';
    }
    var url = actionURL+'?'+querystr+'&contentSelected='+contentSelected;
    showResultWithQueryStr(url, divid, callbackExpertsExplorers, null);
}
function hideExpertsExplorers(id){
    document.getElementById('getAssociatedUsers'+id).style.display = 'none';
    document.getElementById('viewMoreExpert'+id).style.display = 'none';
    document.getElementById('viewMoreExplorer'+id).style.display = 'none';
}
function getAllExpertsById(actionURL,user_ids,type,divid){
    var querystr="search="+escape(user_ids.replace(","," ","g"))+"&type="+type;
    if(searchFilters.domain == 1){
        querystr = querystr+"&searchtype=index";
    }
    var url = actionURL+'?'+querystr;
    //    searchFilters.searchType = type;
    //    searchFilters.url = actionURL;
    //    searchFilters.mainurl = actionURL;
    //    searchFilters.mainSearchPattern = querystr;
    //    searchFilters.setSearchSubType(querystr);
    if(login_user == null || login_user == '' || !login_user){
        ModalPopup('NewLoginpopupdiv','');
    }
    showResultWithQueryStr(url, divid, callbackExpertsExplorers, null);
}

function clearSearch(search){
    var text=document.getElementById(search).value;
    if(text == 'Search by name'){
        document.getElementById(search).value='';
    }
    else {
        if(text == '')
            document.getElementById(search).value='Search by name';
        else
            document.getElementById(search).value=text;
    }
}

function clearRequirementSearch(requirementsearch){
    var SearchText=document.getElementById(requirementsearch).value;
    if(SearchText=='Search for Projects by Id or Name')
    {
        document.getElementById(requirementsearch).value='';
    }
    else
    {
        if(SearchText=='')
            document.getElementById(requirementsearch).value='Search for Projects by Id or Name';
        else
            document.getElementById(requirementsearch).value=SearchText;
    }
}

function getMargin(){
    document.getElementById('getMargin').style.marginTop = '-120px';
}

function filterByRating(rating)
{
    searchFilters.rating = rating;
    performSearch();
}

function filterByRPM(rpm)
{
    searchFilters.feePerMin = rpm;
    performSearch();
}

function performSearch(flag)
{
    if(document.getElementById('pagination_div')){
        document.getElementById('pagination_div').style.display ='none';
    }
    var indicator = flag;
    var divname;
    if(indicator == 1)
        divname = "narrowed_result_center@1";
    else
        divname = "narrowed_result_center";
    var url = searchFilters.mainurl+'?'+searchFilters.getSearchString()+'&pagetype=next&searchfrom1=browsecat&searchfrom=expertsearch&searchtype=myown';
    //Set the current query string into a global variable for further access.
    showResultWithQueryStr(url, divname, callbackRefineJSONSearchResult, null);
}
function performSearchNext(page,type)
{
    var divname='';
    if(type == "ContentRefined")
        divname = "hidiv";
    else if(type == "ExpertRefined")
        divname = "hidiv";
    var url = searchFilters.mainurl+'?'+searchFilters.getSearchString()+'&mypage='+page+'&pagetype=next';
    //var divname = 'hellodiv';
    //Set the current query string into a global variable for further access.
    showResultWithQueryStr(url, divname, callbackRefineJSONSearchResultNext, null);
}

//Search Refinement on basis of search filters
function callbackRefineJSONSearchResult(response,divname){
    var output='';
    var result = response;
    var flag;
    myresult = new Array();
    if(divname == 'narrowed_result_center@1'){
        divname = 'narrowed_result_center';
        flag = 1;
    }
    if(result.indexOf("No Result Found")!=-1 )
    {
        output+="No Result for your search";
    }
    else
    {
        // var jsonContent= eval('('+result+')');
        document.getElementById('selectedCritera').style.display = '';
        document.getElementById('search_result_header').innerHTML = searchFilters.formatSearchString();
        document.getElementById(divname).innerHTML = result;
        if(flag != 1){
            if(document.getElementById('google'))
                document.getElementById('google').style.display = 'none';
        }
        else if(flag == 1){
            if( document.getElementById('selectedCritera'))
                document.getElementById('selectedCritera').style.display = 'none';
        }
    //  document.getElementById(divname).innerHTML = (searchFilters.searchType == "Content")?writeSearchContent(jsonContent,totalpages):writeSearchItems(jsonContent,totalpages);
    }
}

function callbackRefineJSONSearchResultNext(response,divname){
    var output='';
    var result = response;
    myresult = new Array();
    myresult = result.split("##");
    result = myresult[0];
    totalpages = myresult[1];
    if(result.indexOf("No Result Found")!=-1 )
    {
        output+="No Result for your search";
    }
    else
    {
        // var jsonContent= eval('('+result+')');
        document.getElementById('search_result_header').innerHTML = searchFilters.formatSearchString();
        document.getElementById(divname).innerHTML = result;
    // document.getElementById(divname).innerHTML = (searchFilters.searchType == "Content")?getNextTabData(jsonContent):writeSearchItems(jsonContent,totalpages);
    }
}

function onenterRequirementSearch(event,actionurl) {

    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {

        jsonRequirementSearch(actionurl,'Requirement',1);
    }
    return false;
}

//Get Recursive counts of a Given Assosiative Array
function getCount(mapArea)
{
    var catCounts = 0;
    if(mapArea.constructor == Number)
    {
        return mapArea;
    }
    for(var m in mapArea)
    {
        if (!mapArea.hasOwnProperty(m)) continue;
        //catCounts += (mapArea[m].constructor == Number)?catCounts += mapArea[m]:catCounts += getCount(mapArea[m]);
        catCounts += getCount(mapArea[m]);
    }
    return catCounts;
}


function getAreaExpertCount(actionURL)
{
    var url = actionURL;
    //Set the current query string into a global variable for further access.
    searchFilters.url = '/EzdiaLive/jsp/EzdiaSearch.do';
    searchFilters.mainSearchPattern = 'search=';
    showResultWithQueryStr(url, null, callbackAreaExpertCount, null);
}
/***
     *To be moved in jsp
     ***/
function callbackAreaExpertCount(response)
{
    var output = '';
    var result = response;
    if(result.indexOf("No Result Found")!=-1 ){
        output+="No Result for your search";
    }
    else{
        var expertCountByArea= eval('('+result+')');
        var nCount = 1;
        viewNewAreacount = expertCountByArea;
        for(var w1 in expertCountByArea)
        {
            if (!expertCountByArea.hasOwnProperty(w1)) continue;
            output+='<div id="area_'+nCount+'" class="drag_cmn" onclick=narrowExpertSearchByCategory("' + escape(w1) + '","'+escape(expertCountByArea)+'",1)><a href="javascript:void(0)" style="color:#000;">'+w1+'('+getCount(expertCountByArea[w1])+')</a></div>';
            output+='<div id="'+escape(w1)+'"></div>';
            nCount++;
        }
        document.getElementById('Drag_layer').innerHTML = '';
        document.getElementById('Drag_layer').innerHTML = output;
        for(var w2 in expertCountByArea)
        {
            if (!expertCountByArea.hasOwnProperty(w2)) continue;
            //narrowExpertSearchByCategory("' + escape(w2) + '","'+escape(expertCountByArea.toSource())+'",1)>'+w2+'('+getCount(expertCountByArea[w2])+')</div>';
            narrowExpertSearchByCategory(escape(w2) ,escape(expertCountByArea),1);
            break;
        }
    }
}
/***
     *To be moved in jsp
     ***/
function showContentInPopUp(divid,cntTitle, cntURL,contentType,id ,content_name,category_name,count1,count2,experts,explorers,keyword,description,google,external,searchid)
{
    cntTitle = unescape(cntTitle);
    cntURL = unescape(cntURL);
    contentType = unescape(contentType);

    //        var divstr = '<div id="iframeResult" style="background:#FFFFFF; border:1px solid #80A0C0; position: relative; width: 610px; height: 300px; z-index: 50; left: 0px; top: 0px;">';
    //    divstr += '<div id="closeimg" class="closetextreg" onclick="closeIframe(\''+ divid + '\',\'iframeResult\')" style="cursor:pointer; position: absolute; width: 50px; height: 15px; z-index: 3; left: 565px; top: 3px; ">';
    //    divstr += 'Close X</div>';
    //    divstr += '<iframe style="position: absolute;top: 50px; height: 250px; width: 610px;border: none;" src="'+url+'"/>';

    var output = '';
    output += '<div id="ContentFrame" style="background:white; position:relative; margin:auto; margin-top:0; left:0; top:0; width:100%; height:100%;">';
    output += '<table class="contentBar"><tr>';
    output += '<td class="midContentBar">';
    if(contentType == 'Video' || contentType == 'Slide Show'){
        output += '<div style="position: absolute; top:0px; left:2%; z-index: 100; height:43px;"><img height="51" src="../static/images/eZdiaNewLogo.png"></div>';

    }
    else {
        output += '<div style="position: absolute; top:0px; left:2%; z-index: 100; height:60px; width:40px;"><img height="60" width="40" src="../static/images/eZdiaNewLogo.png"></div>';
    }

    output += '<div id="btn_div" style="position: absolute; height: auto; width: auto; z-index: 100; left: 8%; top: 3px;">';
    output += '<div class="row" style="width:230px;">';
    //    output += '<div class="cell-search-btn4" style="padding-left: 0px; margin-left: 0px;" onclick=javascript:ModalPopup.Close("'+divid+'",1);showBodyHeight();getExpertsById("EzdiaSearch.do","' +experts+'","Expert","middle_div")>';
    //    output += '<span class="action" style="color: white;">Get Experts ('+count1+')</span><br><span style="color: white;">[ '+count1+' Associated Experts ]</span>';
    //    output += '</div>';
    if(google == 'google'){
        output += '<div class="cell-search-btn4" id="i_know_it" onclick=javascript:ModalPopup.Close("ConnectionPopUp",1);showBodyHeight();showcommondiv("PostALink.jsp?url='+escape(cntURL)+'&title='+escape(content_name)+'&desc='+escape(stripHTML(description))+'","PostLinkPopUp","PostLinkPopUp");validateURLBox();>';
    }
    else {
        output += '<div class="cell-search-btn4" id="i_know_it" onclick=showKnowItInPopUp('+id +',"' +content_name + '","' + category_name + '","KBContent");showBodyHeight();>';
    }
    output += '<span class="action" style="color: #4070A0;">I know It <span style="font-size:8px;">('+count1+')</span></span>';
    output += '</div>';
    if(google == 'google'){
        output += '<div class="cell-search-btn4" onclick=javascript:ModalPopup.Close("ConnectionPopUp",1);showBodyHeight();showcommondiv("PostALink.jsp?url='+escape(cntURL)+'&title='+escape(content_name)+'&desc='+escape(stripHTML(description))+'","PostLinkPopUp","PostLinkPopUp");validateURLBox();>';
    }
    else {
        output += '<div class="cell-search-btn4" onclick=showLearnItInPopUp('+id +',"' +content_name + '","' + category_name + '","KBContent");showBodyHeight();>';
    }
    output += '<span class="action" style="color: #4070A0;">I Need Help <span style="font-size:8px;">('+count2+')</span></span>';
    output += '</div>';
    output += '</div>';
    output += '</div>';
    if(myuserid != undefined){
        output += '<div id="closeimg" onclick=javascript:ModalPopup.Close("'+divid+'",1);showBodyHeight(); style="cursor: pointer; position: absolute; width: 50px; z-index: 100; color: white; right: 1%; font-weight: bold; top: 1%; font-size: 12px;">Close X</div>';
    }
    else{
        output += '<div id="closeimg" onclick=javascript:ModalPopup.Close("'+divid+'",1);showBodyHeight();closeContentPopup("'+escape(cntTitle)+'"); style="cursor: pointer; position: absolute; width: 50px; z-index: 100; color: white; right: 1%; font-weight: bold; top: 1%; font-size: 12px;">Close X</div>';
    }
    output += '</div>';
    //    output += '<div style="overflow: hidden; position: relative; text-align: left; font-weight: bold; text-decoration: underline; width: 86%; color:#2AD; font-size:12px;">';
    //    output += cntTitle;
    //    output += '</div>';

    if(google == 'google'){
        output += '<div style="position: absolute; top: 11px; left: 35%;"><span class="action" style="color:#FFF; float: left; padding-right: 4px; padding-top: 4px;" onclick=javascript:ModalPopup.Close("ConnectionPopUp",1);showBodyHeight();showcommondiv("PostALink.jsp?url='+escape(cntURL)+'&title='+escape(content_name)+'&desc='+escape(stripHTML(description))+'","PostLinkPopUp","PostLinkPopUp");validateURLBox();><b>Add this content to my </b></span><img height="20" width="20" src="../static/images/smallBucket.png" alt=""/></div>';
    /*output += '<div style="position: absolute; left: 62%; top: 10px;" id="NoOfExpertIcon">';
        output += '<img height="25" src="../static/images/userimg2.png" alt="Get experts" onclick=javascript:ModalPopup.Close("'+divid+'",1);showBodyHeight();getExpertsById("EzdiaSearch.do","' +experts+'","Expert","middle_div")/> </div>';
        output += '<div style="position: absolute; width: 120px; left: 65%; top: 14px;" id="NoOfExpertIcon">';
        output += '<span class="action" style="color: white; font-weight: bold;">Get Experts ('+count1+')</span></div>';

        output += '<div style="position: absolute; left: 76%; top: 10px;" id="NoOfExpertIcon">';
        output += '<img src="../static/images/Explorer.png" alt="Get explorers"/> </div>';
        output += '<div style="position: absolute; top: 14px; left: 78%;" id="NoOfExplorersIcon">';
        output += '<span class="action" style="color: white; font-weight: bold;">Get Explorers ('+count2+')</span></div>';*/
    }
    else{
        output += '<div style="position: absolute; left: 69%; top: 10px;" id="NoOfExpertIcon">';
        var expOnClick = '';
        if (count1 > 0) {
            expOnClick = 'onclick=javascript:ModalPopup.Close("'+divid+'",1);showBodyHeight();getExpertsById("GetExpertsExplorers.do","'+experts+'","Expert","'+searchid+'");';
        }
        output += '<img height="25" src="../static/images/userimg2.png" alt="Get experts" ' + expOnClick + '/> </div>';
        output += '<div style="position: absolute; top: 15px; left: 72%; width: 85px;" id="NoOfExpertIcon">';
        output += '<span class="action" ' + expOnClick + ' style="color: white;">Get Experts ('+count1+')</span></div>';

        output += '<div style="position: absolute; left: 81%; top: 10px;" id="NoOfExpertIcon">';

        expOnClick = '';
        if (count2 > 0) {
            expOnClick = 'onclick=javascript:ModalPopup.Close("'+divid+'",1);showBodyHeight();getExpertsById("GetExpertsExplorers.do","'+explorers+'","Expert","'+searchid+'");';
        }
        output += '<img src="../static/images/Explorer.png" alt="Get explorers" ' + expOnClick + '/> </div>';
        output += '<div style="position: absolute; top: 15px; left: 83%;" id="NoOfExplorersIcon">';
        output += '<span class="action" ' + expOnClick + ' style="color: white;">Get Explorers ('+count2+')</span></div>';
        output += '<div id="TinyIcon" style="position: absolute; width: 17px; height: 25px; left: 41%; top: 4px;">';
        output += '<img alt="" src="../static/images/tinylogo.png" /></div>';
        output += '<div id="catslists" style="overflow: hidden; position: absolute; height: 16px; width: 26%; top: 11px; left: 42.5%;">';

        if(keyword != null)
        {
            if(login_user == null || login_user == '' || !login_user){
                output += '<a style="color: #FFF" href='+contextRoot+'/jsp/IndexSearch.do?search='+escape(keyword)+'&searchtype=index&selected_ezdia_domain=2>'+unescape(keyword).substring(0, 37)+'</a>';
            }
            else{
                keyword = keyword.split(",");
                for(i=0; i<keyword.length; i++){
                    output += '<span class="action" style="color:#FFF;" onclick=jsonSearch("ContentSearch.do","2","Content",0,"middle_div","'+escape(keyword[i])+'","fromContentPopUp");showBodyHeight();>'+unescape(keyword[i])+'</span>';
                    output += ',';
                }
            }
        }
        output += '<span class="action" style="margin-left:10px; color:#FFF;" onclick=showcommondiv("ContentDetails.jsp?url='+escape(cntURL)+'&title='+escape(content_name)+'&desc='+escape(description)+'","ConnectionPopUp","ConnectionPopUp");showBodyHeight();>View All</span>';
        output += '</div>';
        output += '<div id="forwardDiv" style="position: absolute; height: 15px; cursor: pointer; width: 65px; top: 10px; left: 32%;" onclick=showcommondiv("../jsp/ForwardContent.jsp?&isForward=true&flag=content&content_name='+escape(content_name) +'&content_url='+host+contextRoot+"/jsp/Content.do?id="+id+'&content_type='+escape(contentType)+'&id='+escape(id)+'&category_name='+escape(category_name)+'&expert_users='+escape(experts?experts.length:0)+'&explorer_users='+escape(explorers?explorers.length:0)+'&expert_users_id='+escape(experts)+'&actual_url='+escape(cntURL)+'","ConnectionPopUp","ConnectionPopUp");showBodyHeight();><img alt="Forward" src="../static/images/forwardIconWhite.png" title="Forward" /><span class="action" style="color:#FFF;"> Forward</span> </div>';
        output += '<div id="ContentURLDiv" style="position: absolute; height: 15px; cursor: pointer; width: 36%; top: 33px; left: 32%; overflow:hidden; color:white;"><b>Source : </b> <a href="'+cntURL+'" target="_blank" style="color:white;">'+cntURL+'</a></div>';
        if (external) {
            output += '<div style="position: absolute; width: 36%; top: 33px; left: 58%;">';
            output += '<a class="a2a_dd" target="_blank" href="http://www.addtoany.com/share_save"><img src="http://static.addtoany.com/buttons/share_save_120_16.gif" width="120" height="16" border="0" alt="Share/Save/Bookmark"/></a><script type="text/javascript">a2a_linkname=document.title;a2a_linkurl=location.href;</script><script type="text/javascript" src="http://static.addtoany.com/menu/page.js"></script>';
            output += '</div>';
        }
    }
    output += '</td>';
    output += '</tr></table>';
    output += '<div style="width: 100%; height: 100%; position: relative;" align="center">';
    output += '<iframe id="content_display_iframe" src="'+cntURL+'" onload="checkFrameHeight();" onresize="checkFrameHeight();" scrolling="yes" style="height:500px; width:100%;" frameborder="0" noresize="resize"></iframe>';
    output += '</div>';
    output += '</div>';
    document.getElementById(divid).innerHTML = '';
    document.getElementById(divid).innerHTML=output;
    //ModalPopup(divid,"");
    document.getElementById(divid).style.display = '';
    var d = document.getElementById("bottomBarMain");
    if (d) d.style.display = 'none';
    document.getElementById(divid).style.top = '0px';
    document.getElementById(divid).style.left = '0px';
    document.getElementById(divid).style.right = '0px';
    document.getElementById(divid).style.margin = 'auto';
    if (browser == "Explorer") {
        if(login_user == null || login_user == ''  || !login_user){
            document.getElementById(divid).style.position = 'absolute';
        }
        else {
            document.getElementById(divid).style.position = 'fixed';
        }
    } else {
        document.getElementById(divid).style.position = 'fixed';
    }
    document.body.style.overflow = 'hidden';
    addTrackEvent("content",contentType,id);
}
function checkFrameHeight(){
    var my_iframe=document.getElementById("content_display_iframe");
    var iframeHeight = 500;
    document.body.style.overflow = 'hidden';
    if (parseInt(navigator.appVersion)>3) {
        if (navigator.appName=="Netscape") {
            iframeHeight = window.innerHeight;
        }

        if(navigator.appName.indexOf("Microsoft")!=-1) {
            iframeHeight = document.documentElement.clientHeight;
            if (iframeHeight == 0) {
                iframeHeight = document.body.clientHeight;
            }
        }
    }

    if(login_user == null || login_user == ''  || !login_user)
    {
        my_iframe.style.height=(iframeHeight-65)+'px';

    }
    else{
        my_iframe.style.height=(iframeHeight-33)+'px';

    }
}
function showBodyHeight(){
    document.body.style.overflow = 'visible';
//document.getElementById("bottomBarMain").style.display = '';
}

function showCommentPanel(){
    CommentBox = document.getElementById("CommentBox").style.display;
    if(CommentBox == ''){
        document.getElementById("VisibleContentFrame").style.width = '100%';
        document.getElementById("CommentBox").style.width = '0%';
        document.getElementById("CommentBox").style.display = 'none';
        document.getElementById("sideArrowImg").src = contextRoot+'/static/images/chatBillingSideArrowImgLeft.png';
    }
    else if(CommentBox == 'none'){
        document.getElementById("VisibleContentFrame").style.width = '79%';
        document.getElementById("CommentBox").style.width = '21%';
        document.getElementById("CommentBox").style.display = '';
        document.getElementById("sideArrowImg").src = contextRoot+'/static/images/chatBillingSideArrowImg.png';
    }
}
function showHideTxtsIKnowIt(showHideTxt){
    var SearchText=document.getElementById(showHideTxt).value;
    if(SearchText=='Hint Message: * I have developed similar solutions for another client OR * I have provided detailed market research & competitive summary on this topic.')
    {
        document.getElementById(showHideTxt).value='';
        document.getElementById(showHideTxt).style.color='#000';
    }
    else
    {
        if(SearchText==''){
            document.getElementById(showHideTxt).value='Hint Message: * I have developed similar solutions for another client OR * I have provided detailed market research & competitive summary on this topic.';
            document.getElementById(showHideTxt).style.color='#999';
        }
        else
            document.getElementById(showHideTxt).value=SearchText;
    }
}
/***
     *To be moved in jsp
     ***/
function showKnowItInPopUp(content_id,title1, category,id)
{
    var title = escape(title1);
    var title_txt = title.replace("+","&nbsp;","g");
    if(login_user == null || login_user == ''  || !login_user)
    {
        if(document.getElementById(id)){
            ModalPopup.Close(id,'1');
        }
        ModalPopup('NewLoginpopupdiv','');
        document.getElementById('login_details').value = 'iknowit:'+content_id+':'+title+':'+category;
        document.getElementById('regRedirect').value = 'iknowit:'+content_id+':'+title+':'+category;
    }
    else
    {
        var catlevel1 = "CL1";
        var catlevel2 = "CL2";
        var catlevel3 = "CL3";
        var cat_array = unescape(category);
        var cat_txt = cat_array.replace("#", "&nbsp;>&nbsp;","g");
        cat_txt = cat_txt.replace("[\"","");
        cat_txt = cat_txt.replace("\"]","");
        cat_txt = cat_txt.replace("+","&nbsp;","g");
        var divid = "ConnectionPopUp";
        var output = '';
        output += '<table id="corner_dialog_table" align="center" class="corner_dialog_table" style="width: 780px; z-index: 10; height: auto;">';
        output += '<tr>';
        output += '<td class="corner_topleft_green"></td>';
        output += '<td class="corner_topborder_green"></td>';
        output += '<td class="corner_topright_grn"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_borderleft_green"></td>';
        output += '<td id="corner_content_grn" class="corner_content_grn">';
        output += '<div style="width: 100%; height: auto;">';
        output += '<div id="closeimg" onclick=javascript:ModalPopup.Close("'+divid+'","1") style="cursor: pointer; position: absolute; width: 50px; margin-left:695px; margin-top:3px; font-size:12px; z-index:100"><b>Close X</b></div>';
        output += '<div style="text-align: center; font-size: 20px; color: teal;">I Know It !!!</div>';
        output += '<div style="padding: 0px; position: relative; width: 750px; height: auto; left: 0%; margin-top: 0px; z-index: 10; top: 0px;">';
        output += '<table id="corner_dialog_table0" align="left" class="corner_dialog_table" style="width: 100%; z-index: 10; height: auto;">';
        output += '<tr>';
        output += '<td class="corner_topleft_green"></td>';
        output += '<td class="corner_topborder_green"></td>';
        output += '<td class="corner_topright_grn"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_borderleft_green"></td>';
        output += '<td id="corner_content_grn0" class="corner_content_grn">';
        output += '<div id="errorKnowIt" class="error" style="display:none;"></div>';
        output += '<div id="maindiv" style="width: 720px; height: auto; line-height:30px;">';
        output += '<table width="500">';
        output += '<tr>';
        output += '<td class="kbtxt">Title :</td>&nbsp;';
        output += '<td>';
        output += '<input class="tdinput_I" name="i_know_it_title" id="i_know_it_title" type="text" value="'+unescape(title_txt)+'" /></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="kbtxt" valign="top">Highlight your experience on this topic/area :</td>&nbsp;';
        output += '<td><textarea onfocus=showHideTxtsIKnowIt("i_know_it_description") onblur=showHideTxtsIKnowIt("i_know_it_description") style="font-size:12px; color:#999; width: 309px; height: 50px;" id="i_know_it_description" name="i_know_it_description">Hint Message: * I have developed similar solutions for another client OR * I have provided detailed market research & competitive summary on this topic.</textarea></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="kbtxt">Tags :</td>&nbsp;';
        output += '<td><input class=" tdinput_I" name="i_know_it_tags" id="i_know_it_tags" type="text" value="" /></td>';
        output += '</tr>';
        output += '</table>';
        output += '<div style="font-size: 10px; color:#666; position: absolute; width: 200px; left: 515px; line-height: 12px; top: 111px;">(Provide keywords for easy searching) Comma Separated</div>';
        output += '<div style="font-size: 12px; font-weight: bold; position: absolute; margin-left: 52px;">Associated Category :</div>';

        output += '<table id="onCheckFillDetails0" width="540" style="line-height:20px; margin-left:183px; margin-top:2px;">';
        output += '<tr>';
        output += '<td style="color:#666; padding-top:2px; font-weight:bold; font-size:12px;">'+cat_txt+'</td></tr><tr><td style="color:#004080; font-size:12px;"><input type="radio" id="expert_categories" name="content_expert" value="'+cat_txt+'" onchange=checkBG_showlayertome("onCheckFillDetails0","onCheckFillDetails")> Make me expert for this category</td>';
        output += '</tr>';
        output += '<tr id="onCheckFillDetails" style="display:none; text-align:right;"><td><span class="action" onclick=showcommondiv("profile/UpdateExpertiseAgain.jsp?title='+escape(title)+'&category='+escape(cat_txt)+'&contentID='+content_id+'","mynewpopup","mynewpopup");ModalPopup.Close("ConnectionPopUp","1")>Fill in detail</span></td></tr>';
        output += '</table>';
        if(!isAlphaRelease){
            output += '<table id="makmeexpert" width="555" style="padding: 0px 10px; margin-left: 162px; background-color: rgb(255, 255, 255);"><tr><td style="width:646px; color:#004080;"><input class="style_div" type="radio" name="content_expert" onchange=checkBG_showlayer("onCheckFillDetails0","onCheckFillDetails","makmeexpert","onLastCheck")> Make me the Expert of another category related to this article</td></tr>';
            output += '<tr id="onLastCheck" style="display:none;"><td>';
            output += '<table>';
            output += '<tr>';
            output += '<td>';
            output += '<select name="category" id="categoryadd" onChange=getCategoryAndFill(this,"subcategoryadd1"); style="width: 155px" tabindex="21">';
            output += '<option value="-1">-- Select One --</option>';
            output += '<option value="Education">Education</option>';
            output += '<option value="Healthcare and Medicine">Healthcare and Medicine</option>';
            output += '<option value="Legal">Legal</option>';
            output += '<option value="Personal Development">Personal Development</option>';
            output += '<option value="Business and Finance">Business and Finance</option>';
            output += '<option value="Technology & Computers">Technology & Computers</option>';
            output += '</select>';
            output += '</td>&nbsp;';
            output += '<td>';
            output += '<select id="subcategoryadd1" name="subcategory" onChange=getSubCategoryAndFill(this,"sub_subcategoryadd1"); style="width: 155px" tabindex="22">';
            output += '<option value="-1">-- Select One --</option>';
            output += '</select>';
            output += '</td>&nbsp;';
            output += '<td>';
            output += '<select id="sub_subcategoryadd1" name="sub_subcategory" style="width: 155px" tabindex="23">';
            output += '<option value="-1">-- Select One --</option>';
            output += '</select>';
            output += '</td>';
            //    output += '<td>&nbsp;<select name="rating">'
            //    //var i = 0;
            //    for(i = 1; i <= 10; i++)
            //    {
            //        output += '<option value="'+i+'">'+i+'</option>';
            //    }
            //    output += '</select>';
            //    output += '</td>';
            output += '</tr>';
            output += '<tr><td><span class="action" onclick=checkBG_showlayerlast("details","submit_btn_tb")>Fill in detail</span></td></tr>';
            output += '</table>';
            output += '<table id="details" style="display:none; line-height:22px;">';
            output += '<tr><td>Experience :</td> <td><select name="Select4" id="eoexnew" style="width: auto">';
            output += '<option value="1"> Min </option>';
            output += '<option value="2"> 0 -  3 </option>';
            output += '<option value="3"> 3 -  6 </option>';
            output += '<option value="4"> 6 -  10 </option>';
            output += '<option value="5"> 10 +   </option>';
            output += '</select> years</td></tr>';
            output += '<tr><td> Rate/Hour :</td><td> ';
            output += '<input id="min_ratenew" name="Text2" style="width: 55px;height:12px;" type="text" />&nbsp;in USD</td></tr>';
            output += '<tr><td>';
            output += '<table style="line-height:15px; position: relative; left: 220px;">';
            output += '<tr><td><a style="width: 60px;" href="javascript:void(0)" class="global-button global-color small-button-padding" onclick=addANewExpertiesToUser1("addUserAsExpertDetails.do","percentdiv","indicator",0);closecommonconn(); style="color: black;">Submit</a></td></tr></table>';
            output += '</td></tr>';
            output += '</table>';
            output += '</td></tr></table>';
        }
        output += '<div style="background-color: #FFF; height: 10px; top: 0px;">';
        // output += '<div style="width:60px; height:13px; font-size:10px; text-align:center; z-index:15; position:absolute; left: 483px; top: 40px;"><a href="javascript:void(0); onclick="return addExpertise("AddAndUpdateUserExpertise.do","maindiv","indicator","0");">Fill in detail</a></div>';
        // output += '</div>';
        output += '</div>';
        output += '</div>';
        output += '<table id="submit_btn_tb" align="center" style="text-align:center;"><tr><td>';
        output += '<a style="width: 60px;" href="javascript:void(0)" class="global-button global-color small-button-padding" onclick=associateExpertToContent(' +content_id +',"'+escape(cat_txt) +'",1,"' + divid + '","' + title + '")>Submit</a></td>';
        output += '<td>';
        output += '<a style="width: 60px;" href="javascript:void(0)" class="global-button global-color small-button-padding" onclick=javascript:ModalPopup.Close("' +divid + '","1")>Cancel</a>';
        output += '</td></tr></table>';
        output += '</td>';
        output += '<td class="corner_border_right_grn"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_bottomleft_grn"></td>';
        output += '<td class="corner_border_bottom_grn"></td>';
        output += '<td class="corner_bottomright_grn"></td>';
        output += '</tr>';
        output += '</table>';
        output += '</div>';
        //output += '</div>';
        output += '</td>';
        output += '<td class="corner_border_right_grn"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_bottomleft_grn"></td>';
        output += '<td class="corner_border_bottom_grn"></td>';
        output += '<td class="corner_bottomright_grn"></td>';
        output += '</tr>';
        output += '</table>';
        document.getElementById(divid).innerHTML = '';
        document.getElementById(divid).innerHTML=output;
        ModalPopup(divid,"");
    //getAreaAndFill(catlevel1);
    }
}

function showHideTxtsILearnIt(showHideTxt){
    var SearchText=document.getElementById(showHideTxt).value;
    if(SearchText=='Hint Message: * I need someone to train me in hedge funding as described OR * I need a web developer, who can design a website in php using similar styles as shown in this article')
    {
        document.getElementById(showHideTxt).value='';
        document.getElementById(showHideTxt).style.color='#000';
    }
    else
    {
        if(SearchText==''){
            document.getElementById(showHideTxt).value='Hint Message: * I need someone to train me in hedge funding as described OR * I need a web developer, who can design a website in php using similar styles as shown in this article';
            document.getElementById(showHideTxt).style.color='#999';
        }
        else
            document.getElementById(showHideTxt).value=SearchText;
    }
}
/***
     *To be moved in jsp
     ***/
function showLearnItInPopUp(content_id,title,category,id)
{
    var title_txt = title.replace("+","&nbsp;","g");
    if(login_user == null || login_user == '' || !login_user )
    {
        if(document.getElementById(id)){
            ModalPopup.Close(id,'1');
        }
        ModalPopup('NewLoginpopupdiv','');
        document.getElementById('login_details').value = 'ilearnit:'+content_id+':'+title_txt+':'+category;
        document.getElementById('regRedirect').value = 'ilearnit:'+content_id+':'+title_txt+':'+category;
    }
    else
    {
        var output = '';
        var divid = "ConnectionPopUp";
        var catlevel1 = "CL1";
        var catlevel2 = "CL2";
        var catlevel3 = "CL3";
        var cat_array =  unescape(category);
        var cat_txt = cat_array.replace("#", "&nbsp;>&nbsp;","g");
        cat_txt = cat_txt.replace("[\"","");
        cat_txt = cat_txt.replace("\"]","");
        cat_txt = cat_txt.replace("+","&nbsp;","g");

        output += '<table id="corner_dialog_table" align="center" class="corner_dialog_table" style="width: 780px; z-index: 10; height: auto;">';
        output += '<tr>';
        output += '<td class="corner_topleft_green"></td>';
        output += '<td class="corner_topborder_green"></td>';
        output += '<td class="corner_topright_grn"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_borderleft_green"></td>';
        output += '<td id="corner_content_grn" class="corner_content_grn">';
        output += '<div style="width: 100%; height: auto;">';
        output += '<div id="closeimg" onclick=javascript:ModalPopup.Close("'+ divid +'","1") style="cursor: pointer; position: absolute; width: 50px; margin-left:695px; margin-top:3px; font-size:12px; z-index:100"><b>Close X</b></div>';
        output += '<div style="text-align: center; font-size: 20px; color: teal;">I need help !!!</div>';
        output += '<div style="padding: 0px; position: relative; width: 750px; height: auto; left: 0%; margin-top: 0px; z-index: 10; top: 0px;">';
        output += '<table id="corner_dialog_table0" align="left" class="corner_dialog_table" style="width: 100%; z-index: 10; height: auto;">';
        output += '<tr>';
        output += '<td class="corner_topleft_green"></td>';
        output += '<td class="corner_topborder_green"></td>';
        output += '<td class="corner_topright_grn"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_borderleft_green"></td>';
        output += '<td id="corner_content_grn0" class="corner_content_grn">';
        output += '<div style="width: 720px; height: auto">';
        output += '<div id="errorNeedHelp" class="error" style="display:none;"></div>';
        output += '<div style="position: relative; width: 717px; height: auto;">';
        output += '<table width="582">';
        output += '<tr>';
        output += '<td class="kbtxt">Title :</td>';
        output += '<td style="padding-top:5px;">&nbsp;<input id="type_from_user" name="type_from_user" class=" tdinput_I" style="width: 300px; height: 18px;" tabindex="52" type="text" value="'+unescape(title_txt)+'"/></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="kbtxt" valign="top">Describe what you are looking for :</td>';
        output += '<td style="padding-top:5px;">&nbsp;<textarea onfocus=showHideTxtsILearnIt("review_from_user") onblur=showHideTxtsILearnIt("review_from_user") id="review_from_user" name="review_from_user" style="font-size:12px; color:#999; width: 300px; height: 60px;" tabindex="53" type="text">Hint Message: * I need someone to train me in hedge funding as described OR * I need a web developer, who can design a website in php using similar styles as shown in this article</textarea></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="kbtxt">Tags :</td>';
        output += '<td style="padding-top:5px;">&nbsp;<input class=" tdinput_I" name="i_know_it_tags" id="i_know_it_tags" type="text" value="" style="width: 300px; height: 18px;"/></td>';
        output += '</tr>';
        output += '</table>';
        output += '<div style="font-size: 10px; color:#666; position: absolute; width: 200px; left: 543px; top: 111px;">(Provide keywords for easy searching) Comma Separated</div>';
        output += '</div>';
        output += '<div id="categories" style="padding-top:10px;">';
        output += '<table><tr>';
        if(!isAlphaRelease){
            output += '<td class="kbtxt">Select the category you need help in :</td>';
        }
        // var cat_count = 0;
        //        for(cat_count=0;cat_count < cat_array.length; cat_count++)
        //        {onchange=checkBG_showradiolayer("fillCategory")
        output += '<td style="color:#004080; font-weight:bold;"><input type="hidden" id="learner_category" name="learner_category" value="'+cat_txt+'"><div>&nbsp;'+cat_txt+'</div></td>';
        output += '</tr>';
        // }
        if(!isAlphaRelease){
            output += '<tr id="lowerrow">';
            output += '<td></td><td style="color:#004080;"><input type="radio" onchange=showCategoryFill("fillCategory") id="learner_category" name="learner_category" value="">&nbsp;Need help in another category relevant to this article</td>';
            output +='</tr>';

            output += '</table>';

            output += '<table id="fillCategory" style="z-index:20; display:none; line-height: 25px; padding:2px; width:100%;>';
            output += '<tr id="onradio" style="width: 650px; padding:5px; text-align:left;">';
            output += '<td>';
            output += 'Category : <select name="category" id="categoryadd123" onChange=getCategoryAndFill(this,"subcategoryadd123"); style="width: 155px">';
            output += '<option value="-1">-- Select One --</option>';
            output += '<option value="Education">Education</option>';
            output += '<option value="Healthcare and Medicine">Healthcare and Medicine</option>';
            output += '<option value="Legal">Legal</option>';
            output += '<option value="Personal Development">Personal Development</option>';
            output += '<option value="Business and Finance">Business and Finance</option>';
            output += '<option value="Technology & Computers">Technology & Computers</option>';
            output += '</select>';
            output += ' Sub-Category : <select id="subcategoryadd123" name="subcategory" onChange=getSubCategoryAndFill(this,"sub_subcategoryadd123"); style="width: 155px">';
            output += '<option value="-1">-- Select One --</option>';
            output += '</select>';

            output += ' Sub Sub-Catgegory : <select id="sub_subcategoryadd123" name="sub_subcategory" style="width: 155px">';
            output += '<option value="-1">-- Select One --</option>';
            output += '</select>';
            output += '</td>';
            //    output += '<td>&nbsp;<select name="rating">'
            //    //var i = 0;
            //    for(i = 1; i <= 10; i++)
            //    {
            //        output += '<option value="'+i+'">'+i+'</option>';
            //    }
            //    output += '</select>';
            //    output += '</td>';
            output += '</tr>';
            output += '<tr><td><span class="action" onclick=checkBG_showlayerlast("detailed_entry","hideBtn")>Fill in detail</span></td></tr>';
        }
        output += '<tr id="detailed_entry" style="display:none;"><td>';
        output += '<table style="line-height: 25px; width: 100%;">';
        output += '<tr><td><span style="margin-left:3px;">Requirement Type : ';
        output += '<select name="reqtype" id="reqtype123" style="width: 155px; color:#333333;">';
        output += '<option value="-1">Select the following</option>';
        output += '<option value="Expert Help">Expert Help</option>';
        output += '<option value="Learning">Learning</option>';
        output += '<option value="Long Term Requriment">Long Term Requriment</option>';
        output += '</select></span>';
        output += '<span style="margin-left:5px;">Duration : ';
        output += '<select name="reqduration" id="reqduration123" style="width: 155px; color:#333333;">';
        output += '<option value="-1">Select  the following</option>';
        output += '<option value="1">1 Day</option>';
        output += '<option value="7">1 Week</option>';
        output += '<option value="30">1 Month</option>';
        output += '<option value="365">1 Year</option>';
        output += '</select></span>';
        output += '<br>';
        output += '<div id="reqmsg123" class="error" style="display:none;">';
        output += '</div>';
        output += 'Request Expires in : ';
        output += '<select name="reqexpires" id="reqexpires123" style="width: 155px; color:#333333;">';
        output += '<option value="-1">Select the following</option>';
        output += '<option value="7">7 Days</option>';
        output += '<option value="14">14 Days</option>';
        output += '</select>&nbsp;&nbsp;';
        output += '<span style="margin-left:5px;">Budget : ';
        output += '<select name="reqbudget" id="reqbudget123" style="width: 155px; color:#333333;">';
        output += '<option value="-1" style="color:#999999">Select  the following</option>';
        output += '<option value="0" style="color:#004080">Free</option>';
        output += '<option value="10" style="color:#004080">0 - 10 $</option>';
        output += '<option value="20" style="color:#004080">10 - 20 $</option>';
        output += '<option value="50" style="color:#004080">20 - 50 $</option>';
        output += '<option value="100" style="color:#004080">50 - 100 $</option>';
        output += '<option value="200" style="color:#004080">100 - 200 $</option>';
        output += '<option value="300" style="color:#004080">More than 200 $</option>';
        output += '<option value="Leave on Expert" style="color:#004080">Leave on Expert</option>';
        output += '</select></span>';
        output += '&nbsp; Skype Id : <input type="text" style="width: 151px;" id="skypeName123" name="skypeName"/>';
        output += '</td></tr>';
        output += '</td><td>';
        output += '<table align="center" style="text-align:center; margin-top:10px; line-height:15px;"><tr><td>';
        output += '<a style="width: 60px;" href="javascript:void(0)" class="global-button global-color small-button-padding" onclick=postRequirementAgain("PostRequirement.do","postRequirement");>Submit</a></td>';
        output += '</tr>';
        output += '</td></tr></table>';
        output += '</td></tr>';
        output += '</table>';
        output += '</td></tr>';

        output += '</table>';
        output += '<div id="hideBtn">';
        output += '<table align="center" style="text-align:center; margin-top:10px;"><tr><td>';
        output += '<a style="width: 60px;" href="javascript:void(0)" class="global-button global-color small-button-padding" onclick=associateLearnerToContent(' +content_id +',0,"' + divid + '","'+ escape(title) +'")>Submit</a></td>';
        output += '<td>';
        output += '<a style="width: 60px;" href="javascript:void(0)" class="global-button global-color small-button-padding" onclick=javascript:ModalPopup.Close("' +divid + '","1")>Cancel</a>';
        output += '</td></tr></table>';
        output += '</div>';
        output += '</div>';
        output += '</div>';
        output += '</td>';
        output += '<td class="corner_border_right_grn"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_bottomleft_grn"></td>';
        output += '<td class="corner_border_bottom_grn"></td>';
        output += '<td class="corner_bottomright_grn"></td>';
        output += '</tr>';
        output += '</table>';
        output += '</div>';
        output += '<div id="empdiv" style="display:none;"></div>';
        output += '</div>';
        output += '</td>';
        output += '<td class="corner_border_right_grn"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_bottomleft_grn"></td>';
        output += '<td class="corner_border_bottom_grn"></td>';
        output += '<td class="corner_bottomright_grn"></td>';
        output += '</tr>';
        output += '</table>';
        document.getElementById(divid).innerHTML = '';
        document.getElementById(divid).innerHTML=output;
        ModalPopup(divid,"");
    }
}

//Attaching expert or learner
////////////////////////////////////////////////////
function attachUserToContent(content_id,user_type,divname)
{
    var type_from_user = document.getElementById("type_from_user").value;
    var review_from_user = document.getElementById("review_from_user").value;
    var url = "addExpert.do";
    var funcToCall = userAttached;
    var queryStr = "";
    queryStr = "contentId="+content_id;
    queryStr += "&type_from_user="+escape(type_from_user);
    queryStr += "&review_from_user="+escape(review_from_user);
    queryStr += "&user_type="+escape(user_type);
    fetchServerResponse(url,queryStr,funcToCall,divname);
}

function userAttached(divname)
{
    if (req.readyState==4 || req.readyState=="complete")
    {
        if (req.status == 200){
            var result = req.responseText;
        //alert(result);
        }else{
    //@todo
    }
    }
    else{
    //        document.getElementById(divname).innerHTML=sHTMLSearchAnim.replace("###", "");
    //        showDetails(divname);
    }
        javascript:ModalPopup.Close(divname,"1");
}

///////////////////////////////////////////////////////////////

function catagoryLevel2Manage(catLevel1,catLevel2,catLevel3)
{
    var elem = document.getElementById(catLevel1);
    clearItems(new Array(catLevel2,catLevel3));
    getCategoryAndFill(elem,catLevel2);
}

function categoryLevel3Manage(catLevel2,catLevel3)
{
    var elem = document.getElementById(catLevel2);
    getSubCategoryAndFill(elem,catLevel3);
}
function checkBG_showlayer(obj1,obj2,obj3,obj4)
{
    var myobj4 = document.getElementById(obj4).style.display;
    if(myobj4 == "none")
    {
        document.getElementById(obj4).style.display ='';
        document.getElementById(obj1).style.border = 'none';
        document.getElementById(obj3).style.backgroundColor ='#EEF6FA';
        document.getElementById(obj3).style.border = '1px solid #2AD';
        document.getElementById(obj4).style.backgroundColor ='#EEF6FA';
    }
    var myobj2 = document.getElementById(obj2).style.display;

    if(myobj2 != "none")
    {
        document.getElementById(obj1).style.backgroundColor ='#FFFFFF';
        document.getElementById(obj2).style.display ='none';
        document.getElementById(obj2).style.backgroundColor ='#FFFFFF';
    }
}

function checkBG_showlayertome(obj1,obj2,obj3,obj4)
{
    var isExpertOptionChecked = document.getElementById('expert_categories').checked;
    var myobj2 = document.getElementById(obj2).style.display;
    if(isExpertOptionChecked)
    {
        document.getElementById(obj2).style.display ='';
        document.getElementById(obj1).style.backgroundColor ='#EEF6FA';
        document.getElementById(obj1).style.border = '1px solid #2AD';
        document.getElementById(obj2).style.backgroundColor ='#EEF6FA';
    }
    else{
        document.getElementById(obj2).style.display = 'none';
        document.getElementById(obj1).style.backgroundColor = '#FFFFFF';
        document.getElementById(obj1).style.border = 'none';
    }
//    var myobj4 = document.getElementById(obj4).style.display;
//    if(myobj4 != "none")
//    {
//        document.getElementById(obj4).style.display = 'none';
//        document.getElementById(obj4).style.background = '#FFFFFF';
//        document.getElementById(obj3).style.background = '#FFFFFF';
//        document.getElementById(obj3).style.border = 'none';
//    }
}
function checkBG_showlayerlast(obj1,obj2)
{
    var myobj = document.getElementById(obj1).style.display;
    //var myobj1 = document.getElementById(obj2).style.background;
    if(myobj == "none")
    {   //alert("hello");
        document.getElementById(obj1).style.display ='';
        document.getElementById(obj1).style.backgroundColor ='#EEF6FA';
        document.getElementById(obj2).style.display = 'none';
    }
    else
    {
        document.getElementById(obj1).style.backgroundColor ='#FFFFFF';
        document.getElementById(obj1).style.display ='none';
        document.getElementById(obj2).style.display = '';
    }
}

function checkBG_showradiolayer(obj1)
{
    var myobj1 = document.getElementById(obj1).style.display;
    if(myobj1 != "none")
    {
        //alert("lower is open");
        document.getElementById(obj1).style.display ='none';
    }
        javascript:ModalPopup.Close("ConnectionPopUp","1");
    showcommondiv('PostRequirement.jsp','postRequirement','postRequirement');
}
function showCategoryFill(obj1)
{
    var myobj1 = document.getElementById(obj1).style.display;
    if(myobj1 == "none")
    {
        document.getElementById(obj1).style.display ='';
        document.getElementById(obj1).style.border ='1px solid #2AD';
        document.getElementById(obj1).style.backgroundColor ='#EEF6FA';
    }

}


function getCheckedValue(radioObj) {
    if(!radioObj)
        return "";
    var radioLength = radioObj.length;
    if(radioLength == undefined)
        if(radioObj.checked)
            return radioObj.value;
        else
            return "";
    for(var i = 0; i < radioLength; i++) {
        if(radioObj[i].checked) {
            return radioObj[i].value;
        }
    }
    return "";
}





function associateLearnerToContent(content_id,user_type,divname,content_name){
    if (content_name != null) {
        var content_url = "/" + content_name.replace('%20', '_') + "/Content.do?id=" + content_id;
    }
    var category = document.getElementById("learner_category").value;
    //category = getCheckedValue(l_cat);
    //var title = document.getElementById("type_from_user").value;
    var description = document.getElementById("review_from_user").value;
    var tags = "";

    if(category.length ==  0)
    {
        //category = document.getElementById("categoryadd123").value + "#" + document.getElementById("subcategoryadd123").value + "#" + document.getElementById("sub_subcategoryadd123").value;
        if(category.charAt(category.length - 1 ) == '#')
        {
            category = category.substr(0,category.length - 1);
        }
    }
    else if(description == 'Hint Message: * I need someone to train me in hedge funding as described OR * I need a web developer, who can design a website in php using similar styles as shown in this article')
    {
        description = '';
    }
    associateUserToContent(content_id,category,user_type,title,description,tags,divname,content_url);
}


function associateExpertToContent(content_id,category,user_type,divname,content_name)
{
    if (content_name != null) {
        var content_url = "/" + content_name.replace('%20', '_') + "/Content.do?id=" + content_id;
    }
    var title = document.getElementById("i_know_it_title").value;
    var description = document.getElementById("i_know_it_description").value;
    var tags = document.getElementById("i_know_it_tags").value;
    var l_cat2 = document.getElementById("expert_categories");
    category = getCheckedValue(l_cat2);
    //    if(category.length ==  0)
    //    {
    //        document.getElementById('errorKnowIt').style.display = '';
    //        document.getElementById('errorKnowIt').innerHTML = 'Please select make me expert for this category';
    //        return false;
    //    }
    if(description == 'Hint Message: * I have developed similar solutions for another client OR * I have provided detailed market research & competitive summary on this topic.')
    {
        description = '';
    }
    associateUserToContent(content_id,category,user_type,title,description,tags,divname,content_url);
}

/*
     * Add a user who know the content in the given category.
     */
function associateUserToContent(content_id,category,user_type,title,description,tags,divname,content_url)
{
    var url = "associateUserToContent.do";
    divname = 'corner_content_grn';
    var category_new, cat;
    category_new = escape(category).replace("%A0", "%20", "g");
    cat = category_new.replace("%20%3E%20", "%23", "g");
    var query_str = "&description=" + escape(description);
    query_str += "&tags=" + escape(tags);
    query_str += "&category=" + cat;
    query_str += "&content_id=" + escape(content_id);
    query_str += "&user_type="  + escape(user_type);
    query_str += "&content_url=" + content_url;
    showResultWithQueryStr1(url, divname, callbackContentAsso, query_str);

    //    req = getXHR();
    //    req.open("POST",url+"?"+query_str,true);
    //    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    //    req.onreadystatechange=   function()
    //    {
    //        if (req.readyState==4 || req.readyState=="complete")
    //        {
    //            if (req.status == 200)
    //            {
    //                var result = req.responseText;
    //                callbackContentAsso(result,divname);
    //            //User added. //Update I know it div.
    //
    //            }
    //        }
    //        else
    //        {
    //    //            document.getElementById(divname).innerHTML=sHTMLSearchAnim.replace("###", "");
    //    //            showDetails(divname);
    //    }
    //    };
    //    req.send(null);
    return true;
//javascript:ModalPopup.Close(divname,"1");
}

/*
     * Add a new experties to a user
     */

function callbackContentAsso(response){
    var result = response.split("##");
    if(document.getElementById('UserComment') != null){
        if(result[1] == 'Exp'){
            document.getElementById('UserComment').style.display = 'none';
            document.getElementById('commentPostedMsg').innerHTML = "Comment Posted as an Expert";
            document.getElementById('commentPostedMsg').style.display = '';
        }
        else if(result[1] == 'Explr'){
            document.getElementById('UserComment').style.display = 'none';
            document.getElementById('commentPostedMsgExplr').innerHTML = "Comment Posted as an Explorer";
            document.getElementById('commentPostedMsgExplr').style.display = '';
        }
        else if(result[1] == 'AlrExp'){
            document.getElementById('commentPostedMsg').innerHTML = "You are already an EXPERT";
            document.getElementById('commentPostedMsg').style.display = '';
            document.getElementById('getComments').value = 'Write what help you may able to provide as an expert of this content.';
        }
        else if(result[1] == 'AlrExpr'){
            document.getElementById('commentPostedMsgExplr').innerHTML = "You are already an EXPLORER";
            document.getElementById('commentPostedMsgExplr').style.display = '';
            document.getElementById('getComments').value = 'Write what help you may be looking about this content.';
        }
        else {
            document.getElementById('UserComment').style.display = 'none';
        //document.getElementById('UserCommentExplr').style.display = 'none';
        }
        window.setTimeout("refreshComments("+result[2]+")", 2000);
    }
    else{
        closecommonconn();
        document.getElementById('globalErrorMessage').style.display = '';
        if(result[1] == 'Exp')
            setErrorMessage('You are now an EXPERT for this content ..');
        else if(result[1] == 'Explr')
            setErrorMessage('You are now an EXPLORER for this content ..');
        else if(result[1] == 'AlrExp')
            setErrorMessage('You are already an EXPLORER for this content ..');
        else if(result[1] == 'AlrExpr')
            setErrorMessage('You are already an EXPLORER for this content ..');
        window.setTimeout("clearDiv('globalErrorMessage')", 5000);
    }
}

function addUserComment(content_id){
    var user_type;
    var description = document.getElementById("getComments").value;
    var readCommentTypeUp = document.getElementById("readCommentTypeUp").checked;
    var readCommentTypeDown = document.getElementById("readCommentTypeDown").checked;
    var url = "associateUserToContent.do";
    var comment = document.getElementById('getComments').value;
    var contentid = content_id;
    divname = 'corner_content_grn';

    if(readCommentTypeUp){
        user_type = 0;
    }
    else if(readCommentTypeDown){
        user_type = 1;
    }
    if(description == 'Write what help you may able to provide as an expert of this content.' || description == 'Write what help you may be looking about this content.' || description == ''){
        return false;
    }
    if(login_user == null || login_user == '')
    {
        closecommonconn();
        showBodyHeight();
        ModalPopup('NewLoginpopupdiv','');
        url = contextRoot+'/jsp/ContentHome.jsp?id='+contentid+'&searchId=1&source=ezdia';
        document.getElementById('login_details').value = 'addcomment:'+url+':'+contentid+':'+comment+':'+user_type;
        document.getElementById('regRedirect').value = 'addcomment:'+url+':'+contentid+':'+comment+':'+user_type;
    }
    else
    {
        var query_str = "description=" + escape(description);
        query_str += "&content_id=" + escape(content_id);
        query_str += "&user_type="  + escape(user_type);
        showResultWithQueryStr1(url, divname, callbackContentAsso, query_str);
    }

    return true;
}

function reAddUserComment(content_id, contentComment, user_type){
    var url = "associateUserToContent.do";
    divname = 'corner_content_grn';
    readdedComment = true;
    var query_str = "description=" + escape(contentComment);
    query_str += "&content_id=" + escape(content_id);
    query_str += "&user_type="  + escape(user_type);
    showResultWithQueryStr1(url, divname, callbackContentAsso, query_str);
    return true;

}

function addANewExpertiesToUser(actionURL)
{
    //var expert = document.getElementById('expert').value;
    var id_type = document.getElementById('id_type').value;
    var profileid = document.getElementById('profileid').value;
    var expertise_title = document.getElementById('expertise_title').value;
    var expertise_category = document.getElementById('expertise_category').value;
    var detaildesc  = document.getElementById('detaildesc').value;
    var min_ratenew = document.getElementById('enterrate').value;
    var certificate = document.getElementById('cert_type').value;
    //    var cert_type = document.getElementById('cert_type');
    //    var certificate = cert_type.options[cert_type.selectedIndex].value;
    var eoexnew = document.getElementById('albertpinto');
    var experience = eoexnew.options[eoexnew.selectedIndex].value;
    
    if(expertise_title == '' || experience == '' || min_ratenew == '' || detaildesc=='' || !IsNumeric(min_ratenew))
    {
        document.getElementById('expertise_error').style.display = '';
        document.getElementById('expertise_error').innerHTML = 'Please enter valid data marked with [ * ]';
        return false;
    }
    else if(expertise_title == 'Title or a headline for your expertise')
    {
        document.getElementById('expertise_error').style.display = '';
        document.getElementById('expertise_error').innerHTML = 'Title field is empty';
        document.getElementById("expertise_title").focus();
        return false;
    }
    else if(detaildesc == 'A short description about your experience'){
        document.getElementById('expertise_error').style.display = '';
        document.getElementById('expertise_error').innerHTML = 'Please enter description about your expertise';
        document.getElementById("detaildesc").focus();
        return false;
    }
    else{
        detaildesc.replace(new RegExp( "\\n", "g" ), "<br>" );
        var queryStr = "category="  + escape(expertise_category) + "&"
        +  "certificate=" + escape(certificate) + "&"
        +  "title=" + escape(expertise_title) + "&"
        +  "desc=" + escape(detaildesc) + "&"
        +  "rate=" + escape(min_ratenew) + "&"
        +  "exp=" + escape(experience) + "&"
        //          +  "expert=" + escape(expert) + "&"
        +  "id_type=" + escape(id_type) + "&"
        +  "profileid=" + escape(profileid);

        var url = actionURL + "?" + queryStr;
    
        showResultWithQueryStr(url, null, handleGlobalResponse,null);
        closecommonconn();
        return true;
    }
}

function addANewExpertiesToUser1(actionURL)
{
    //var expert = document.getElementById('expert').value;
    //var id_type = document.getElementById('id_type').value;
    // var profileid = document.getElementById('profileid').value;
    var expertise_title = document.getElementById('i_know_it_title').value;
    // alert(expertise_title);
    var catobj = document.getElementById('categoryadd').options[document.getElementById('categoryadd').selectedIndex].value;
    var subobj = document.getElementById('subcategoryadd1').options[document.getElementById('subcategoryadd1').selectedIndex].value;
    var sub_subobj = document.getElementById('sub_subcategoryadd1').options[document.getElementById('sub_subcategoryadd1').selectedIndex].value;
    //alert(catobj);
    var min_ratenew = document.getElementById('min_ratenew').value;
    var eoexnew = document.getElementById('eoexnew');
    var experience = eoexnew.options[eoexnew.selectedIndex].value;
    //alert(experience);
    var queryStr = "category="  + escape(catobj) + "&"
    //+  "certificate=" + escape(certificate) + "&"
    +  "subcategory="  + escape(subobj) + "&"
    +  "sub_subcategory="  + escape(sub_subobj) + "&"
    +  "title=" + escape(expertise_title) + "&"
    //+  "desc=" + escape(detaildesc) + "&"
    +  "rate=" + escape(min_ratenew) + "&"
    +  "exp=" + escape(experience);
    //          +  "expert=" + escape(expert) + "&"
    // +  "id_type=" + escape(id_type) + "&"
    //+  "profileid=" + escape(profileid);

    var url = actionURL + "?" + queryStr;

    req = getXHR();
    req.open("POST",url,true);
    req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    req.onreadystatechange=   function()
    {
        if (req.readyState==4 || req.readyState=="complete")
        {
            if (req.status == 200)
            {
                var result = req.responseText;

            }
        }
        else
        {
    //            document.getElementById(divname).innerHTML=sHTMLSearchAnim.replace("###", "");
    //            showDetails(divname);
    }
    };
    req.send(null);
}

function changebutton(obj1,obj2)
{
    document.getElementById(obj1).style.display ='none';
    document.getElementById(obj2).style.display ='';
}
var flag = false;
function checkuserinlist(user_list,type){
    // alert(escape(user_list.replace(","," ","g")));
    // var users = user_list.split(",");
    //alert(user_list);
    for(var i=0;i<user_list.length;i++){
        //alert(user_list[i]);
        if(hiddenUserid == user_list[i]){
            return true;
        }
    }
}
function contentMsg(type){

    if(type == 'Expert'){
        //document.getElementById("globalErrorMessage").innerHTML = 'You are already an expert for this content.';
        clearErrorMessage();
        setErrorMessage('You are already an expert for this content.');
    }else{
        //document.getElementById("globalErrorMessage").innerHTML = 'You are already a learner for this content.';
        clearErrorMessage();
        setErrorMessage('You are already a learner for this content.');
    }
}
/*
     * The getDomain willreturn the Domain name from the given URL
     */
function getDomain(url) {
    return url.match(/:\/\/(.[^\/]+)/)[1];
}

function closeButtonURLForContent() {
    var winHost = document.referrer.indexOf(window.host);
    if(winHost == -1 || winHost == 0) {
        history.go(-1);
    } else {
        document.location.href = contextRoot+'/knowledge';
    }
}

// TODO unused code <21 Dec 2011> will be removed in 2 months
// function homePageHeaderTabs(myHeader){
//    if(myHeader == 'mouse out'){
//        if(isKBActive == 'ontabactive'){
//            //document.getElementById("KB").className ="ontabactive";
//            document.getElementById("EA").className ="ontab";
//            //document.getElementById("Home").className ="ontab";
//            proj = document.getElementById("Projects");
//            if (proj) {
//                proj.className ="ontab";
//            }
//        }
//        else if(isEAActive == 'ontabactive'){
//            //document.getElementById("KB").className ="ontab";
//            document.getElementById("EA").className ="ontabactive";
//            //document.getElementById("Home").className ="ontab";
//            proj = document.getElementById("Projects");
//            if (proj) {
//                proj.className ="ontab";
//            }
//        }
//        else if(isProjActive == 'ontabactive'){
//            //document.getElementById("KB").className ="ontab";
//            document.getElementById("EA").className ="ontab";
//            //document.getElementById("Home").className ="ontab";
//            proj = document.getElementById("Projects");
//            if (proj) {
//                proj.className ="ontabactive";
//            }
//        }
//        else {
//            //document.getElementById("Home").className ="ontabactive";
//            document.getElementById("EA").className ="ontab";
//            //document.getElementById("KB").className ="ontab";
//            proj = document.getElementById("Projects");
//            if (proj) {
//                proj.className ="ontab";
//            }
//        }
//    }
//
//    if (myHeader=="Home"){
//        //document.getElementById("Home").className ="ontabactive";
//        document.getElementById("EA").className ="ontab";
//        //document.getElementById("KB").className ="ontab";
//        var proj = document.getElementById("Projects");
//        if (proj) {
//            proj.className ="ontab";
//        }
//    }
//    else if (myHeader=="EA"){
//        document.getElementById("EA").className ="ontabactive";
//        //document.getElementById("Home").className ="ontab";
//        //document.getElementById("KB").className ="ontab";
//        proj = document.getElementById("Projects");
//        if (proj) {
//            proj.className ="ontab";
//        }
//    }
//    else if(myHeader=="KB"){
//        //document.getElementById("KB").className ="ontabactive";
//        document.getElementById("EA").className ="ontab";
//        //document.getElementById("Home").className ="ontab";
//        proj = document.getElementById("Projects");
//        if (proj) {
//            proj.className ="ontab";
//        }
//    }
//    else if(myHeader=="Projects"){
//        document.getElementById("Projects").className ="ontabactive";
//        document.getElementById("EA").className ="ontab";
//        //document.getElementById("Home").className ="ontab";
//        //document.getElementById("KB").className ="ontab";
//    }
//    else{
//        //        document.getElementById("Home").className ="ontabactive";
//        //        document.getElementById("HomeSubTabs").style.display ="";
//        //        document.getElementById("EASubTabs").style.display ="none";
//        //        document.getElementById("KBSubTabs").style.display ="none";
//        //        projSubTab = document.getElementById("ProjectsSubTabs");
//        //        if (projSubTab) {
//        //            projSubTab.style.display ="none";
//        //        }
//        //        document.getElementById("EA").className ="ontab";
//        //        document.getElementById("KB").className ="ontab";
//        //        proj = document.getElementById("Projects");
//        //        if (proj) {
//        //            proj.className ="ontab";
//        //        }
//        //document.getElementById("home-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        //document.getElementById("kb-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("ea-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("proj-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    }
//}
//
//function indexPageHeaderTabs(myHeader){
//    //var paymentMethod = document.getElementById("SearchSelection").options[document.getElementById("SearchSelection").selectedIndex].value;
//    if(myHeader == 'mouse out'){
//        if(isKBActive == 'ontabactive'){
//            document.getElementById("KB").className ="ontabactive";
//            document.getElementById("EA").className ="ontab";
//            //document.getElementById("Home").className ="ontab";
//            proj = document.getElementById("Projects");
//            if (proj) {
//                proj.className ="ontab";
//            }
//        }
//        else if(isEAActive == 'ontabactive'){
//            document.getElementById("KB").className ="ontab";
//            document.getElementById("EA").className ="ontabactive";
//            //document.getElementById("Home").className ="ontab";
//            proj = document.getElementById("Projects");
//            if (proj) {
//                proj.className ="ontab";
//            }
//        }
//        else if(isProjActive == 'ontabactive'){
//            document.getElementById("KB").className ="ontab";
//            document.getElementById("EA").className ="ontab";
//            //document.getElementById("Home").className ="ontab";
//            proj = document.getElementById("Projects");
//            if (proj) {
//                proj.className ="ontabactive";
//            }
//        }
//        else {
//            //document.getElementById("Home").className ="ontabactive";
//            document.getElementById("EA").className ="ontab";
//            document.getElementById("KB").className ="ontab";
//            proj = document.getElementById("Projects");
//            if (proj) {
//                proj.className ="ontab";
//            }
//        }
//    }
//
//    //    if (myHeader=="Home"){
//    //        //document.getElementById("Home").className ="ontabactive";
//    //        document.getElementById("EA").className ="ontab";
//    //        document.getElementById("KB").className ="ontab";
//    //        var proj = document.getElementById("Projects");
//    //        if (proj) {
//    //            proj.className ="ontab";
//    //        }
//    //        //document.getElementById("SearchSelection").value = 'Knowledge';
//    //        //document.getElementById("home-tab-txt").className = "header_Tab_txt header_Tab_txt_Active";
//    //        document.getElementById("kb-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    //        document.getElementById("ea-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    //        document.getElementById("proj-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    //    }
//    //    else
//    if (myHeader=="EA"){
//        document.getElementById("EA").className ="ontabactive";
//        //document.getElementById("Home").className ="ontab";
//        document.getElementById("KB").className ="ontab";
//        proj = document.getElementById("Projects");
//        if (proj) {
//            proj.className ="ontab";
//        }
//        //document.getElementById("SearchSelection").value = 'Expert';
//        document.getElementById("ea-tab-txt").className = "header_Tab_txt header_Tab_txt_Active";
//        document.getElementById("kb-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        //document.getElementById("home-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("proj-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    }
//    else if(myHeader=="KB"){
//        document.getElementById("KB").className ="ontabactive";
//        document.getElementById("EA").className ="ontab";
//        //document.getElementById("Home").className ="ontab";
//        proj = document.getElementById("Projects");
//        if (proj) {
//            proj.className ="ontab";
//        }
//        //document.getElementById("SearchSelection").value = 'Knowledge';
//        document.getElementById("kb-tab-txt").className = "header_Tab_txt header_Tab_txt_Active";
//        //document.getElementById("home-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("ea-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("proj-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    }
//    else if(myHeader=="Projects"){
//        document.getElementById("Projects").className ="ontabactive";
//        document.getElementById("EA").className ="ontab";
//        //document.getElementById("Home").className ="ontab";
//        document.getElementById("KB").className ="ontab";
//        //document.getElementById("SearchSelection").value = 'Project';
//        document.getElementById("proj-tab-txt").className = "header_Tab_txt header_Tab_txt_Active";
//        document.getElementById("kb-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("ea-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    //document.getElementById("home-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    }
//    else{
//        //        document.getElementById("Home").className ="ontabactive";
//        //        document.getElementById("EA").className ="ontab";
//        //        document.getElementById("KB").className ="ontab";
//        //        proj = document.getElementById("Projects");
//        //        if (proj) {
//        //            proj.className ="ontab";
//        //        }
//        //document.getElementById("SearchSelection").value = 'Knowledge';
//        //document.getElementById("home-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("kb-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("ea-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//        document.getElementById("proj-tab-txt").className = "header_Tab_txt header_Tab_txt_Inactive";
//    }
//}

//function SelectSearchType(){
//    var searchstr = document.getElementById("search").value;
//    var paymentMethod = document.getElementById("SearchSelection").options[document.getElementById("SearchSelection").selectedIndex].value;
//    if(paymentMethod == 'Knowledge'){
//        if(login_user == null || login_user == '' || !login_user ){
//            //indexPageHeaderTabs('KB');
//            document.getElementById("button-href").href = contextRoot+'/knowledge?search='+searchstr;
//        }
//        else {
//            homePageHeaderTabs('KB');
//            jsonSearch(contextRoot+'/jsp/KBSearch.do','2','Content',2,'middle_div',searchstr,'','','ezdianw','header');
//        }
//    }
//    else if(paymentMethod == 'Expert'){
//        if(login_user == null || login_user == '' || !login_user ){
//            //indexPageHeaderTabs('EA');
//            document.getElementById("button-href").href = contextRoot+'/experts?search='+searchstr;
//        }
//        else {
//            homePageHeaderTabs('EA');
//            jsonSearch(contextRoot+'/jsp/EzdiaSearch.do','2','Expert',0,'middle_div',searchstr);
//        }        
//    }
//    else if(paymentMethod == 'Project'){
//        if(login_user == null || login_user == '' || !login_user ){
//            //indexPageHeaderTabs('Projects');
//            document.getElementById("button-href").href = contextRoot+'/projects?search='+searchstr;
//        }
//        else {
//            homePageHeaderTabs('Projects');
//            showProjectResult(contextRoot+'/jsp/RequirementsSearch.do?sortBy=posteddate&asExpertOrExplorer=null&uid='+login_user+'&category=&pagetype=index&projectInfoType=findProject&pageNo=0&search='+searchstr,'middle_div');
//        }        
//    }
//    else{
//        if(login_user == null || login_user == '' || !login_user ){
//            //indexPageHeaderTabs('EA');
//            document.getElementById("button-href").href = contextRoot+'/experts?search='+searchstr;
//        }
//        else {
//            homePageHeaderTabs('EA');
//            jsonSearch(contextRoot+'/jsp/EzdiaSearch.do','2','Expert',0,'middle_div',searchstr);
//        }
//    }
//}
//
//function onKeyPressSearch(){
//    var searchstr = document.getElementById("search").value;
//    if(searchstr == ""){
//        searchstr = 'Search For';
//    }
//    var selectOpt = document.getElementById("SearchSelection").options[document.getElementById("SearchSelection").selectedIndex].value;
//    if(selectOpt == 'Knowledge'){
//        window.location.href = contextRoot+'/knowledge?search='+searchstr;
//    }
//    else if(selectOpt == 'Expert'){
//        window.location.href = contextRoot+'/experts?search='+searchstr;
//    }
//    else if(selectOpt == 'Project'){
//        window.location.href = contextRoot+'/projects?search='+searchstr;
//    }
//    else{
//        window.location.href = contextRoot+'/experts?search='+searchstr;
//    }
//}

//function onenter(event,actionurl,domain,page) {
//    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
//    if (keyCode == 13) {
//        if(page == 'home')
//            jsonSearch(actionurl,domain,'Content',0,'middle_div');
//        else if(page == 'search')
//            SelectSearchType();
//        else if(page == 'indexSearch')
//            onKeyPressSearch();
//        else
//            jsonSearch(actionurl,domain,'Content',0,'middle_div');
//    }
//    return false;
//}

/*TODO unused code <03 Feb 2011> will be removed in 2 months

function narrowExpertSearchByCategory(category,nR,showLevel)
{
    //var narrowResults = unescape(nR);
    var narrowResults = '';
    if(showLevel == 1){
        narrowResults = viewNewAreacount;
    }
    if(showLevel == 2){
        narrowResults = newSubTag;
    }
    if(showLevel == 3){
        narrowResults = newSubTag2;
    }
    var max_size = 30; // max font size in pixels
    var min_size = 10; // min font size in pixels
    //Get min and max value counts
    var minVal = Number.MAX_VALUE;
    var maxVal = Number.MIN_VALUE;
    var cat = unescape(category);
    var subAreaDiv = "subsubareas";//"subsubareas" is a divname to hold the third level
    for(var x in narrowResults[cat])
    {
        if (!narrowResults[cat].hasOwnProperty(x)) continue;
        var categoryWeight = getCount(narrowResults[cat][x]);
        if(categoryWeight < minVal)        {
            minVal = categoryWeight;
        }
        if(categoryWeight > maxVal)        {
            maxVal = categoryWeight;
        }
    }
    var spread = (maxVal == minVal)?1:maxVal - minVal;
    //Font size increment Unit.
    var step = (max_size - min_size) / (spread);
    if(showLevel == 1)
    {
        //Global var to hold search Filters, Set the category here;
        searchFilters.categoryL1 = category;
        searchFilters.categoryL2 = '';
        searchFilters.categoryL3 = '';
        expandAreas(narrowResults,cat,subAreaDiv,min_size,minVal,step);
    }
    else if(showLevel == 2)
    {
        //Global var to hold search Filters, Set the sub category here;
        searchFilters.categoryL2 = category;
        searchFilters.categoryL3 = '';
        expandSubAreas(narrowResults,cat,subAreaDiv,min_size,minVal,step);
    }
    else if(showLevel == 3)
    {
        searchFilters.categoryL3 = category;
    }
    //Call Search
    performSearch();
}

//Expand the level two and create a newdiv for for the third level (subsubare on the divname provided
function expandAreas(narrowResults,cat,divname,min_size,minVal,step)
{
    //Clean the clouds if any existing
    for(var areas in narrowResults)
    {
        if (!narrowResults.hasOwnProperty(areas)) continue;
        var a = document.getElementById(escape(areas));
        if(a != null)       {
            a.innerHTML = '';
        }
    }
    var subTags = narrowResults[cat];
    for(var t in subTags)
    {
        if (!subTags.hasOwnProperty(t)) continue;
        newSubTag = narrowResults[cat];
        var size = Math.round(min_size + ((getCount(narrowResults[cat][t]) - minVal) * step));
        document.getElementById(escape(cat)).innerHTML += '<span id="'+ escape(cat+"#"+t) +'"><a class="cloud_elem_s'+ size +'" href="javascript:void(0)" onclick=narrowExpertSearchByCategory("' +escape(t) + '","'+escape(narrowResults[cat])+'",2) >' + t + '</a></span> &nbsp;';
    }
    document.getElementById(escape(cat)).innerHTML += '<div id="'+divname+'"/>';
}
var newSubTag;
var newSubTag2;
//Expand the third level in the
function expandSubAreas(narrowResults,cat,divname,min_size,minVal,step)
{
    var subTags = narrowResults[cat];

    //Clean sub area Div
    document.getElementById(divname).innerHTML = '';
    //  document.getElementById(divname).style.backgroundColor='#FFFFFF';
    document.getElementById(divname).style.padding = '5px';
    document.getElementById(divname).style.margin = '5px';
    //  document.getElementById(divname).style.width = '180px';
    document.getElementById(divname).style.border = 'solid';
    document.getElementById(divname).style.borderColor = '#E5E5E5';
    document.getElementById(divname).style.borderWidth = '1px';

    for(var t in subTags)
    {
        if (!subTags.hasOwnProperty(t)) continue;
        //TODO:Don't want to show others here. Need to check if ther is anything else with others then how to manage that.
        if(t == "others")
        {
            continue;
        }
        newSubTag2 = narrowResults[cat];
        var size = Math.round(min_size + ((getCount(subTags[t]) - minVal) * step));
        document.getElementById(divname).innerHTML += '<span id="'+ escape(cat+"#"+t) +'"><a class="cloud_elem_s'+ size +'" href="javascript:void(0)" onclick=narrowExpertSearchByCategory("' +escape(t) + '","'+escape(narrowResults[cat])+'",3) >' + t + '</a></span> &nbsp;';
    }
}

 * Write the searched content div.
function writeSearchContent(jsonContent,totalpages)
{
    var i=0;
    var output = '';

    if(searchFilters.searchType == 'Content'){
        output += '<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 100%; z-index: 10">';
        output += '<tr>';
        output += '<td class="corner_topleft"></td>';
        output += '<td class="top_side_border"></td>';
        output += '<td class="corner_topright"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="left_side_border"></td>';
        output += '<td id="corner_content_" class="corner_content">';
    }
    if(pid == 'middle_div' ||  pid =='MyNetwork' || pid == 'MyOwn' || pid == 'Content' || pid == 'narrowed_result_center')
        output += '<div id="hellodiv">';
    if(jsonContent.length-1 >0){
        for (i = 0 ; i<jsonContent.length-1 ; i++){
            contentName[i] = jsonContent[i].content_name;
            output += '<div style="position: relative; width: 100%; height: auto;">';
            output += '<div id="kb_mainDiv" style="position: relative; width: 640px; margin-top:10px; height: 90px; border-bottom:2px solid #DAEFFE; z-index: 1; left: 0px; top: 0px">';
            output += '<div id="innerContent">';
            if(jsonContent[i].explorer_users){

                if(checkuserinlist(jsonContent[i].explorer_users)){

                    if(searchFilters.searchSubType == 'myown')
                    {
                        output += '<div id="i_know_learn_it" style="color: grey; position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 50px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    else
                    {
                        output += '<div id="i_know_learn_it" onclick=contentMsg("Explorer"); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 50px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    output += '<table align="center" cellpadding="0"  cellspacing="0" class="i-want-txts" style="text-align:center; margin-top:5px;"><tr><td>I need help</td></tr>';
                    output += '<tr><td>('+(jsonContent[i].explorer_users?jsonContent[i].explorer_users.length:0)+')</td></tr></table>';
                    output += '</div>';
                }else{
                    if(searchFilters.searchSubType == 'myown')
                    {
                        output += '<div id="i_know_learn_it" style="color: grey;position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 50px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    else
                    {
                        output += '<div id="i_know_learn_it" onclick=showLearnItInPopUp('+jsonContent[i].id +',"' + escape(jsonContent[i].content_name) + '","' + escape(jsonContent[i].category_name!=null?jsonContent[i].category_name:"") + '"); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 50px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    output += '<table align="center" cellpadding="0"  cellspacing="0" class="i-want-txts" style="text-align:center; margin-top:5px;"><tr><td>I need help</td></tr>';
                    output += '<tr><td>('+(jsonContent[i].explorer_users?jsonContent[i].explorer_users.length:0)+')</td></tr></table>';
                    output += '</div>';
                }
            }
            else{
                if(searchFilters.searchSubType == 'myown')
                {
                    output += '<div id="i_know_learn_it"  style="color: grey; position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 50px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                }
                else
                {
                    if(jsonContent[i].source == 'google')
                    {
                        output += '<div id="i_know_learn_it" onclick=showcommondiv("PostALink.jsp?url='+escape(jsonContent[i].content_url)+'&title='+escape(jsonContent[i].content_name)+'&desc='+escape(stripHTML(jsonContent[i].description))+'","PostLinkPopUp","PostLinkPopUp");validateURLBox(); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 50px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    else
                    {
                        output += '<div id="i_know_learn_it" onclick=showLearnItInPopUp('+jsonContent[i].id +',"' + escape(jsonContent[i].content_name) + '","' + escape(jsonContent[i].category_name!=null?jsonContent[i].category_name:"") + '"); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 50px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                }
                output += '<table align="center" cellpadding="0"  cellspacing="0" class="i-want-txts" style="text-align:center; margin-top:5px;"><tr><td>I need help</td></tr>';
                output += '<tr><td>('+(jsonContent[i].explorer_users?jsonContent[i].explorer_users.length:0)+')</td></tr></table>';
                output += '</div>';
            }
            if(jsonContent[i].expert_users){

                if(checkuserinlist(jsonContent[i].expert_users)){
                    if(searchFilters.searchSubType == 'myown')
                    {
                        output += '<div id="i_know_it" style="color: grey;position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 10px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    else
                    {
                        output += '<div id="i_know_it" onclick=contentMsg("Expert"); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 10px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    output += '<table align="center" cellpadding="0"  cellspacing="0" class="i-know-txts" style="text-align:center;"><tr><td>I know it</td></tr>';
                    output += '<tr><td>('+(jsonContent[i].expert_users?jsonContent[i].expert_users.length:0)+')</td></tr></table>';
                    output += '</div>';
                }else{
                    if(searchFilters.searchSubType == 'myown')
                    {
                        output += '<div id="i_know_it" style="color: grey; position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 10px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    else
                    {
                        output += '<div id="i_know_it" onclick=showKnowItInPopUp('+jsonContent[i].id +',"' + escape(jsonContent[i].content_name) + '","' + escape(jsonContent[i].category_name!=null?jsonContent[i].category_name:"") + '"); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 10px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    output += '<table align="center" cellpadding="0"  cellspacing="0" class="i-know-txts" style="text-align:center;"><tr><td>I know it</td></tr>';
                    output += '<tr><td>('+(jsonContent[i].expert_users?jsonContent[i].expert_users.length:0)+')</td></tr></table>';
                    output += '</div>';
                }

            }
            else{
                if(searchFilters.searchSubType == 'myown')
                {
                    output += '<div id="i_know_it"  style="color: grey; position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 10px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                }
                else
                {
                    if(jsonContent[i].source == 'google')

                    {
                        output += '<div id="i_know_it" onclick=showcommondiv("PostALink.jsp?url='+escape(jsonContent[i].content_url)+'&title='+escape(jsonContent[i].content_name)+'&desc='+escape(stripHTML(jsonContent[i].description))+'","PostLinkPopUp","PostLinkPopUp");validateURLBox(); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 10px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                    else
                    {
                        output += '<div id="i_know_it" onclick=showKnowItInPopUp('+jsonContent[i].id +',"' + escape(jsonContent[i].content_name) + '","' + escape(jsonContent[i].category_name!=null?jsonContent[i].category_name:"") + '"); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 10px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
                    }
                }
                output += '<table align="center" cellpadding="0"  cellspacing="0" class="i-know-txts" style="text-align:center;"><tr><td>I know it</td></tr>';
                output += '<tr><td>('+(jsonContent[i].expert_users?jsonContent[i].expert_users.length:0)+')</td></tr></table>';
                output += '</div>';
            }
            //alert(jsonContent[i].content_url+"::"+jsonContent[i].firstname);
            output += '<div id="userTinyIco" style="position: absolute; width: 16px; height: 16px; z-index: 1; left: 85px; top: 0px">';
            output += '<img alt="" height="21" src="../static/images/userimg2.png" width="18" /></div>';
            output += '<div id="topBrieftxts" onclick=showContentInPopUp("ConnectionPopUp","'+escape(jsonContent[i].content_name) +'","'+ escape(isAURL(escape(jsonContent[i].related_url))?jsonContent[i].related_url:jsonContent[i].content_url)+'","'+ escape(jsonContent[i].content_type)  + '",'+jsonContent[i].id +',"'+ escape(jsonContent[i].content_name)+'","'+ escape(jsonContent[i].category_name!=null?jsonContent[i].category_name:"")+'","'+(jsonContent[i].expert_users?jsonContent[i].expert_users.length:0)+'","'+(jsonContent[i].explorer_users?jsonContent[i].explorer_users.length:0)+'","'+jsonContent[i].expert_users+'","'+jsonContent[i].explorer_users+'","'+escape(jsonContent[i].keyword)+'","'+escape(jsonContent[i].description)+'","'+jsonContent[i].source+'") style="position: absolute; width: 525px; height: 16px; z-index: 2; left: 115px; top: 0px; font-size: 12px; color: #048; font-weight: bold;">';
            output += '<div style="max-height:15px; max-width:600px; cursor:pointer; overflow:hidden;">'+jsonContent[i].content_name.substring(0,50) +'...</div></div>';
            output += '<div id="userDetailBrief" style="position: absolute; width: 500px; height: 18px; z-index: 3; left: 90px; top: 21px">';
            output += '<span id="UserCat" style="position: absolute; width: auto; height: 16px; z-index: 2; left: 0px; top: 1px; font-size: 12px; color: #666; overflow: hidden;">';
            output += getDomain(jsonContent[i].content_url)+'</div>';
            output += '</span>';
            if(jsonContent[i].source == 'google'){
                output += '<div style="position:absolute; right:10px;"><img height="18" width="18" src="../static/images/google_img.png"></div>';
            }
            output += '<div id="textBriefDescrip" style="position: absolute; width: 450px; height: 16px; z-index: 4; left: 90px; top: 40px; ">';
            if(jsonContent[i].description){
                output += '<div style="position: absolute; width: 450px; height: 15px; overflow:hidden;font-size:12px">'+(jsonContent[i].description).substring(0,150)+'...</div>';
            }
            else{
                output += '<div style="position: absolute; width: 450px; height: 15px; overflow:hidden;font-size:12px">No Description ...</div>';
            }
            output += '</div>';
            if(jsonContent[i].source == 'google'){
                output +='<div style="position: absolute; left: 90px; top: 59px;"><span class="action" style="float: left; padding-right: 4px; padding-top: 4px;" onclick=showcommondiv("PostALink.jsp?url='+escape(jsonContent[i].content_url)+'&title='+escape(jsonContent[i].content_name)+'&desc='+escape(stripHTML(jsonContent[i].description))+'","PostLinkPopUp","PostLinkPopUp");validateURLBox();><b>Add this content to my </b></span><img height="20" width="20" src="../static/images/smallBucket.png" alt=""/></div>';
            }
            else{
                output += '<div id="forwardDiv" style="position: absolute; width: 65px; height: 15px; z-index: 6; cursor: pointer; top: 65px; left: 95px;" onclick=showcommondiv("../jsp/ForwardContent.jsp?&isForward=true&flag=content&content_name='+escape(jsonContent[i].content_name) +'&content_url='+host+contextRoot+"/jsp/Content.do?id="+jsonContent[i].id+'&content_type='+escape(jsonContent[i].content_type)+'&id='+escape(jsonContent[i].id)+'&category_name='+escape(jsonContent[i].category_name)+'&expert_users='+escape(jsonContent[i].expert_users?jsonContent[i].expert_users.length:0)+'&explorer_users='+escape(jsonContent[i].explorer_users?jsonContent[i].explorer_users.length:0)+'&expert_users_id='+escape(jsonContent[i].expert_users)+'&actual_url='+escape(jsonContent[i].content_url)+'","ConnectionPopUp","ConnectionPopUp");><img alt="Forward" src="../static/images/forwardIcon.png" title="Forward" /><span class="action"> Forward</span> </div>';
            }

            output += '<div id="actionsDiv" class="row" style="margin: 0pt; right: 0px; position: absolute; height: 45px; top: 40px; width: 97px;">';
            //            output += '<span style="display:none; color:#900;font-weight:bold; font-size:21px;">****<span style="display:none; font-size:21px;font-weight:bold;color:gray">*</span>';
            //            output += '</span>';
            //            output += '<div id="riviewsDiv" style="display:none; position: absolute; width: 60px; height: 18px; z-index: 2; left: 70px; top: 3px">';
            //            output += '<span>7</span> Reviews</div>';

            if(jsonContent[i].expert_users){
                output += '<div style="width: 18px; float: left; margin-left:3px;" id="NoOfExpertIcon">';
                output += '<img height="21" width="18" src="../static/images/userimg2.png" alt="Get experts"/> </div>';
                output += '<div class="cell" style="width:65px;" id="NoOfExpertIcon">';
                output += '<span class="action" onclick=getExpertsById("EzdiaSearch.do","' +jsonContent[i].expert_users+'","Expert","middle_div")>Get Experts</span></div>';
            }
            else{
                output += '<div style="width: 18px; float: left; margin-left:3px;" id="NoOfExpertIcon">';
                output += '<img height="21" width="18" src="../static/images/userimg2.png" alt="Get experts"/> </div>';
                output += '<div class="cell" style="width:65px;" id="NoOfExpertIcon">';
                output += '<span style="color:gray">Get Experts</span></div>';
            }
            output += '<div class="row" style="width:120px;">';
            if(jsonContent[i].explorer_users){
                output += '<div style="width: 18px; float: left;" id="NoOfExpertIcon">';
                output += '<img src="../static/images/Explorer.png" alt="Get explorer"/> </div>';
                output += '<div class="cell" style="width:90px;" id="NoOfExpertIcon">';
                output += '<span class="action" onclick=getExpertsById("EzdiaSearch.do","' +jsonContent[i].explorer_users+'","Expert","middle_div")>Get Explorers</span></div>';
            }
            else{
                output += '<div style="width: 18px; float: left;" id="NoOfExpertIcon">';
                output += '<img src="../static/images/Explorer.png" alt="Get explorer"/> </div>';
                output += '<div class="cell" style="width:90px;" id="NoOfExpertIcon">';
                output += '<span style="color:gray">Get Explorers</span></div>';
            }
            output += '</div>';
            output += '</div>';
            //        output += '<div id="ChatIcon" style="position: absolute; width: 17px; height: 15px; z-index: 1; left: 66px; top: 4px">';
            //        output += '<img alt="" src="../static/images/green-chat-icon.gif" /></div>';
            if(jsonContent[i].source == 'google'){
            }
            else{
                output += '<div id="TinyIcon" style="position: absolute; width: 17px; height: 25px; top: 60px; left: 165px; z-index: 1;">';
                output += '<img alt="" src="../static/images/tinylogo.png" /></div>';
                output += '<div id="catslists" style="position: absolute; width: 220px; overflow:hidden; height: 16px; z-index: 2; left: 185px; top: 67px;">';

                if(jsonContent[i].keyword != null)
                {
                    for(var keywordCount = 0; keywordCount < jsonContent[i].keyword.length;keywordCount++ )
                    {
                        if(login_user == null || login_user == ''  || !login_user){
                            output += '<a style="color: #4070A0 !important" href='+contextRoot+'/jsp/IndexSearch.do?search='+escape(jsonContent[i].keyword[keywordCount])+'&searchtype=index&selected_ezdia_domain=2>'+jsonContent[i].keyword[keywordCount]+'</a>';
                        }
                        else{
                            output += '<span class="action" onclick=jsonSearch("ContentSearch.do","2","Content",0,"middle_div","'+escape(jsonContent[i].keyword[keywordCount])+'") >'+jsonContent[i].keyword[keywordCount]+'</span>';
                        //output += '<span class="action">'+jsonContent[i].keyword[keywordCount]+'</span>';
                        }
                        output += (keywordCount != jsonContent[i].keyword.length - 1)?',':'';
                    }
                }
                //, <a href="#">firebug</a> , <a href="#">css</a></div>';
                output += '<span class="action" style="margin-left:10px;" onclick=showcommondiv("ContentDetails.jsp?url='+escape(jsonContent[i].content_url)+'&title='+escape(jsonContent[i].content_name)+'&desc='+escape(jsonContent[i].description)+'","ConnectionPopUp","ConnectionPopUp");>View All</span></div>';
                output += '</div>';
            }
            output += '</div>';
            output += '</div>';
            if(i == ezdiaSearch-1){
                output += '<div id="google" class="errorBlue" style="position: relative; color: rgb(153, 0, 0); margin-top: -2px; left: -1%; width: 101%; background-color:#DAEFFE; border:0px;">Contents from Google</div>';
            }
            output += '</div>';
        }
    }
    else{

        if(searchFilters.searchSubType == 'myown')
        {
            output += "<b>You have not posted any content</b> <div style='float:right;'><span class='action' onclick=showcommondiv('PostALink.jsp','PostLinkPopUp','PostLinkPopUp')><b>Add content to your Knowledge Bucket</b></span></div>";
        }
        else
        {
            output += "<b>No content found with this keyword "+token+"..!!</b> <div style='float:right;'><span class='action' onclick='reloadHomePage()'><b>Go Back To New Search >></b></span></div>";
        }
    }
    if(pid == 'middle_div' ||  pid =='MyNetwork' || pid == 'MyOwn' || pid == 'Content' || pid == 'narrowed_result_center')
        output +='</div>';
    lastpage = totalpages - 1;
    if(totalpages > 1)
    {
        output+='<div id="ContentSearchPages">';
        output+=' <table align=right id="ContentPagination" style="margin-right:2%; margin-top:1%;">';
        output+='<tr>';
        output+='<td width="30">Page</td>';
        output+='<td width="15">';
        output+='1';
        output+='</td>';
        output+='<td width="15">of</td>';
        output+='<td width="20">';
        output+=totalpages;
        output+='</td>';
        output+='<td width="30">';
        //mypage++;
        if(pid == 'narrowed_result_center')
            output+='<span class="action" onclick=setNextlinks("ContentSearch.do","ContentRefined",1,'+totalpages+') >Next</span>';
        else
            output+='<span class="action" onclick=setNextlinks("ContentSearch.do","Content",1,'+totalpages+') >Next</span>';
        output+='</td>';
        output+='<td width="30">';
        if(pid == 'narrowed_result_center')
            output+='<span class="action" onclick=setNextlinks("ContentSearch.do","ContentRefined",'+lastpage+','+totalpages+')>Last</span>';
        else
            output+='<span class="action" onclick=setNextlinks("ContentSearch.do","Content",'+lastpage+','+totalpages+')>Last</span>';
        output+='</td></tr>';
        output+=' </table>';
    }

    if(searchFilters.searchType == 'Content'){
        output += '</td>';
        output += '<td class="right_side_border"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_bottomleft"></td>';
        output += '<td class="bottom_side_border"></td>';
        output += '<td class="corner_bottomright"></td>';
        output += '</tr>';
        output += '</table>';
    }
    return output;
}
function writeSearchItems(jsonContent,totalpages)
{
    var i=0;
    var output = '';
    if(pid == 'middle_div' || pid == 'narrowed_result_center')
        output += '<div id="hidiv">';
    if(jsonContent.length-1>0){
        for (i = 0 ; i<jsonContent.length-1 ; i++){

            //TO Check
            if(hiddenUserid)
            {
                //output+='<div style="position: relative; width: 100%; height: 153px; padding-top: 0px; z-index: 1; top:0px;">';
                output+='    <div class="expertSearchUserCard">';
            }
            else{
                //output+='<div style="position: relative; width: 100%; height: auto; padding-top: 0px; z-index: 1; margin-bottom: 10px;top:0px;">';
                output+='    <div class="expertSearchUserCard">';

            }
            output+='<div style="position: relative; width: 100%; height: auto; padding-top: 0px; z-index: 1; margin-bottom: 10px;top:0px;">';
            output+='    <div style="position: relative; width: 100%; height: 140px; z-index: 10; left: auto; margin-top: 0px; padding-left: 0px;">';
            output+='<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 100%; height: 145px; z-index:100;">';
            output+='   <tr>';
            output+='   <td class="corner_topleft">';
            output+='   </td>';
            output+='   <td class="top_side_border">';
            output+='  </td>';
            output+='  <td class="corner_topright">';
            output+=' </td>';
            output+=' </tr>';
            output+='<tr>';
            output+='  <td class="left_side_border">';
            output+='  </td>';
            output+='  <td id="corner_content" class="corner_content">';
            output+='    <div style="width:100%; height:120px;">';
            if(jsonContent[i].username != myuserid){
                output+='      <div id="userdiv" style="padding-right: 10px; padding-left: 10px; padding-top: 4px; width: 86px; z-index: 1;">';
                if(jsonContent[i].photo_thumbnail){
                    if(login_user == null || login_user == ''  || !login_user){
                        output+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; cursor: pointer;" alt="uimg" src='+localhost+jsonContent[i].photo_thumbnail+' height="96"  />';
                    }
                    else{
                        output+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; cursor: pointer;" alt="uimg" src='+localhost+jsonContent[i].photo_thumbnail+' height="96"  />';
                    }
                }
                else{
                    if(login_user == null || login_user == ''  || !login_user){
                        output+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; margin-top:10px; cursor: pointer;" alt="uimg" src="../static/images/newUserImg.png"/>';
                    }
                    else{
                        output+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; margin-top:10px; cursor: pointer;" alt="uimg" src="../static/images/newUserImg.png"/>';
                    }

                }
                output+='</div>';
            }
            else{
                output+='<div id="userdiv" style="padding-right: 10px; padding-left: 10px; padding-top: 4px; width: 86px; z-index: 1;">';
                if(jsonContent[i].photo_thumbnail){
                    output+='<img onclick=showviewprofile("MyProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; cursor: pointer;" alt="uimg" src='+localhost+jsonContent[i].photo_thumbnail+' height="96"  />';
                }
                else{
                    output+='<img onclick=showviewprofile("MyProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; margin-top:10px; cursor: pointer;" alt="uimg" src="../static/images/newUserImg.png"/>';
                }
                output+='</div>';
            }
            output+='     <div id="available" style="width: 80px; margin-left: 30px; font-size: 12px; margin-top: 5px;">';
            output+='     <div class="'+ ((jsonContent[i].presence == PRESENCE_STATUS_ONLINE)?"green-dot-icon":"red-dot-icon");
            output+='" style="float: left; margin-top: -79px; margin-left: -20px;">.</div>' + ((jsonContent[i].presence == PRESENCE_STATUS_ONLINE)?"Available":"Offline") + '</div>';
            output+='<div style="overflow: hidden; position: absolute; height: 110px; top: 20px; line-height: 20px; left: 33%; width: 440px;">';
            output+='<div id="namediv" style="display:inline; overflow:hidden; max-height:20px;">';
            if(jsonContent[i].username != myuserid){
                if(login_user == null || login_user == ''  || !login_user){
                    output+='<h1 style="font-size: 12px;"><span class="action" style="color:#000;" onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div","'+escape(jsonContent[i].username)+'")>'+jsonContent[i].firstname+'</span></h1>';
                }
                else{
                    output+='<h1 style="font-size: 12px;"><span class="action" style="color:#000;" onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'")>'+jsonContent[i].firstname+'</span></h1>';
                }
            }
            else{
                output+='<h1 style="font-size: 12px;"><span class="action" onclick=showviewprofile("MyProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'")>'+jsonContent[i].firstname+'</span></h1>';
            }
            if(jsonContent[i].status == 'I am looking for..') {
                output+='<div id="statusdiv" style="overflow:hidden;display:inline;margin-left:5px;max-height: 20px; color: rgb(0, 64, 128);">';
                output+='</div></div>';
            }
            else {
                output+='<div id="statusdiv" style="overflow:hidden;display:inline;margin-left:5px;max-height: 20px; color: rgb(0, 64, 128);">';
                output+='( '+jsonContent[i].status+' )</div></div>';
            }
            if(jsonContent[i].summary) {
                output+='<div id="summarydiv" style="overflow: hidden; text-overflow: ellipsis; height: 20px;">';
                output+=jsonContent[i].summary + '</div>';
            }
            output+='<div id="star1div" style="max-height:20px;">';
            output+='<img alt="starsimage"  src="../static/images/'+Math.round(jsonContent[i].rating)+'rating.png"/>&nbsp;<span id="reviewsdiv">( <span class="action" onclick=showcommondiv("ViewAllReviews.do?username='+jsonContent[i].username+'&skillid=0","ConnectionPopUp","ConnectionPopUp")>';
            if(jsonContent[i].reviews){

                output+=jsonContent[i].reviews+' Reviews</span> )</span></div>';
            }
            else{
                output+='0 Reviews</span> )</span></div>';
            }

            output+='<div id="sendMsgDiv" style="color: rgb(31, 101, 152);">';
            output+='<table width="280"><tr>';
            if(jsonContent[i].username != myuserid){
                output+='<td><span class="action" onclick="openChatWindow(\'';
                output+= jsonContent[i].username;
                output+="','" + jsonContent[i].category;
                output+='\',\'' +jsonContent[i].firstname+ '\',\'';
                if(jsonContent[i].photo_thumbnail){
                    output+=localhost+jsonContent[i].photo_thumbnail;
                }
                else
                {
                    output+="../static/images/newUserImg.png";
                }
                //output+='\',\''+jsonContent[i].skypeid+'\',\''+jsonContent[i].position+'\',\''+jsonContent[i].company+'\')"><img alt="" border="0" src="../static/images/green-chat-icon.gif" /></span></td><td><span class="action" onclick="openChatWindow(\'';
                output+='\',\''+jsonContent[i].skypeid+'\',\''+jsonContent[i].position+'\',\''+jsonContent[i].company+'\')">';
                if(jsonContent[i].presence == PRESENCE_STATUS_ONLINE){
                    output+='<img alt="Chat" border="0" src="../static/images/green-chat-icon.gif" title="Chat" width="18px" />';
                }else{
                    output+='<img alt="" border="0" src="../static/images/gray-chat-icon.gif"  width="18px" />';
                }
                output+='</span></td><td><span class="action" onclick="openChatWindow(\'';

                output+= jsonContent[i].username;
                output+="','" + jsonContent[i].category;
                output+='\',\'' +jsonContent[i].firstname+ '\',\'';
                if(jsonContent[i].photo_thumbnail){
                    output+=localhost+jsonContent[i].photo_thumbnail;
                }
                else
                {
                    output+="../static/images/newUserImg.png";
                }
                output+="','" + jsonContent[i].skypeid;
                output+='\',\''+jsonContent[i].position+'\',\''+jsonContent[i].company+'\')">Chat</span></td><td width="20"></td>';
            }
            if(jsonContent[i].username != myuserid){
                output+='<td><span class="action" onclick=showComposeMsg("messages/popupcompose.jsp?replyto='+escape(jsonContent[i].username)+'&firstname='+escape(jsonContent[i].firstname)+'","common","compose",event)><img border="0" alt="" src="../static/images/msgimg.png"/></span></td><td><span class="action" onclick=showComposeMsg("messages/popupcompose.jsp?replyto='+escape(jsonContent[i].username)+'&firstname='+escape(jsonContent[i].firstname)+'","common","compose",event)>Send Message</span></td>';
                output+='<td onclick=showcommondiv("../jsp/ForwardContent.jsp?&isForward=true&flag=profile&profile_name='+escape(jsonContent[i].firstname) +'&profile_url='+host+contextRoot+'/jsp/Profile.do?id='+escape(jsonContent[i].username)+'&summary='+escape(jsonContent[i].summary)+'&actual_url='+host+contextRoot+'/jsp/Profile.do?id='+escape(jsonContent[i].username)+'&profile_id='+escape(jsonContent[i].username)+'","ConnectionPopUp","ConnectionPopUp")><img alt="Forward" src="../static/images/forwardIcon.png" title="Forward" id="forward" /><span class="action"> Forward</span> </td>';
            }
            output+='</tr></table>';
            output+='<div style="position:absolute;"><img alt="KB" border="0" src="../static/images/kb_icon.png" style="width: 15px; height: 19px;"/></div><div style="position:absolute; margin-left:20px;">';
            if(jsonContent[i].username != myuserid){
                if(login_user == null || login_user == ''  || !login_user){
                    output+='<span class="action" onclick=showResultAct("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div",0,"Content","profileparam","'+jsonContent[i].username+'")>View Knowledge Bucket</span></div>';
                }
                else{
                    output+='<span class="action" onclick=showResultAct("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div",0,"Content","profileparam","'+jsonContent[i].username+'")>View Knowledge Bucket</span></div>';
                }
            }
            else{
                output+='<span class="action" onclick=showResultAct("MyProfile.do?pagnum=0","middle_div",0,"Content","profileparam","'+jsonContent[i].username+'")>View Knowledge Bucket</span></div>';
            }

            if(jsonContent[i].username != myuserid && jsonContent[i].skypeid){
                output+='<div id="skypediv" ';
                output+='style="cursor: pointer; position: absolute; font-size: 12px; width: auto; height: 20px; z-index: 11; left: 40%; top: 58%;">';
                output+='<a href="skype:' +jsonContent[i].skypeid+'?call" border="0">  <img border="0"  alt="" src="../static/images/skype.png" /></a></div>';
            }
            if(jsonContent[i].username != myuserid){
                if(!checkInGroup(jsonContent[i].username)){
                    output+='<div id="Add_Txts" style="position: absolute; height: auto; z-index: 5; left: 92%; width: 20px; top: 68%;">';
                    output+='<span class="action"><img onclick=showcommondiv("connection/AddConnections.jsp?username='+jsonContent[i].username+'&tousername='+escape(jsonContent[i].firstname)+'&reqType=add","ConnectionPopUp","ConnectionPopUp") alt="" border="0" height="20" src="../static/images/add_con.png" width="20" /></span><br/><span class="action" onclick=showcommondiv("connection/AddConnections.jsp?username='+jsonContent[i].username+'&tousername='+escape(jsonContent[i].firstname)+'&reqType=add","ConnectionPopUp","ConnectionPopUp") style="font-size: 10px;">Add</span></div>';
                }
            }
            output+='</div>';
            output+='</div>';
            output+='  </td>';
            output+='   <td class="right_side_border">';
            output+='   </td>';
            output+=' </tr>';
            output+=' <tr>';
            output+='   <td class="corner_bottomleft">';
            output+='  </td>';
            output+='  <td class="bottom_side_border">';
            output+='  </td>';
            output+='  <td class="corner_bottomright">';
            output+='  </td>';
            output+='</tr>';
            output+='</table>';
            output+='</div>';
            if(!isAlphaRelease){
                if(hiddenUserid)
                {
                    output+='<div style="position: absolute; margin-top: 8px; left: 94%; z-index:-10; width: 74%; height: auto;">';
                    output+='<div style="position:absolute; width: 300px; top: 0px; left: 4px; height: 25px; background: url(../static/images/searchCatBoxBg.png) no-repeat; text-align:center;"><select style="width:253px; margin-top:2px; margin-left:10px; border:1px solid #2297C6;"><option>Java</option></select></div>';
                    output+=' <table id="corner_dialog_table" class="corner_dialog_table" style="width: 100%; height: auto; z-index:-10;">';
                    output+='  <tr>';
                    output+='    <td class="corner_topleft">';
                    output+='    </td>';
                    output+='    <td class="top_side_border">';
                    output+='    </td>';
                    output+='    <td class="corner_topright">';
                    output+='    </td>';
                    output+='  </tr>';
                    output+='  <tr>';
                    output+='    <td class="left_side_border">';
                    output+='    </td>';
                    output+='    <td id="corner_content" class="corner_content">';
                    output+='      <div style="width:100%; height:97px; overflow-y:scroll; margin-left:10px; margin-top:10px;">';
                    output+='<span style="color:#006060;">> Title of the associated contents here</span>';
                    //output+='        <span style="position: absolute; left: 8%; text-align: left; color: rgb(0, 96, 96); font-size: 12px; font-weight: bold; margin-top: -10px;">Java Tutorial</span><br/>';
                    //output+='        <div style="position: relative; text-align: justify; color: rgb(0, 96, 96); font-size: 10px; left: 3%; top: -10px;">Imran<a href="">more</a></div>';
                    //output+='        <div id="star1div" onclick=showcommondiv("Feedback.jsp?uid='+jsonContent[i].Username+'&name='+escape(jsonContent[i].Firstname)+'&skillid=0","common",event) style="cursor:pointer;position: absolute; width: auto; height: auto; z-index: 8; left: 7%; top: 70%">';
                    //output+='        <img alt="starsimage"  src="../static/images/'+jsonContent[i].rating+'rating.png"  /></div>';
                    //output+='        <div id="reviewdiv" onclick=showcommondiv("ViewAllReviews.do?username='+jsonContent[i].Username+'&skillid=0","common",event) style="cursor: pointer; position: absolute; width: auto; height: 14px; z-index: 9; left: 32%; top: 72%;">';
                    //output+='        ( <span style="text-decoration:underline;">'+jsonContent[i].reviews+' Reviews&nbsp;</span> )</div>';

                    //            output+='<div style="position: relative; text-align: justify; color: rgb(0, 96, 96); font-size: 25px; left: 3%; top: -8px;"><b><a href="">ASP</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 15px; left: 35%; top: -35px;"><b><a href="">C</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 20px; left: 45%; top: -60px;"><b><a href="">C++</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 30px; left: 63%; top: -90px;"><b><a href="">DBase</a></b></div>';
                    //
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 35px; left: 3%; top: -110px;"><b><a href="">Java</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 10px; left: 33%; top: -132px;"><b><a href="">JSF</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 20px; left: 44%; top: -160px;"><b><a href="">JSP</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 20px; left: 59%; top: -185px;"><b><a href="">.NET</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 15px; left: 80%; top: -207px;"><b><a href="">Network</a></b></div>';
                    //
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 15px; left: 3%; top: -200px;"><b><a href="">Oracle</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 30px; left: 25%; top: -235px;"><b><a href="">Swings</a></b></div>';
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(96, 0, 96); font-size: 25px; left: 67%; top: -260px;"><b><a href="">Virus</a></b></div>';
                    //
                    //            output+='<div style="position: relative; text-align: justify; color: rgb(0, 96, 96); font-size: 13px; left: 30%; top: -370px;"><b>Associated Content</b></div>';

                    output+='      </div>';
                    output+='   </td>';
                    output+='   <td class="right_side_border">';
                    output+='   </td>';
                    output+=' </tr>';
                    output+=' <tr>';
                    output+='   <td class="corner_bottomleft">';
                    output+='   </td>';
                    output+='   <td class="bottom_side_border">';
                    output+='   </td>';
                    output+='   <td class="corner_bottomright">';
                    output+='   </td>';
                    output+=' </tr>';
                    output+='</table>';
                    output+='</div>';

                }
                if(hiddenUserid)
                {
                    output+='</div>';
                    output+='</div>';

                }
                else{
                    //output+='</div>';
                    output+='</div>';
                }
            }
            else{
                output+='</div>';
                output+='</div>';
            }
        }
    }else{
        output += '<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 100%; z-index: 10">';
        output += '<tr>';
        output += '<td class="corner_topleft"></td>';
        output += '<td class="top_side_border"></td>';
        output += '<td class="corner_topright"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="left_side_border"></td>';
        output += '<td id="corner_content_" class="corner_content">';
        output += "<b>No Expert found with this "+token+" name </b> <div style='float:right;'><span class='action' onclick='reloadHomePage()'><b>Go Back To New Search >></b></span></div>";
        output += '</td>';
        output += '<td class="right_side_border"></td>';
        output += '</tr>';
        output += '<tr>';
        output += '<td class="corner_bottomleft"></td>';
        output += '<td class="bottom_side_border"></td>';
        output += '<td class="corner_bottomright"></td>';
        output += '</tr>';
        output += '</table>';
    }
    if(pid == 'middle_div' || pid == 'narrowed_result_center')
        output +='</div>';
    lastpage = totalpages - 1;

    if(totalpages > 1 && (pid == 'middle_div' || pid == 'narrowed_result_center'))
    {
        output+='<div id="ExpertSearchPages">';
        output+='<table align=right id="ExpertPagination" style="margin-right:2%">';
        output+='<tr>';
        output+='<td width="30">Page</td>';
        output+='<td width="15">';
        output+='1';
        output+='</td>';
        output+='<td width="15">of</td>';
        output+='<td width="20">';
        output+=totalpages;
        output+='</td>';
        output+='<td width="30">';
        //mypage++;
        if(pid == 'narrowed_result_center')
        {
            output+='<span class="action" onclick=setNextlinks("EzdiaSearch.do","ExpertRefined",1,'+totalpages+') >Next</span>';
        }
        else
            output+='<span class="action" onclick=setNextlinks("EzdiaSearch.do","Expert",1,'+totalpages+') >Next</span>';
        output+='</td>';
        output+='<td width="30">';
        if(pid == 'narrowed_result_center')
            output+='<span class="action" onclick=setNextlinks("EzdiaSearch.do","ExpertRefined",'+lastpage+','+totalpages+')>Last</span>';
        else
            output+='<span class="action" onclick=setNextlinks("EzdiaSearch.do","Expert",'+lastpage+','+totalpages+')>Last</span>';
        output+='</td></tr>';
        output+=' </table>';
        output+='</div>';
    }

    return output;
}
var viewNewAreacount;
function getTabData(jsonContent){
    var output='';
    output+='<div id="mainBrowseCatDiv">';
    output+='<div id="selectedCritera" style="display:none; float:left; padding-bottom:7px;">';
    output+='<table align="left" class="corner_dialog_table" style="width: 219px;">';
    output+='<tr>';
    output+='<td class="corner_topleft">';
    output+='</td>';
    output+='<td class="top_side_border">';
    output+='</td>';
    output+='<td class="corner_topright">';
    output+='</td>';
    output+='</tr>';
    output+='<tr>';
    output+='<td class="left_side_border">';
    output+='</td>';
    output+='<td id="corner_content" class="corner_content">';
    output+='<div style="border-bottom:1px solid #CCC; font-size: 12px; font-weight:bold; text-align: center; color:#990000;">Selected Criteria</div>';
    output+='<div id="search_result_header" style="position:relative; width:100%; height:71px; font-size:10px; color:#000000; font-weight:bold;">';
    output+='</div>';
    //output+='<div align="right" style="text-align:right; font-size:12px;">Drill Down</div>';
    output+='</td>';
    output+='<td class="right_side_border">';
    output+='</td>';
    output+='</tr>';
    output+='<tr>';
    output+='<td class="corner_bottomleft">';
    output+='</td>';
    output+='<td class="bottom_side_border">';
    output+='</td>';
    output+='<td class="corner_bottomright">';
    output+='</td>';
    output+='</tr>';
    output+='</table>';
    output+='</div>';

    output+='<div id="browseCategory">';
    output+='<table align="left" class="corner_dialog_table" style="width: 219px;">';
    output+='<tr>';
    output+='<td class="corner_topleft">';
    output+='</td>';
    output+='<td class="top_side_border">';
    output+='</td>';
    output+='<td class="corner_topright">';
    output+='</td>';
    output+='</tr>';
    output+='<tr>';
    output+='<td class="left_side_border">';
    output+='</td>';
    output+='<td id="corner_content" class="corner_content">';
    output+='<div style="position:relative; width:100%; min-height:120px; height:auto;">';
    output+='<div style="border-bottom:1px solid #CCC; font-size: 12px; font-weight:bold; text-align: center; color:#990000;">Browse by category</div>';
    output+='<div style="position:relative; width: 200px; height: auto; z-index: 1; left: -2%; top: 5px;">';
    var narrowResults = jsonContent[jsonContent.length - 1].narrowResults;
    var nAreaCount=0;
    var areaCounts = narrowResults["areaCounts"];
    viewNewAreacount = areaCounts;
    var categoryCounts = narrowResults["categoryCounts"];
    for(var workarea in areaCounts)
    {
        if (!areaCounts.hasOwnProperty(workarea)) continue;
        output+='<div id="area_'+nAreaCount+'" class="drag_cmn" onclick=narrowExpertSearchByCategory("' + escape(workarea) + '","'+escape(areaCounts)+'",1)>'+workarea+'('+categoryCounts[workarea]+')</div>';
        output+='<span style="margin:0; margin-left:3px; margin-right:3px;">';
        output+='<span id="'+escape(workarea)+'"></span>';
        output+='</span>';
        nAreaCount++;
    }
    output+='</div>';
    output+='</div>';
    output+='</td>';
    output+='<td class="right_side_border">';
    output+='</td>';
    output+='</tr>';
    output+='<tr>';
    output+='<td class="corner_bottomleft">';
    output+='</td>';
    output+='<td class="bottom_side_border">';
    output+='</td>';
    output+='<td class="corner_bottomright">';
    output+='</td>';
    output+='</tr>';
    output+='</table>';
    output+='</div>';
    //output+='</div>';
    if(!isAlphaRelease) {
        if(searchFilters.searchType=="Expert")
        {
            output+='<div id="narrowByFee" style="position: relative; width: 220px; z-index: 2; left: 8px; height: auto; margin-top: 10px; min-height: 100px;">';
            output+='<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 100%; z-index: 10">';
            output+='<tr>';
            output+='<td class="corner_topleft">';
            output+='</td>';
            output+='<td class="top_side_border">';
            output+='</td>';
            output+='<td class="corner_topright">';
            output+='</td>';
            output+='</tr>';
            output+='<tr>';
            output+='<td class="left_side_border">';
            output+='</td>';
            output+='<td id="corner_content" class="corner_content">';
            output+='<div style="position:relative; width:100%;">';
            output+='<div style="border-bottom:1px solid #CCC; font-size: 12px; font-weight:bold; text-align: center; color:#990000;">Narrow by fee/min</div>';
            output+='<div style="position:relative; width: 200px; min-height:50px; height: auto; z-index: 1; left: -15%; top: 0px;">';
            output+='<ul style="list-style-type:none; display:block; font-size:10px; font-weight:bold;">';
            var j;
            for(j=0;j<fpmArray.length;j++){
                if(narrowResults[fpmArray[j]] == undefined){
                    narrowResults[fpmArray[j]]=0;
                }
                output+='<li id='+fpmArray[j]+'><span class="action" style="color:black; text-align: left" onclick=filterByRPM("'+fpmArray[j]+'")>-&nbsp;'+fpmArrayValues[j]+' :: '+narrowResults[fpmArray[j]]+'</span></li>';
            //alert(fpmArray[j]+" :: "+narrowResults[fpmArray[j]]);
            }
            output+='</ul>';
            output+='</div>';
            output+='</div>';
            output+='</td>';
            output+='<td class="right_side_border">';
            output+='</td>';
            output+='</tr>';
            output+='<tr>';
            output+='<td class="corner_bottomleft">';
            output+='</td>';
            output+='<td class="bottom_side_border">';
            output+='</td>';
            output+='<td class="corner_bottomright">';
            output+='</td>';
            output+='</tr>';
            output+='</table>';
            output+='</div>';
        }
        output+='<div id="narrowByRating" style="position: relative; width: 220px; margin-top:10px; z-index: 2; left: 8px; height: auto; min-height: 120px;">';
        output+='<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 100%; z-index: 10">';
        output+='<tr>';
        output+='<td class="corner_topleft">';
        output+='</td>';
        output+='<td class="top_side_border">';
        output+='</td>';
        output+='<td class="corner_topright">';
        output+='</td>';
        output+='</tr>';
        output+='<tr>';
        output+='<td class="left_side_border">';
        output+='</td>';
        output+='<td id="corner_content" class="corner_content">';
        output+='<div style="position:relative; width:100%;">';
        output+='<div style="border-bottom:1px solid #CCC; font-size: 12px; font-weight:bold; text-align: center; color:#990000;">Narrow by rating</div>';
        output+='<div style="position:relative; width: 200px; min-heigh:50px; height: auto; z-index: 1; left: -15%; top: 0px;">';
        output+='<ul style="list-style-type:none; display:block; font-size:10px; font-weight:bold;">';
        for(j=0;j<ratingArray.length;j++){
            if(narrowResults[ratingArray[j]] == undefined){
                narrowResults[ratingArray[j]]=0;
            }
            output+=' <li id='+ratingArray[j]+'><span class="action" style="color:black; text-align: left;" onclick=filterByRating("'+ratingArray[j]+'")>-&nbsp;'+ratingArrayValues[j]+' :: '+narrowResults[ratingArray[j]]+'</span></li>';
        // alert(ratingArray[j]+" :: "+narrowResults[ratingArray[j]]);
        }
        output+='</ul>';
        output+='</div>';
        output+='</div>';
        output+='</td>';
        output+='<td class="right_side_border">';
        output+='</td>';
        output+='</tr>';
        output+='<tr>';
        output+='<td class="corner_bottomleft">';
        output+='</td>';
        output+='<td class="bottom_side_border">';
        output+='</td>';
        output+='<td class="corner_bottomright">';
        output+='</td>';
        output+='</tr>';
        output+='</table>';
        output+='</div>';
    }
    output+='</div>';
    if(search != myuserid){
        output+='<div style="height: auto; float: left; width: 675px; margin-top: 20px;">';
        output+='<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 100%; z-index: 10">';
        output+='<tr>';
        output+='<td class="corner_topleft">';
        output+='</td>';
        output+='<td class="top_side_border">';
        output+='</td>';
        output+='<td class="corner_topright">';
        output+='</td>';
        output+='</tr>';
        output+='<tr>';
        output+='<td class="left_side_border">';
        output+='</td>';
        output+='<td id="corner_content" class="corner_content">';
        if(ezdiaSearch == 0){
            output+='<div style="padding:5px; text-align:left; font-weight:bold; color:#990000;">No Content posted for <span style="color:#048;font-size:16px;">'+unescape(token)+'</span> Following are top search results from Google';
        }
        else{
            output+='<div style="padding:5px; text-align:left; font-weight:bold; color:#990000;">Results for <span style="color:#048;font-size:16px;">'+unescape(token)+'</span>';
            if(jsonContent[jsonContent.length - 1].bNoResults)
            {
                output += '&nbsp;&nbsp;<span>There were <b style="font-size:12px; color:red;">NO Results</b> found for the search. Below are the ' + ((searchFilters.searchType == "Expert")?"experts":"contents") + ' other users are looking for.</span>';
                searchFilters.mainSearchPattern = 'search=';
            }
        }
        output += '</div>';

        if(!isAlphaRelease) {
            output+='<div style="color:#048; position: absolute; right: 120px; top: 18px;">Sort By :</div><div style="position: absolute; right: 15px; top: 15px;"><select style="width:100px; color:#999"><option value="Name">Name</option><option value="Category">Category</option></select></div>';
        }
        output+='</td>';
        output+='<td class="right_side_border">';
        output+='</td>';
        output+='</tr>';
        output+='<tr>';
        output+='<td class="corner_bottomleft">';
        output+='</td>';
        output+='<td class="bottom_side_border">';
        output+='</td>';
        output+='<td class="corner_bottomright">';
        output+='</td>';
        output+='</tr>';
        output+='</table>';
        output+='</div>';
    }

    // Div containing the filtered results
    if(search != myuserid){
        output+='<div id="innerSearchResultDiv">';
    }
    else{
        output+='<div id="getMargin" style="height: auto; float: left; margin-top: 20px; width: 675px;">';
    }
    output+='<div id="narrowed_result_center">';
    if(searchFilters.searchType == "Expert")
    {
        output+= writeSearchItems(jsonContent,totalpages);
    }
    else
    {
        output += writeSearchContent(jsonContent,totalpages);

    }
    output+='</div>';
    output+='</div>';

    return output;
}

//function callbackAssociatedContent(){
//    //document.getElementById('middle_div').innerHTML = '';
//    var output = '';
//
//    if (req.readyState==4){
//        if (req.status == 200){
//            var result = req.responseText;
//            if(result.indexOf("No Result Found")!=-1 ){
//                output+="No Result for your search "+search;
//            }
//            else{
//                //alert(result);
//                var jsonContent= eval('('+result+')');
//
//                output += writeSearchContent(jsonContent);
//            }
//
//
//            document.getElementById('narrowed_result_center').innerHTML=output;
//            var TabbedPanels1 = new Spry.Widget.TabbedPanels('TabbedPanels1',tabindexer);
//        }else{
//    //@todo
//    }
//    }
//    else{
////        document.getElementById('output').innerHTML=sHTMLSearchAnim.replace("###", "");
////        showDetails('output');
//}
//}
function getNextTabDataExpert(jsonContent){
    var output = '';
    for (i = 0 ; i<jsonContent.length-1 ; i++){

        if(hiddenUserid)
        {
            output+='<div style="position: relative; width: 100%; height: auto; padding-top: 0px; z-index: 1; margin-bottom: 10px;top:0px;">';
            output+='    <div style="position: relative; width: 100%; height: 140px; z-index: 10; left: auto; margin-top: 0px; padding-left: 0px;">';
        }
        else{
            output+='<div style="position: relative; width: 100%; height: auto; padding-top: 0px; z-index: 1; margin-bottom: 10px;top:0px;">';
            output+='    <div style="position: relative; width: 100%; height: 140px; z-index: 10; left: auto; margin-top: 0px; padding-left: 0px;">';
        }
        output+='<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 100%; height: 145px; z-index:100;">';
        output+='   <tr>';
        output+='   <td class="corner_topleft">';
        output+='   </td>';
        output+='   <td class="top_side_border">';
        output+='  </td>';
        output+='  <td class="corner_topright">';
        output+=' </td>';
        output+=' </tr>';
        output+='<tr>';
        output+='  <td class="left_side_border">';
        output+='  </td>';
        output+='  <td id="corner_content" class="corner_content">';
        output+='    <div style="width:100%; height:120px;">';
        if(jsonContent[i].username != myuserid){
            output+='      <div id="userdiv" style="padding-right: 10px; padding-left: 10px; padding-top: 4px; width: 86px; z-index: 1;">';
            if(jsonContent[i].photo_thumbnail){
                if(login_user == null || login_user == ''  || !login_user){
                    output+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; cursor:pointer;" alt="uimg" src='+localhost+jsonContent[i].photo_thumbnail+' height="96" />';
                }
                else{
                    output+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; cursor:pointer;" alt="uimg" src='+localhost+jsonContent[i].photo_thumbnail+' height="96" />';
                }
            }
            else{
                if(login_user == null || login_user == ''  || !login_user){
                    output+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; margin-top:10px; cursor:pointer;" alt="uimg" src="../static/images/newUserImg.png"/>';
                }
                else{
                    output+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; cursor:pointer;" alt="uimg" src='+localhost+jsonContent[i].photo_thumbnail+' height="96" />';
                }
            }
            output+='</div>';
        }
        else{
            output+='<div id="userdiv" style="padding-right: 10px; cursor: pointer; padding-left: 10px; padding-top: 4px; width: 86px; z-index: 1;">';
            if(jsonContent[i].photo_thumbnail){
                output+='      <img onclick=showviewprofile("MyProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; cursor:pointer;" alt="uimg" src='+localhost+jsonContent[i].photo_thumbnail+' height="96" />';
            }
            else{
                output+='      <img onclick=showviewprofile("MyProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") style="border: 0px; margin-top:10px; cursor:pointer;" alt="uimg" src="../static/images/newUserImg.png"/>';
            }
            output+='</div>';
        }
        output+='     <div id="available" style="width: 80px; margin-left: 30px; font-size: 12px; margin-top: 5px;">';
        output+='     <div class="'+ ((jsonContent[i].presence == PRESENCE_STATUS_ONLINE)?"green-dot-icon":"red-dot-icon");
        output+='" style="float: left; margin-top: -79px; margin-left: -20px;">.</div>' + ((jsonContent[i].presence == PRESENCE_STATUS_ONLINE)?"Available":"Offline") + '</div>';
        output+='<div style="overflow: hidden; position: absolute; height: 110px; top: 20px; line-height: 20px; left: 33%; width: 440px;">';
        output+='<div id="namediv" style="overflow:hidden; max-height:20px;display:inline;">';
        if(jsonContent[i].username != myuserid){
            if(login_user == null || login_user == ''  || !login_user){
                output+='<h1 style="font-size: 12px;"><span class="action" style="color:#000;" onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div","'+escape(jsonContent[i].username)+'")>'+jsonContent[i].firstname+'</span></h1>';
            }
            else{
                output+='<h1 style="font-size: 12px;"><span class="action" style="color:#000;" onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'")>'+jsonContent[i].firstname+'</span></h1>';
            }
        }
        else{
            output+='<h1 style="font-size: 12px;"><span class="action" onclick=showviewprofile("MyProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'")>'+jsonContent[i].firstname+'</span></h1>';
        }
        if(jsonContent[i].status == 'I am looking for..') {
            output+='<div id="statusdiv" style="overflow:hidden;display:inline;margin-left:5px;max-height: 20px; color: rgb(0, 64, 128);">';
            output+='</div></div>';
        }
        else{
            output+='<div id="statusdiv" style="overflow:hidden;display:inline;margin-left:5px;max-height: 20px; color: rgb(0, 64, 128);">';
            output+='( '+jsonContent[i].status+' )</div></div>';
        }
        if(jsonContent[i].summary) {
            output+='<div id="summarydiv" style="overflow: hidden; text-overflow: ellipsis; height: 20px;">';
            output+=jsonContent[i].summary + '</div>';
        }
        output+='<div id="star1div" style="max-height:20px;">';
        output+='<img alt="starsimage"  src="../static/images/'+Math.round(jsonContent[i].rating)+'rating.png"/>&nbsp;<span id="reviewsdiv">( <span class="action" onclick=showcommondiv("ViewAllReviews.do?username='+jsonContent[i].username+'&skillid=0","ConnectionPopUp","ConnectionPopUp")>';
        if(jsonContent[i].reviews){
            output+=jsonContent[i].reviews+' Reviews</span> )</span></div>';
        }
        else{
            output+='0 Reviews</span> )</span></div>';
        }

        output+='<div id="sendMsgDiv" style="color: rgb(31, 101, 152);">';
        output+='<table width="280"><tr>';
        if(jsonContent[i].username != myuserid){
            output+='<td><span class="action" onclick="openChatWindow(\'';
            output+= jsonContent[i].username;
            output+="','" + jsonContent[i].category;
            output+='\',\'' +jsonContent[i].firstname+ '\',\'';
            if(jsonContent[i].photo_thumbnail){
                output+=localhost+jsonContent[i].photo_thumbnail;
            }
            else
            {
                output+="../static/images/newUserImg.png";
            }
            //output+='\',\''+jsonContent[i].skypeid+'\',\''+jsonContent[i].position+'\',\''+jsonContent[i].company+'\')"><img alt="" border="0" src="../static/images/green-chat-icon.gif" /></span></td><td><span class="action" onclick="openChatWindow(\'';
            output+='\',\''+jsonContent[i].skypeid+'\',\''+jsonContent[i].position+'\',\''+jsonContent[i].company+'\')">';
            if(jsonContent[i].presence == PRESENCE_STATUS_ONLINE){
                output+='<img alt="Chat" border="0" src="../static/images/green-chat-icon.gif" title="Chat" width="18px" />';
            }else{
                output+='<img alt="" border="0" src="../static/images/gray-chat-icon.gif"  width="18px" />';
            }
            output+='</span></td><td><span class="action" onclick="openChatWindow(\'';

            output+= jsonContent[i].username;
            output+="','" + jsonContent[i].category;
            output+='\',\'' +jsonContent[i].firstname+ '\',\'';
            if(jsonContent[i].photo_thumbnail){
                output+=localhost+jsonContent[i].photo_thumbnail;
            }
            else
            {
                output+="../static/images/newUserImg.png";
            }
            output+="','" + jsonContent[i].skypeid;
            output+='\',\''+jsonContent[i].position+'\',\''+jsonContent[i].company+'\')">Chat</span></td><td width="20"></td>';
        }
        if(jsonContent[i].username != myuserid){
            output+='<td><span class="action" onclick=showComposeMsg("messages/popupcompose.jsp?replyto='+escape(jsonContent[i].username)+'&firstname='+escape(jsonContent[i].firstname)+'","common","compose",event)><img border="0" alt="" src="../static/images/msgimg.png"/></span></td><td><span class="action" onclick=showComposeMsg("messages/popupcompose.jsp?replyto='+escape(jsonContent[i].username)+'&firstname='+escape(jsonContent[i].firstname)+'","common","compose",event)>Send Message</span></td>';
            output+='<td onclick=showcommondiv("../jsp/ForwardContent.jsp?&isForward=true&flag=profile&profile_name='+escape(jsonContent[i].firstname) +'&profile_url='+host+contextRoot+'/jsp/Profile.do?id='+escape(jsonContent[i].username)+'&summary='+escape(jsonContent[i].summary)+'&actual_url='+host+contextRoot+'/jsp/Profile.do?id='+escape(jsonContent[i].username)+'&profile_id='+escape(jsonContent[i].username)+'","ConnectionPopUp","ConnectionPopUp")><img alt="Forward" src="../static/images/forwardIcon.png" title="Forward" id="forward" /><span class="action"> Forward</span> </td>';
        }
        output+='</tr></table>';
        output+='<div style="position:absolute;"><img alt="KB" border="0" src="../static/images/kb_icon.png" style="width: 15px; height: 19px;"/></div><div style="position:absolute; margin-left:20px;">';
        if(jsonContent[i].username != myuserid){
            if(login_user == null || login_user == ''  || !login_user){
                output+='<span class="action" onclick=showResultAct("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div",0,"Content","profileparam","'+jsonContent[i].username+'")>View Knowledge Bucket</span></div>';
            }
            else{
                output+='<span class="action" onclick=showResultAct("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div",0,"Content","profileparam","'+jsonContent[i].username+'")>View Knowledge Bucket</span></div>';
            }
        }
        else{
            output+='<span class="action" onclick=showResultAct("MyProfile.do?pagnum=0","middle_div",0,"Content","profileparam","'+jsonContent[i].username+'")>View Knowledge Bucket</span></div>';
        }

        if(jsonContent[i].username != myuserid && jsonContent[i].skypeid){
            output+='<div id="skypediv" ';
            output+='style="cursor: pointer; position: absolute; font-size: 12px; width: auto; height: 20px; z-index: 11; left: 40%; top: 58%;">';
            output+='<a href="skype:' +jsonContent[i].skypeid+'?call" border="0">  <img border="0"  alt="" src="../static/images/skype.png" /></a></div>';
        }
        if(jsonContent[i].username != myuserid){
            if(!checkInGroup(jsonContent[i].username)){
                output+='<div id="Add_Txts" style="position: absolute; height: auto; z-index: 5; left: 92%; width: 20px; top: 68%;">';
                output+='<span class="action"><img onclick=showcommondiv("connection/AddConnections.jsp?username='+jsonContent[i].username+'&tousername='+escape(jsonContent[i].firstname)+'&reqType=add","ConnectionPopUp","ConnectionPopUp") alt="" border="0" height="20" src="../static/images/add_con.png" width="20" /></span><br/><span class="action" onclick=showcommondiv("connection/AddConnections.jsp?username='+jsonContent[i].username+'&tousername='+escape(jsonContent[i].firstname)+'&reqType=add","ConnectionPopUp","ConnectionPopUp") style="font-size: 10px;">Add</span></div>';
            }
        }
        output+='</div>';
        output+='</div>';
        output+=' </td>';
        output+=' <td class="right_side_border">';
        output+=' </td>';
        output+=' </tr>';
        output+=' <tr>';
        output+='  <td class="corner_bottomleft">';
        output+='  </td>';
        output+='  <td class="bottom_side_border">';
        output+='  </td>';
        output+='  <td class="corner_bottomright">';
        output+='  </td>';
        output+='</tr>';
        output+='</table>';
        if(!isAlphaRelease ) {
            if(hiddenUserid)
            {
                output+='<div style="position: absolute; margin-top: 8px; left: 94%; z-index:-10; width: 74%; height: auto;">';
                output+='<div style="position:absolute; width: 300px; top: 0px; left: 4px; height: 25px; background: url(../static/images/searchCatBoxBg.png) no-repeat; text-align:center;"><select style="width:253px; margin-top:2px; margin-left:10px; border:1px solid #2297C6;"><option>Java</option></select></div>';
                output+=' <table id="corner_dialog_table" class="corner_dialog_table" style="width: 100%; height: auto; z-index:-10;">';
                output+='  <tr>';
                output+='    <td class="corner_topleft">';
                output+='    </td>';
                output+='    <td class="top_side_border">';
                output+='    </td>';
                output+='    <td class="corner_topright">';
                output+='    </td>';
                output+='  </tr>';
                output+='  <tr>';
                output+='    <td class="left_side_border">';
                output+='    </td>';
                output+='    <td id="corner_content" class="corner_content">';
                output+='      <div style="width:100%; height:95px; overflow-y:scroll; margin-left:10px; margin-top:10px;">';
                output+='<span style="color:#006060;">> Title of the associated contents here</span>';
                output+='      </div>';
                output+='   </td>';
                output+='   <td class="right_side_border">';
                output+='   </td>';
                output+=' </tr>';
                output+=' <tr>';
                output+='   <td class="corner_bottomleft">';
                output+='   </td>';
                output+='   <td class="bottom_side_border">';
                output+='   </td>';
                output+='   <td class="corner_bottomright">';
                output+='   </td>';
                output+=' </tr>';
                output+='</table>';
                output+='</div>';

            }
            if(hiddenUserid)
            {
                output+='</div>';
                output+='</div>';

            }
            else{
                output+='</div>';
                output+='</div>';

            }

        }
        else{
            output+='</div>';
            output+='</div>';
        }
    }

    output += '</div>';
    return output;
}
function getNextTabData(jsonContent){
    var output = '';
    for (i = 0 ; i<jsonContent.length-1 ; i++){
        contentName[i] = jsonContent[i].content_name;
        output += '<div style="position: relative; width: 100%; height: auto;">';
        output += '<div id="kb_mainDiv" style="position: relative; width: 640px; margin-top:10px; height: 90px; border-bottom:2px solid #DAEFFE; z-index: 1; left: 0px; top: 0px">';
        output += '<div id="i_know_learn_it" onclick=showLearnItInPopUp('+jsonContent[i].id +',"' + escape(jsonContent[i].content_name) + '","' + escape(jsonContent[i].category_name!=null?jsonContent[i].category_name:"") + '"); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 50px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
        output += '<table align="center" cellpadding="0"  cellspacing="0" class="i-want-txts" style="text-align:center; margin-top:5px;"><tr><td>I need help</td></tr>';
        output += '<tr><td>('+(jsonContent[i].explorer_users?jsonContent[i].explorer_users.length:0)+')</td></tr></table>';
        output += '</div>';
        output += '<div id="i_know_it" onclick=showKnowItInPopUp('+jsonContent[i].id +',"' + escape(jsonContent[i].content_name) + '","' + escape(jsonContent[i].category_name!=null?jsonContent[i].category_name:"") + '"); style="position: absolute; width: 75px; height: 33px; z-index: 1; left: 0px; top: 10px; background-image: url(../static/images/BlueBox.png); background-repeat:no-repeat">';
        output += '<table align="center" cellpadding="0"  cellspacing="0" class="i-know-txts" style="text-align:center;"><tr><td>I know it</td></tr>';
        output += '<tr><td>('+(jsonContent[i].expert_users?jsonContent[i].expert_users.length:0)+')</td></tr></table>';
        output += '</div>';
        //alert(jsonContent[i].content_url+"::"+jsonContent[i].firstname);
        output += '<div id="userTinyIco" style="position: absolute; width: 18px; height: 21px; z-index: 1; left: 85px; top: 0px">';
        output += '<img alt="" height="21" src="../static/images/userimg2.png" width="18" /></div>';
        output += '<div id="topBrieftxts" onclick=showContentInPopUp("ConnectionPopUp","'+escape(jsonContent[i].content_name) +'","'+ escape(isAURL(escape(jsonContent[i].related_url))?jsonContent[i].related_url:jsonContent[i].content_url)+'","'+ escape(jsonContent[i].content_type)+'",'+jsonContent[i].id+',"'+ escape(jsonContent[i].content_name)+'","'+ escape(jsonContent[i].category_name!=null?jsonContent[i].category_name:"")+'","'+(jsonContent[i].expert_users?jsonContent[i].expert_users.length:0)+'","'+(jsonContent[i].explorer_users?jsonContent[i].explorer_users.length:0)+'","'+jsonContent[i].expert_users+'","'+jsonContent[i].explorer_users+'","'+escape(jsonContent[i].keyword)+'","'+escape(jsonContent[i].description)+'") style="position: absolute; width: 525px; height: 16px; z-index: 2; left: 115px; top: 0px; font-size: 12px; color: #048; font-weight: bold;">';
        output += '<div style="max-height:15px; max-width:600px; cursor:pointer; overflow:hidden;">'+jsonContent[i].content_name.substring(0,50) +'...</div></div>';
        output += '<div id="userDetailBrief" style="position: absolute; width: 500px; height: 18px; z-index: 3; left: 90px; top: 21px">';
        output += '<span id="UserCat" style="position: absolute; width: auto; height: 16px; z-index: 2; left: 0px; top: 1px; font-size: 12px; color: #666; overflow: hidden;">';
        output += getDomain(jsonContent[i].content_url)+'</div>';
        output += '</span>';
        output += '<div id="textBriefDescrip" style="position: absolute; width: 450px; height: 16px; z-index: 4; left: 90px; top: 40px; ">';
        if(jsonContent[i].description){
            output += '<div style="position: absolute; width: 450px; height: 15px; overflow:hidden;font-size:12px">'+jsonContent[i].description.substring(0,150)+'...</div>';
        }
        else{
            output += '<div style="position: absolute; width: 450px; height: 15px; overflow:hidden;font-size:12px">No Description present for this Content...</div>';
        }
        output += '<div id="forwardDiv" style="position: absolute; width: 65px; height: 15px; z-index: 10; left: 5px; top: 25px;cursor: pointer;" onclick=showcommondiv("../jsp/ForwardContent.jsp?&isForward=true&flag=content&content_name='+escape(jsonContent[i].content_name) +'&content_url='+host+contextRoot+"/jsp/Content.do?id="+jsonContent[i].id+'&content_type='+escape(jsonContent[i].content_type)+'&id='+escape(jsonContent[i].id)+'&category_name='+escape(jsonContent[i].category_name)+'&expert_users='+escape(jsonContent[i].expert_users?jsonContent[i].expert_users.length:0)+'&explorer_users='+escape(jsonContent[i].explorer_users?jsonContent[i].explorer_users.length:0)+'&expert_users_id='+escape(jsonContent[i].expert_users)+'&actual_url='+escape(jsonContent[i].content_url)+'","ConnectionPopUp","ConnectionPopUp");><img alt="Forward" src="../static/images/forwardIcon.png" title="Forward" /><span class="action"> Forward</span> </div>';
        output += '</div>';
        output += '<div id="actionsDiv" style="position: absolute; width: 510px; height: 20px; z-index: 2; left: 90px; top: 58px">';
        output += '<span style="display:none; color:#900;font-weight:bold; font-size:21px;">****<span style="display:none; font-size:21px;font-weight:bold;color:gray">*</span>';
        output += '</span>';
        output += '<div id="TinyIcon" style="position: absolute; width: 17px; height: 25px; z-index: 1; left: 75px; top: 0px">';
        output += '<img alt="" src="../static/images/tinylogo.png" /></div>';
        output += '<div id="riviewsDiv" style="display:none; position: absolute; width: 60px; height: 18px; z-index: 2; left: 70px; top: 3px">';
        output += '<span>7</span> Reviews</div>';

        if(jsonContent[i].expert_users){
            output += '<div style="position: absolute; z-index: 1; left: 455px; top: -15px;" id="NoOfExpertIcon">';
            output += '<img height="21" width="18" src="../static/images/userimg2.png" alt="Get experts"/> </div>';
            output += '<div style="position: absolute; width: 120px; z-index: 1; left: 481px; top: -15px;" id="NoOfExpertIcon">';
            output += '<span class="action" onclick=getExpertsById("EzdiaSearch.do","' +jsonContent[i].expert_users+'","Expert","middle_div")>Get Experts</span></div>';
        }
        else{
            output += '<div style="position: absolute; z-index: 1; left: 455px; top: -15px;" id="NoOfExpertIcon">';
            output += '<img height="21" width="18" src="../static/images/userimg2.png" alt="Get experts"/> </div>';
            output += '<div style="position: absolute; width: 120px; z-index: 1; left: 481px; top: -15px;" id="NoOfExpertIcon">';
            output += '<span style="color:gray">Get Experts</span></div>';
        }
        if(jsonContent[i].explorer_users){
            output += '<div style="position: absolute; z-index: 1; left: 455px; top: 5px;" id="NoOfExpertIcon">';
            output += '<img src="../static/images/Explorer.png" alt="Get explorers"/> </div>';
            output += '<div style="position: absolute; width: 130px; z-index: 1; left: 481px; top: 8px;" id="NoOfExpertIcon">';
            output += '<span class="action" onclick=getExpertsById("EzdiaSearch.do","' +jsonContent[i].explorer_users+'","Expert","middle_div")>Get Explorers</span></div>';
        }
        else{
            output += '<div style="position: absolute; z-index: 1; left: 455px; top: 5px;" id="NoOfExpertIcon">';
            output += '<img src="../static/images/Explorer.png" alt="Get explorers"/> </div>';
            output += '<div style="position: absolute; width: 130px; z-index: 1; left: 481px; top: 8px;" id="NoOfExpertIcon">';
            output += '<span style="color:gray">Get Explorers</span></div>';
        }
        //        output += '<div id="ChatIcon" style="position: absolute; width: 17px; height: 15px; z-index: 1; left: 66px; top: 4px">';
        //        output += '<img alt="" src="../static/images/green-chat-icon.gif" /></div>';
        output += '<div id="catslists" style="position: absolute; width: 220px; overflow:hidden; height: 16px; z-index: 2; left: 95px; top: 10px;">';

        if(jsonContent[i].keyword != null)
        {
            for(var keywordCount = 0; keywordCount < jsonContent[i].keyword.length;keywordCount++ )
            {
                if(login_user == null || login_user == '' || !login_user){
                    output += '<a style="color: #4070A0 !important" href='+contextRoot+'/jsp/IndexSearch.do?search='+escape(jsonContent[i].keyword[keywordCount])+'&searchtype=index&selected_ezdia_domain=2>'+jsonContent[i].keyword[keywordCount]+'</a>';
                }
                else{
                    output += '<span class="action" onclick=jsonSearch("ContentSearch.do","2","Content",0,"middle_div","'+escape(jsonContent[i].keyword[keywordCount])+'") >'+jsonContent[i].keyword[keywordCount]+'</span>';
                //output += '<span class="action">'+jsonContent[i].keyword[keywordCount]+'</span>';
                }
                output += (keywordCount != jsonContent[i].keyword.length - 1)?',':'';
            }
        }
        output += '<span class="action" style="margin-left:10px;" onclick=showcommondiv("ContentDetails.jsp?url='+escape(jsonContent[i].content_url)+'&title='+escape(jsonContent[i].content_name)+'&desc='+escape(jsonContent[i].description)+'","ConnectionPopUp","ConnectionPopUp");>View All</span></div>';
        output += '</div>';
        output += '</div>';
    }
    output += '</div>';
    return output;
}
function callbackNextContentExpert(response,pid){
    var output = '';
    var result = response;
    myresult = new Array();
    myresult = result.split("##");
    result = myresult[0];
    totalpages = myresult[1];
    if(result.indexOf("No Result Found")!=-1 ){
        output+="No Result for your search "+search;
    }
    else{
        var jsonContent= eval('('+result+')');
        output+= getNextTabDataExpert(jsonContent);
    }
    document.getElementById(pid).innerHTML=output;
    if(searchFilters.domain == '2'){
        var TabbedPanels1 = new Spry.Widget.TabbedPanels('TabbedPanels1',tabindexer);
    }
}
function callbackNextContent(response,pid){
    var output = '';
    var result = response;
    myresult = new Array();
    myresult = result.split("##");
    result = myresult[0];
    totalpages = myresult[1];
    //    if(result.indexOf("No Result Found")!=-1 ){
    //        output+="No Result for your search "+search;
    //    }
    //    else{
    //        var jsonContent= eval('('+result+')');
    //        output+= getNextTabData(jsonContent);
    //    }
    document.getElementById(pid).innerHTML=output;
    if(searchFilters.domain == '2'){
        var TabbedPanels1 = new Spry.Widget.TabbedPanels('TabbedPanels1',tabindexer);
    }
}
function callbackAssociatedContent(response,pid){
    var output = '';
    var result = response;
    myresult = new Array();
    myresult = result.split("##");
    result = myresult[0];
    totalpages = myresult[1];
    if(result.indexOf("No Result Found")!=-1 ){
        output+="No Result for your search "+search;
    }
    else{
        var jsonContent= eval('('+result+')');
        output+= getTabData(jsonContent);
    }
    document.getElementById(pid).innerHTML=output;
    if(searchFilters.domain == '2'){
        var TabbedPanels1 = new Spry.Widget.TabbedPanels('TabbedPanels1',tabindexer);
    }
}
function callbackJSONSearchResult(response,pid){
    var output = '';
    var result = response;
    myresult = new Array();
    myresult = result.split("##");
    result = myresult[0];
    ezdiaSearch = myresult[2];
    totalpages = myresult[1];
    if(result.indexOf("No Result Found")!=-1 ){
        output+="No Result for your search "+search;
    }
    else{
        var jsonContent= eval('('+result+')');
        output+='<div id="searchMainContentDiv">';
        output+='<table id="corner_dialog_table_bdr1" align="left" class="corner_dialog_table_bdr1" style="width: 951px;">';
        output+='<tr>';
        output+='<td class="corner_topleft_bdr1">';
        output+='</td>';
        output+='<td class="corner_border_bdr1_tm">';
        output+='</td>';
        output+='<td class="corner_topright_bdr1">';
        output+='</td>';
        output+='</tr>';
        output+='<tr>';
        output+='<td class="corner_border_bdr1_lm">';
        output+='</td>';
        output+='<td id="corner_content_bdr1" class="corner_content_bdr1">';
        output+='<div style="position: relative; height: auto; z-index: 10; left: -13px; top: -42px; width: 945px;">';
        output+='<table align="left" id="blue_top_bar_table" class="blue_top_bar_table" style="z-index: 10;">';
        output+='<tr>';
        output+='<td class="blue_left_bar_cnr"></td>';
        if(searchFilters.searchType == 'Expert'){
            output+='<td class="blue_mid_bar" style="text-align:center;">Expert Advice</td>';
        }
        else if(searchFilters.domain == '1'){
            output+='<td class="blue_mid_bar" style="text-align:center;"><span style="margin-left:0px;">Knowledge Bucket</span></td>';
        }
        else if(searchFilters.domain == '2'){
            output+='<td class="blue_mid_bar" style="text-align:center;"><span style="margin-left:280px;">Knowledge Bucket</span></td>';
        }
        output+='<td class="blue_right_bar_cnr"></td>';
        output+='</tr>';
        output+='</table>';
        output+='</div>';
        output+='<div id="TabbedPanels1" class="TabbedPanels"  style="position: relative; width: 951px; height: auto; padding-bottom: 10px; left: 0px; top: 0px; z-index: 10;">';
        if(searchFilters.searchType == 'Expert'){
            output+='<ul class="TabbedPanelsTabGroup ieUL_height" style="margin-top: -67px;">';
            if(searchFilters.domain == '1')
            {
                output+='<li class="TabbedPanelsTab" onclick=jsonSearch("EzdiaSearch.do","1","Expert",0,"middle_div"); tabindex="0" style="width:155px; float:left;">Experts</li>';
            }
            else
            {
                output+='<li class="TabbedPanelsTab" onclick=jsonSearch("EzdiaSearch.do","2","Expert",0,"middle_div"); tabindex="0" style="width:155px; float:left;">Experts</li>';
            }
            if(!isAlphaRelease ) {
                if(searchFilters.domain == '1')
                {//alert("In the Index page");
                    output+='<li class="TabbedPanelsTab" onclick=showResultAct("RequirementsSearch.do?pagetype=index","Requirements",1);changebutton("Expertbutton","Contentbutton") tabindex="0" style="display:none;width:155px; float:left;">Requirements</li>';
                }
                else
                {
                    output+='<li class="TabbedPanelsTab" onclick=showResultAct("RequirementsSearch.do?pagetype=home","Requirements",1);changebutton("Expertbutton","Contentbutton") tabindex="0" style="width:155px; float:left;">Requirements</li>';
                }
            }
            if(searchFilters.domain == '1')
            {
                output+='<div id="Expertbutton" style="position:relative; margin-top:-3px; right:22px; float: right;" class="red-button"><span class="action" onclick="showcommondiv(\'profile/UpdateExpertise.jsp\',\'ConnectionPopUp\',\'ConnectionPopUp\')" style="color:white">Become An Expert</span></div>';
                if(!isAlphaRelease ) {
                    output+='<div id="Requirebutton" style="display:none; position:relative; margin-top:-3px; right:22px; float: right;" class="red-button"><span class="action" onclick=showcommondiv("PostRequirement.jsp","postRequirement","postRequirement"); style="color:white">Post A Requirement</span></div>';
                }
            }
            else
            {
                output+='<div id="Expertbutton" style="position:relative; margin-top:-3px; right:22px; float: right;" class="red-button"><span class="action" onclick="showcommondiv(\'profile/UpdateExpertise.jsp\',\'ConnectionPopUp\',\'ConnectionPopUp\')" style="color:white">Become An Expert</span></div>';
                if(!isAlphaRelease ) {
                    output+='<div id="Contentbutton" style="display:none; position:relative; margin-top:-3px; right:22px; float: right;" class="red-button"><span class="action" onclick=showcommondiv("PostRequirement.jsp","postRequirement","postRequirement"); style="color:white">Post A Requirement</span></div>';
                }
            }
            output+='</ul>';
        }
        else
        {
            output+='<ul class="TabbedPanelsTabGroup ieUL_height" style="margin-top: -67px;">';
            if(searchFilters.domain == '1'){
                output+='<li class="TabbedPanelsTab TabbedPanelsTabSelected"  tabindex="0" style="width:155px; float:left;">eZdia Network</li>';
            }
            else{

                if(search != myuserid){
                    output+=' <li class="TabbedPanelsTab" onclick=assocaitedContent("ContentSearch.do","2","Content",0,"MyNetwork","'+escape(search)+'") tabindex="0" style="width:155px; float:left;">eZdia Network</li>';
                    output+=' <li class="TabbedPanelsTab" onclick=networkKB("ContentSearch.do","2","Content",1,"MyOwn","'+escape(search)+'") tabindex="0" style="width:155px; float:left;">My Network</li>';
                    output+=' <li class="TabbedPanelsTab" onclick=assocaitedContent("ContentSearch.do","2","Content",2,"Content","'+escape(search)+'") tabindex="0" style="width:155px; float:left;">My Own</li>';

                }
                else
                {
                    output+=' <li class="TabbedPanelsTab" onclick=assocaitedContent("ContentSearch.do","2","Content",0,"MyNetwork","'+escape(search)+'") tabindex="0" style="width:155px; float:left;">eZdia Network</li>';
                    output+=' <li class="TabbedPanelsTab" onclick=networkKB("ContentSearch.do","2","Content",1,"MyOwn","'+escape(search)+'") tabindex="0" style="width:155px; float:left;">My Network</li>';
                    output+=' <li class="TabbedPanelsTab" onclick=assocaitedContent("ContentSearch.do","2","Content",2,"Content","'+escape(search)+'") tabindex="0" style="width:155px; float:left;">My Own</li>';
                }
            }

            output+=' <div onclick=showcommondiv("PostALink.jsp","PostLinkPopUp","PostLinkPopUp"); style="position:relative; margin-top:-3px; right:22px; float: right;" class="KB-red-button"><span class="action" style="color:white; padding-right:15px;">Add content to your</span></div>';
            output+='</ul>';
        }

        output+='<div class="TabbedPanelsContentGroup iesearchResultDiv">';

        if(searchFilters.domain == '2'){
            if(searchFilters.searchType == 'Content'){
                if(search != myuserid){
                    output+='<div id="MyNetwork" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                    output+= getTabData(jsonContent)+'</div>';

                    output+='<div id="MyOwn" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                    output+= '</div>';
                    output+='<div id="Content" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                    output+= '</div>';
                }
                else{
                    output+='<div id="MyNetwork" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                    output+= '</div>';

                    output+='<div id="MyOwn" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                    output+= '</div>';
                    output+='<div id="Content" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                    output+= getTabData(jsonContent)+'</div>';
                }
            }
            else{
                output+='<div id="Experts" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                output+= getTabData(jsonContent)+'</div>';
                if(!isAlphaRelease ) {
                    output+= '<div id="Requirements" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                    output+= '</div>';
                }
            }
        }
        else{
            if(searchFilters.searchType == 'Content'){
                output+='<div id="Content" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                output+= getTabData(jsonContent)+'</div>';
            }
            else{
                output+='<div id="Experts" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                output+= getTabData(jsonContent)+'</div>';
                if(!isAlphaRelease ) {
                    output+='<div id="Requirements" class="TabbedPanelsContent" style="padding:0px; width: 100%; height:auto;">';
                    output+='</div>';
                }
            }
        }

        output+='</div>';
        output+='</div>';
        output+='</td>';
        output+='<td class="corner_border_bdr1_rm">';
        output+='</td>';
        output+='</tr>';
        output+='<tr>';
        output+='<td class="corner_bottomleft_bdr1">';
        output+='</td>';
        output+='<td class="corner_border_bdr1_bm">';
        output+='</td>';
        output+='<td class="corner_bottomright_bdr1">';
        output+='</td>';
        output+='</tr>';
        output+='</table>';
        output+='</div>';
        output+='<table align="center" style="float:left; width:800px; margin-top:50px; height:50px;"><tr><td></td></tr></table>';
    }
    //if(tabindexer == 0 )
    document.getElementById(pid).innerHTML=output;
    if(searchFilters.domain == '2'){
        var TabbedPanels1 = new Spry.Widget.TabbedPanels('TabbedPanels1',tabindexer);
    }
// updatenavbar(searchFilters.searchType);
}
function callbackMyContent(response,pid){
    var output = '';
    var result = response;
    myresult = new Array();
    myresult = result.split("##");
    result = myresult[0];
    totalpages = myresult[1];
    if(result.indexOf("No Result Found")!=-1 ){
        output+="No Result for your search "+search;
    }
    else{
        var jsonContent= eval('('+result+')');
        output += writeSearchContent(jsonContent,totalpages);
    }
    document.getElementById(pid).innerHTML=output;
    if(searchFilters.domain == '2'){
        var TabbedPanels1 = new Spry.Widget.TabbedPanels('TabbedPanels1',tabindexer);
    }
}
function videoSearchList(divname)
{
    //  alert(divname);
    if (req.readyState==4 || req.readyState=="complete")
    {
        if (req.status == 200){
            var result = req.responseText;
            if(result.indexOf("No Content" )!=-1){
                showSearchContent(-1, 0);
            }
            else{
                var video_lst = eval('('+result+')');
                var total = video_lst.length;
                var arraySize = 0;
                var cacheLength = contentListing.length;
                var nextFlag = 0;
                if(total>contentpagesize)
                {
                    arraySize = contentpagesize + cacheLength;
                    nextFlag = 1;
                }
                else
                {
                    arraySize = total + cacheLength;
                    nextFlag = 0;
                }
                var temp_lst = new Array(arraySize);
                var j;
                var i;
                if(cacheLength != 0)
                {
                    for(j=0;j<cacheLength;j++)
                    {
                        temp_lst[j]  = contentListing[j];
                    }
                }
                for(j=cacheLength,i=0;i<(arraySize-cacheLength);j++, i++)
                {
                    temp_lst[j] = video_lst[i];
                }
                contentListing = temp_lst;
                contentmaxpagenextflag = nextFlag;
                showSearchContent(contentpagenum, nextFlag);


            }
        }else{
    //@todo
    }
    }
    else{
        document.getElementById(divname).innerHTML=sHTMLSearchAnim.replace("###", "");
        showDetails(divname);
    }
}
function getContentSearchList(pagenum,querystr)
{
    contentdivname = 'learning_div2';
    contentactionname = 'ContentSearch.do';
    contentpagenum = pagenum;

    if(contentsearchstr != search_str && pagenum==1)    contentListing = new Array();

    if((contentsearchstr != search_str && pagenum==1) || pagenum>contentmaxpagenum)
    {
        contentmaxpagenum = pagenum;
        contentsearchstr = search_str;
        var start = ((pagenum-1) * contentpagesize) + 1;
        var end = start + (contentpagesize);
        var url = contentactionname;
        var funcToCall = videoSearchList;
        var queryStr = 'search_str='+escape(querystr)+'&start='+escape(start)+'&end='+escape(end);
        fetchServerResponse(url,queryStr,funcToCall,contentdivname);
    }
    else
    {
        var nextFlag = 0;
        if(pagenum<contentmaxpagenum)  nextFlag = 1;
        else nextFlag = contentmaxpagenextflag;
        showSearchContent(pagenum, nextFlag);
    }
}
function getVideoSearchList(pagenum)
{
    contentdivname = 'learning_div2';
    contentactionname = 'ContentSearch.do';
    contentpagenum = pagenum;
    var search_str = document.getElementById('search_str').value;
    if(search_str == "")
    {
        document.getElementById('search_str_check').innerHTML = '';
        document.getElementById('search_str_check').innerHTML = 'Enter a search string';
        return;
    }
    else
    {
        document.getElementById('search_str_check').innerHTML = '';

    }
    if(contentsearchstr != search_str && pagenum==1)    contentListing = new Array();

    if((contentsearchstr != search_str && pagenum==1) || pagenum>contentmaxpagenum)
    {
        contentmaxpagenum = pagenum;
        contentsearchstr = search_str;
        var start = ((pagenum-1) * contentpagesize) + 1;
        var end = start + (contentpagesize);
        var url = contentactionname;
        var funcToCall = videoSearchList;
        var queryStr = 'search_str='+escape(search_str)+'&start='+escape(start)+'&end='+escape(end);
        fetchServerResponse(url,queryStr,funcToCall,contentdivname);
    }
    else
    {
        var nextFlag = 0;
        if(pagenum<contentmaxpagenum)  nextFlag = 1;
        else nextFlag = contentmaxpagenextflag;
        showSearchContent(pagenum, nextFlag);
    }
}
function onenterVideoSearch(event) {

    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {
        contentdivname = 'learning_div2';
        contentactionname = 'ContentSearch.do';
        getVideoSearchList(1);
    }
    return false;
}
function headerActiveTabIndex(myHeader){
    if (myHeader=="EA"){
        document.getElementById("EA").className ="indexontabactive";
        document.getElementById("KB").className ="indexontab";
        document.getElementById('EA_NavLink').style.display = '';
        document.getElementById('KB_NavLink').style.display = 'none';
    }
    else if(myHeader=="KB"){
        document.getElementById("KB").className ="indexontabactive";
        document.getElementById("EA").className ="indexontab";
        document.getElementById('KB_NavLink').style.display = '';
        document.getElementById('EA_NavLink').style.display = 'none';
    }
    else{
        document.getElementById('KB_NavLink').style.display = '';
        document.getElementById('EA_NavLink').style.display = '';
    }
}
function showSearchContent(pagenum, nextFlag)
{
    var outputstr;
    if(pagenum == -1)
    {
        outputstr = 'Sorry, No Specific video for your search!!!';
    }
    else
    {
        outputstr  = '<div id="videotab" onclick=showMessageResult("../jsp/learning3.jsp","mainvideodiv","") class="learning_video_tab " style="border: 1px solid #C0C0C0; position: relative; width: 49px; height: 16px; z-index: 19; left: 296px; top: 10px; cursor: pointer; text-decoration: none; ">';
        outputstr += 'Videos</div>';
        outputstr += '<div id="learningtab0" class="learning_video_tab " style="border: 1px solid #C0C0C0; position: relative; width: 49px; height: 16px; z-index: 19; left: 562px; top: -8px; cursor: pointer; text-decoration: none;">';
        outputstr += 'Favorite</div>';
        outputstr += '<div id="learningtab" onclick=showMessageResult("../jsp/learning2.jsp","mainvideodiv","") class="learning_video_tab " style="border: 1px solid #C0C0C0; position: relative; width: 98px; height: 16px; z-index: 19; left: 463px; top: -26px; cursor: pointer; text-decoration: none;">';
        outputstr += 'Learning Buddy</div>';
        outputstr += '<div id="experttab" class="learning_video_tab " style="border: 1px solid #C0C0C0; position: relative; width: 58px; height: 16px; z-index: 19; left: 404px; top: -44px; cursor: pointer; text-decoration: none;">';
        outputstr += 'Experts</div>';
        outputstr += '<div id="articletab" class="learning_video_tab " style="border: 1px solid #C0C0C0; position: relative; width: 57px; height: 16px; z-index: 19; left: 346px; top: -62px; cursor: pointer; text-decoration: none;">';
        outputstr += 'Articles</div>';
        outputstr += '<div id="alltab" onclick=showMessageResult("../jsp/learning1.jsp","learning_div2","") class="learning_video_tab " style="border: 1px solid #C0C0C0; position: relative; width: 40px; height: 16px; z-index: 19; left: 255px; top: -80px; cursor: pointer; text-decoration: none;background-color: #336699; color: #FFFFFF;">';
        outputstr += 'All</div>';
        outputstr += '<div id="topline2"style="background:#e6e6e6; position: relative; width: 430px; height: 1px; z-index: 8; left: 209px; top: -81px; ">';
        outputstr += '</div>';
        outputstr += '<div id="mainvideodiv" style="position: relative; width: 709px; height: auto; z-index: 20; left: 0px; top: -50px">';
        outputstr += '<div id="videos" class="learning_video_subheading " style="position: relative; width: 55px; height: 19px; z-index: 6; left: 30px; top: -10px;">Videos</div>';
        var i;
        var total = contentListing.length;
        var start= (pagenum-1) * contentpagesize;
        var end = start + contentpagesize;
        if(end>total) end = total;
        for(i =start; i < end; i++)
        {
            //contentstr[i] = new UserContent('<object width="300" height="200" align="center"><param name="movie" value="'+video_lst[i].url+'&fs=1"></param><param name="wmode" value="transparent"></param><param name="allowFullScreen" value="true"></param><embed src="'+video_lst[i].url+'&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" wmode="transparent" width="300" height="200"></embed></object>');
            //            if(contentListing[i].related_url != null)
            //            {
            //               contentstr[i] = new UserContent(contentListing[i].related_url);
            //            }
            //            else
            //            {
            //               contentstr[i] = new UserContent(contentListing[i].url);
            //            }
            //alert(i+"\n"+contentstr[i].contenturl);
            outputstr += '<div id="v1'+i+'" style="border-bottom:1px solid #CCCCCC; position: relative; width: 690px; height: auto; z-index: 9; left: 10px; top: 0px;">';
            outputstr += '<div id="videoicon1" style="cursor:pointer;position: relative; width: 35px; height: 35px; z-index: 1; left: 20px; top: 5px">';
            //outputstr += '<img alt="image1" onclick=showVideos("'+i+'","v1'+i+'","v2'+i+'","v3'+i+'") height="37" src="../static/images/videosmallicon.jpg" width="37" /></div>';
            outputstr += '<img alt="image1" onclick=';
            if(contentListing[i].related_url != null)
            {
                contentstr[i] = new UserContent(contentListing[i].related_url);
                outputstr += 'showVideoinPopup('+i+',"ConnectionPopUp",event)';
            }
            else
            {
                contentstr[i] = new UserContent(contentListing[i].url);
                outputstr += 'showIframe("ConnectionPopUp","'+contentListing[i].url+'")';
            }
            outputstr += ' height="37" src="../static/images/videosmallicon.jpg" width="37" /></div>';
            outputstr += '<div id="layer23" class="learning_search_title" style="position: relative; width: 132px; height: 16px; z-index: 2; left: 60px; top: -28px">';
            outputstr += '<b> ' + contentListing[i].firstname  + '</b></div>';
            outputstr += '<div id="introCategory3" style="position: relative; width: 120px; height: 90px; z-index: 3; left: 76px; top:-30px">';
            outputstr += '<span class="learning_video_selection">' + contentListing[i].content_name + '<br />';
            outputstr += '<span class="learning_video_selection">' + contentListing[i].description + '</span><br class="learning_video_selection" />';
            outputstr += '<span class="learning_video_selection">Number of hits </span><br/>';
            outputstr += '<span class="learning_video_selection">Reviews </span><br/>';
            outputstr += '<span class="learning_video_selection">' + contentListing[i].experts + ' Experts of this video</span>';
            outputstr += '</div>';
            outputstr += '<div id="intromenu1" class="learning_video_title1" style="position: relative; width: 237px; height: 15px; z-index: 4; left: 210px; top: -40px">';
            outputstr += '<span class="action" onclick=addExpert("addExpert.do",' + contentListing[i].content_id + ',"experts'+i+'")>Add as Expert</span> | Read article | Refer a friend | Read later </div>';
            outputstr += '<div id="expertlist1"  class="learning_video_title1" style="position: relative; width: 60px; height: 13px; z-index: 5; left: 520px; top: -145px">';
            outputstr += '<span class="action" onclick=getExperts("experts.do",' + contentListing[i].content_id + ',"experts'+i+'")>Expert List</span></div>';
            outputstr += '<div id="experts' +i+ '"  class="learning_video_title1" style="position: relative; width: 100px; height: 13px; z-index: 5; left: 520px; top: -145px"></div>';
            outputstr += '<div id="v2'+i+'" align="center" style="position: relative;top:-40px;width:0px;height:0px;left:170px;z-index: 3;">';
            outputstr += '</div>';
            outputstr += '<div id="v3'+i+'" align="center" style="background-color:white;opacity: .05;filter: alpha(opacity=1);position: relative;top:-242px;width:0px;height:0px;left:170px;z-index: 20;">';
            outputstr += '</div>';
            outputstr+= '</div>';
        }
        var prvCtr = pagenum - 1;
        outputstr += '<div id="navigationLinks" style="position: relative; width: 635px; height: 5px; text-align: top">';
        if(pagenum!=1)
            outputstr += '<span class="action" onclick=getVideoSearchList("'+prvCtr+'")>Previous</span>&nbsp;&nbsp;&nbsp;';
        if(nextFlag == 1)
            outputstr += '<span class="action" onclick=getVideoSearchList("'+(++pagenum)+'")>Next</span>';
        outputstr+= '</div>';
        outputstr+= '</div>';
    }
    document.getElementById(contentdivname).innerHTML = '';
    document.getElementById(contentdivname).innerHTML=outputstr;
}
*/
