 
/*
* This url get a default banner for this service.
*/
var bannerRandom='';
var bannerRandomPrio='';
var existBanner=0;
function getDefaultBanner()
{
	
	var url="http://www.vloqutor.com/pruebaslingua-tools/external-includes/banner_imgBoxSuggestions.php?us=1073";
	//alert(url);
	var script = document.createElement("script");        
	script.setAttribute("src",url);
	script.setAttribute("type","text/javascript");                
	document.body.appendChild(script);
	
}
function getBannerRandom(banner)
{
 /*
 * Default banner
 */
  bannerRandom=banner;
}
// This vars are used for saving consultations into sugs_selected database.
var optionSentence=0;
var optionPhrase='';
var optionPhraseSelected='';

document.write('<link href="http://www.vloqutor.com/pruebaslingua-tools/external-includes/style-sbox.php?id=26320100903180243&colorBoxFont=white&colorBoxBg=red&colorListFont=white&colorListHighlight=yellow&colorListBg=red" rel="stylesheet" type="text/css">');
document.write('<input accesskey="q" tabindex="1" id="search26320100903180243" name="aa" type="text" size="32" value="" class="searchbox_26320100903180243" autocomplete="off" /><div align="left" id="searchsuggestions26320100903180243"></div>');
/*
* Text field
*/
var searchfield26320100903180243=document.getElementById("search26320100903180243");
/*
* Div of consultations
*/
var sugbox26320100903180243=document.getElementById("searchsuggestions26320100903180243");
var queries26320100903180243=new Array();
var suggestions26320100903180243=new Array();
var searchValue26320100903180243;
var hoveredSuggestion26320100903180243=-1;
var g_old_action26320100903180243;


function realOffset26320100903180243(B,A)
{
	var C=0;
	while(B)
	{
		C+=B[A];B=B.offsetParent
	}
	return C;
}
/*
* Send a consultation where the user push enter.
*/
function enviar_consulta26320100903180243()
{
 enviarForm26320100903180243();
 return false;;
}

/*
*  Send the form when the user has pushed enter or other key.
*/
function buildSearch26320100903180243()
{
    if (document.prueba)
	{
    	g_old_action26320100903180243=document.prueba.onsubmit;
	}
    else
	{
		if (document.getElementById('prueba'))
		{
		g_old_action26320100903180243=document.getElementById('prueba').onsubmit;
		}
    }
    if (document.prueba)
	{
    	document.prueba.onsubmit=enviar_consulta26320100903180243;
	}
	else
	{
		if (document.getElementById('prueba'))
		{
			document.getElementById('prueba').onsubmit=enviar_consulta26320100903180243;
		}
    }
	searchfield26320100903180243.setAttribute("autocomplete","off");
	searchfield26320100903180243.onkeydown=function(F)
	{
				try{
					searchKeyDown26320100903180243(event.keyCode)
				}
				catch(G)
				{
					searchKeyDown26320100903180243(F.keyCode)
				}
	};
	searchfield26320100903180243.onkeyup=function(F)
	{
				try
				{
					searchKeyUp26320100903180243(event.keyCode)
				}
				catch(G)
				{
					searchKeyUp26320100903180243(F.keyCode)
				}
	};
	searchfield26320100903180243.onblur=function()
	{
				setTimeout(hideSugbox26320100903180243,250)
	}
	
	
}
/*
*  Select a suggestion of the suggestions list.
*/
function selectSuggestion26320100903180243(A)		
{
   var userText=document.getElementById('search26320100903180243').value;
   userText=userText.toLowerCase();
   if(hoveredSuggestion26320100903180243 < npalabras_sugerencia26320100903180243)
   {
     
	searchfield26320100903180243.value=searchfield26320100903180243.value.substr(0,g_pos_palabra26320100903180243+1)+suggestions26320100903180243[hoveredSuggestion26320100903180243];
   }
   else
   {
     searchfield26320100903180243.value=suggestions26320100903180243[hoveredSuggestion26320100903180243];
   }
   optionPhraseSelected=suggestions26320100903180243[hoveredSuggestion26320100903180243];
}
/*
* Change into state hover a suggestion
*/
function hoverSuggestion26320100903180243(A)
{
			for(var B=0;B<suggestions26320100903180243.length;B++)
			{
				sugbox26320100903180243.getElementsByTagName("a")[B].className=""
			}
			if(A!=-1)
			{
				sugbox26320100903180243.getElementsByTagName("a")[A].className="hovered";
				hoveredSuggestion26320100903180243=A
			}
}
/*
* When user push a key down
*/
function searchKeyDown26320100903180243(A)
{
			if(sugbox26320100903180243.style.display=="block")
			{
				if(A!=38&&A!=40)
				{
					hoveredSuggestion26320100903180243=-1
				}
				if(A==38&&hoveredSuggestion26320100903180243!=-1)
				{
					hoveredSuggestion26320100903180243--;
					hoverSuggestion26320100903180243(hoveredSuggestion26320100903180243);
                    if(hoveredSuggestion26320100903180243<npalabras_sugerencia26320100903180243)
                    {
					 searchfield26320100903180243.value=searchfield26320100903180243.value.substr(0,g_pos_palabra26320100903180243+1)+suggestions26320100903180243[hoveredSuggestion26320100903180243];
                    }
                    else
                    {
                     searchfield26320100903180243.value=suggestions26320100903180243[hoveredSuggestion26320100903180243];
                    }
					//searchfield26320100903180243.value=suggestions26320100903180243[hoveredSuggestion26320100903180243]
				}
				if(A==40&&hoveredSuggestion26320100903180243<suggestions26320100903180243.length-1)
				{
					hoveredSuggestion26320100903180243++;
					hoverSuggestion26320100903180243(hoveredSuggestion26320100903180243);
                    if(hoveredSuggestion26320100903180243<npalabras_sugerencia26320100903180243)
                    {
					 searchfield26320100903180243.value=searchfield26320100903180243.value.substr(0,g_pos_palabra26320100903180243+1)+suggestions26320100903180243[hoveredSuggestion26320100903180243];
                    }
                    else
                    {
                     searchfield26320100903180243.value=suggestions26320100903180243[hoveredSuggestion26320100903180243];
                    }
				}
				if(A==38&&hoveredSuggestion26320100903180243==-1)
				{
					searchfield26320100903180243.value=searchValue26320100903180243				}
			}
}
/*
* When user push a key up
*/
function searchKeyUp26320100903180243(A)
{
			
			if(A!=38&&A!=40)
			{
				searchValue26320100903180243=searchfield26320100903180243.value;
			}
			if(searchfield26320100903180243.value!=""&&A!=13&&A!=27&&A!=38&&A!=40)
			{
				//giveSuggestions();
				buscar_sugerencias26320100903180243();
			}
			if((searchfield26320100903180243.value==""||A==27)&&sugbox26320100903180243.style.display=="block")
			{
				hideSugbox26320100903180243()
			}
}

function getElementPosition(elemID){
	var offsetTrail = document.getElementById(elemID);
	var offsetLeft = 0;
	var offsetTop = 0;
	while (offsetTrail){
		offsetLeft += offsetTrail.offsetLeft;
		offsetTop += offsetTrail.offsetTop;
		offsetTrail = offsetTrail.offsetParent;
	}	
	if (navigator.userAgent.indexOf('Mac') != -1 && typeof document.body.leftMargin != 'undefined'){
		offsetLeft += document.body.leftMargin;
		offsetTop += document.body.topMargin;
	}
	return {left:offsetLeft,top:offsetTop};
}
/*
* Show div of suggestions
*/
function showSugbox26320100903180243()
{
					sugbox26320100903180243.style.top=(realOffset26320100903180243(searchfield26320100903180243,"offsetTop")+searchfield26320100903180243.offsetHeight-1)+"px";
            sugbox26320100903180243.style.left=realOffset26320100903180243(searchfield26320100903180243,"offsetLeft")+"px";
         			//adHiders[0]=true;
			//updateAd();
			sugbox26320100903180243.style.display="block";
			
}
/*
* Hide div of suggestions
*/
function hideSugbox26320100903180243()
{
			sugbox26320100903180243.style.display="none";
			//adHiders[0]=false;
			//updateAd()
};

  
/*
* Update banner. The banner isnt random, depends of the user write.
*/
var npalabras_sugerencia26320100903180243=0;
function updateBanner26320100903180243(response,elemen )
{
	
  if (document.getElementById(elemen))
  {
  		if (response!="")
  		{
  		    //alert(response);
  			document.getElementById(elemen).innerHTML=response;
  			//alert(response);
  			bannerRandomPrio=response;
  		}
  		else
  		{
  		   bannerRandomPrio='';
  		}
  	
  }
}
/*
* This function is called from sugestions_json. Show the suggestions into suggestions field.
*/
function stateChanged_sugerencias26320100903180243(sugerencias,npalabras_sugerencia)
{
 
 	if (existBanner==0)
	{
		getDefaultBanner();
		existBanner=1;
	}
		
 //xmlHttp26320100903180243.loadXML(unescape(xmlstr));
 //alert(sugerencias.length);
 npalabras_sugerencia26320100903180243=npalabras_sugerencia;
 suggestions26320100903180243=new Array();
 suggestions26320100903180243=sugerencias;

	 if(suggestions26320100903180243.length==0)
	 {
				hideSugbox26320100903180243()
	 }
	 else
	 {
				showSugbox26320100903180243()
	 }
	 sugbox26320100903180243.innerHTML="";


	 
     /*
     Suggestion list remensionable.
     */
	 var max=-1;
	 var cwords=0;
	 var csugs=0;
	 	 
	 codeHTML='<table id="tablesugs26320100903180243" style="border:0px solid #FF0000;width:370px;">';
	 for(var A=0;A< suggestions26320100903180243.length;A++)
	 {
	 			var sugerencia=searchfield26320100903180243.value.substr(0,g_pos_palabra26320100903180243+1)+suggestions26320100903180243[A];
	 			if (suggestions26320100903180243[A].length>max)
	 				max=suggestions26320100903180243[A].length;
                if(A< npalabras_sugerencia26320100903180243)
                {
                
										    
						codeHTML+='<tr><td style="color:#999"><a style="color:#999" onclick="pushNoOption26320100903180243();selectSuggestion26320100903180243('+A+')" onmouseover="hoverSuggestion26320100903180243('+A+')">'+suggestions26320100903180243[A]+'</a></td></tr>';
					
									}
                else
                {
                                    	    var bcolor='#FFF';
                	    codeHTML+='<tr><td style="border-left:5px solid #999;background:'+bcolor+'"><a style=";"  onclick="pushOption26320100903180243();selectSuggestion26320100903180243('+A+')" onmouseover="hoverSuggestion26320100903180243('+A+')">';
                		
                	var jump=false;
                	                	var characters=41;
                	for(var m=0; m< suggestions26320100903180243[A].length; m++)
                	{
	                	   codeHTML+=suggestions26320100903180243[A].charAt(m);
	                	   if ((m+2)  % characters  == 0) 
	                	   {
	                	     jump=true;
	                	   }
	                	   if (suggestions26320100903180243[A].charAt(m)==' ')
	                	   {
	                	   		if (jump)
	                	   		{
									codeHTML+="<br />";
									jump=false;
								}
	                	   		
	                	   }
                	}
                	codeHTML+='</a>';
                	codeHTML+='</td></tr>';
				}
	 }
	 codeHTML+='</table>';
	 //alert(codeHTML);
	 sugbox26320100903180243.innerHTML+=codeHTML;     
	 		     
	     	     sugbox26320100903180243.innerHTML+="<div align='center' id='ad_cell26320100903180243'></div>";
	     
	     if (bannerRandomPrio!="")
	     {
	     	document.getElementById("ad_cell26320100903180243").innerHTML=bannerRandomPrio;
	     }	
	     else
	     {
	     	document.getElementById("ad_cell26320100903180243").innerHTML=bannerRandom;
	     }
	     	 	 sugbox26320100903180243.innerHTML+="<div align=\"right\" style=\"font-size:9px;\"><a style=\"font-size:9px;font-style:italic;width:"+(searchfield26320100903180243.offsetWidth*1-6)+"px;\" href=\"http://www.vloqutor.com/pruebaslingua-tools/index.php?us=1073\" target=\"_blank\">Lingua-tools suggestions</a></div>";
	     f_max=400;
	     if (f_max>0)
	     {
	     	sugbox26320100903180243.style.width=f_max+'px';
	     }
	     
}
/*
* The user push a word
*/
function pushOption26320100903180243()
{
  optionSentence=1;
  optionPhrase=document.getElementById('search26320100903180243').value;
  document.getElementById('search26320100903180243').focus();
 
  
}
/*
* The user push a suggestion
*/

function pushNoOption26320100903180243()
{
  optionSentence=0;
  optionPhrase='';  
  document.getElementById('search26320100903180243').focus();
  
}
var g_pos_palabra26320100903180243;
/*
* Search suggestions.
*/
function buscar_sugerencias26320100903180243()
{
 
 //buscar sugerencias
 //xmlHttp26320100903180243=GetXmlHttpObject26320100903180243();
 var palabra=document.getElementById('search26320100903180243').value;
 palabra=palabra.toLowerCase();
 consulta=palabra;
 p1=palabra.lastIndexOf(' ');
 p2=palabra.lastIndexOf('.');
 p3=palabra.lastIndexOf(',');
 p4=palabra.lastIndexOf(';');
 //pos=Math.max (p1,p2,p3,p4);
 g_pos_palabra26320100903180243=Math.max (p1,p2,p3,p4);
 palabra=palabra.substring(g_pos_palabra26320100903180243+1,palabra.length);
 
 if(palabra.length<3)
 {
    if(consulta.length<3)
    {
	 //document.getElementById('sugerencias').innerHTML=""; 
	 suggestions26320100903180243=new Array();
	 sugbox26320100903180243.innerHTML="";
    }  
    
    stateChanged_sugerencias26320100903180243(suggestions26320100903180243,npalabras_sugerencia26320100903180243);
    
 }
 else
 {
 var mycod="a";
 	if (document.characterSet=="UTF-8")
 	{
 		mycod="u";
 	} 
 	else
 	{
 		mycod="a";
 	}
 

  var r=Math.random()*1000;
  var usertext=document.getElementById("search26320100903180243").value;
  var url="http://www.vloqutor.com/pruebaslingua-tools/sugerencias_json.php?sk=1&h=0x928a5df454d46d4e86a3bf1280f507b62ce28ff7bfe5e57709172b726eefbb8b1e8a468a3ead7e0f&id=40&us=1073&cod="+mycod+"&r="+r+"&c=326&l=en&fres=stateChanged_sugerencias26320100903180243&fbann=updateBanner26320100903180243&elementBann=ad_cell26320100903180243&p="+encodeURIComponent(consulta)+"&uid=";
  //alert(url);

  var script = document.createElement("script");        
  script.setAttribute("src",url);
  script.setAttribute("type","text/javascript");                
  document.body.appendChild(script);
	
 } 
}
/*
* This function is called for sugerencias_json when the operation is insert.
*/

var g_palabra26320100903180243='';
function stateChanged_estadisticas26320100903180243( query_id )
{
 
 	suggestions26320100903180243=new Array();
   /*
   * Save searchers of users. Only suggestions, no words
   */
 	var palabra=document.getElementById('search26320100903180243').value;
        //alert("-"+optionPhraseSelected+"-"+"-"+palabra+"-");
        if ((optionPhraseSelected==palabra) && (optionSentence==1) )
        {
             
	   		var r=Math.random()*1000;
	   		//optionPhraseSelected
	   		var url="http://www.vloqutor.com/pruebaslingua-tools/external-includes/setReportsBoxSuggestions.php?type=sugbox_selected&userText="+optionPhrase+"&p="+palabra+"&c=326&l=en";
	   		//alert(url);
	   		var script = document.createElement("script");        
	   		script.setAttribute("src",url);
	   		script.setAttribute("type","text/javascript");                
	   		document.body.appendChild(script);
	}	   
        
     if(g_old_action26320100903180243==null)
	 {
	   if (document.prueba)
       {
       	document.prueba.submit();
       }
       else
	   {
		document.getElementById('prueba').submit();
       }
     }
     else
	   g_old_action26320100903180243();
  }  
/*
* Send a form
*/
function enviarForm26320100903180243()
{
 var palabra=document.getElementById('search26320100903180243').value;
 if (document.getElementById("ad_cell26320100903180243"))
 {
	 if (bannerRandomPrio!="")
	 {
	   	document.getElementById("ad_cell26320100903180243").innerHTML=bannerRandomPrio;
	 }	
	  else
		     {
		     	document.getElementById("ad_cell26320100903180243").innerHTML=bannerRandom;
		     }
 }
 if(palabra.length<3)
 {
 }
 else
 {
  var pay='yes';
  if (""=="basic")
  {
    pay='no';
  }
 if (document.characterSet=="UTF-8")
 	{
 		mycod="u";
 	} 
 	else
 	{
 		mycod="a";
 	}
  
 
  var r=Math.random()*1000;
  var url="http://www.vloqutor.com/pruebaslingua-tools/sugerencias_json.php?sk=1&pay="+pay+"&h=0x928a5df454d46d4e86a3bf1280f507b62ce28ff7bfe5e57709172b726eefbb8b1e8a468a3ead7e0f&id=40&us=1073&cod="+mycod+"&r="+r+"&fres=stateChanged_estadisticas26320100903180243&fbann=updateBanner26320100903180243&elementBann=ad_cell26320100903180243&f=ins&c=326&l=en&p="+encodeURIComponent(palabra)+"&uid=";
  //alert(url);
  g_palabra26320100903180243=palabra;

  var script = document.createElement("script");        
  script.setAttribute("src",url);
  script.setAttribute("type","text/javascript");                
  document.body.appendChild(script);
 } 
 
  setTimeout("g_old_action26320100903180243();",1000);
  
 return false;
}

buildSearch26320100903180243();

