//////////////////////Browser detection////////////
var browserName='';
if(navigator.appName == "WebTV")
{
	browserName='WTV';
}
 if(navigator.appName == "Netscape")
{
	browserName='NS';
}
 if(navigator.appName == "Microsoft Internet Explorer")
{
	browserName='IE';
}

////////////////////////////////////////////////////

		var txtFieldName='';
		var txtFieldName1='';
        var Cbo = new CallBackObject();
        Cbo.OnComplete = Cbo_Complete;
        Cbo.OnError    = Cbo_Error;
        
        
        function getSrchBox(txtSrch,txtName)
        {
		  cleanUp(txtFieldName1,'div_Keyword');
		  var oDiv=document.getElementById('autocomplete');
		  setLyr(txtName,oDiv);
          txtFieldName = txtName;
          if( txtSrch.length > 0 )
          {
            Cbo.DoCallBack('txtSrch', '');
          }
          else
          {
            Cbo.AbortCallBack();
            oDiv.innerHTML = '';
            HideDiv("autocomplete");
          }
        }

        function Cbo_Complete(responseText, responseXML)
        {
		  var msg = document.getElementById('autocomplete');
          if( responseText == "" )
          {
            msg.innerHTML = '';
            HideDiv("autocomplete");
          }
          else
          {
			ShowDiv("autocomplete");
            msg.innerHTML =responseText;
          }
        }

        function Cbo_Error(status, statusText, responseText)
        {
          alert(responseText);
        }
              
		function setTxtNow(strTxt){
			txtFieldName.value =strTxt;
			 HideDiv("autocomplete");
			 document.forms[0].submit();
		}
		
		
function initilaize(){
	
	setLyr(obj,lyr)
}

//////////////Position the Layer...

function setLyr(oText,oDiv)
{
	// align the drop down div
	var c = GetCoords(oText);
	var n = oText.style.pixelHeight;
	var w =oText.style.pixelWidth;
	if(browserName=='IE'){
		oDiv.style.pixelWidth = oText.style.pixelWidth + 1;
	}else if(browserName=='NS'){
		oDiv.style.width="141px";
	}
	
	
	if( !n )
	{ 
	  n = 25;
	 }
	else
	{
	  n += 2;
	}
	oDiv.style.left = c.x;
	var rightCord=c.y;
	oDiv.style.top = c.y + n-3;
	//oDiv.style.display = 'none';
	oDiv.style.position = 'absolute';
	
	oDiv.style.border = '1px';
	oDiv.style.borderColor = '#2E638C';
	oDiv.style.borderStyle = 'solid';
	oDiv.style.backgroundColor = 'white';
	oDiv.style.padding = '2';
}

////////////Position the Layer////////////////////
  //////////////////////////   Clean Up code ///////////////////
  
  function cleanUp(txtFld,divID){
	//alert(divID);
	if (document.getElementById(divID)){
		
		txtFld.value='';
		HideDiv(divID);
	}
  }
  
  
  ///////////////////////Clean Up code Ends here //////////////


/////////////////////////////   Javascript code for second list box ////////////////////////////////////////////

		var Cbo1 = new CallBackObject();
	    Cbo1.OnComplete = obj_Complete;
		Cbo1.OnError    = obj_Error;
		
        function getAutoComplete(txtStr,txtName)
        {
       	  cleanUp(txtFieldName,'autocomplete');
		  var oDiv=document.getElementById('div_Keyword');
		  setLyr(txtName,oDiv);
          txtFieldName1 = txtName;
          if( txtStr.length > 0 )
          {
            Cbo1.DoCallBack('txtStr', '');
          }
          else
          {
            Cbo1.AbortCallBack();
            oDiv.innerHTML = '';
            HideDiv("div_Keyword");
          }
        }
        
        function obj_Complete(responseText, responseXML)
        {
		  var msg = document.getElementById('div_Keyword');
          if( responseText == "" )
          {
            msg.innerHTML = '';
            HideDiv("div_Keyword");
          }
          else
          {
			ShowDiv("div_Keyword");
            msg.innerHTML =responseText;
          }
        }

        function obj_Error(status, statusText, responseText)
        {
          alert(responseText);
        }
        
        function setTxtNow1(strTxt){
			txtFieldName1.value =strTxt;
			 HideDiv("div_Keyword");
			 txtFieldName1.focus();
		}    
		