var ruta = document.location;
var idioma = new String(ruta);
idioma = idioma.substr(idioma.indexOf('.')+1);
idioma = idioma.substr(0,idioma.indexOf('.'));
if(idioma.length>2) idioma=variable_ruta('idioma');

/*********************************************************************************************/

function traducir(texto){
	var aux = texto.toLowerCase();
	if(aux == 'bienvenido'){
		switch(idioma){
			case 'en': document.write('Welcome to Agropal'); break;
			//case 'fr': document.write('retourner'); break;
			//case 'pt': document.write('volver'); break;
			//case 'it': document.write('tornare'); break;
			//case 'de': document.write('R&uuml;ckkehr'); break;
			//case 'pl': document.write('back'); break;
			//case 'mx': document.write('volver'); break;
			default: document.write('Bienvenido a Agropal');
		}
	}else if(aux == 'otros'){
		switch(idioma){
			case 'en': document.write('more products'); break;
			case 'fr': document.write('plusdeproduits'); break;
			//case 'pt': document.write('¿Qu&eacute; quiere saber o buscar?'); break;
			//case 'it': document.write('What are you looking for?'); break;
			//case 'de': document.write('What are you looking for?'); break;
			//case 'pl': document.write('What are you looking for?'); break;
			//case 'mx': document.write('Espa&ntilde;a'); break;
			default: document.write('otros productos');
		}
	}
	
	else document.write('error');
}

/*********************************************************************************************/

function variable_ruta(theArgName){
	var valor="";    
	var b = document.location;
	var a = new String(b);
	var srch = a.substr(a.indexOf('?')+1);
	partOf = srch.split("&");
	for (var i=0; i<partOf.length; i++) {
		var tmp = partOf[i].split("=");
		mas = new RegExp('\\+','g');
        if (tmp[0] == theArgName) valor=unescape(tmp[1]);
	}
	return valor;
}
