var iCallID
function initWebservices() 
{	
	servidor = window.location.host;			
	if(servidor=="www.signumresearch.com")
	{service.useService("http://www.signumresearch.com/Controls/Toolbar/WSGetAutocomplete.asmx?WSDL","GetAutoComplete");}
	if(servidor=="www.signumresearch.com.mx")
	{service.useService("http://www.signumresearch.com.mx/Controls/Toolbar/WSGetAutocomplete.asmx?WSDL","GetAutoComplete");}			
	if(servidor=="signumresearch.com")
	{service.useService("http://signumresearch.com/Controls/Toolbar/WSGetAutocomplete.asmx?WSDL","GetAutoComplete");}
	if(servidor=="signumresearch.com.mx")
	{service.useService("http://signumresearch.com.mx/Controls/Toolbar/WSGetAutocomplete.asmx?WSDL","GetAutoComplete");}	
	if(servidor=="localhost")	
	service.useService("http://localhost/signum/Controls/Toolbar/WSGetAutocomplete.asmx?WSDL","GetAutoComplete");				
}
function DoMyLookup(value) {
	if(value != "")			
	{										
		iCallID = service.GetAutoComplete.callService(wsResult, "GetAutoComplete", value);			
	}
	else
	{
		document.all.divAutoCom.innerHTML = "";
		document.all.divAutoCom.style.backgroundColor  = "White";
	}
}			
function wsResult(result) {

	if (!result.error)
		{								
			if(result.value.length >0)
			document.all.divAutoCom.style.backgroundColor  = "#f6f6f6";	
			else document.all.divAutoCom.style.backgroundColor  = "#ffffff";									
			document.all.divAutoCom.className ="m0l0iout";
			document.all.divAutoCom.innerHTML = result.value;
			window.load= init();		
		}			
}


function cleanText()
{	
	document.getElementById("txtAutoCom").value = "";
}
function updateText(emisora,description)
{
    
	var cadena  = String(window.location).split("/");
	var cutPage = String(cadena[(cadena.length-1)]);
	var Page = String(cutPage).split('.');
	var Page1 = Page[0];
	   	
	document.getElementById("txtAutoCom").value = emisora+" "+description;
	if(Page1 == "Default")
	{eval(document.location.href="Equity/companies.aspx?idemp="+emisora);}
	else
	if(Page1 != "Default")
	{eval(document.location.href="../Equity/companies.aspx?idemp="+emisora);}
	
}		
			

function checkKeycode(e) {
var tabla;
var ban=false;
var count=-1;
var tabla=document.getElementById("tablaws");
var div =document.getElementById("divAutoCom");

document.onkeydown = checkKeycode   
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	if(ban && (keycode==38 || keycode==40)){
		if(count>=0){
						
			tabla.rows[count].style.backgroundColor='';
		}
		if(keycode==38){
		//alert('');
			arriba();
		}
		else{
			abajo();
		}
		tabla.rows[count].style.backgroundColor='#CCCCCC';
	}
}
function arriba(){
	if(count<1){
		count=tabla.rows.length-1;
	}
	else count--;
}
function abajo(){
	if(count>=(tabla.rows.length-1)){
		count=0;
	}
	else count++;
}
function init(){	
	tabla=document.getElementById("tablaws");
	//alert(tabla);
	
}
