// JavaScript Document

function translate_field(lang,article,translation){
   var source = document.getElementById(article).innerHTML;
   var len = source.length;
   var words = 500;
   var sourcelang = "en";
   document.getElementById(translation).innerHTML = "";

   for(i=0; i<=(len/words); i++) {
     google.language.translate (source.substr(i*words, words),
                 "en", lang, function (result) {
     if (!result.error) {
     document.getElementById(translation).innerHTML
           = document.getElementById(translation).innerHTML
           + result.translation;
    } }); }  

  // Hide the text written in the original language
  document.getElementById(article).style.display = 'none';


  return false;

 }


function setLanguage(langid){ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){ 
alert ("Browser does not support HTTP Request")
return 
} 
var url="setLanguage.php?langid="+langid;
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () {  
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL instead of sending data.
} // Close Function.


function getLanguage(){ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null){ 
alert ("Browser does not support HTTP Request")
return 
} 
var url="getLanguage.php";
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () {  
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
var result =xmlHttp.responseText; // Updates the div with the response text from check.php
if(result)
{
if(result!="en")
{
translate(result);
}
}
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL instead of sending data.
} // Close Function.


function changeCategory(value)
{

var value;
switch(value)
{

case 'service': value ="servicevalue";
                break;
default : value="Test";
          break;				
       
} 

alert(value);
}


function imageTranslate(lang)
{

switch(lang)
{

case 'fr' : french();
            break;

case 'de' : german();
            break;

case 'ru' : russian();
            break;
			
			
case 'es' : spain();
            break;
			
			
default : english();
           break;			
}

}

function german()
{

document.getElementById("bid_menu1").innerHTML="<img src=images/German/top_menugerman_01.gif width=132 height=46 border=0 />";

document.getElementById("bid_menu2").innerHTML="<img src=images/German/top_menugerman_02.gif  width=101 height=46 border=0 />";
document.getElementById("bid_menu3").innerHTML="<img src=images/German/top_menugerman_03.gif  width=144 height=46 border=0 />";
document.getElementById("bid_menu4").innerHTML="<img src=images/German/top_menugerman_04.gif  width=161 height=46 border=0 />";
document.getElementById("bid_menu5").innerHTML="<img src=images/German/top_menugerman_05.gif  width=108 height=46 border=0 />";
document.getElementById("bid_menu6").innerHTML="<img src=images/German/top_menugerman_06.gif  width=113 height=46 border=0 />";
document.getElementById("bid_menu7").innerHTML="<img src=images/German/top_menugerman_07.gif  width=108 height=46 border=0 />";
document.getElementById("bid_menu8").innerHTML="<img src=images/German/top_menugerman_08.gif  width=133 height=46 border=0 />";
}

function spain()
{

document.getElementById("bid_menu1").innerHTML="<img src=images/Spain/top_menuspain_01.gif width=127 height=46 border=0 />";
document.getElementById("bid_menu2").innerHTML="<img src=images/Spain/top_menuspain_02.gif width=100 height=46 border=0 />";
document.getElementById("bid_menu3").innerHTML="<img src=images/Spain/top_menuspain_03.gif  width=161 height=46 border=0 />";
document.getElementById("bid_menu4").innerHTML="<img src=images/Spain/top_menuspain_04.gif  width=149 height=46 border=0 />";
document.getElementById("bid_menu5").innerHTML="<img src=images/Spain/top_menuspain_05.gif  width=113 height=46 border=0 />";
document.getElementById("bid_menu6").innerHTML="<img src=images/Spain/top_menuspain_06.gif  width=109 height=46 border=0 />";
document.getElementById("bid_menu7").innerHTML="<img src=images/Spain/top_menuspain_07.gif  width=113 height=46 border=0 />";
document.getElementById("bid_menu8").innerHTML="<img src=images/Spain/top_menuspain_08.gif  width=128 height=46 border=0 />";

}

function russian()
{
document.getElementById("bid_menu1").innerHTML="<img src=images/Russia/top_menurussian_01.gif  width=151 height=46 border=0 />";
document.getElementById("bid_menu2").innerHTML="<img src=images/Russia/top_menurussian_02.gif  width=105 height=46 border=0 />";
document.getElementById("bid_menu3").innerHTML="<img src=images/Russia/top_menurussian_03.gif  width=152 height=46 border=0 />";
document.getElementById("bid_menu4").innerHTML="<img src=images/Russia/top_menurussian_04.gif  width=137 height=46 border=0 />";
document.getElementById("bid_menu5").innerHTML="<img src=images/Russia/top_menurussian_05.gif  width=122 height=46 border=0 />";
document.getElementById("bid_menu6").innerHTML="<img src=images/Russia/top_menurussian_06.gif  width=96 height=46 border=0 />";
document.getElementById("bid_menu7").innerHTML="<img src=images/Russia/top_menurussian_07.gif  width=109 height=46 border=0 />";
document.getElementById("bid_menu8").innerHTML="<img src=images/Russia/top_menurussian_08.gif  width=128 height=46 border=0 />";
}

function french()
{

document.getElementById("bid_menu1").innerHTML="<img src=images/France/top_menufrance_01.gif width=116 height=46 border=0 />";
document.getElementById("bid_menu2").innerHTML="<img src=images/France/top_menufrance_02.gif  width=103 height=46 border=0 />";
document.getElementById("bid_menu3").innerHTML="<img src=images/France/top_menufrance_03.gif  width=142 height=46 border=0 />";
document.getElementById("bid_menu4").innerHTML="<img src=images/France/top_menufrance_04.gif  width=160 height=46 border=0 />";
document.getElementById("bid_menu5").innerHTML="<img src=images/France/top_menufrance_05.gif  width=133 height=46 border=0 />";
document.getElementById("bid_menu6").innerHTML="<img src=images/France/top_menufrance_06.gif  width=118 height=46 border=0 />";
document.getElementById("bid_menu7").innerHTML="<img src=images/France/top_menufrance_07.gif  width=110 height=46 border=0 />";
document.getElementById("bid_menu8").innerHTML="<img src=images/France/top_menufrance_08.gif  width=118 height=46 border=0 />";
}

function english()
{
document.getElementById("bid_menu1").innerHTML="<img src=images/top_menu_01.gif width=113 height=46 border=0 />";

document.getElementById("bid_menu2").innerHTML="<img src=images/top_menu_02.gif  width=104 height=46 border=0 />";
document.getElementById("bid_menu3").innerHTML="<img src=images/top_menu_03.gif  width=140 height=46 border=0 />";
document.getElementById("bid_menu4").innerHTML="<img src=images/top_menu_04.gif  width=153 height=46 border=0 />";
document.getElementById("bid_menu5").innerHTML="<img src=images/top_menu_05.gif  width=125 height=46 border=0 />";
document.getElementById("bid_menu6").innerHTML="<img src=images/top_menu_06.gif  width=117 height=46 border=0 />";
document.getElementById("bid_menu7").innerHTML="<img src=images/top_menu_07.gif  width=114 height=46 border=0 />";
document.getElementById("bid_menu8").innerHTML="<img src=images/top_menu_08.gif  width=134 height=46 border=0 />";

}


function searchimageTranslate(lang)
{
switch(lang)
{

case 'fr' : //document.getElementById("bid_advancssearch_image").innerHTML='<img src=images/advanced_searchlbl.gif/>';
            document.getElementById("bid_search_btn").innerHTML='<input type=image src=images/France/searchbox_francebtn.gif onclick=store_AdvanceSearch(); />'
            break;

case 'de' : //document.getElementById("bid_advancssearch_image").innerHTML='<img src=images/advanced_searchlbl.gif/>';
            document.getElementById("bid_search_btn").innerHTML='<input type=image src=images/German/searchbox_germanbtn.gif onclick=store_AdvanceSearch(); />'
            break;

case 'ru' : //document.getElementById("bid_advancssearch_image").innerHTML='<img src=images/advanced_searchlbl.gif/>';
            document.getElementById("bid_search_btn").innerHTML='<input type=image src=images/Russia/searchbox_russianbtn.gif onclick=store_AdvanceSearch(); />'
            break;
			
			
case 'es' : //document.getElementById("bid_advancssearch_image").innerHTML='<img src=images/advanced_searchlbl.gif/>';
            document.getElementById("bid_search_btn").innerHTML='<input type=image src=images/Spain/searchbox_spanishbtn.gif onclick=store_AdvanceSearch(); />'
            break;
			
			
default : //document.getElementById("bid_advancssearch_image").innerHTML='<img src=images/advanced_searchlbl.gif/>';
            document.getElementById("bid_search_btn").innerHTML='<input type=image src=images/searchbox_btn.gif onclick=store_AdvanceSearch(); />'
           break;			
}

}





