// ====================================================================
// Google Translate Dropdown Box
//	Copyright (C) 2006 http://isnoop.net/
//  
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// http://www.gnu.org/copyleft/gpl.html
//
// ====================================================================

function dotrans(lang)
{
   myurl = window.encodeURIComponent(document.location.href);
   if(document.location.href.search("translate_c") >= 0)
	{
		regexp = new RegExp(/&u=(.*?)&/);
		match = regexp.exec(document.location.href);
		myurl = match[1];
	}
	var url = "http://translate.google.com/translate?u=" + myurl + "&langpair=en%7C" + lang + "&hl=en&safe=off&ie=UTF-8&oe=UTF-8&prev=%2Flanguage_tools";
   if (lang != "")
	{
		top.location.href=url;
	}
}

var lang = new Array();
lang["de"] = "Deutsch";
lang["es"] = "Espa&#241;ol";
lang["fr"] = "Fran&#231;ais";
lang["it"] = "Italiano";
lang["pt"] = "Portuguese";
lang["ja"] = "&#26085;&#26412;&#35486; Japanese";
lang["ko"] = "&#54620;&#44397; Korean";
lang["zh-CN"] = "&#20013;&#22269; Chinese";

document.write("<select id=\"trans\" onChange=dotrans(this.value);><option value=\"\">Translate</option>");
for(key in lang)
{
	if(typeof(lang[key]) != 'string')
		continue;
	document.write("<option value=\"" + key + "\">" + lang[key] + "</option>");
}
document.write("</select>");

