//Added by Jeff: 14 Sep 09. Service desk requestId: 76333
//What is this about?
//On the FreeTranslation homepage, we display a different tab according to the keywords 
//which someone has searched for. Specifically, if you search for 'Professional Translation' in Google, 
//and click through to FreeTranslatin, then we display the 'Professional Translation Services' tab, 
//rather than the 'Free Text Translation' tab.
//Besides, we also try to preselect the source language accoprding to the searched keyword.
//Note: This file has the dependency on freetranslation-languages-control_ver2.js

if(document.referrer)	{
	strURL = document.referrer;
	if (strURL != null){
		strURL = strURL.toLowerCase(); 
		
		//Show panel2
		if(strURL.indexOf("q=professional+translation") > -1){
			TabbedPanels1.showPanel(2);
		}else if(strURL.indexOf("q=professional+translation+services") > -1){
			TabbedPanels1.showPanel(2);		
		}else if(strURL.indexOf("q=professional+translation+agency") > -1){
			TabbedPanels1.showPanel(2);
		}else if(strURL.indexOf("q=professional+translator") > -1){
			TabbedPanels1.showPanel(2);
		}else if(strURL.indexOf("q=online+professional+translation") > -1){
			TabbedPanels1.showPanel(2);
		}

		
		//Show panel1
		if(strURL.indexOf("q=website+translation") > -1)	{
			TabbedPanels1.showPanel(1);
		}
		
		
		//Pre set source language
		if(strURL.indexOf("q=professional+spanish+translator") > -1)	{
			if (document.getElementById("param_srcLang").options[31] != null){
				if(document.getElementById("param_srcLang").options[31].value.toLowerCase() == "spanish"){
					document.getElementById("param_srcLang").options[31].selected = true;
					setSubLanguages(31);
				}
			}
		}
		
		if(strURL.indexOf("q=professional+french+translator") > -1)	{
			if (document.getElementById("param_srcLang").options[10] != null){
				if(document.getElementById("param_srcLang").options[10].value.toLowerCase() == "french"){
					document.getElementById("param_srcLang").options[10].selected = true;
					setSubLanguages(10);
				}
			}
		}
		
		if(strURL.indexOf("q=professional+german+translator") > -1)	{
			if (document.getElementById("param_srcLang").options[11] != null){
				if(document.getElementById("param_srcLang").options[11].value.toLowerCase() == "german"){
					document.getElementById("param_srcLang").options[11].selected = true;
					setSubLanguages(11);
				}
			}
		}
	}
}