﻿// JScript File
function ShowMessageBox(a,p,u)
{
	p = p || window.event;
	n = p.keyCode;
	var j=0;
	if (n==13)
	{
        document.getElementById("SpanConnectionList").style.display="none";
        return false;
    }
	if (n==38 || n==40)
	{  
		if (n==40)
		{
			if (document.getElementById('tbs')!=null)
			{  				
				document.getElementById('tbs').rows[j].cells[0].style.backgroundColor="#ededed";					
				str=document.getElementById('tbs').rows[j].cells[0].innerHTML                 
				ss=str.replace(/&amp;/ ,"&")                
				document.getElementById("ctl00_ContentPlaceHolder1_txtAuthoredBy").value=ss;
				if (j!=0)
				{
					document.getElementById('tbs').rows[j-1].cells[0].style.backgroundColor="#ffffff";	
				}
				if (j==0)
				{
					document.getElementById('tbs').rows[document.getElementById('tbs').rows.length-1].cells[0].style.backgroundColor="#ffffff";	
				}
				j=j+1;
				if (j==document.getElementById('tbs').rows.length)
				{
					j=0;		
				}
				return false;
			}
		}
	}
	if (n!=38 || n!=40 || n!=37 || n!=39 || n!=13)
	{
		if (a.value.length>0)
		{   
			j=0;
			//var urlString = "uid=" + a.value +"&s=1";			
			var urlString = "q=" + a.value + "&uid="+ u + "&mode=1";
			RunAjax("ConnectionList.aspx", urlString, "GET", "1"); 
			return false;
		}
	}
}
	
function Handle(responseTxt, contextId)
{ 
    if(contextId == 1)
	{
		if (responseTxt.length>0)
		{ 
			document.getElementById("SpanConnectionList").innerHTML = responseTxt;
			document.getElementById("SpanConnectionList").style.display="block";
		}
		if (responseTxt.length==0)
			document.getElementById("SpanConnectionList").style.display="none";
	}
	
	if(contextId == 2)
	{
		if (responseTxt.length>0)
		{ 
			document.getElementById("SpanConnectionList1").innerHTML = responseTxt;
			document.getElementById("SpanConnectionList1").style.display="block";
		}
		if (responseTxt.length==0)
			document.getElementById("SpanConnectionList1").style.display="none";
	}
}
function HideList(hid)
{
    if(hid == 1)
    {
	    document.getElementById("SpanConnectionList").style.display="none";
	}
}
function selectconnection(s)
{
    s.style.backgroundColor="#ededed";
    str=s.innerHTML;
    ss=str.replace(/&amp;/ ,"&")
    document.getElementById("ctl00_ContentPlaceHolder1_txtAuthoredBy").value =ss;
}
function deseletcme(a)
{
	 a.style.backgroundColor="#ffffff";
}
function CancelDiv(p)
{
	p = p || window.event;
	var nEnter = p.keyCode;
	if(nEnter == 13)
	{
        document.getElementById("SpanConnectionList").style.display="none";
	    return false;
	}
}


// for CommentedBy Text box

function ShowMessageBox1(a,p,u)
{
	p = p || window.event;
	n = p.keyCode;
	var j=0;
	if (n==13)
	{
        document.getElementById("SpanConnectionList1").style.display="none";
        return false;
    }
	if (n==38 || n==40)
	{  
		if (n==40)
		{
			if (document.getElementById('tbs')!=null)
			{  				
				document.getElementById('tbs').rows[j].cells[0].style.backgroundColor="#ededed";					
				str=document.getElementById('tbs').rows[j].cells[0].innerHTML                 
				ss=str.replace(/&amp;/ ,"&")                
				document.getElementById("ctl00_ContentPlaceHolder1_txtCommentBy").value=ss;
				if (j!=0)
				{
					document.getElementById('tbs').rows[j-1].cells[0].style.backgroundColor="#ffffff";	
				}
				if (j==0)
				{
					document.getElementById('tbs').rows[document.getElementById('tbs').rows.length-1].cells[0].style.backgroundColor="#ffffff";	
				}
				j=j+1;
				if (j==document.getElementById('tbs').rows.length)
				{
					j=0;		
				}
				return false;
			}
		}
	}
	if (n!=38 || n!=40 || n!=37 || n!=39 || n!=13)
	{
		if (a.value.length>0)
		{   
			j=0;
			//var urlString = "uid=" + a.value +"&s=1";			
			var urlString = "q=" + a.value + "&uid="+ u + "&mode=2";
			RunAjax("ConnectionList.aspx", urlString, "GET", "2"); 
			return false;
		}
	}
}

function HideList1(hid)
{
    if(hid == 1)
    {
	    document.getElementById("SpanConnectionList1").style.display="none";
	}
}
function selectconnection1(s)
{
    s.style.backgroundColor="#ededed";
    str=s.innerHTML;
    ss=str.replace(/&amp;/ ,"&")
    document.getElementById("ctl00_ContentPlaceHolder1_txtCommentBy").value =ss;
}
function deseletcme1(a)
{
	 a.style.backgroundColor="#ffffff";
}
function CancelDiv1(p)
{
	p = p || window.event;
	var nEnter = p.keyCode;
	if(nEnter == 13)
	{
        document.getElementById("SpanConnectionList1").style.display="none";
	    return false;
	}
}






