/*===============================================================
Retorna a la pag. QueryCompanies si se cumplen condiciones
=================================================================*/
function RetornaAAspMakeQueryCompanies(lang)
{ 

	var strTipoBusqueda;
	var intCodigoPais;
	var strNombreCampo;
	

	if ((Trim(document.FormSearchCompanies.keyword.value)=="") || (document.FormSearchCompanies.keyword.value.length==0))
	{
		if (lang=="esp") {
			alert ('Debe ingresar al menos una palabra a buscar');
			return;
		}
		if (lang=="por") {
			alert ('Voce deve inserir no mínimo uma palavra chave para efetuar a busca');
			return;
		}
		if (lang!="esp" && lang!="por") {
			alert ('You must insert at least one keyword to search');
			return;
		}				
	}	
	
	
	
	/*if ((Trim(document.FormSearchCompanies.keyword.value)=="") || (document.FormSearchCompanies.keyword.value.length==0))
	{
		alert ('Debe ingresar al menos una palabra a buscar');
		return;
	}*/
		
		
//	document.formulario.action="MakeQuery.asp?keyword=" && document.formulario.keyword.value && "&#38;" && "tipobusqueda=" && strTipoBusqueda && "&#38;" && "codigopais=" && intCodigoPais && "&#38;" &&"nombrecampo=" && strNombreCampo && ""; 
//	document.formulario.action="makequerycompanies.asp";
	document.FormSearchCompanies.submit(); 
} 

/*===============================================================
Retorna a la pag. QueryBuzz si se cumplen condiciones
=================================================================*/
function RetornaAAspMakeQueryBuzz(lang)
{ 

	var strTipoBusqueda;
	var intCodigoPais;
	var strNombreCampo;
	

	if ((Trim(document.FormSearchBuzz.keyword.value)=="") || (document.FormSearchBuzz.keyword.value.length==0))
	{
		/*alert ('Debe ingresar al menos una palabra a buscar.');
		return;*/
		if (lang=="esp") {
			alert ('Debe ingresar al menos una palabra a buscar');
			return;
		}
		if (lang=="por") {
			alert ('Voce deve inserir no mínimo uma palavra chave para efetuar a busca');
			return;
		}
		if (lang!="esp" && lang!="por") {
			alert ('You must insert at least one keyword to search');
			return;
		}			
	}
	
	if (!document.FormSearchBuzz.cate_code[0].checked && !document.FormSearchBuzz.cate_code[1].checked && !document.FormSearchBuzz.cate_code[2].checked  && !document.FormSearchBuzz.cate_code[3].checked && !document.FormSearchBuzz.cate_code[4].checked) {
		/*alert ('Debe elegir al menos un Tipo de Oportunidad en el que desee buscar.')
		return;*/
		if (lang=="esp") {
			alert ('Debe elegir al menos un Tipo de Oportunidad en el que desee buscar.');
			return;
		}
		if (lang=="por") {
			alert ('Voce deve escolher no mínimo um tipo de Oportunidade para efetuar sua busca.');
			return;
		}
		if (lang!="esp" && lang!="por") {
			alert ('You must choose at least one Opportunity type which you want to search');
			return;
		}			
	}
	
		
		
//	document.formulario.action="MakeQuery.asp?keyword=" && document.formulario.keyword.value && "&#38;" && "tipobusqueda=" && strTipoBusqueda && "&#38;" && "codigopais=" && intCodigoPais && "&#38;" &&"nombrecampo=" && strNombreCampo && ""; 
//	document.formulario.action="makequerybuzz.asp";
	document.FormSearchBuzz.submit(); 
} 



/*===============================================================
Retorna a la pag. QueryActivities si se cumplen condiciones
=================================================================*/
function RetornaAAspMakeQueryActivities(lang)
{ 

	var strTipoBusqueda;
	var intCodigoPais;
	var strNombreCampo;
	

	if ((Trim(document.FormSearchActivities.keyword.value)=="") || (document.FormSearchActivities.keyword.value.length==0))
	{
		if (lang=="esp") {
			alert ('Debe ingresar al menos una palabra a buscar');
			return;
		}
		if (lang=="por") {
			alert ('Voce deve inserir no mínimo uma palavra chave para efetuar a busca');
			return;
		}
		if (lang!="esp" && lang!="por") {
			alert ('You must insert at least one keyword to search');
			return;
		}				
	}	
	
	
	
	/*if ((Trim(document.FormSearchCompanies.keyword.value)=="") || (document.FormSearchCompanies.keyword.value.length==0))
	{
		alert ('Debe ingresar al menos una palabra a buscar');
		return;
	}*/
		
		
//	document.formulario.action="MakeQuery.asp?keyword=" && document.formulario.keyword.value && "&#38;" && "tipobusqueda=" && strTipoBusqueda && "&#38;" && "codigopais=" && intCodigoPais && "&#38;" &&"nombrecampo=" && strNombreCampo && ""; 
//	document.formulario.action="makequerycompanies.asp";
	document.FormSearchActivities.submit(); 
} 




/*===============================================================
Retorna una copia del string sin espacios en blanco a la izquierda
=================================================================*/
function LTrim(str)
/*
PURPOSE: Remove leading blanks from our string.
IN: str - the string we want to LTrim
*/
{
	var whitespace = new String(" \t\n\r");
	
	var s = new String(str);
	
	if (whitespace.indexOf(s.charAt(0)) != -1) {
	    // We have a string with leading blank(s)...
	
	    var j=0, i = s.length;
	
	    // Iterate from the far left of string until we
	    // don't have any more whitespace...
	    while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
	        j++;
	
	
	    // Get the substring from the first non-whitespace
	    // character to the end of the string...
	    s = s.substring(j, i);
	}
	
	return s;
}

						  
/*===============================================================
Retorna una copia del string sin espacios en blanco a la derecha
=================================================================*/						  
function RTrim(str)
	/*
	PURPOSE: Remove trailing blanks from our string.
	IN: str - the string we want to RTrim
	
	*/
{
	// We don't want to trip JUST spaces, but also tabs,
	// line feeds, etc.  Add anything else you want to
	// "trim" here in Whitespace
	var whitespace = new String(" \t\n\r");
	
	var s = new String(str);
	
	if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
	    // We have a string with trailing blank(s)...
	
	    var i = s.length - 1;       // Get length of string
	
	    // Iterate from the far right of string until we
	    // don't have any more whitespace...
	    while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
	        i--;
	
	
	    // Get the substring from the front of the string to
	    // where the last non-whitespace character is...
	    s = s.substring(0, i+1);
	}
	
	return s;
}


/*===============================================================
Retorna una copia del string sin espacios en blanco a ambos lados
=================================================================*/
function Trim(str)
/*
        PURPOSE: Remove trailing and leading blanks from our string.
        IN: str - the string we want to Trim

        RETVAL: A Trimmed string!
*/
{
	return RTrim(LTrim(str));
}


/*===============================================================
Retorna a la pag. QueryCompanies si se cumplen condiciones
=================================================================*/
function RetornaAAsp(lang)
{ 

	var strTipoBusqueda;
	var intCodigoPais;
	var strNombreCampo;
	

	if ((Trim(document.FormSearchGeneric.keyword.value)=="") || (document.FormSearchGeneric.keyword.value.length==0))
	{
		if (lang=="esp") {
			alert ('Debe ingresar al menos una palabra a buscar');
			return;
		}
		if (lang=="por") {
			alert ('Voce deve inserir no mínimo uma palavra chave para efetuar a busca');
			return;
		}
		if (lang!="esp" && lang!="por") {
			alert ('You must insert at least one keyword to search');
			return;
		}				
	}

	var url;

	
	if (document.FormSearchGeneric.adress.selectedIndex==0)	
		url ='/rc/search/MakeQueryActivities.asp';    /*url ='/rc/search/MakeQueryActivities.asp';*/
	if (document.FormSearchGeneric.adress.selectedIndex==1)	
		url ='/rc/search/RespuestaCompaniesGral.asp';   /*url ='/rc/search/MakeQueryCompanies.asp';*/
	if (document.FormSearchGeneric.adress.selectedIndex==2)	
		url ='/rc/search/RespuestaBOpptysGral.asp';    /*url ='/rc/search/MakeQueryBuzz.asp';*/
	if (document.FormSearchGeneric.adress.selectedIndex==3){	
		url ='/rc/ie/companies.asp';
		document.FormSearchGeneric.hscode.value=document.FormSearchGeneric.keyword.value	
	}
	document.FormSearchGeneric.action=url;
	document.FormSearchGeneric.submit(); 
		
		
	//if (document.FormSearchGeneric.adress.selectedIndex==3)	
		//url ='/rc/ie/companies.asp'; // && '?hscode=' &&  (Trim(document.FormSearchGeneric.keyword.value));    /*url ='/rc/search/MakeQueryBuzz.asp';*/
		

} 

//**********************************************************************************************************/
//*	Salta a una direccion URL
//**********************************************************************************************************/

function SaltarAPagina(pag) {
	location.href = pag;
}


