function getCurrLan(query) {
  var vars = query.split("%26");
  var tmp="";
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("%3D");
	if (pair[0] !="hl") {
		tmp = tmp + pair[0]+ "\=" + pair[1] + "\&";
	}
  }
  return tmp;
}


function getTrans(query) {
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
	if (pair[0] =="u") {
		return pair[1];
	}
  }
  return "";
}
//------------------------------------------------------------------------------

document.write(
 '<form name="transform" action="http://www.google.com/translate_p" style="margin:0;padding:0;">'+
 'Translate:  '+
 '<input name="hl" value="en" type="hidden" />'+
 '<input name="ie" value="UTF8" type="hidden" />'+
 '<input name="langpair" value="" type="hidden" />'+
 '<input name="u" value="http://www.onlinedataextractor.com/index.html%3F" type="hidden" />'+
 '<input style="width:20px;height:11px;" name="langpair" value="en|fr" title="Fran&#231;ais/French" src="images/french.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=fr\';"  type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|it" title="Italiano/Italian" src="images/italian.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=it\';"  type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|pt" title="Portugu&#234;s/Portuguese" src="images/portuguese.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=pt\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|el" title="Greek" src="images/greek.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=el\';"  type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|nl" title="Dutch/Netherland" src="images/dutch.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=nl\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|es" title="Espa&#241;ol/Spanish" src="images/spanish.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=es\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|ja" title="&#26085;&#26412;&#35486;/Japanese" src="images/japanese.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=ja\';"  type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|ko" title="&#54620;&#44397;&#50612;/Korean" src="images/korean.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=ko\';"  type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|zh-CN" title="&#20013;&#25991;&#65288;&#31616;&#20307;&#65289;/Chinese Simplified" src="images/chinese.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=zh-CN\';"  type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|ar" title="Arabic" src="images/arabic.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=ar\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|ru" title="Russian" src="images/russian.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=ru\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|bg" title="Bulgarian" src="images/bulgarian.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=bg\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|da" title="Dansk" src="images/dansk.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=da\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|fi" title="Finish" src="images/finish.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=fi\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|hi" title="Hindi" src="images/hindi.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=hi\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|hr" title="Croatian" src="images/croatian.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=hr\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|no" title="Norge" src="images/norge.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=no\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|pl" title="Polish" src="images/polish.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=pl\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|ro" title="Romanian" src="images/romanian.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=ro\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|sv" title="Swedish" src="images/swedish.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=sv\';" type="image" /> '+
 '<input style="width:20px;height:11px;" name="langpair" value="en|cs" title="Czech" src="images/czech.png" onclick="this.form.langpair.value=this.value; this.form.u.value=this.form.u.value + \'hl=cs\';" type="image" />'+
 '</form>');


var tmp="";
var myLocation = window.location.search.substring(1);
tmp = getTrans(myLocation);
if(tmp){
	if (tmp.indexOf("%3F")==-1){
		myLocation = tmp + "\?";
	}
	else{
		uFirst=tmp.substring(0,tmp.indexOf("%3F"))+"?";
		tmp= tmp.substring(tmp.indexOf("%3F")+1);
		myLocation=uFirst + getCurrLan(tmp.substring(tmp.indexOf("%3F")+3));
	}
}
else{
	myLocation=location.href;
	if (myLocation.indexOf("?")==-1){
		myLocation = location.href + "?";
	}
	else{
		myLocation= myLocation.substring(0,myLocation.indexOf("?")+1) + getCurrLan(escape(window.location.search.substring(1)));

	}
}

document.forms["transform"].u.value = myLocation;
