
// define some language dependent values before other scripts are included xx
   var page_language  = "de";  // indicates laguage of this page; set by "en" in translation
   // var txt_sign_in    = "sign-in";     // id=604
   var txt_sign_in    = "ABO-Login";     // id=604
   var txt_sign_out   = "sign-out";    // id=605
   var txt_non_member = "Mitglied werden";  // id=606
   var txt_confirm_oldsite = "OK to change language, CANCEL to stay"; // id=607

   /*
ua.js revision 0.200 2001-12-03

Contributor(s): Bob Clary, Netscape Communications, Copyright 2001

Netscape grants you a royalty free license to use, modify and 
distribute this software provided that this copyright notice 
appears on all copies.  This software is provided "AS IS," 
without a warranty of any kind.
*/

function xbDetectBrowser()
{
  // ujm
  //var oldOnError = window.onerror;
  var oldOnError = null;
  if (window.onerror){
    oldOnError = window.onerror;
  }
  
  var element = null;

  window.onerror = null;
  
  // work around bug in xpcdom Mozilla 0.9.1
  window.saveNavigator = window.navigator;

  navigator.OS    = '';
  navigator.version  = parseFloat(navigator.appVersion);
  navigator.org    = '';
  navigator.family  = '';

  var platform;
  if (typeof(window.navigator.platform) != 'undefined')
  {
    platform = window.navigator.platform.toLowerCase();
    if (platform.indexOf('win') != -1)
      navigator.OS = 'win';
    else if (platform.indexOf('mac') != -1)
      navigator.OS = 'mac';
    else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
      navigator.OS = 'nix';
  }

  var i = 0;
  var ua = window.navigator.userAgent.toLowerCase();
  
  if (ua.indexOf('opera') != -1)
  {
    i = ua.indexOf('opera');
    navigator.family  = 'opera';
    navigator.org    = 'opera';
    navigator.version  = parseFloat('0' + ua.substr(i+6), 10);
  }
  else if ((i = ua.indexOf('msie')) != -1)
  {
    navigator.org    = 'microsoft';
    navigator.version  = parseFloat('0' + ua.substr(i+5), 10);
    
    if (navigator.version < 4)
      navigator.family = 'ie3';
    else
      navigator.family = 'ie4'
  }
  else if (ua.indexOf('gecko') != -1)
  {
    navigator.family = 'gecko';
    var rvStart = navigator.userAgent.indexOf('rv:') + 3;
    var rvEnd = navigator.userAgent.indexOf(')', rvStart);
    var rv = navigator.userAgent.substring(rvStart, rvEnd);
    var decIndex = rv.indexOf('.');
    if (decIndex != -1)
    {
      rv = rv.replace(/\./g, '')
      rv = rv.substring(0, decIndex-1) + '.' + rv.substr(decIndex)
    }
    navigator.version = parseFloat(rv);

    if (ua.indexOf('netscape') != -1)
      navigator.org = 'netscape';
    else if (ua.indexOf('compuserve') != -1)
      navigator.org = 'compuserve';
    else
      navigator.org = 'mozilla';
  }
  else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
  {
    var is_major = parseFloat(navigator.appVersion);
    
    if (is_major < 4)
      navigator.version = is_major;
    else
    {
      i = ua.lastIndexOf('/')
      navigator.version = parseFloat('0' + ua.substr(i+1), 10);
    }
    navigator.org = 'netscape';
    navigator.family = 'nn' + parseInt(navigator.appVersion);
  }
  else if ((i = ua.indexOf('aol')) != -1 )
  {
    // aol
    navigator.family  = 'aol';
    navigator.org    = 'aol';
    navigator.version  = parseFloat('0' + ua.substr(i+4), 10);
  }
  else if ((i = ua.indexOf('hotjava')) != -1 )
  {
    // hotjava
    navigator.family  = 'hotjava';
    navigator.org    = 'sun';
    navigator.version  = parseFloat(navigator.appVersion);
  }

  window.onerror = oldOnError;
}

xbDetectBrowser();


      // 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
   // 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
   // 22-Jul-2002 JR  - changed cookie language variable to LANG2 to avoid conflict with old site
   //                   and added confirm() dialogue to prevent annoying users!
   // 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
   
   // 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
   //url_kiserver = "http://test02.kompass.com/kinl/";

   // 15-Jul-2002 JR - list languages to use new site
   // 28-Aug-2002 JR - added new langs for test site only
   // ujm  var token eingefuegt
     //new_design = "cs|da|de|en|es|et|fi|fr|hu|it|lt|nl|no|pl|pt|ro|ru|sk|sv|tr|";
   var new_design = "cs|da|de|en|es|et|fi|fr|hu|it|nl|no|pl|pt|ru|sk|sv|ch";

   // 4.8.2003 ujm
   var local_ctry = "sq-al|hy-am|be-by|cs-cz|da-dk|en-gb|ko-kr|sv-se|kl-gl|el-gr|uk-ua|vi-vn|ca-XX|gl-XX|sa-XX|ka-XX|div-XX|Syr-XX";
   var russe;

   var url_kiserver = "http://www.kompass.com/kinl/";
   var url_adserver = "http://www.kompass.com/kinl/";

   // ujm20050416
   var url_adserver_domain = "http://www.kompass.com"; // no ending / !

   var url_chserver = "http://de102.kompass.com/";
   var url_staticserver = "http://www.kompass.com/kinl/";
   // variables to store current membership status
   var member_portal = "";
   var member_id = "";       // non-blank means signed in (except special value "in")
   var member_name = "";
   var member_country = "";
   //Reload wird gebraucht, um in set_member_data zu unterscheiden, ob die Funktion von initialise oder von sonst jemandem aufgerufen wird. Bei initialise darf kein Reload ausgeführt werden, sonst gibts einen Endlosloop

   // 4.8.2003 ujm
   // var locale = "";
   // var member_units = "";
   // var member_language = "";
   // var offset = "";
   // var date = "";
   // .
 
   // 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":
// 4.8. ujm
//         locale = navigator.language;
//         break;

      case "opera":
	  case "gecko": // Mozilla, Netscape V6, V7  etc
         locale = navigator.language;
         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 ("LANG2");
//   if (temp > " ")
//      member_language = temp;
//   else {
      // 22-Jul-2002 JR - pick up old variable if new not defined yet.
      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)
{ busy_mark (false); 
//top.resize(3); 
if (nomad(formu._Keyword.value))
{ alert("You must enter at least 3 characters before * or % symbols"); formu._Keyword.focus();}
else
{ formu.submit();}
}

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.
    var my_url_kiserver = "http://www.kompass.com/kinl/";

    
    formu._Keyword.focus();

	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;
    // formu._Langrech.value=page_language;
    // formu._Langrech.value="de";

	// selection de la recherche
	for(i=0; i< formu._Choix.length; i++)
	{
		if (formu._Choix.options[i].selected == true)
		{
			search_type = formu._Choix.options[i].value;

			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=my_url_kiserver+"cgi-bin/KINL_SOCaction.cgi";
  				formu.submit();
				break;

			case 'PS' : //Products & services

				if (formu._Keyword.value == '' )
				{
    		     
					formu._Action.value="49_RECGUIDEE";
					formu._Page.value="classif";
					formu._Path.value="classif";
					formu._Level.value="1";
					formu.action=my_url_kiserver+"cgi-bin/KINL_PROaction.cgi";
					formu.submit();
					return;
				}

				busy_mark (true);
				// ujm #1229
				formu._Action.value="21_PRORECH";
				formu._Prevact.value="PRORECH";
				formu._Secteur.value="SOC";
				formu._Page.value="comp_list";
                
				// formu._Path.value="";
				// formu._Level.value="";
				// formu._Typerech.value="";
				// formu._Prod.value="";
				// formu._Nbpage.value="1";
				// formu._Pgdebut.value="1";
				// formu._Choice.value="product";
				formu.action=my_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 guided searches");
				}

				// ujm formu._Action.value="49_RECGUIDEE";
				formu._Action.value="49";
				formu._Page.value="classif";
				formu._Path.value="classif";
				formu._Level.value="1";
				formu.action=my_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=my_url_kiserver+"cgi-bin/KINL_SOCaction.cgi";
				formu.submit();
				break;

			default:
    		    alert ("Bugcheck: unexpected search type ["+search_type+"]" );
    		    return false;
				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);
   //  alert ("ki_eid:start");

   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;
		    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!)
      // ujm
      // alert ("Element "+id+" not found in this document");
      // ujm
      return false;
} // ki_eid()

function busy_mark (visible) {

   // alert ("Busy mark called [" + visible + "]");
   if (visible)
      window.status = "Searching...";
   else
      window.status = "";
}

function wemftag (seitenkontingent1,seitenkontingent2) {
// Wemf Tag 1.3
// eingefuegt LAM 12.01.2006
   var seitenkontingente = "";
   if (seitenkontingent1 != "") {
      seitenkontingente = seitenkontingente + "/" + seitenkontingent1;
   }
   if (seitenkontingent2 != "") {
      seitenkontingente = seitenkontingente + "/" + seitenkontingent2;
   }
   var WEMF="http://kompa.wemfbox.ch/cgi-bin/ivw/CP" + seitenkontingente;
   ki_eid ("wemf").src = WEMF+"?r="+escape(document.referrer)+"&d="+(Math.random()*100000);
}

function wemf (url) {

    function extractCgiParam (cgiParam,url) {
       var cgiIdx = url.indexOf('?');
       if (cgiIdx != -1) {
          var cgiString = url.substring(cgiIdx + 1, url.length);
          // Parameterwert extrahieren
          var paramIdx = cgiString.indexOf(cgiParam);
          if (paramIdx != -1) {
             var paramString = cgiString.substring(paramIdx + cgiParam.length + 1, cgiString.length);
             if (paramString.indexOf('&') != -1) {
                return paramString.substring(0, paramString.indexOf('&'));
             }
             else {
                return paramString;
             }
          }
          return
       }
       return
    }

    var seitenkontingent1 = "";
    var seitenkontingent2 = "";
    if (extractCgiParam ("page",document.URL)) {
       seitenkontingent1 = extractCgiParam("page",document.URL); 
    }
    if (extractCgiParam ("_Keyword",document.URL)) {
       seitenkontingent1 = seitenkontingent1 + "suche";
       seitenkontingent2 = seitenkontingent2 + "+Keyword=" +extractCgiParam("_Keyword",document.URL); 
    }
    if (url != "") {
       if (extractCgiParam ("PC",url)) {
          seitenkontingent2 = seitenkontingent2 + "+PC=" +extractCgiParam("PC",url); 
       }
    }
    if (extractCgiParam ("_Choix",document.URL)) {
       seitenkontingent2 = seitenkontingent2 + "+Choix=" +extractCgiParam("_Choix",document.URL); 
    }
    if (extractCgiParam ("_Zone",document.URL)) {
       seitenkontingent2 = seitenkontingent2 + "+Zone=" +extractCgiParam("_Zone",document.URL); 
    }
    if (extractCgiParam ("_Language",document.URL)) {
       seitenkontingent2 = seitenkontingent2 + "+Language=" +extractCgiParam("_Language",document.URL); 
    }
    wemftag(seitenkontingent1,seitenkontingent2);
}

//--------------------------------------------------------------------------------//
//------ Function to display a banner ad from kompass.com or a local source ------//
//--------------------------------------------------------------------------------//
function MajPub(url,version) { 
    var first=0; 

	complement = '';

	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&LG="+page_language+"&S="+version+"&loc="+location.hostname+complement; 
		url=url_adserver+"jgi/kinl_pub.jgi?T=FL&LG="+page_language+"&S="+version+"&RE=CH";
        first=1;
    } 

	document.getElementById('sb_banner').width = 440;  // Ajout pour bannière standard (hors KI)

	// ki_eid("_Version").value = version;
	frames['sb_banner'].location.href = url;
	//alert(url);

	return true;
}
     
     
function isLink(obj){ 
    return (typeof(obj.href) == "string")?true:false;
}






function MajPubCH(pic,version,id,url)
{
MajPub(pic,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 banner_url = "";
	
	//if (pic==""){   // KI Banner
      // MajPub(pic,version);
	//} else {        // us dr Schwiiz
	   // neu ujm 25.8.2003
         
	  // ki_eid ("sb_banner").src = pic;
	 ///  banner_url = "http://www.kompass.ch/showBanner.cfm?id=" + id;
	  // ki_eid ("sb_banner_href").href = "javascript:ClickBanner('" + banner_url + "');";
	//}
	
	return;
}



// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
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 = "";
   var  ch_lang = "d";

   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!
	   ki_eid("ma_sign_in").value = txt_sign_out;
       member_id = id;
  	   setCookie ("MBRID", id);
	}
	else
	if (id == "in")  {
	    // change button to sign-out and clear cookie
		ki_eid("ma_sign_in").value = txt_sign_in;
        member_id = "";

  	    ki_eid("ma_member").value = txt_non_member;
        member_name = "";

        ki_eid("ma_units").value = "-";

  	    setCookie ("MBRID", "");
  	    setCookie ("NAME", "");
  	    setCookie ("TERRITORY", "");
  	    setCookie ("CREDITS", "");
		
  	    setCookie ("LANG", "");
		// ujm Abmelden
		 if (language == "fr"){
		   ch_lang = "f";
		 } else {
		   if (language == "en"){
		     ch_lang = "e";
		   };
		 };
	     if (language != '-1')
	     	top.location = url_chserver; //top.location = url_chserver + "index.cfm?l=" + ch_lang;

	}
   if (name > " "){
	  ki_eid("ma_member").value = name;
          member_name = name;
	  setCookie ("NAME", member_name);
	}

   if ((units > 0) && ( units < 100))
   {
      member_units = units;
      ki_eid("ma_units").value = units;
   }
   else
   {
   	if (units > 100)
   	{
      		member_units = units;
      		ki_eid("ma_units").value = units;
	}
   	else
   	{
   		if (units < 0)
	   	{
	      		member_units = 0;
	      		ki_eid("ma_units").value = "";
		}
	   	else
   		{
      			member_units = 0;
      			ki_eid("ma_units").value = "";
		}
	}
   }

   setCookie ("CREDITS", member_units);

   if (language > " ")
   {	     
	if (language != page_language)
	{

	   // The language is not allowed in kompass.com ==> default="en"
	   if (new_design.indexOf(language) < 0 ) {
		language="en";
		}
	}		
     setCookie ("LANG", language);
   }

   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;
        //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); 
}



// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
function ChargeFrameBas(name)
{
var frame_bool=0;
   if(name=="ma_sign_in")
   {
      // ujm20050416
//      if(ki_eid("ma_sign_in").value==txt_sign_in){
      if(ki_eid("login").value=="no"){
	 
      // ujm20050416
        // url=url_adserver+"static/"+page_language+"/membership/index_sign-in_auto.htm";
        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_adserver+"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")
      // ujm20050416
      // if(ki_eid("ma_sign_in").value==txt_sign_in)
        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("ma_sign_in").value==txt_sign_in)
         url=url_adserver+"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("ma_sign_in").value==txt_sign_in)
            url=url_adserver+"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";
  }

// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
function initialise (myLang) {
// shorten the current document domain to avoid security problem
    setCookie ("LANG", myLang);

	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);
}
function setLanguage (f) { var language, temp; temp = f; language = temp.substr(0,2); 
setPortal(language);
}
/*
function setLanguage (f) { var language, country, temp; temp = f; language = temp.substr(0,2); country = ""; if (temp.substr(2,1) == "-")
country = temp.substr(3,2); window.top.kiTopFrame.setPortal(language,country);}
setPortal(language,country);}
}*/
/*
if (country > " ")
{ member_country = country; setCookie ("TERRITORY", member_country);}
}
*/
function setPortal(language)
{

	setCookie ("LANG", language);
	switch (language )
	{

	case "fr": //da
		//top.location = "http://www.kompass.ch/2003." + country;
		
		//top.location = "http://localhost/mykompass/index.cfm?l=f";
		top.location = "http://de102.kompass.com/index.cfm?l=f";
		break;
	
	case "en":
		//top.location = "http://ch01.kompass.com/index.cfm?l=e";
		top.location = "http://de102.kompass.com/index.cfm?l=e";
		break;

	case "de":
	
//		top.location = "http://localhost/mykompass/index.cfm?l=d";
		top.location = "http://de102.kompass.com/";
		break;

	default:

		// must be set before moving to another language or a loop results
		top.location = "http://www.kompass.com/kinl/"+language;
		//setCookie ("LANG", language);
			
		break;

	}// end switch
	
}
function resize(m){
//{ if(m == 2)
//{ m = "136,50,*";}
//else
//{ m = "136,*,50";}
//document.getElementById("bb").rows=m; return false;
}

   function ClickBanner(url){
     if (url==""){
     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;
	 window.open(url, "ki_pub", "resizable=yes,scrollbars=yes," + "width=800,height=600");
	 }
	 else {
	 window.open(url, "ki_pub", "resizable=yes,scrollbars=yes," + "width=800,height=600");
	 }
			
   }
   
   function initHeader(){
     initialise('ch');
     

MajPub('','');
     
//	   externe HTML BAnner 8.9.2003 
     
	 //  externe HTML BAnner Ende 
   }

/* Added on 10.10.06 by alk */

//Funktion zum kontrollieren des Formulars (string-check)
function checkString(entry){
	for(var i=0; i<entry.length; i++){
		if(entry.charAt(i) != " "){ return true; }
	}

	return false;
}

// Funktion zum überprüfen der Search-Box, ob etwas eingegeben wurde
function verification(formulaire, strLang){
	if(document.getElementById('SearchArt').value==''){
		ouvre('/staticSearchPage/suche_inkorrekt.asp?msg=1&lang='+strLang, 'suche_inkorrekt', 390, 220, 'scrollbars=no');
		return false;
	}

	if(document.getElementById('SearchArt').value!='' && !checkString(formulaire._Keyword.value)){
		formulaire._Keyword.focus();
		ouvre('/staticSearchPage/suche_inkorrekt.asp?msg=2&lang='+strLang, 'suche_inkorrekt', 390, 220, 'scrollbars=no');
		return false;
	}
	return true;
}

function switchToSelectedZone(strZone){
    SearchBox._Zone.value = strZone;
}

// Funktion zum öffnen des Pop-Ups
function ouvre(adresse, fenetre, largeur, hauteur, options){
	var top = (screen.height-hauteur) / 2;
	var left = (screen.width-largeur) / 2;
	window.open(adresse, fenetre, "top=" + top + ",left=" + left + ",width=" + largeur + ",height=" + hauteur + "," + options);
}
