function QueryString(param){

  var begin,end;
  if(self.location.search.length>1)
  {
    begin=self.location.search.indexOf(param) +param.length+1;
    end=self.location.search.indexOf("&",begin);
    if(end==(-1)) end=self.location.search.length;
    return(self.location.search.substring(begin,end));
  }
  else if(self.location.hash.length>1)
  {
    begin=self.location.hash.indexOf(param) +param.length+1;
    end=self.location.hash.indexOf("&",begin);
    if(end==(-1)) end=self.location.hash.length;
    return(self.location.hash.substring(begin,end));
  }
  else return("");

}
function translate() {
	var dest = 'http://translate.google.com/translate?u=';
	var googled = false;
	var origUrl = "";

	if (window.location.toString().toLowerCase().indexOf("translate.google.com")>=0
		|| window.location.toString().toLowerCase().indexOf("translate_c")>=0) {
			origUrl = QueryString("&u");
	}
	
	if (null!=origUrl && origUrl.length>0) {
		googled = true;
		dest += origUrl;
	} else {
			dest += window.encodeURIComponent(window.location);
	}
	dest += '&sl=en&tl='+document.getElementById('PageLanguage').options[document.getElementById('PageLanguage').selectedIndex].value;

//	if (googled && window.parent && window.parent.n) { window.parent.n.location.href=dest; }
	if (googled && window.parent && window.parent.location) {
		window.parent.location.href=dest;
	}else {
		window.location.href=dest;
	}
}

// TODO: Setup proper selection correspondign to language being translated automatically