    // this function gets the cookie, if it exists
    function getCookie( name ) {
        var start = document.cookie.indexOf( name + "=" );
        var len = start + name.length + 1;
        if ( ( !start ) && ( name != document.cookie.substring( 0, name.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 setCookie( name, value ) {
        document.cookie = name + "=" +escape( value );
    }
    function wopen(link,wi,he, scrollbar, name) {
        var screentop, screenleft;
        
        var ScreenWidth = screen.width;
        var ScreenHeight = screen.height;
        
        screenleft = parseInt( ( ScreenWidth - wi ) / 2 );
        screentop = parseInt( ( ScreenHeight - he ) / 2 );
            
        if ( screenleft < 0 )
                screenleft = 0;
        if ( screentop < 0 ){
                screentop = 0;
        }
        var args = "toolbar=0,"+",left="+screenleft;
        args +=",top="+screentop+",directories=0,status=1,menubar=0,scrollbars="+scrollbar+",resizable=1,width="+wi+",height="+he;
        
        var wincom = window.open(link, name, args);
        wincom.focus();
    }
    function switchVisibility(id){
      var x = 0;
      while(true){
        try{
          var obj = document.getElementById(id + "_" + x);
          var news;
          if(obj.style.visibility == 'visible'){
            news = 'hidden';
          }else{
            news = 'visible';
          }
          obj.style.visibility = news;
          x++;
        }catch(e){
          break;
        }
      }
    }

