//function to set region cookie
function setRegions(regid,referer)
{
   var regionid=regid;
   var refpath=referer;
   if(refpath==null){
   	var getpath=1;
   }
   if(regid==null){
       regionid=document.regionset.regionvalue.options[document.regionset.regionvalue.selectedIndex].value;
       var getpath=1;
   }
   var today = new Date();
   today.setTime( today.getTime() );
   var expires = 30 * 1000 * 60 * 60 * 24;
   var expires_date = new Date( today.getTime() + (expires) );
   var path = '/';
   var domain = '';
   var secure = '';

   document.cookie = "region=" +escape(regionid) +
   ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
   ( ( path ) ? ";path=" + path : "" ) +
   ( ( domain ) ? ";domain=" + domain : "" ) +
   ( ( secure ) ? ";secure" : "" );

   if(getpath){
   	var path = window.location.pathname;
   	var host = window.location.host;
  	if(path=="/apps/meeting_list.php" || path=="/apps/member_list.php" || path=="/apps/company_list.php" || path=="/cgi/searchcompurls" || path=="/employment/emjoblist.php"){
  	    window.location="http://"+host+path;
  	}
   	else{
  	    window.location.reload(true);
  	}
   }
   else{
        var host = window.location.host;
        window.location="http://"+host+refpath;
   }
}


//function to set region cookie
function setLanguage(lang,referer)
{
   var langid=lang;
   var refpath=referer;
   if(refpath==null){
   	var getpath=1;
   }
   if(lang==null){
       langid=document.langset.langvalue.options[document.langset.langvalue.selectedIndex].value;
       var getpath=1;
   }
   if(langid=="E"){langid="";}
   var today = new Date();
   today.setTime( today.getTime() );
   var expires = 30 * 1000 * 60 * 60 * 24;
   var expires_date = new Date( today.getTime() + (expires) );
   var path = '/';
   var domain = '';
   var secure = '';

   document.cookie = "language=" +escape(langid) +
   ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
   ( ( path ) ? ";path=" + path : "" ) +
   ( ( domain ) ? ";domain=" + domain : "" ) +
   ( ( secure ) ? ";secure" : "" );

   if(getpath){
   	var path = window.location.pathname;
   	var host = window.location.host;
  	if(path=="/apps/meeting_list.php" || path=="/apps/member_list.php" || path=="/apps/company_list.php" || path=="/cgi/searchcompurls" || path=="/employment/emjoblist.php"){
  	    window.location="http://"+host+path;
  	}
   	else{
  	    window.location.reload(true);
  	}
   }
   else{
        var host = window.location.host;
        window.location="http://"+host+refpath;
   }
}



//function to set region cookie
function setMicroSiteLanguage(lang,referer,mtgcode)
{
   var langid=lang;
   var refpath=referer;
   if(refpath==null){
   	var getpath=1;
   }
   if(lang==null){
       langid=document.langset.langvalue.options[document.langset.langvalue.selectedIndex].value;
       var getpath=1;
   }
   if(langid=="E"){langid="";}
   var today = new Date();
   today.setTime( today.getTime() );
   var expires = 30 * 1000 * 60 * 60 * 24;
   var expires_date = new Date( today.getTime() + (expires) );
   var path = '/';
   var domain = '';
   var secure = '';

   document.cookie = "language" +escape(mtgcode) + "=" +escape(langid) +
   ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
   ( ( path ) ? ";path=" + path : "" ) +
   ( ( domain ) ? ";domain=" + domain : "" ) +
   ( ( secure ) ? ";secure" : "" );

   if(getpath){
   	var path = window.location.pathname;
   	var host = window.location.host;
  	if(path=="/apps/meeting_list.php" || path=="/apps/member_list.php" || path=="/apps/company_list.php" || path=="/cgi/searchcompurls" || path=="/employment/emjoblist.php"){
  	    window.location="http://"+host+path;
  	}
   	else{
  	    window.location.reload(true);
  	}
   }
   else{
        var host = window.location.host;
        window.location="http://"+host+refpath;
   }
}

