function RenderExpertStatus(divClientID ,expertID , status, expertName, onlineFee, catID, sessionUrlParams, sendRequestUrlParams,onlineOnly)
{
    var requestByMail =  "javascript:openRequestByMail('"+ sendRequestUrlParams +"')" ;
    var onlineSession =  "javascript:openOnlineSession('"+ sessionUrlParams +"')" ;
    
    if (onlineOnly==1)  //only online
    {
        document.getElementById(divClientID).innerHTML =  '<div id="onlineOnly" class="veryTiny"><span class="expertStatus">Online</span><br><span><a href=' + onlineSession + ' title="Contact Live!"><img src="' + imagesPath + '/images/view1/Status/Status_1.gif" WIDTH="122" HEIGHT="21" border="0"></a></span></div>';
    }
    else if (onlineOnly==2) //show nothing
    {
        document.getElementById(divClientID).innerHTML =  '<div id="showNothing"></div>';
    }
    else    //regular mode
    {
        if (status==4 || status==1)  //expert is online
	    {
            document.getElementById(divClientID).innerHTML ='<div id="divOnlineStatus1"  class="veryTiny" ><span class="expertStatusOnline">Online</span><br><span style="DISPLAY:none"><a  href="' + requestByMail + '" title="Send a request" style="border-width:0px;"><img src="' + imagesPath + '/images/categories/buttons/send_email_button.gif" border="0" WIDTH="96" HEIGHT="25"></a></span><span><a href=' + onlineSession + ' title="Contact Live!" style="border-width:0px;"><img src="' + imagesPath + '/images/categories/buttons/contact_live_button.gif"  border="0"></a></span><br><span class="text6">$' + onlineFee +'/minute<br>OR <a href=' + requestByMail + ' class="text5">Send a request</a></span></div>';
        }    
        if (status==2)               // expert is Busy
	    {
	        document.getElementById(divClientID).innerHTML ='<div id="divOnlineStatus2" class="veryTiny" ><span class="expertStatusOnline">Busy</span><br><span><a href="' + requestByMail + '" title="Send a request"><img src="' + imagesPath + '/images/categories/buttons/send_email_button.gif" border="0" WIDTH="96" HEIGHT="25"></a></span></div>';
        }
        if (status==0 || status==3 || status==-1)   // expert is offline or suspended
	    {
	        document.getElementById(divClientID).innerHTML ='<div id="divOnlineStatus03" class="veryTiny" ><span class="expertStatus"></span><br><span><a href="' + requestByMail + '" title="Send a request" style="border-width:0px;"><img src="' + imagesPath + '/images/categories/buttons/send_email_button.gif" border="0" WIDTH="96" HEIGHT="25"></a></span></div>';
        }
    }
    
    
    //this function should be implemented if we need other things beside the status changing
    if (typeof(AdditionalAjaxFunctionality) !== "undefined") 
        AdditionalAjaxFunctionality(status)
}

function openRequestByMail(qs)
{   
	var url;
	url = "/Registration/send-email.aspx" + qs;
    
	// are we in an iframe?
    if (self != window.top)
    {
        window.open(url,"_blank");	
    }
    //are we in a popup
    else 
    {
        if ( openTarget == "_top")
        {
            window.opener.location = url;
            window.close();	   
        }
        else  //regular case
        {
             window.open(url,"_self");	
        }
     }
}

function openOnlineSession(qs)
{   
	var url;
	url = "/session/session-selector.aspx" + qs;
    
	// are we in an iframe?
    if (self != window.top)
    {
        window.open(url,"_top");	
    }
    //are we in a popup
    else 
    {
        if ( openTarget == "_top")
        {
            window.opener.location = url;
            window.close();	   
        }
        else  //regular case
        {
             window.open(url,"_self");	
        }
     }
}