function expandAll(divid, imgid)
{
    var ele_visibibility = document.getElementById(divid).style.display;
    if(ele_visibibility == "none")
    {
        document.getElementById(divid).style.display ='';
        document.getElementById(imgid).src='../../static/images/minus.gif';
    }
    else
    {
        document.getElementById(divid).style.display ='none';
        document.getElementById(imgid).src='../../static/images/plus.gif';
    }
}

function ShowImportFromOtherId(flag, email){
    if(flag == '0'){
        document.getElementById("emailid").value = '';
        document.getElementById("emailid").style.width = '120px';
        document.getElementById("displayMailingDomains").style.display = '';
        document.getElementById("OtherIdImport").style.display = 'none';
        document.getElementById("MyIdImport").style.display = '';
    }
    if(flag == 1){
        document.getElementById("displayMailingDomains").style.display = 'none';
        document.getElementById("emailid").value = email;
        document.getElementById("emailid").style.width = '220px';
        document.getElementById("MyIdImport").style.display = 'none';
        document.getElementById("OtherIdImport").style.display = '';
    }
    document.getElementById("passwd").value = '';
}

function getExpertise(actionURL,invID,tabindex,tabtype,param,userid){
    otheruserid = userid;
    profileparam =param;
    type = tabtype;
    tabindexer=tabindex;
    showResultWithQueryStr(actionURL, invID, callbackcommon, null,false,tabindex,tabtype);
}

function swapValuesNColor(expert,explorer,flag){
    if(flag == 1){
        document.getElementById(explorer).style.fontWeight = 'bold';
        document.getElementById(expert).style.fontWeight = 'normal';
        document.getElementById("getComments").value = 'Write what help you may be looking about this content.';        
    }
    else if(flag == 2){
        document.getElementById(expert).style.fontWeight = 'bold';
        document.getElementById(explorer).style.fontWeight = 'normal';
        document.getElementById("getComments").value = 'Write what help you may able to provide as an expert of this content.';
    }
}
    
function checkstatus(actionURL,invID){
    showResultWithQueryStr(actionURL,invID,invitationHandler,null,true);
    return true;
}

function invitationErrorHandler(invID) {
    document.getElementById(invID).innerHTML = '';
    document.getElementById(invID).innerHTML = 'Error while retrieving connection request';
}

function checkforother(id,divid){
    var other =document.getElementById(id).value;
    if(other == 'Other'){
        document.getElementById(divid).style.display ='';
        return true;
    }else{
        document.getElementById(divid).style.display ='none';
        return true;
    }
}

function invitationHandler(result,invID){
    document.getElementById(invID).innerHTML = '';
    var output = document.getElementById(invID).innerHTML;
    var i;
    var jsonContent= eval('('+result+')');

    output+='<span style="font-weight: bold; color: rgb(0, 64, 128);" class="action" onclick=showmyconnectiion("pendingConnection.do?type=0","middle_div","pending",0,1,'+myuserid+')>Invitations (<span id="invCountID">'+jsonContent.length+'</span>)</span>';
    output+='<div id="specialdiv4" style="position: relative; width: 640px; height: auto; z-index: 2; left: 3%; margin-top: 1%; margin-bottom:1%;">';
    output+='<div align="left" style="position:relative;margin-top:0px; width:auto;height:auto; left: 0px; top: 0px;">';
    /*/
    output+='<table style=" font-size: 10px; margin-left:0px;width:100%">';

    for (i = 0 ; i<jsonContent.length ; i++){
        if(jsonContent[i].response){
            output+=jsonContent[i].response;
        }
        else{
            EzdiaConnection[i] = new EzdiaConn(jsonContent[i].idconnection,jsonContent[i].fromuser,jsonContent[i].photo_thumbnail, jsonContent[i].firstname);
            //output+=' <tr id="inv'+i+'"><td align="left" width="50%" style="color:#787678;">Request from <span style="color:#4070A0;"><span class="action" onclick=showcommondiv("connection/AddConnections.jsp?username='+escape(jsonContent[i].fromuser)+'&tousername='+escape(jsonContent[i].firstname)+'&reqType=accept&connid='+escape(jsonContent[i].idconnection)+'&index='+i+'","ConnectionPopUp","ConnectionPopUp")>'+ jsonContent[i].firstname+'</span>,</span> A '+jsonContent[i].position+' from '+jsonContent[i].company+'</td></tr>';
            output+=' <tr id="inv1'+i+'" onmouseover="colorBG(\'inv'+i+'\');" onmouseout="uncolorBG(\'inv'+i+'\');" ><td align="left" width="50%" style="color:#787678;">Connection request from <span style="color:#4070A0;"><span class="action">'+ jsonContent[i].firstname+'</span>. A '+jsonContent[i].position+' from '+jsonContent[i].company+'</span><span style=\'color: #990000; font-style: italic; margin-left: 10px;\' onclick=showcommondiv("connection/AddConnections.jsp?username='+escape(jsonContent[i].fromuser)+'&tousername='+escape(jsonContent[i].firstname)+'&reqType=accept&connid='+escape(jsonContent[i].idconnection)+'&index='+i+'","ConnectionPopUp","ConnectionPopUp")>[Action Required]</span> </td></tr>';
        }
    }
    output+='</table>';
    */
    output+='</div>';
    output+='</div>';

    if(jsonContent.length > 0){
        output+='<div id="connectionoutput" style="padding: 8px 5px;">';
        //alert("LENGTH :"+jsonContent.length);
        if(!jsonContent[jsonContent.length-1].response && jsonContent.length>0){
            for(var i=0;i<jsonContent.length;i++){
                output+='<div id="inv'+i+'" style="position: relative; width: auto; height: 123px; padding-top: 0px; left: 0px; margin-top: 6px;">';
                output+='<div style="position: absolute; width: 100%; height: auto; left: 0px; margin-top: 0px;">';
                output+='<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 100%; z-index: 10">';
                output+='<tr><td class="corner_topleft"></td><td class="top_side_border"></td><td class="corner_topright"></td></tr>';
                output+='<tr><td class="left_side_border"></td><td id="corner_content" class="corner_content">';
                output+='<div style="width:680px; height:120px;">';

                UserInfoConnDiv[i] = new UserInfo(jsonContent[i].userid,jsonContent[i].firstname,jsonContent[i].photo_thumbnail,jsonContent[i].summary,jsonContent[i].expertise,jsonContent[i].country,jsonContent[i].reviews,jsonContent[i].rating,jsonContent[i].rpm,jsonContent[i].category);

                //MyConnectionList[i] = new MyConn(jsonContent[i].userid, jsonContent[i].firstname,jsonContent[i].groupname,jsonContent[i].conid,jsonContent[i].relation,jsonContent[i].tag);
                output+='<div id="mulpv'+i+'" onmouseout="mclosetime()" onmouseover="mcancelclosetime()" style="display:none; left:80px; top:0px; position: absolute; width: 355px; height: auto; z-index: 100;"></div>';
                output+='<div id="ul" style="padding-right: 10px; cursor: pointer; padding-left: 10px; padding-top: 4px; width: 86px; z-index: 1;">';
                output+='<img id="mul'+i+'" onmouseout=mclosetime() onmouseover=viewBusinessCard('+i+',"mulpv'+i+'",event,"mul'+i+'","manageconnections") style="border: 0px; cursor:pointer;" height="76" alt="userimage" src="';

                if(jsonContent[i].photo_thumbnail){

                    output+=localhost+jsonContent[i].photo_thumbnail;
                }
                else
                {
                    output+="../static/images/newUserImg.png";
                }
                output+='"/></div>';

                output+='<div id="available" style="height: 13px; z-index: 2; font-size: 12px; width: 80px; margin-left: 30px; margin-top: 5px; float:left;">';
                //output+='<img src=' + ((jsonContent[i].presence == PRESENCE_STATUS_ONLINE)?"../static/images/green-dot-icon.png":"../static/images/gray-dot-icon.png");
                output+='<img src="'+PRESENCE_SERVICE_URL.replace('$uid$',jsonContent[i].userid)+'"';
                output+=' />';
                //output+=((jsonContent[i].presence == PRESENCE_STATUS_ONLINE)?"Available":"Offline") + '</div>';
                output+='</div>';
                output+='<div style="overflow: hidden; position: absolute; height: 120px; top: 20px; line-height: 20px; width: 260px; left: 34%;">';
                if(login_user == null || login_user == '' || !login_user )
                {
                    output+='<div id="namediv" style="overflow:hidden; max-height:20px;cursor:pointer;text-decoration:underline" onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'&from=index","middle_div","'+escape(jsonContent[i].username)+'") ><h1 style="font-size: 12px;">';
                }
                else
                {
                    output+='<div id="namediv" style="overflow:hidden; max-height:20px;cursor:pointer;text-decoration:underline" onclick=showviewprofile("ViewOtherProfile.do?uid='+jsonContent[i].username+'","middle_div","'+escape(jsonContent[i].username)+'") ><h1 style="font-size: 12px;">';
                }

                output+= jsonContent[i].firstname+'</h1></div>';
                output+='<div id="statusdiv" style="overflow:hidden; max-height: 20px; color: rgb(0, 64, 128);">';
                if(jsonContent[i].summary){
                    output+= jsonContent[i].summary+'</div>';
                }
                else{
                    output+='No summary</div>';
                }
                //                    output+='<div id="workDetailsdiv" style="overflow:hidden; color: rgb(0, 0, 0); max-height:20px;">';
                //                    output+=jsonContent[i].position+'&nbsp;at&nbsp;'+jsonContent[i].mycompany+'</div>';
                output+='<div id="ratingAndReview" style="max-height:20px;">';
                output+='<img alt="" src="../static/images/'+jsonContent[i].rating+'red.gif"/>&nbsp;<span id="reviewsdiv">( <span class="action">'+jsonContent[i].reviews+' Reviews</span> )</span></div>';
                output+='<div id="ratediv" style="color: rgb(51, 51, 51);">';
                output+='Rate : $ '+jsonContent[i].rpm+'/minute</div>';
                output+='<div id="sendMsgDiv" style="color: rgb(31, 101, 152);">';
                output+='<table width="180"><tr>';
                output+='<td><span class="action" onclick="openChatWindow(\'';

                output+= jsonContent[i].userid;
                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+='\')"><img alt="Chat" border="0" src="../static/images/green-chat-icon.gif" title="Chat"/></span></td><td><span class="action" onclick="openChatWindow(\'';
                output+= jsonContent[i].userid;
                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+='\')">Chat</span></td><td width="10"></td>';
                output+='<td><span class="action" onclick=showComposeMsg("messages/popupcompose.jsp?replyto='+escape(jsonContent[i].userid)+'&firstname='+escape(jsonContent[i].firstname)+'","common","compose",event)><img border="0" alt="" src="../static/images/message_ico.gif"/></span></td><td><span class="action" onclick=showComposeMsg("messages/popupcompose.jsp?replyto='+escape(jsonContent[i].userid)+'&firstname='+escape(jsonContent[i].firstname)+'","common","compose",event)>Send Message</span></td>';
                output+='</tr></table>';
                output+='</div>';
                output+='</div>';
                //Button for Action
                output+='<div class="red-button" style="padding: 3px 6px 6px; position: absolute; top: 35px; left: 440px; font-size: 15px; color: white; height: 30px; width: 180px; margin-left: 35px;z-index:10" onclick=showcommondiv("connection/AddConnections.jsp?username='+escape(jsonContent[i].fromuser)+'&tousername='+escape(jsonContent[i].firstname)+'&reqType=accept&connid='+escape(jsonContent[i].idconnection)+'&index='+i+'","ConnectionPopUp","ConnectionPopUp")>Take Action</div>';
                output+='</div>';
                output+='</div>';
                output+='</td><td class="right_side_border"></td></tr>';
                output+='<tr><td class="corner_bottomleft"></td><td class="bottom_side_border"></td><td class="corner_bottomright"></td></tr>';
                output+='</table>';
                output+='</div>';
                output+='</div>';
            }
        }
    }

    document.getElementById(invID).innerHTML=output;
}

function updateHomePage(name,userid,redirect,password,httpbase,hostname,details,id,event,feedbackUser){

    userName=name;
    login_user=userid;
    myuserid=userid;
    otheruserid=userid;
    document.getElementById('login_chat').style.display = 'none';
    doLogin(userid,password,httpbase,hostname);
    if (redirect == "showprofile"){
        showResultAct('MyProfile.do?pagnum=0', 'middle_div',3);
    }
    else{
        listUserConnections('MyConnection.do', '0', login_user,'home',details,id,event,feedbackUser);
        showResultAct('GetMessages.do', 'inboxHome',2);
    }
    checkForServices(details,event,id,feedbackUser);
}

function doStatusGreen(){
    
    /*var ah = new AjaxHandler();
    ah.init("doOffline.do?flag=1");
    ah.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    ah.send("username="+hiddenUserid);*/
    showResultWithQueryStr("doOffline.do?flag=1", null, doStatusGreenCallback, "username="+hiddenUserid);
//reloadHomePage(); call
}

function doStatusGreenCallback() {
//do nothing for now
}

function postFeedback(actionURL,output){
    pid=output;
    var url = actionURL;

    var toreview = document.getElementById('toreview').value;
    var skillid = document.getElementById('skillid').value;

    var communication ;
    var presentation;


    for(var i=1; i<=5; i++){
        var rdiv= 'communication'+i;

        if(document.getElementById(rdiv).checked) {
            communication = document.getElementById(rdiv).value;
        }
    }

    for(var j=1; j<=5; j++){
        var rdiv1= 'presentation'+j;
        if(document.getElementById(rdiv1).checked) {
            presentation = document.getElementById(rdiv1).value;
        }
    }

    for(var k=1; k<=5; k++){
        var rdiv2= 'rating'+k;
        if(document.getElementById(rdiv2).checked) {
            rating = document.getElementById(rdiv2).value;
        }
    }

    var reviews = document.getElementById('review').value;
    showResultWithQueryStr(url,output,callback,"user="+escape(toreview)+"&communication="+escape(communication)+"&presentation="+escape(presentation)+"&rating="+escape(rating)+"&review="+escape(reviews)+"&skillid="+escape(skillid));
    closecommonconn();
    return true;
}

function setDropDownValue(dropdown){
    var index  = dropdown.selectedIndex;
    var SelValue = dropdown.options[index].value;
    return SelValue;
}

checked=false;
function checkedAll () {
    var aa= document.getElementsByName('userfriend');
    if (checked == false){
        checked = true;
    }
    else{
        checked = false;
    }
    for (var i =0; i < aa.length; i++){
        aa[i].checked = checked;
    }
}

function toggleDiv(id) {
    if (document.layers){
        if(document.layers[''+id+''].display == "")
            document.layers[''+id+''].display = "none";
        else
            document.layers[''+id+''].display = "";
    }
    else if (document.all){
        if(document.all[''+id+''].style.display == "")
            document.all[''+id+''].style.display = "none";
        else
            document.all[''+id+''].style.display = "";
    }
    else if (document.getElementById){
        if(document.getElementById(''+id+'').style.display == "")
            document.getElementById(''+id+'').style.display = "none";
        else
            document.getElementById(''+id+'').style.display = "";
    }
}

function viewPopDivForuser(divid){

    document.getElementById(divid).style.borderTopStyle='solid';
    document.getElementById(divid).style.borderBottomStyle='solid';
    document.getElementById(divid).style.borderLeftStyle='solid';
    document.getElementById(divid).style.borderRightStyle='solid';
    document.getElementById(divid).style.borderTopColor='#C6D6FD';
    document.getElementById(divid).style.borderBottomColor='#C6D6FD';
    document.getElementById(divid).style.borderLeftColor='#C6D6FD';
    document.getElementById(divid).style.borderRightColor='#C6D6FD';
    document.getElementById(divid).style.borderTopWidth='medium';
    document.getElementById(divid).style.borderBottomWidth='medium';
    document.getElementById(divid).style.borderLeftWidth='medium';
    document.getElementById(divid).style.borderRightWidth='medium';
    document.getElementById(divid).style.backgroundColor ='#FFFFFF';
    document.getElementById(divid).style.width=180+'px';
    document.getElementById(divid).style.height=100+'px';
    document.getElementById(divid).style.display='';

}

function viewPopupDiv(divid){
    document.getElementById(divid).style.display='';
}

function hidePopDivForuser(divid){

    document.getElementById(divid).style.display='none';
}

function newviewPopupDivGeorge(xyz,e,cnno,uli){

    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }
    //alert(  tempX+'::'+tempY);
    mcancelclosetime();
    if(ddmenuitem)
        ddmenuitem.style.display = 'none';

    tempY=tempY-45;
    ddmenuitem = document.getElementById(xyz);
    ddmenuitem.style.display = '';
}




function newviewPopupDiv(xyz,e,cnno,uli){
    colorBG(uli);
    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }
    //alert(  tempX+'::'+tempY);
    mcancelclosetime();
    if(ddmenuitem)
        ddmenuitem.style.display = 'none';

    tempY=tempY-45;
    ddmenuitem = document.getElementById(xyz);
    ddmenuitem.innerHTML='';
    ddmenuitem.innerHTML=UserInfopopupDiv[cnno].divContent;
    ddmenuitem.style.display = '';
}

function newviewPopupDiv2(xyz,e,cnno,uli){
    colorBG(uli);
    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }
    mcancelclosetime();
    if(ddmenuitem)
        ddmenuitem.style.display = 'none';

    tempY=tempY-30;
    ddmenuitem = document.getElementById(xyz);
    ddmenuitem.innerHTML='';
    ddmenuitem.innerHTML=UserInfopopupDiv[cnno].divContent;
    ddmenuitem.style.display = '';
}

function newviewPopupDiv3(xyz,e,cnno,uli){
    colorBG(uli);
    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }
    //alert(  tempX+'::'+tempY);
    mcancelclosetime();
    if(ddmenuitem)
        ddmenuitem.style.display = 'none';

    tempY=tempY-30;
    ddmenuitem = document.getElementById(xyz);
    ddmenuitem.innerHTML='';
    ddmenuitem.innerHTML=UserInfopopupCommonConnDiv[cnno].divContent;
    ddmenuitem.style.display = '';
}

function omoSearch(xyz,e,cnno,uli){
    colorBG(uli);
    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }
    mcancelclosetime();
    if(ddmenuitem)
        ddmenuitem.style.display = 'none';

    tempY=tempY-30;
    ddmenuitem = document.getElementById(xyz);
    ddmenuitem.innerHTML='';
    ddmenuitem.innerHTML=ViewPopuponSearch[cnno].divContent;
    ddmenuitem.style.display = '';
}

function newviewPopupDiv4(xyz,e,cnno,uli){
    colorBG(uli);
    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }
    mcancelclosetime();
    if(ddmenuitem)
        ddmenuitem.style.display = 'none';

    tempY=tempY-30;
    ddmenuitem = document.getElementById(xyz);
    ddmenuitem.innerHTML='';
    ddmenuitem.innerHTML=ViewPopuponSearch1[cnno].divContent;
    ddmenuitem.style.display = '';
}


function newviewPopupDiv5(xyz,e,cnno){
    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }
    mcancelclosetime();
    if(ddmenuitem)
        ddmenuitem.style.display = 'none';

    tempY=tempY-30;
    ddmenuitem = document.getElementById(xyz);
    ddmenuitem.innerHTML='';
    ddmenuitem.innerHTML=UserInfoConnDiv[cnno].divContent;
    ddmenuitem.style.display = '';
}
function colorBG(uli){
    document.getElementById(uli).style.background = '#F4F9FF';
}

function uncolorBG(uli){
    document.getElementById(uli).style.background = '#FFFFFF';
}

function newhidePopDivForuser(){
    document.getElementById(ulpv).innerHTML='';
    document.getElementById(ulpv).style.display='none';

}

function toggleRowColor(cb, row) {
    if (cb.checked == true) {
        document.getElementById(row).style.backgroundColor = '#EEF6FA';
    }
    else if (cb.checked  == false) {
        document.getElementById(row).style.backgroundColor = '#FFF';
    }
}
function check(method){

    var checkboxes = document.getElementsByName("subscriptions");
    var rowcolor = document.getElementsByName("rowcolor");

    for(i=0; i < checkboxes.length; i++)
    {
        checkboxes[i].checked = method;
    }
    if(method == true){
        for(i=0; i < rowcolor.length; i++)
            rowcolor[i].style.backgroundColor = '#EEF6FA';
    }
    else if(method == false){
        for(i=0; i < rowcolor.length; i++)
            rowcolor[i].style.backgroundColor = '#FFFFFF';
    }

}

function mail_showlayer(obj1,img_id)
{   
    var temp = obj1+'body';
    var ele_visibibility = document.getElementById(obj1).style.display;
    if(ele_visibibility == "none")
    {
        document.getElementById(obj1).style.display ='';
        wordWrapDiv(temp);
        document.getElementById(img_id).innerHTML='<img src="../static/images/arrowDown_1.gif" style="cursor:pointer;"/>';
    }
    else
    {
        document.getElementById(obj1).style.display ='none';
        document.getElementById(img_id).innerHTML='<img src="../static/images/arrowUp.gif" style="cursor:pointer;"/>';
    }
}

function mail_showlayer_home(obj1)
{
    var ele_visibibility = document.getElementById(obj1).style.display;
    var temp = obj1+'body';
    if(ele_visibibility == "none")
    {
        document.getElementById(obj1).style.display ='';
        wordWrapDiv(temp);
    }
    else
    {
        document.getElementById(obj1).style.display ='none';
    }
}

function bae_showlayer(obj1)
{
    var ele_visibibility = document.getElementById(obj1).style.display;
    //document.getElementById('reqmsg').style.display = 'none';
    if(ele_visibibility == "none")
    {
        document.getElementById(obj1).style.display ='';
    }
    else
    {
        document.getElementById(obj1).style.display ='none';
    }
}

//get the array for multiple selected value
function getSelected(opt) {
    var selected = new Array();
    var index = 0;
    for (var intLoop=0; intLoop < opt.length; intLoop++) {
        if (opt[intLoop].selected) {
            index = selected.length;
            selected[index] = new Object();
            selected[index].value = opt[intLoop].value;
            selected[index].index = intLoop;
        }
    }
    return selected;
}

function outputSelected(opt) {
    var sel = getSelected(opt);
    var strSel = "";
    for (var item in sel) {
        if (!item.hasOwnProperty(sel)) continue;
        strSel += sel[item].value + ".";
    }
    //alert("Selected Items:\n" + strSel);
    return strSel;
}

function fetchServerResponse(actionURL,querystr, funcToCall, displaydatain)
{
    var url=actionURL;
    url=url+"?" +querystr;
    showResultWithQueryStr1(url, displaydatain, funcToCall, null);
    return true;
}

function showlayer(obj1, obj2)
{
    var ele_visibibility = document.getElementById(obj1).style.display;
    if(ele_visibibility == "none")
    {
        document.getElementById(obj1).style.display ='';
        document.getElementById(obj2).src= contextRoot+'/static/images/arrowdown.gif';
    }
    else
    {
        document.getElementById(obj1).style.display ='none';
        document.getElementById(obj2).src= contextRoot+'/static/images/arrowside.gif';
    }
}

//function onenterInvitee(event,actionurl) {
//
//    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
//    if (keyCode == 13) {
//
//        ImportContacts(actionurl,'Invitepopup','Show_Error');
//    }
//    return false;
//}

function onenterInviteeHome(event,actionurl){

    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {
        ImportContactsHome(actionurl,'ConnectionPopUp','Show_Error');
    }
    return false;
}

function onenterAction(event,actionurl,flag){
    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
    if (keyCode == 13) {
        if(flag == 'searchconn'){
            showmysearch(actionurl,"connectionsAndPagination","view1");
            return false;
        }
        else if(flag == 'forgetPswd'){
            checkUserExists(actionurl,'invalid_div');
            return false;
        }
    }
    return true;
}

//function onenterConnInvitee(event,actionurl,divid) {
//
//    var keyCode = event.keyCode ? event.keyCode : event.which ? event.which : event.charCode;
//    if (keyCode == 13) {
//
//        ImportContacts(actionurl,divid,'Show_Error');
//    }
//    return false;
//}

//added for displaying updated username
function updateUserName(username)
{
    document.getElementById('username').innerHTML=username; //updating username on home.jsp
}
function reduceProjBC(){
    
    document.getElementById("projBC").style.width = '200px';
}

//function CompleteRegistrationProfile(actionURL,divid,regtype,firstname,userweight){
//    var flag = validateCPReg();
//    if(!flag){
//        return true;
//    }
//    pid = divid;
//    var type = regtype;
//    var mycategory = document.getElementById('registration_category_list1');
//    var category = mycategory.options[mycategory.selectedIndex].value;
//    var company = document.getElementById('companyreg').value;
//    var myworkarea= document.getElementById('workareareg');
//    workarea = myworkarea.options[myworkarea.selectedIndex].value;
//    var mysubarea = document.getElementById('sub_areareg');
//    subarea = mysubarea.options[mysubarea.selectedIndex].value;
//    var zipcode = document.getElementById('zipreg').value;
//    var country = document.getElementById('countryreg').value;
//    var weight = userweight;
//    var url = actionURL;
//    if(type == 'wc')
//        showResultWithQueryStr(url, divid, callbackimportcontact,"company="+escape(company)+"&category="+escape(category)+"&workarea="+escape(workarea)+"&subarea="+escape(subarea)+"&zipcode="+escape(zipcode)+"&country="+escape(country)+"&firstname="+escape(firstname)+"&weight="+escape(weight));
//    else
//        showResultWithQueryStr(url, divid, callbackcommon,"company="+escape(company)+"&category="+escape(category)+"&workarea="+escape(workarea)+"&subarea="+escape(subarea)+"&zipcode="+escape(zipcode)+"&country="+escape(country)+"&firstname="+escape(firstname)+"&weight="+escape(weight));
//    return true;
//}

function changePic(img_name,img_src,flag) {
    document[img_name].src=img_src;
    changeTxt(flag);
}

function changeTxt(flag){
    if(flag == 'a'){
        document.getElementById("red_textDiv").innerHTML = '';
        document.getElementById("onclick_text").innerHTML ='Find an expert help you solve your problems or get your work done ';
    }
    if(flag == 'b'){
        document.getElementById("red_textDiv").innerHTML = '';
        document.getElementById("onclick_text").innerHTML ='Use Expert Guided video training and increase your knowledge base ';
    }
    if(flag == 'c'){
        document.getElementById("onclick_text").innerHTML ='Based on your information entered, you can make up to....';
        document.getElementById("red_textDiv").innerHTML ='$100/Hr.';
    }
}

var maxmin = true;


function setNextlinks(URL,pagetype,pagnum,total){
    var tabindex=1;
    var actionURL = URL;
    if(pagetype == 'Expert')
        tabindex=2;
    if(pagetype == 'message')
        tabindex=2;
    if(pagetype == 'ProjectProfile')
        tabindex=1;
    var output = '';
    if(pagnum < (total-1)){
        if(pagnum !=0){
            output+= '<table align="right" width="250"><tr><td width="30"><span class="action" onclick=setNextlinks(\"'+actionURL+'\",\"'+pagetype+'\",'+escape(0)+','+escape(total)+')>First</span></td>';
            output+= '<td width="30"><span class="action" onclick=setNextlinks(\"'+actionURL+'\",\"'+pagetype+'\",'+escape(pagnum-1)+','+escape(total)+')>Prev</span></td>';
        }

        pagnum++;
        if(pagnum == 1)
            output+= '<table align="right" width="250"><tr><td width="30">Page</td><td width="15"> <b>'+escape(pagnum)+'</b> </td><td width="20">of</td><td width="20"> <b>'+escape(total)+'</b></td>';
        else
            output+= '<td width="30">Page</td><td width="15"> <b>'+escape(pagnum)+'</b> </td><td width="20">of</td><td width="20"> <b>'+escape(total)+'</b></td>';
        pagnum--;

        output+= '<td width="30"><span class="action" onclick=setNextlinks(\"'+actionURL+'\",\"'+pagetype+'\",'+escape(pagnum+1)+','+escape(total)+')>Next</span></td>';
        output+= '<td width="30"><span class="action" onclick=setNextlinks(\"'+actionURL+'\",\"'+pagetype+'\",'+escape(total-1)+','+escape(total)+')>Last</span></td></tr></table>';

        if(pagetype=='message')
        {
            showResultAct(actionURL+'?pagenum='+escape(pagnum), 'mydiv',2);
        }
        else if(pagetype=='ProjectProfile')
        {
            showResultAct(actionURL+'?pagenum='+escape(pagnum), 'mydiv',1);
        }
        else if(pagetype=='messagesent')
        {
            showResultAct(actionURL+'?pagenum='+escape(pagnum), 'specialdiv',1);
        }
        else  if(pagetype == 'connection')
        {
            showmyconnectiion(actionURL,'connectionoutput', 'view',pagnum,tabindexer,otheruserid);
        }
        else if(pagetype == 'manageconn')
        {
            showmyconnectiion(actionURL,'manageoutput', 'manage',pagnum);
        }
        else  if(pagetype == 'Content')
        {
            jsonSearchNext(actionURL+'?mypage='+escape(pagnum)+'&pagetype=next',searchFilters.domain,'Content',tabindexer,'hidiv',searchFilters.mainSearchPattern);
        }
        else  if(pagetype == 'ContentRefined')
        {
            performSearchNext(+escape(pagnum),pagetype);
        }
        else  if(pagetype == 'Expert')
        {
            jsonSearchNext(actionURL+'?mypage='+escape(pagnum)+'&pagetype=next',searchFilters.domain,'Expert',tabindexer,'hellodiv',searchFilters.mainSearchPattern);
        }
        else  if(pagetype == 'ExpertRefined')
        {
            performSearchNext(+escape(pagnum),pagetype);
        }
        else  if(pagetype == 'AsExpert')
        {
            showResultAct(actionURL+'?mypage='+escape(pagnum), 'expertdiv',2);
        }
        else  if(pagetype == 'Explorer')
        {
            showResultAct(actionURL+'?mypage='+escape(pagnum), 'explorerdiv',1);
        }
        else  if(pagetype == 'Requirements')
        {
            showProjPages(actionURL+'?pagenum='+escape(pagnum), 'mydiv',2);
        }
    }
    else if(pagnum==total-1){
        output+= '<table align="right" width="200"><tr><td width="30"><span class="action" onclick=setNextlinks(\"'+actionURL+'\",\"'+pagetype+'\",'+escape(0)+','+escape(total)+')>First</span></td>';
        output+= '<td width="30"><span class="action" onclick=setNextlinks(\"'+actionURL+'\",\"'+pagetype+'\",'+escape(pagnum-1)+','+escape(total)+')>Prev</span></td>';
        pagnum++;
        output+= '<td width="30">Page</td><td width="15">'+escape(pagnum)+'</td><td width="20">of</td><td width="20">'+escape(total)+'</td></tr></table>';
        pagnum--;
        if(pagetype=='message')
        {
            showResultAct(actionURL+'?pagenum='+escape(pagnum),'mydiv',2);
        }
        else if(pagetype=='ProjectProfile')
        {
            showResultAct(actionURL+'?pagenum='+escape(pagnum), 'mydiv',1);
        }
        else if(pagetype=='messagesent')
        {
            showResultAct(actionURL+'?pagenum='+escape(pagnum),'specialdiv',1);
        }
        else if(pagetype == 'connection')
        {
            showmyconnectiion(actionURL,"connectionoutput","view",+escape(pagnum),0);
        }
        else  if(pagetype == 'Content')
        {
            jsonSearchNext(actionURL+'?mypage='+escape(pagnum)+'&pagetype=next',searchFilters.domain,'Content',tabindexer,'hidiv',searchFilters.mainSearchPattern);
        }
        else  if(pagetype == 'ContentRefined')
        {
            performSearchNext(+escape(pagnum),pagetype);
        }
        else if(pagetype == 'manageconn')
        {
            showmyconnectiion(actionURL,'manageoutput', 'manage',pagnum);
        }
        else  if(pagetype == 'Expert')
        {
            jsonSearchNext(actionURL+'?mypage='+escape(pagnum)+'&pagetype=next',searchFilters.domain,'Expert',tabindexer,'hellodiv',searchFilters.mainSearchPattern);
        }
        else  if(pagetype == 'ExpertRefined')
        {
            performSearchNext(+escape(pagnum),pagetype);
        }
        else  if(pagetype == 'AsExpert')
        {
            showResultAct(actionURL+'?mypage='+escape(pagnum), 'expertdiv',2);
        }
        else  if(pagetype == 'Explorer')
        {
            showResultAct(actionURL+'?mypage='+escape(pagnum), 'explorerdiv',1);
        }
        else  if(pagetype == 'Requirements')
        {
            showProjPages(actionURL+'?pagenum='+escape(pagnum), 'mydiv',2);
        }
        else{
            showResultAct(actionURL+'?pagnum='+escape(pagnum),'RequirementResults',tabindex);
        }
    }
    if(pagetype == 'message' || pagetype == 'Requirements')
        document.getElementById('mypagination').innerHTML=output;
    else if(pagetype=='ProjectProfile')
        document.getElementById('mypagination').innerHTML=output;
    else if(pagetype == 'Expert' || pagetype == 'ExpertRefined'){
        document.getElementById('ExpertSearchPages').innerHTML=output;
    }
    else if(pagetype == 'Content' || pagetype == 'ContentRefined'){
        document.getElementById('ContentSearchPages').innerHTML=output;
    }
    else{

        document.getElementById('pagination').innerHTML=output;
    }
    return true;
}


function viewBusinessCard(i,xyz,e,uli,viewtype){

    var userid,firstname,photo,summary,expertise,conid,relation,tag,country,reviews,rating,rpm,category,position,company,skypeid,presence;
    if(viewtype == 'connections'){
        userid = UserInfopopupDiv[i].userid;
        firstname = UserInfopopupDiv[i].firstname;
        photo = UserInfopopupDiv[i].photo;
        summary = UserInfopopupDiv[i].summary;
        expertise = UserInfopopupDiv[i].expertise;
        conid = UserInfopopupDiv[i].conid;
        relation = UserInfopopupDiv[i].relation;
        tag = UserInfopopupDiv[i].tag;
        //country = UserInfopopupDiv[i].country;
        rating = UserInfopopupDiv[i].rating;
        reviews = UserInfopopupDiv[i].reviews;
        rpm = UserInfopopupDiv[i].rpm;
        category = UserInfopopupDiv[i].category;
        position = UserInfopopupDiv[i].position;
        company = UserInfopopupDiv[i].company;
        skypeid = UserInfopopupDiv[i].skypeid;
        presence = UserInfopopupDiv[i].presence;
    }
    else if( viewtype == 'commonconnections'){
        userid = UserInfopopupCommonConnDiv[i].userid;
        firstname = UserInfopopupCommonConnDiv[i].firstname;
        photo = UserInfopopupCommonConnDiv[i].photo;
        summary = UserInfopopupCommonConnDiv[i].summary;
        expertise = UserInfopopupCommonConnDiv[i].expertise;
        //country = UserInfopopupCommonConnDiv[i].country;
        rating = UserInfopopupDiv[i].rating;
        reviews = UserInfopopupCommonConnDiv[i].reviews;
        rpm = UserInfopopupCommonConnDiv[i].rpm;
        category = UserInfopopupCommonConnDiv[i].category;
        presence = UserInfopopupDiv[i].presence;
    }
    else if( viewtype == 'manageconnections'){
        userid = UserInfopopupDiv[i].userid;
        firstname = UserInfopopupDiv[i].firstname;
        photo = UserInfopopupDiv[i].photo;
        summary = UserInfopopupDiv[i].summary;
        expertise = UserInfopopupDiv[i].expertise;
        conid = UserInfopopupDiv[i].conid;
        relation = UserInfopopupDiv[i].relation;
        tag = UserInfopopupDiv[i].tag;
        //country = UserInfopopupDiv[i].country;
        rating = UserInfopopupDiv[i].rating;
        reviews = UserInfopopupDiv[i].reviews;
        rpm = UserInfopopupDiv[i].rpm;
        category = UserInfopopupDiv[i].category;
        position = UserInfopopupDiv[i].position;
        company = UserInfopopupDiv[i].company;
        skypeid = UserInfopopupDiv[i].skypeid;
        presence = UserInfopopupDiv[i].presence;
    }
    else if( viewtype == 'viewconnections'){
        userid = UserInfoConnDiv[i].userid;
        firstname = UserInfoConnDiv[i].firstname;
        photo = UserInfoConnDiv[i].photo;
        summary = UserInfoConnDiv[i].summary;
        expertise = UserInfoConnDiv[i].expertise;
        //country = UserInfoConnDiv[i].country;
        rating = UserInfopopupDiv[i].rating;
        reviews = UserInfoConnDiv[i].reviews;
        rpm = UserInfoConnDiv[i].rpm;
        category = UserInfoConnDiv[i].category;
        presence = UserInfopopupDiv[i].presence;
    }
    else if(viewtype == 'expertiselist'){
        userid = ExpertsList[i].userid;
        firstname = ExpertsList[i].firstname;
        photo = ExpertsList[i].photo;
        summary = ExpertsList[i].summary;
        expertise = ExpertsList[i].expertise;
        //country = ExpertsList[i].country;
        rating = UserInfopopupDiv[i].rating;
        reviews = ExpertsList[i].reviews;
        rpm = ExpertsList[i].rpm;
        category = ExpertsList[i].category;
        presence = UserInfopopupDiv[i].presence;

    }
    var divstr ='<div style="width: 370px; height:auto; z-index: 10000">';
    divstr+='<table id="corner_dialog_table" align="left" class="corner_dialog_table" style="width: 370px; height:auto;">';
    divstr+='<tr>';
    divstr+='<td class="corner_topleft">';
    divstr+='</td>';
    divstr+='<td class="top_side_border">';
    divstr+='</td>';
    divstr+='<td class="corner_topright">';
    divstr+='</td>';
    divstr+='</tr>';
    divstr+='<tr>';
    divstr+='<td class="left_side_border">';
    divstr+='</td>';
    divstr+='<td id="corner_content" class="corner_content">';
    divstr+='<div id="borderVline" style="margin:2px; height: 140px; width: 105px;">';
    divstr+='<div id="uploadPic" style="border-right: 1px solid #CCC; padding: 6px; height: 118px; width: 90px;">';
    if(photo){
        if(login_user == null || login_user == '' || !login_user )
        {
            divstr+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+escape(userid)+'&from=index","middle_div","'+escape(userid)+'") alt="uimg" width="80" src='+localhost+photo+' alt='+firstname+' style="cursor:pointer"/>';
        }
        else{
            divstr+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+escape(userid)+'","middle_div","'+escape(userid)+'") alt="uimg" width="80" src='+localhost+photo+' alt='+firstname+' style="cursor:pointer"/>';
        }
        
    }
    else
    {
        if(login_user == null || login_user == '' || !login_user )
        {
            divstr+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+escape(userid)+'&from=index","middle_div","'+escape(userid)+'") alt="uimg" src="../static/images/newUserImg.png" style="margin-top:10px; cursor:pointer"/>';
        }
        else{
            divstr+='<img onclick=showviewprofile("ViewOtherProfile.do?uid='+escape(userid)+'","middle_div","'+escape(userid)+'") alt="uimg" src="../static/images/newUserImg.png" style="margin-top:10px; cursor:pointer"/>';
        }
        
    }
    divstr+='<div id="available" style="color: #333; padding:3px; padding-left:0px; text-align:center;">';
    //divstr+='<img src=' + ((presence == PRESENCE_STATUS_ONLINE)?"../static/images/green-dot-icon.png":"../static/images/gray-dot-icon.png");
    divstr+='<img src="'+PRESENCE_SERVICE_URL.replace('$uid$',userid)+'"';
    divstr+=' />';
    //divstr+=''+((presence == PRESENCE_STATUS_ONLINE)?"&nbsp;&nbsp;Available" : "&nbsp;Offline")+'';
    divstr+='</div>';
    divstr+='</div>';
    divstr+='</div>';
    divstr+='<div style="padding: 5px; min-height:85px; width: 235px; height: auto; position: relative; margin-top: -110px; margin-left: 110px;">';
    divstr+='<div id="ufn" style="color: #D26419; font-weight:bold;">';
    divstr+=firstname+'</div>';
    divstr+='<div id="summarytxts" style="max-height:100px; overflow:hidden;">';
    if(summary){
        divstr+=summary+'</div>';
    }
    else{
        divstr+='No summary</div>';
    }
    divstr+='<div id="expertisetxts" style="max-height:40px; overflow:hidden;">';
    if(expertise){
        divstr+=expertise+'</div>';
    }
    else{
        divstr+='No Expertise </div>';
    }
    //    if(country){
    //        divstr+='<div id="workdiv0" style="position: absolute; width: auto; height: 14px; z-index: 5; left: 10px; top: 49px; font-size: 10px; color: #000000;">';
    //        divstr+='<img id="flagdiv" alt="flagimage" src="../static/images/flags/'+country+'.png" /> ';
    //        divstr+=country;
    //        divstr+=' </div>';
    //    }
    //    divstr+='<div id="workdiv1" style="position: absolute; width: 147px; height: 14px; z-index: 5; left: 97px; top: 48px; color: #000000; font-size: 9px;">';
    //    divstr+='EST Local Time : 10:45 PM</div>';
    divstr+='<div id="reviewdiv" style="width: 115px; height: 14px; color: #1F6598;">';
    divstr+='<span class="action" onclick=showcommondiv("ViewAllReviews.do?username='+escape(userid)+'&skillid=0","ConnectionPopUp","ConnectionPopUp")>[ '+reviews+' reviews ]</span></div>';
    divstr+='<div id="RatingStars">';
    divstr+='<img alt="" src="../static/images/'+rating+'red.gif"/></div>';
    divstr+='<div id="ratediv" style="color: #333333;">';
    divstr+='$ '+rpm+'/minute</div>';
    divstr+='</div>';
    divstr+='<div id="topBarMenu" style="position: absolute; width: 240px; height: 23px; z-index: 100; left: 117px; top: 12px; background-color: #E5ECF2; border:1px solid #CCC;">';
    divstr+='<div id="morediv'+i+'" onmouseover=viewPopupDiv("moreList'+i+'") onmouseout=hidePopDivForuser("moreList'+i+'") style="border: 0px none #CCCCCC; padding: 4px 0px 4px 0px; position: absolute; width: 58px; height: auto; z-index: 100; left: 182px; top: 1px; color: #004080; text-align: center; cursor: pointer;">';
    divstr+='More <img alt="" height="6" src="../static/images/arrowds.gif" width="6" />';
    divstr+='<div id="moreList'+i+'" style="display:none;border: 1px solid #80A0C0; position: absolute; width: 100px; height: auto; z-index: 210; left: -20px; top: 20px; color: #004080; background-color: #FFFFFF;text-align:left;">';
    divstr+='<div style="display:block; z-index:100; margin-left:0px; margin-top:0px; padding:6px; line-height:15px;">';
    if(userid == myuserid){
        divstr+='<span class="action" style="color:#1F6598;" onclick=showviewprofile("MyProfile.do?uid='+escape(userid)+'","middle_div","'+escape(userid)+'")>View Profile</span><br>';
    }
    else if(checkInGroup(userid)){
        if(login_user == null || login_user == '' || !login_user )
        {
            divstr+='<span class="action" style="color:#1F6598;" onclick=showviewprofile("ViewOtherProfile.do?uid='+escape(userid)+'&from=index","middle_div","'+escape(userid)+'")>View Profile</span><br>';
        }
        else{
            divstr+='<span class="action" style="color:#1F6598;" onclick=showviewprofile("ViewOtherProfile.do?uid='+escape(userid)+'","middle_div","'+escape(userid)+'")>View Profile</span><br>';
        }
        

    }
    else{
        if(login_user == null || login_user == '' || !login_user )
        {
            divstr+='<span class="action" style="color:#1F6598;" onclick=showviewprofile("ViewOtherProfile.do?uid='+escape(userid)+'&from=index","middle_div","'+escape(userid)+'")>View Profile</span><br>';
        }
        else{
            divstr+='<span class="action" style="color:#1F6598;" onclick=showviewprofile("ViewOtherProfile.do?uid='+escape(userid)+'","middle_div","'+escape(userid)+'")>View Profile</span><br>';
        }
        
    }
    if(userid != myuserid){
        divstr+='<span class="action" style="color:#1F6598;" onclick=showcommondiv("checkfeedback.do?uid='+escape(userid)+'&name='+escape(firstname)+'&skillid=0","ConnectionPopUp","ConnectionPopUp")>Give Feedback</span><br>';
    }
    divstr+='<span class="action" style="color:#1F6598;" onclick=showcommondiv("ViewAllReviews.do?username='+escape(userid)+'&skillid=0","ConnectionPopUp","ConnectionPopUp")>View Feedback</span><br>';
    if(userid != myuserid ){
        divstr+='<span class="action" style="color:#1F6598;" onclick=showcommondiv("connection/EditConnections.jsp?firstname='+escape(firstname)+'&conid='+escape(conid)+'&touserid='+escape(userid)+'&relation='+escape(relation)+'&tag='+escape(tag)+'","ConnectionPopUp","ConnectionPopUp")>Add as Expert</span><br>';
        divstr+='<span class="action" style="color:#1F6598;" onclick=showcommondiv("connection/EditConnections.jsp?firstname='+escape(firstname)+'&conid='+escape(conid)+'&touserid='+escape(userid)+'&relation='+escape(relation)+'&tag='+escape(tag)+'","ConnectionPopUp","ConnectionPopUp")>Add as Explorer</span><br>';
        divstr+='<span class="action" style="color:#1F6598;" onclick=showcommondiv("connection/EditConnections.jsp?firstname='+escape(firstname)+'&conid='+escape(conid)+'&touserid='+escape(userid)+'&relation='+escape(relation)+'&tag='+escape(tag)+'","ConnectionPopUp","ConnectionPopUp")>Add as Friend</span><br>';
    }
    divstr+='</div>';
    divstr+='</div></div>';
    if(userid == hiddenUserid){
        divstr+='<div id="chatdiv"  style="border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 0px solid #CCCCCC; border-bottom: 0px solid #CCCCCC; padding: 4px 0px 4px 0px; position: absolute; width: 76px; height: auto; z-index: 1; left: 103px; top: 1px; color: #004080; text-align: center; cursor: pointer;">';
        divstr+='Live Chat</div>';
    }
    else
    {
        divstr+='<div id="chatdiv" onclick="openChatWindow(\'';
        divstr+=userid;
        divstr+="','" + category;
        divstr+='\',\'' +firstname+ '\',\'';
        if(photo){
            divstr+=localhost+photo;
        }
        else
        {
            divstr+="../static/images/newUserImg.png";
        }

        divstr+='\',\'' +skypeid+ '\',\'' +position+ '\',\'' +company+ '\',event)" style="border-left: 1px solid #CCCCCC; border-right: 1px solid #CCCCCC; border-top: 0px solid #CCCCCC; border-bottom: 0px solid #CCCCCC; padding: 4px 0px 4px 0px; position: absolute; width: 76px; height: auto; z-index: 1; left: 103px; top: 1px; color: #004080; text-align: center; cursor: pointer;">';
        divstr+='Live Chat</div>';
    }
    if(userid == myuserid){
        divstr+='<div id="emaildiv"  style="padding: 4px 0px 4px 0px; position: absolute; width: 102px; height: auto; z-index: 1; left: 2px; top: 1px; color: #004080; text-align: center; cursor: pointer;">';
        divstr+='Send Message</div>';
    }
    else{
        divstr+='<div id="emaildiv" onclick=showComposeMsg("messages/popupcompose.jsp?replyto='+escape(userid)+'&firstname='+escape(firstname)+'","common","compose") style="padding: 4px 0px 4px 0px; position: absolute; width: 102px; height: auto; z-index: 1; left: 2px; top: 1px; color: #004080; text-align: center; cursor: pointer;">';
        divstr+='Send Message</div>';
    }
    divstr+='</div>';
    divstr+='</td>';
    divstr+='<td class="right_side_border">';
    divstr+='</td>';
    divstr+='</tr>';
    divstr+='<tr>';
    divstr+='<td class="corner_bottomleft">';
    divstr+='</td>';
    divstr+='<td class="bottom_side_border">';
    divstr+='</td>';
    divstr+='<td class="corner_bottomright">';
    divstr+='</td>';
    divstr+='</tr>';
    divstr+='</table>';
    divstr+='</div>';
    //colorBG(uli);
    mcancelclosetime();
    if(ddmenuitem)
        ddmenuitem.style.display = 'none';

    ddmenuitem = document.getElementById(xyz);
    ddmenuitem.innerHTML='';
    ddmenuitem.innerHTML=divstr;
    ddmenuitem.style.display = '';

}


function showVideoinPopup(url, divid, e) {

    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }

    var divstr ='<table id="pop_dialog_tableA" class="pop_dialog_tableA" style="width: auto; margin-left:15px;">';
    divstr +='<tbody>';
    divstr +='<tr>';
    divstr +='<td class="pop_topleftA"/>';
    divstr +='<td class="pop_borderA"/>';
    divstr +='<td class="pop_toprightA"/>';
    divstr +='</tr>';
    divstr +='<tr>';
    divstr +='<td class="pop_borderA"/>';
    divstr +='<td id="pop_contentA" class="pop_contentA">';
    divstr += '<div id="InnerDiv" 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="closecommonconn()" style="cursor:pointer; position: absolute; width: 50px; height: 15px; z-index: 3; left: 565px; top: 3px; ">';
    divstr += 'Close X</div>';
    divstr += '<div id="iframe" onclick=showIframe("' + divid + '",'+escape("http://www.google.com")+') style="cursor:pointer; position: absolute; width: 50px; height: 15px; z-index: 3; left: 300px; top: 3px; ">';
    divstr += 'Iframe</div>';
    divstr += '<div style="position: absolute; left: 150px; top: 50px;">';
    divstr += '<object style="margin:0px" width="300" height="200">';
    divstr += '<param name="movie" value="'+contentstr[url].contenturl+'"/>';
    divstr += '<param name="allowFullScreen" value="true"/>';
    divstr += '<param name="allowScriptAccess" value="always"/>';
    divstr += '<embed src="'+contentstr[url].contenturl+'" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="300" height="200"></embed>';
    divstr += '</object>';
    divstr +='</div>';
    divstr += '</div>';
    divstr +='</td>';
    divstr +='<td class="pop_borderA"/>';
    divstr +='</tr>';
    divstr +='<tr>';
    divstr +='<td class="pop_bottomleftA"/>';
    divstr +='  <td class="pop_borderA"/>';
    divstr +='<td class="pop_bottomrightA"/>';
    divstr +='</tr>';
    divstr +='</tbody>';
    divstr +='</table>';

    document.getElementById(divid).style.display='';
    document.getElementById(divid).style.top= (tempY-50)+'px';
    document.getElementById(divid).style.marginLeft = newIcordX+'px';
    document.getElementById(divid).innerHTML = '';
    document.getElementById(divid).innerHTML=divstr;
}

function managecommondiv(actionURL,userid,input,e){
    mangeuserid=userid;

    var IE = document.all?true:false;

    if (IE) { // grab the x-y pos.s if browser is IE
        tempX = event.clientX;// + document.body.scrollLeft + document.documentElement.scrollLeft;
        tempY = event.clientY ;//+ document.body.scrollTop + document.documentElement.scrollTop;
    }
    else { // grab the x-y pos.s if browser is NS
        tempX = e.pageX;
        tempY = e.pageY;
    }
    if (tempX < 0){
        tempX = 0;
    }
    if (tempY < 0){
        tempY = 0;
    }
    pid=input;
    showResultWithQueryStr(actionURL, invID, commonmanagecallback, null);
    return true;
}


function showcommondiv(actionURL,input,e,flag){
    if(login_user == null || login_user == '')
    {
        ModalPopup('NewLoginpopupdiv','');
        if(flag == null || flag == 'undefined'){
            document.getElementById('login_details').value = 'other:'+actionURL+':'+input+':'+e;
            document.getElementById('regRedirect').value = 'other:'+actionURL+':'+input+':'+e;
        } else if(flag == 'forward') {
            document.getElementById('login_details').value = 'forward:'+actionURL+':'+input+':'+e;
            document.getElementById('regRedirect').value = 'forward:'+actionURL+':'+input+':'+e;
        }
    }
    else
    {   
        freezid=input;
        lid = e;
        //alert(commoncallback);
        showResultWithQueryStr(actionURL, input, commoncallback, null,true);
    }
    if(flag == 1){
        getProfileViewers('getViewers.do', 'profileVisits');
    }
    else if(flag == 2){
        showRequestResult('CheckMyConnections.do', 'invitationRequest',0);
    }
}
//function showcommonforward(actionURL,input,e){
//    if(login_user == null || login_user == '')
//    {
//        ModalPopup('NewLoginpopupdiv','');
//        document.getElementById('login_details').value = 'other:'+actionURL+':'+input+':'+e;
//    }
//    else
//    {
//        pid=input;
//        lid = e;
//        showResultWithQueryStr(actionURL, input, callbackforward, null);
//    }
//}

function showContentFromIndex(actionURL,input,e,userType,content_id,commentText){
    contentId = content_id;
    contentComment = commentText;
    user_type = userType;
    freezid=input;
    lid = e;
    showResultWithQueryStr(actionURL, input, commoncallback, null,true);
}
function callbackforward(result,mid){
    document.getElementById(mid).innerHTML = '';
    document.getElementById(mid).innerHTML=result;
    clearItems(new Array('subcategory','sub_subcategory'));
    getAreaAndFill('category');
    fillConnectionList('msg_to');
    listUserConnections('MyConnection.do','0',myuserid);

}
function showcommondivIndex(actionURL,input,e){
    freezid=input;
    lid = e;
    showResultWithQueryStr(actionURL, input, commoncallbackindex, null);
}

function showComposeMsg(actionURL,input,parent,flag){
    if(flag == 1){
        var kbOwner = document.getElementById('viewkbname').innerHTML;
        actionURL+= '&firstname='+kbOwner;
    }
    if(flag == 'InvMsg'){
        closecommonconn();
    }
    pid=input;
    freezid = input;
    lid=parent;
    if(login_user == null || login_user == '')
    {
        ModalPopup('NewLoginpopupdiv','');
        document.getElementById('login_details').value = 'sendmsg:'+actionURL+':'+input+':'+parent;
    }
    else
    {
        showResultWithQueryStr(actionURL, input, callbackCompose, null,true);
    }
}

var arVersion = navigator.appVersion.split("MSIE");
var version = parseFloat(arVersion[1]);

function fixPNG(myImage)
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters))
    {
        var imgID = (myImage.id) ? "id='" + myImage.id + "' " : "";
        var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : "";
        var imgTitle = (myImage.title) ?
        "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' ";
        var imgStyle = "display:inline-block;" + myImage.style.cssText;
        var strNewHTML = "<span " + imgID + imgClass + imgTitle
        + " style=\"" + "width:" + myImage.width
        + "px; height:" + myImage.height
        + "px;" + imgStyle + ";"
        + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
        + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>";
        myImage.outerHTML = strNewHTML;
    }
}

function checkForServices(details, event,id,feedbackUser)
{   

    var params = details.split(":");
    var opt = params[0];
    if(id!= 'null'){
        directToReg(id,id,feedbackUser);
    }
    else if(opt == 'chat')
    {
        openChatWindow(params[1],params[2],params[3],params[4]);
        return true;
    }
    else if(opt == 'sendmsg')
    {
        showComposeMsg(params[1],params[2],params[3],event);
        return true;
    }
    else if(opt == 'viewprofile')
    {
        showviewprofile(params[1],params[2],params[3]);
        return true;
    }
    else if(opt == 'viewkbprofile')
    {
        showResultAct(params[1],params[2],params[4],params[5],params[6],params[3]);
        return true;
    }
    else if(opt == 'Inbox')
    {
        showResultAct('GetMessages.do', 'middle_div',3);
        return true;
    }
    else if(opt == 'viewpendingreq')
    {   
        showmyconnectiion(params[1],params[2],params[3],params[4],params[5]);
        return true;
    }
    else if(opt == 'viewotherconnections')
    {
        showmyconnectiion(params[1],params[2],params[3],params[4],params[5],params[6]);
        return true;
    }
    else if(opt == 'addcomment')
    {
        showContentFromIndex(params[1],'ConnectionPopUp','ConnectionPopUp',params[4],params[2],params[3]);
        return true;
    }
    else if(opt == 'postcontent')
    {
        postContent(params[1],params[2],'globalErrorMessage');
        return true;
    }
    else if(opt == 'postproject')
    {
        ReAddProject(params[1],params[2]);
        return true;
    }
    else if(opt == 'other')
    {   
        showcommondiv(params[1],params[2],params[3]);
        return true;
    }
    else if(opt == 'forward')
    {   
        showcommondiv(params[1],params[2],params[3]);
        return true;
    }
    else if(opt == 'iknowit')
    {
        //alert(opt);
        showKnowItInPopUp(params[1],params[2],params[3]);
        return true;
    }
    else if(opt == 'ilearnit')
    {
        //alert(opt);
        showLearnItInPopUp(params[1],params[2],params[3]);
        return true;
    }
    else if(opt == 'search')
    {
        var d = document.getElementById("ezdiadbsearch");
        if (d) {
            d.value = params[2];
            var e = document.getElementById((params[1] == "content")?"kb_search_btn":"expert_search_btn");
            if (e) e.onclick();
        }
    }
    else if(opt == 'paypal')
    {
        showcommondiv('AddFund.do?projectInfoType=addFund', 'ConnectionPopUp','ConnectionPopUp');
        return true;
    }
    else if(opt == 'Project'){

        showResultAct(params[1], params[2]);
        if(params[3] == login_user){
            params[3] = '[{"response":"Sorry!! You Can not bid your project yourself !!"}]';
            handleGlobalResponse2(params[3]);
            return true;
        }
        
    }
    return false;
}