   // History:
   // 05-Jul-2002 JR  - final version made into separate script
   // 08-Jul-2002 JR  - added UrlRechGuidee() which prevents multiple selection
   //                   in country searches (which would overload the server).
   // 09-Jul-2002 JR  - removed URLrechGuidee() and replaced with .focus() in verifSaisie()
   // 11-Jul-2002 JR  - added cookie override for user name, language and country
   // 15-Jul-2002 JR  - list languages to use new site
   // 16-Jul-2002 JR  - added path=/control to cookies to allow sharing between languages
   // 19-Jul-2002 JR  - prevent language selection if original_domain is static.kompass.com (for tourists!)
   // 22-Jul-2002 JR  - moved literal string definitions to top.html (txt_*) to allow translation
   // 24-Jul-2002 JR  - changed url_kiserver to www.kompass.com
   // 25-Jul-2002 JR  - set the LANG cookie because it is used by server occasionally
   // 28-Aug-2002 JR  - allow new language to come from same server as current
   // 04-Sep-2002 JR  - change /en/ in ChargeFrameBas() to use member_language
   // 21-May-2003 JLM - Add choice to russe language to go to the russian site
   // 16-Jun-2003 JLM - Set the country from the locale language-country variable.
   // 24-Jun-2003 JLM - RU access from kompass.ru & from main.html.
   // 01-Sep-2003 JLM/GO - server adresses set in the file /kinl/JS/config/config.js
   // 03-Sep-2003 JLM - set the default _Zone value to WW for negative values of _Zone.
   // 07-Mai-2004 JLM - test the login value instead of the txt_sign_in for entity char purpose.
   // 19-Mai-2004 JLM - membership button entity char correction (ma_entity)
   
   // Purpose:
   // This script provides all the logic for the control panel of
   // the main kompass.com portal.  It is NOT meant for use in other 
   // portals although it can serve as a model.  It should be included 
   // in all language versions of static/xx/home/top.html.  Note that 
   // any language dependencies should be handled by flags or strings
   // defined in the calling page (tagged for translation if necessary)
   // This file must never be translated!
    
   // define the addresses of the kompass.com servers
   // 01-Sep-2003 JLM/GO - now set in each local server file /kinl/JS/config/config.js
   //url_kiserver = "http://test02.kompass.com/kinl/";

   //url_kiserver = "/kinl/";
   //url_adserver = "/kinl/";

   //url_staticserver = "/kinl/";

   
 //new_design = "cs|da|de|en|es|et|fi|fr|hr|hu|it|ja|nl|no|pl|pt|ro|ru|sk|sl|sv|tr|zh|";
 //new_design = "cs|da|de|en|es|et|fi|fr|hr|hu|it|nl|no|pl|pt|ro|ru|sk|sl|sv|tr";
   var new_design = "ch|li|lu|at|cs|da|de|en|es|et|fi|fr|hr|hu|it|ja|nl|no|pl|pt|ro|ru|sk|sl|sr|sv|tr|zh";
   
    
    // 16-Jun-2003 JLM - Set the country here when it is different from the language code.
   var local_ctry = "sq-al|hy-am|be-by|cs-cz|da-dk|en-gb|kl-gl|el-gr|ja-jp|ko-kr|sv-se|sl-si|uk-ua|vi-vn|ca-XX|fa-XX|gl-XX|he-XX|ka-XX|kk-kz|sa-XX|div-XX|Syr-XX";
     
   var russe;
   
   // Pour le passage d'info via iframe
   var IFrameObj;

   // variables to store current membership status
   member_portal = "";
   member_id = "";       // non-blank means signed in (except special value "in")
   member_name = "";
   member_country = "";

   //alert ("1 Lang: "+navigator.language+"  userL: "+navigator.userLanguage);  

   // language & country detection
   switch (navigator.family ) {

      case "ie3":
      case "ie4":  // includes ie5 and ie6
         locale = navigator.userLanguage;
         break;

      case "aol":
      case "nn3":
      case "nn4":
      case "opera":
      case "gecko": // Mozilla, Netscape V6, V7  etc
      	if(langue_netscape=="")
        	locale = navigator.language;
        else
          locale = langue_netscape;
         break;

      case "hotjava":
      default:
         locale = "     ";
	 break;
    } // switch
	
    // ALWAYS make the language the same as the page language!
    if( page_language == "")
	    member_language  = locale.substr(0,2);
    else
	    member_language = page_language;
    		
    // 16-Jun-2003 JLM - Set the country from the locale language-country variable.
    member_country  = "XX";	// Default value
    if (locale.substr(2,1) == "-")
       member_country  = locale.substr(3,2);
    else
    {
    	temp=local_ctry.indexOf(locale);
	if ( temp < 0 ) {
		// case where no country = local language.
		member_country  = locale;
        }
        else    // get the country from the local_ctry variable
        {
	    if (local_ctry.substr(temp+2,1) == "-")
	       member_country  = local_ctry.substr(temp+3,2);
        }
    }
    //alert ("locale: " + locale +  "  Lang: "+member_language+"  country: "+member_country);  
    // 16-Jun-2003 JLM - end


   member_units = 0;

   // 11-Jul-2002 JR - override with cookie values, if present
   var temp;

   //alert("Cookie: "+document.cookie);

   // alert ("Cookie - MBRID=|"+getCookie ("MBRID")+"| LANG=|"+getCookie ("LANG")+"| LANG2=|"+getCookie ("LANG2")+"| Name=|"+getCookie ("NAME")+"| Credits=|"
   //                     +getCookie ("CREDITS")+"| Territory=|"+getCookie ("TERRITORY")+"|");      

   temp = getCookie ("MBRID");
   if (temp > " ")
      member_id = temp;
	  
   temp = getCookie ("LANG");
   if (temp > " ")
      member_language = temp;
	  
   temp = getCookie ("NAME");
   if (temp > " ")
      member_name = temp;
	  
   temp = getCookie ("CREDITS");
   if (temp > " ")
      member_units = temp;
	  
   temp = getCookie ("TERRITORY");
   if (temp > " ")
      member_country = temp;


   // 18-Sep-2002 JR - added to test Bonnier-style result list
   //setCookie ("typeList", "1");     // this should be a hidden input field!

   
   
function ChaineVide(chaine)
{//test si la chaine est vide (true) ou pas (false)
 	if (chaine=='') return true;
 	if (chaine.search(/^[ ]*$/)) {return false;} else {return true;}
}
function nomad(chaine)
{
	NbreCar=3;
	if ( ( ( (chaine.indexOf("*") != -1) && (chaine.indexOf("*") < NbreCar) ) || ( (chaine.indexOf("%") != -1) && (chaine.indexOf("%") < NbreCar) ) ) )
	    return true;
	else
	    return false;
}

function sendFormu(formu)
{
	// debut _BUG1025_
	var temp = getCookie ("KPROV"); 
	//alert('sendFormu avec '+formu._Keyword.value +" KPROV = "+ temp);
	if (temp == "RU100")
		formu._KProv.value=temp;
	// fin _BUG1025_
	busy_mark (false);
	 
	/* si code clx => verification du format */
	if((typeof(document.SearchBox._Choix[4]) != "undefined") && document.SearchBox._Choix[4].checked)
	{
		return checkClx(document.SearchBox._Keyword.value, document.SearchBox._ClassifPub.value);
	}
	else if (nomad(formu._Keyword.value))
	{
		alert("You must enter at least 3 characters before * or % symbols");
		formu._Keyword.focus();
		return false;
	}
	return true;
}

function verifSaisie(formu)
{
    busy_mark (false);
    // 09-Jul-2002 JR  - removed URLrechGuidee() function. 
    // move the focus back to the search word box -- this is crucial to
	// prevent multiple searches being started by "roller" button mice
	// being used to select the country.
    formu._Keyword.focus();

    //GRB : redimenssionement des frames
   	if (nomad(formu._Keyword.value))
	{
		alert("You must enter at least 3 characters before * or % symbols");
		formu._Keyword.focus();
		return;
	}

    // set the search language for all searches
	formu._Lang.value=member_language;
	formu._Langrech.value=member_language;

	// selection de la recherche
//	for(i=0; i< formu._Choix.length; i++)
//	{
//		if (formu._Choix.options[i].selected == true)
//		{
			search_type = formu._Choix.value;
			// 03-Sep-2003 JLM - set the default Zone value to WW 
			if( formu._Zone.value <0 )
			{
			 formu._Zone.value="WW";
			}
			// end 03-Sep-2003 JLM 
			switch (search_type)
			{
			case 'KW' : //Keyword

				if(formu._Keyword.value == '' )
				{
    		        // search word(s) missing - quietly ignore this request
					return;
				}
				busy_mark (true);
			    formu._Prod.value= "ACTI2";
				formu._Typerech.value= "1";
  				formu._Choice.value="company";
 				formu._Description.value = "";
  				formu._Action.value="31";
  				formu._Prevact.value="SOCRECH";
 				formu._Path.value="";
   				formu._Secteur.value="SOC";
				formu._Page.value="comp_list";
  				formu.action=url_kiserver+"cgi-bin/KINL_SOCaction.cgi";
  				formu.submit();
				break;

			case 'PS' : //Products & services

				if (formu._Keyword.value == '' )
				{
    		        // search word(s) missing - do guided search instead
                    // 19-Jul-2002 JR - change to do guided search when blank but don't 
					//                  change search type (user may have made a mistake)

					formu._Action.value="49_RECGUIDEE";
					formu._Page.value="classif";
					formu._Path.value="classif";
					formu._Level.value="1";
					formu.action=url_kiserver+"cgi-bin/KINL_PROaction.cgi";
					formu.submit();
					return;
				}

				busy_mark (true);
				formu._Action.value="21";
				formu._Prevact.value="PRORECH";
				formu._Page.value="";
				formu._Path.value="";
				formu._Level.value="";
				formu._Secteur.value="SOC";
				formu._Typerech.value="";
				formu._Prod.value="";
				formu._Nbpage.value="1";
				formu._Pgdebut.value="1";
				formu._Choice.value="product";
				formu.action=url_kiserver+"/cgi-bin/KINL_PROaction.cgi";
				formu.submit();
				break;

			case 'GS' : //Guided search

				if(formu._Keyword.value != '' )
				{
					alert ("Search word(s) are ignored in Browse categories option");
				}

				formu._Action.value="49_RECGUIDEE";
				formu._Page.value="classif";
				formu._Path.value="classif";
				formu._Level.value="1";
				formu.action=url_kiserver+"cgi-bin/KINL_PROaction.cgi";
				formu.submit();
			    break;

			case 'CN' :  // company name
			case 'TN' :  // trade name
			case 'EN' :  // executive

				if(formu._Keyword.value == '' )
				{
    		        // search word(s) missing - quietly ignore this request
					return;
				}

				busy_mark (true);
				formu._Action.value="46_det_fic";
				formu._Prevact.value="SOCRECH";
				formu._Typerech.value= "1";
				formu._Description.value= "";
				formu._Path.value="";
				formu._Prod.value="";
				formu._Secteur.value="SOC";
				formu._Level.value="";
				formu._Choice.value="";
				formu._Page.value="comp_list";
				formu.action=url_kiserver+"cgi-bin/KINL_SOCaction.cgi";
				formu.submit();
				break;

			default:
    		    alert ("Bugcheck: unexpected search type ["+search_type+"]" );
    		    return;
				break;
			}
		//}
//	}
}

function ki_eid(id) {
   // returns the DOM local element id for various browsers. It assumes
   // that browser detection code (browser_detect.js) has been included.
   // NB elements are found by id="" or by name="".  If the element is
   // not found using the id, the name space is searched instead.  The 
   // name search will find the first element with the name.

   // alert ("ki_eid:id="+id+"  browser: "+navigator.family);

   var eid;

   switch (navigator.family ) {

      case "ie3":
      case "ie4":  // includes ie5 and ie6
         eid = eval("document.all."+id);    // node id in IE 5, 6
         if (!eid) {
            // search the forms for this value
            var i = -1;
            while (!eid && document.forms[++i] ) {
		       eid = eval("document.forms["+i+"]."+id);
            }
         }

         break;

      case "aol":
      case "nn3":
      case "nn4":
	     // element must have name="ïd" in Netscape V4
	     eid = eval("document."+id);
		 if (!eid) {
            // search the forms for this value
		    var i = -1;
		    while (!eid && document.forms[++i] ) {
		       eid = eval("document.forms["+i+"]."+id);
			   }
			}
         break;
      case "opera":
	  case "gecko": // Mozilla, Netscape V6, V7  etc
	     eid = document.getElementById(id); // node id in W3C DOM (NS 6)
         if (!eid) {
   	         eid = document.getElementsByName(id);
 			 if (eid) 
 			    eid = eid.item(0);  // assume only one item with this name 
			} 
         break;

	  case "hotjava":
	  default:
	     alert ("Browser type not recognized: "+navigator.family);
		 break;
    } // switch

  // alert ("ki_eid:eid="+eid);

   if (eid)
      return eid;
   else
      // this is usually a developer error (it really is not there!)
      alert ("Element "+id+" not found in this document");
} // ki_eid()

function busy_mark (visible)
{

   	// alert ("Busy mark called [" + visible + "]");
   	if (visible)
   	{
	   window.status = "Searching...";
	}
	else
	{
		window.status = "";
	}
}


//--------------------------------------------------------------------------------//
//------          Function to call the server from the client         ------------//
//--------------------------------------------------------------------------------//
/*
function callToServer(URL) {
	if (!document.createElement) {return true};
	var IFrameDoc;
	
	if (!IFrameObj && document.createElement) {
		try {
			var tempIFrame=document.createElement('iframe');
			tempIFrame.setAttribute('id','RSIFrame');
			tempIFrame.style.border='0px';
			tempIFrame.style.width='0px';
			tempIFrame.style.height='0px';
			IFrameObj = document.body.appendChild(tempIFrame);
			
			if (document.frames) {
				IFrameObj = document.frames['RSIFrame'];
			}
		} catch(exception) {
			iframeHTML='<iframe id="RSIFrame" style="border:0px;width:0px;height:0px;"><\/iframe>';
			document.body.innerHTML+=iframeHTML;
			IFrameObj = new Object();
			IFrameObj.document = new Object();
			IFrameObj.document.location = new Object();
			IFrameObj.document.location.iframe = document.getElementById('RSIFrame');
			IFrameObj.document.location.replace = function(location) {
			this.iframe.src = location;
			}
		}
	}
	
	if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument) {
		setTimeout('callToServer("'+theFormName+'")',10);
		return false;
	}
	
	if (IFrameObj.contentDocument) {
		// For NS6
		IFrameDoc = IFrameObj.contentDocument; 
	} else if (IFrameObj.contentWindow) {
		// For IE5.5 and IE6
		IFrameDoc = IFrameObj.contentWindow.document;
	} else if (IFrameObj.document) {
		// For IE5
		IFrameDoc = IFrameObj.document;
	} else {
		return true;
	}
	
	IFrameDoc.location.replace(URL);
	return false;
}

function handleResponseBanner(doc) 
{
		var st = doc.getElementById("codebanner").innerHTML;
		ki_eid ("sb_banner").innerHTML = st;
}
*/
//--------------------------------------------------------------------------------//
//------ Function to display a banner ad from kompass.com or a local source ------//
//--------------------------------------------------------------------------------//
function MajPub(url,version)
{
  // function called by pages sent from kompass.com.  This function MUST be
	// present even if it performs no action.

  // leave url and version blank to call up an ad from kompass.com
	// give a url with version blank to display an ad from elsewhere
    
	
	var first=0;

	busy_mark (false);

	complement="";
	if(member_name!="")
	{
		complement="&SWF=2&ED=ID&UC="+member_country;
	}

	if(version=="")
	{
		date = new Date();
		version=date.getFullYear()+""+date.getMonth()+""+date.getDate()+""+date.getHours()+""+date.getMinutes()+""+date.getSeconds();
	}
	
	if(url=="")
	{
		url=url_adserver+"T=FP&SWF=2&LG="+page_language+"&S="+version+"&loc="+location.hostname+complement;
		first=1;
	}
	
	/*
	var re = new RegExp("http://[a-zA-Z0-9\.\-]+", "g");
	url=url.replace(re,"");
	if(navigator.appName == "Netscape")
	{
		url = "http://kompass.com"+url;
	}
	
	xmlhttp.open("GET",url,true);
  	xmlhttp.onreadystatechange=function() 
  		{
   		if (xmlhttp.readyState==4) 
   		{
	   		ki_eid ("sb_banner").innerHTML = (xmlhttp.responseText);
			
   		}
  	}
 	xmlhttp.setRequestHeader('Accept','message/x-formresult');
	xmlhttp.send(null)
	*/
	ki_eid ("_Version").value = version;
	//url = "http://kinsa1.kompass.com/kinl/static/kinl_pub.jgi.html";
	frames['sb_banner'].location.href = url;
	return true;
	
	/*
	ki_eid ("_Version").value = version;
	document.getElementById("RSIFrame").src=url;	
	*/
}

// this function test is the object is a link (<a href="">)
function isLink(obj)
{
	return (typeof(obj.href) == "string")?true:false;
}
function set_member_data (id, name, units, language, country) {

   // This function stores and acts on the values passed as arguments. It must
   // NEVER act on an empty value because that indicates no change in the status 
   // of the value.

   var temp = "";
   busy_mark (false);

   // the id arg contains "out" when the user has just signed-in and "in" when just signed-out!
   // do nothing if there is no change in sign-in status.
   
   if ((id > "") && (id != 'in'))    // ID should be changed from "in/out" to real member ID
   {
		// user is signed in, change button to sign out!
		/* GRB 28/06/2004 ki_eid("ma_sign_in").value = ma_entity(txt_sign_out);*/
		if (isLink(ki_eid("ma_sign_in"))){ki_eid("ma_sign_in").innerHTML = txt_sign_out;}
		ki_eid("login").value = "yes";
		member_id = id;
		setCookie ("MBRID", id);

		if (name > " "){
			//alert ("NAME=|"+name+"|");
			/* GRB 28/06/2004 ki_eid("ma_member").value = ma_entity(name);*/
			if (isLink(ki_eid("ma_member"))){ki_eid("ma_member").innerHTML = name;}

			member_name = name;
			setCookie ("NAME", member_name);
		}

    }
    else if (id == "in")
    {
		// change button to sign-in and clear cookie
		/* GRB 28/06/2004 ki_eid("ma_sign_in").value = ma_entity(txt_sign_in);*/
		if (isLink(ki_eid("ma_sign_in"))){ki_eid("ma_sign_in").innerHTML = txt_sign_in;}
		ki_eid("login").value = "no";
		
		/* GRB 28/06/2004 ki_eid("ma_member").value = ma_entity(txt_non_member);*/
		if (isLink(ki_eid("ma_member"))){ki_eid("ma_member").innerHTML = txt_non_member;}
		
		/* GRB 28/06/2004 ki_eid("ma_units").value = ma_entity(txt_ma_units);*/
		if (isLink(ki_eid("ma_units"))){ki_eid("ma_units").innerHTML = txt_ma_units;}
		
		member_id = "";
		member_name = "";


		setCookie ("MBRID", "");
		setCookie ("NAME", "");
		setCookie ("TERRITORY", "");
		setCookie ("CREDITS", "");
		setCookie ("LANG", "");
		if (language != '-1')
			top.location = url_kiserver+language;
   }

   if ((units > 0) && ( units < 100))
   {
	member_units = units;
	/* GRB 28/06/2004 ki_eid("ma_units").value = units;*/
	if (isLink(ki_eid("ma_units"))){ki_eid("ma_units").innerHTML = units;}
	//ki_eid("ma_units").class = "credit_meter_low";
   }
   else
   {
   	if (units >= 100)
   	{
      		member_units = units;
      		/* GRB 28/06/2004 ki_eid("ma_units").value = units;*/
			if (isLink(ki_eid("ma_units"))){ki_eid("ma_units").innerHTML = units;}
	}
   	else
   	{
   		if (units < 0)
	   	{
		     	member_units = 0;
                /* GRB 28/06/2004 ki_eid("ma_units").value = txt_ma_units;*/
				if (isLink(ki_eid("ma_units"))){ki_eid("ma_units").innerHTML = txt_ma_units;}       
		}
	   	else
   		{
      		      //alert("2");	
		      member_units = 0;
      		  /* GRB 28/06/2004 ki_eid("ma_units").value = txt_ma_units;*/
			  if (isLink(ki_eid("ma_units"))){ki_eid("ma_units").innerHTML = txt_ma_units;}

		}
	}
   }
   setCookie ("CREDITS", member_units);

   // Redirection kompass.fr
   // Si on vient d'un searchengine, toolbar ou searchbox on ne redirige pas    
   /*
   var searchengine = document.referrer.search("index_kise.php?");
   var toolbar = document.referrer.search("index_kitoolbar.php?");
   var searchbox = document.referrer.search("index_searchbox.php?");
   */
   
   if (language > " ")
   {	     
	/*
	var groupaccess=-1;	
	temp = getCookie ("GROUPACCESS");
	if (temp > " ")
		groupaccess = 1;
	*/
	  

	if (language != page_language)
	{
	   // The language is not allowed in kompass.com ==> default="en"
	   if (new_design.indexOf(language) < 0 ) 
	   {
		language="en";
	   }
	   setPortal(language,country);

	}
	/*
	else if(language == "fr" && country == "fr"  && groupaccess == -1 && searchengine == -1 && toolbar == -1 && searchbox == -1)
	{
		//redirection FR
		setPortal(language,country);
	}
	*/
	
   }


   if (country > " ")
   {
      member_country = country;
      setCookie ("TERRITORY", member_country);
   }
}

//---------------------------------------------------------------------------

function ClickLien()
{
        date = new Date();
        uniq=date.getFullYear()+""+date.getMonth()+""+date.getDate()+""+date.getHours()+""+date.getMinutes()+""+date.getSeconds();

	    //url=url_adserver+"jgi/kinl_pub_clic.jgi?S="+ki_eid("_Version").value+"&x="+uniq;
	    url=url_adclickserver+"S="+ki_eid("_Version").value+"&x="+uniq;
        //alert(url);
        MM_openBrWindow(url,"ki_pub","resizable=yes,scrollbars=yes,width=800,height=600");
}
 
function MM_openBrWindow(theURL,winName,features) 
{ 
   window.open(theURL,winName,features); 
}


// Here is the function ChargeFrameBas()

function ChargeFrameBas(name)
{

	var frame_bool=0;

   if(name=="ma_sign_in")
   {

	   if(ki_eid("login").value=="no")
	   {
        url=url_staticserver+"static/"+page_language+"/membership/index_sign-in_auto.htm";
    }else
        url=url_kiserver+"cgi-bin/KINL_ENRaction.cgi?_Action=98";
   }
   if(name=="ma_member")
   {
      if(ki_eid("login").value=="no")
      {
	      url=url_staticserver+"static/"+page_language+"/membership/index_sign-in_new_member.htm";
    	}
    	else
      {
	      url=url_kiserver+"cgi-bin/KINL_ENRaction.cgi?_Action=131";
        frame_bool=1;
      }
   }
   if(name=="ma_units")
   {
      if(ki_eid("login").value=="no")
//	 	url=url_staticserver+"static/"+page_language+"/membership/index_sign-in_auto.htm";
         url=url_kiserver+"cgi-bin/KINL_PAIaction.cgi?_Action=50";
      else
      {
         url=url_kiserver+"cgi-bin/KINL_ENRaction.cgi?_Action=130";
         frame_bool=1;
      }
   }
   if(name=="ma_language")
   {
      if(ki_eid("login").value=="no")
         url=url_staticserver+"static/"+page_language+"/membership/index_sign-in_auto.htm";
      else
      {
         url=url_kiserver+"cgi-bin/KINL_ENRaction.cgi?_Action=131";
         frame_bool=1;
      }
   }
   if(name=="ma_country")
   {
      if(ki_eid("login").value=="no")
          url=url_staticserver+"static/"+page_language+"/membership/index_sign-in_auto.htm";
      else
      {
          url=url_kiserver+"cgi-bin/KINL_ENRaction.cgi?_Action=131";
          frame_bool=1;
      }
   }
   if(frame_bool==1)
   {
        top.kiDisplayFrame.location=url;
   }
   else
   {
        top.kiDisplayFrame.location=url;
   }
}

function getCookie(name) {
  var search = name + "=";
  var setStr = 0;
  var offSet = 0;
  var end = 0;
  if (document.cookie.length > 0) {
   offset = document.cookie.indexOf(search);
   if (offset != -1) {
    offset += search.length;
    end = document.cookie.indexOf(";",offset);
    if (end == -1) {
     end = document.cookie.length;
    }
    setStr = unescape(document.cookie.substring(offset, end));
   }
  }
  return(setStr);
}

function setCookie(name, value) {
  // 16-Jul-2002 JR - set path to allow cookies to be shared between all pages
   document.cookie = name + "=" + escape(value) + '; path=/; domain=kompass.com;' ;
}

function shadeCell (cell) {

  cell.color = "#FF0000";
  }

// shorten the current document domain to avoid security problem
function initialise () {

	adjust_domain_name ();

	// call the set_member_data() to change the page to the required language
	set_member_data (member_id, member_name, member_units, member_language, member_country);
	// debut _BUG1025_
	var temp = getCookie ("KPROV"); 
	if (temp != "RU100") 
	// fin _BUG1025_
		setCookie ("KPROV", "");
	
	//la langue
	majLanguageList();
}


// 21-May-2003 JLM - Add choice to russe language to go to the russian site
function fnRusse(location){
	russe.close();
	top.location=location;
}

function setPortal(language, country)
{
//	alert ("setPortal():" + language + " - " + country);
	setCookie ("LANG", language);
		switch (country )
	{

//	case "dk": //da
	case "cz": //cs
	case "fr": //fr
	case "ru": //ru
//	case "se": //sv
//	case "hu":
//	case "fi":
//	case "no":
		top.location = "http://www.kompass." + country;
		break;

//	case "kr":
//	case "nz":
//	case "uk":
//		top.location = "http://www.kompass.co." + country;
//		break;

//	case "de":
//		top.location = "http://www.kompass-deutschland.de";
//		break;

	case "it":
		top.location = "http://www.kompassitalia.it";
		break;

//	case "pl":
//		top.location = "http://www.kompass.com.pl";
//		break;

//	21/10/2004 JLM
//	Pour les pays dont la langue est le chinois, on redirige vers l'interface anglaise la première fois
//	Les fois suivantes (changement de langue depuis l'interface) country = "" ... on ne passe pas dans ce cas
//	case "cn":
//	case "sg":
//	case "tw":
//	case "mo":
//	case "hk":
//		top.location = url_kiserver + "en";
//		break;

		
	default:
		// must be set before moving to another language or a loop results
		setCookie ("LANG", language);
		/*if( language=="ru") {
			url=url_staticserver+"static/ru/home/kompass_ru.html";
			russe=window.open(url, 'Russian','resizable=no,scrollbars=yes,width=370,height=270');
		}
		else 
		{*/
		
			// 25-Jul-2002 JR - set the LANG cookie because it is used by the server, occasionally!
			top.location = url_kiserver + language;
		/*}*/
		break;

	}// end switch
}

function setLanguage (f) {

   var language, country, temp;
   // tell the control panel which language to set (it will change the page if necessary)

   temp  = f;
   language = temp.substr(0,2);
   country  = "";	// Default value
   if (temp.substr(2,1) == "-")
       country  = temp.substr(3,2);
   //alert ("setLanguage():"+language + "-" + country);
   window.top.kiTopFrame.setPortal(language,country);

}
function majLanguageList()
{ 
	if(document.getElementById('_Language') != null)
	{ 
		obj = document.getElementById('_Language'); for (i = 0; i < obj.length; i++)
		{ 
			if (obj.options[i].value == page_language)
			obj.options[i].selected = true;
		}
	}
}

function BloquePays(language, country, redirect)
{
    switch (country)
    {
    case "de":
     top.location = url_staticserver+"static/de/home/not_available.html";
     return true;
     break;
    case "ch":
    case "li":
    case "at":
    case "lu":
     if (redirect==1)
      {
       top.location = url_kiserver + member_country;
       return true;
      }
     break;
    default:
     if (language == "de" || language == "ch" 
      || language == "li" || language == "at" 
      || language == "lu")
     {
      member_country="ch";
      if (redirect==1)
      {
       top.location = url_kiserver +"ch";
       return true;
      }
     } 
     break;
    }// end switch
 return false;
}

