var hubovercount=0;
var huboutcount=0;
var cookieNameField = "ClubVAIOLocale";
var requestParameters = new Array();

function hoverhub(tohubtext){
 t=document.getElementById('hubtextcontent');
 w=document.getElementById('hubtextwelcome');
 if(tohubtext!=''){
  hubovercount++;
  t.innerHTML=tohubtext;
  t.style.display='block';
  t.style.visibility='visible';
  w.style.display='none';
  w.style.visibility='hidden';
 }else{
  huboutcount++;
  if(hubovercount==huboutcount){
   t.style.display='none';
   t.style.visibility='hidden';
   w.style.visibility='visible';
   w.style.display='block';
  }
 }
}

function hubgo(localePath){
 var domain="";
 setLocaleCookie(localePath);
  switch(localePath) {
	  case "/be/nl/" : domain="club.vaio.sony.be/clubvaio/be/nl/home";
	  break
	  case "/be/fr/" : domain="club.vaio.sony.be/clubvaio/be/fr/home";
	  break
	  case "/cz/cs/" : domain="club.vaio.sony.cz/clubvaio/cz/cs/home";
	  break
	  case "/es/es/" : domain="club.vaio.sony.es/clubvaio/es/es/home";
	  break
	  case "/fr/fr/" : domain="club.vaio.sony.fr/clubvaio/fr/fr/home";
	  break
	  case "/ie/en/" : domain="club.vaio.sony.ie/clubvaio/ie/en/home";
	  break
	  case "/it/it/" : domain="club.vaio.sony.it/clubvaio/it/it/home";
	  break
	  case "/nl/nl/" : domain="club.vaio.sony.nl/clubvaio/nl/nl/home";
	  break
	  case "/at/de/" : domain="club.vaio.sony.at/clubvaio/at/de/home";
	  break
	  case "/pt/pt/" : domain="club.vaio.sony.pt/clubvaio/pt/pt/home";
	  break
	  case "/fi/fi/" : domain="club.vaio.sony.fi/clubvaio/fi/fi/home";
	  break
	  case "/se/sv/" : domain="club.vaio.sony.se/clubvaio/se/sv/home";
	  break
	  case "/gb/en/" : domain="club.vaio.sony.co.uk/clubvaio/gb/en/home";
	  break
	  case "/gr/el/" : domain="club.vaio.sony.gr/clubvaio/gr/el/home";
	  break
	  case "/ru/ru/" : domain="club.vaio.sony.ru/clubvaio/ru/ru/home";
	  break
	  case "/de/de/" : domain="club.vaio.sony.de/clubvaio/de/de/home";
	  break
	  case "/ch/de/" : domain="club.vaio.sony.ch/clubvaio/ch/de/home";
	  break
	  case "/ch/fr/" : domain="club.vaio.sony.ch/clubvaio/ch/fr/home";
      break
      case "/tr/tr/" : domain="club.vaio.sony.com.tr/clubvaio/tr/tr/home";
      break
	  case "/ro/ro/" : domain="club.vaio.sony.ro/clubvaio/ro/ro/home";
      break
	  case "/pl/pl/" : domain="club.vaio.sony.pl/clubvaio/pl/pl/home";
      break
	  case "/ua/uk/" : domain="club.vaio.sony.ua/clubvaio/ua/uk/home";
      break
      default: domain="club.vaio.sony.co.uk/clubvaio/gb/en/home";
	  break
  }
 window.location = "http://".concat(domain);
 //alert(document.domain.concat("/clubvaio",localePath,"home.jsp"));
 return false;
}

function setLocaleCookie(localePath) {
    /* 1000 ms x 60 sec x 60 min x 24h = 1 day */
    var expires = 1000 * 60 * 60 * 24 * 30;
    var today = new Date();
    var expires_date = new Date( today.getTime() + expires );
    document.cookie = cookieNameField + "=" + escape( localePath ) +
                      ";expires=" + expires_date.toGMTString();
}

function getLocaleCookie() {
    var start = document.cookie.indexOf(cookieNameField);
    var len = start + cookieNameField.length + 1;
    if ((!start) && (cookieNameField!=document.cookie.substring(0, cookieNameField.length))) {
        return null;
    }
    if (start==-1) return null;
    var end = document.cookie.indexOf( ";", len );
    if (end==-1) end = document.cookie.length;
    return unescape( document.cookie.substring(len, end));
}

function deleteLocaleCookie (localePath) {
    if (getLocaleCookie())
        document.cookie = cookieNameField + "=" + escape(localePath) +
                          ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function fillRequestParameters() {
    var query = window.location.search.substring(1);
    var parms = query.split('&');
    for (var i=0; i<parms.length; i++) {
        var pos = parms[i].indexOf('=');
        if (pos > 0) {
            var key = parms[i].substring(0,pos);
            requestParameters[key] = parms[i].substring(pos+1);
        }
    }
}

