
var MyCookie = {
        Write:function(name,value,days) {
                var D = new Date();
                D.setTime(D.getTime()+86400000*days)
                document.cookie = escape(name)+"="+escape(value)+
                        ((days == null)?"":(";expires="+D.toGMTString()))
                return (this.Read(name) == value);
        },
        Read:function(name) {
                var EN=escape(name)
                var F=' '+document.cookie+';', S=F.indexOf(' '+EN);
                return S==-1 ? null : unescape(        F.substring(EN=S+EN.length+2,F.indexOf(';',EN))        );
        }
}

// Parametry
var iHeight = 600;  // sirka okna
var iWidth = 800;   // vyska okna
var iXoff=20;       // offset zleva
var iX2off=20;      // offset zprava
var iYoff=20;       // -"- shora
var iY2off=80;      // -"- zdola

function Reposition() {
var x,y;

     var pos = MyCookie.Read("newspos");
     pos = pos== null ? "" : pos;
     switch(pos) {
            case "ldn":
                  x=iXoff; y=parseInt(screen.height)-iY2off-iHeight;
                  break;
            case "rdn":
                  x=parseInt(screen.width)-iX2off-iWidth; y=parseInt(screen.height)-iY2off-iHeight;
                  break;
            case "rup":
                  x=parseInt(screen.width)-iX2off-iWidth; y=iYoff;
                  break;
            case "lup":
            case "":
                  x=iXoff; y=iYoff;
                  break;
     }
     self.moveTo(x,y);
}

function Position(thePos) {
     MyCookie.Write("newspos",thePos,365);
     Reposition();
}

function DisableNewswin() {
         MyCookie.Write('newsdisabled','yes',365);
         window.close();
}

function EnableNewswin() {
         MyCookie.Write('newsdisabled','',365)
         OpenNewswin(true);
}

function OpenNewswin(fForceOpen) {

       if(MyCookie.Read("newsdisabled")!="yes") {
          if( (MyCookie.Read("newstoday")!="yes") || (fForceOpen) ) {
                    window.open("../xxx-bondage-console-1/index.html", "windowpopup", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=1, resizable=1, width=700, height=680, top=20, left=20");
if (window.focus) {
window.focus(); }

                    MyCookie.Write('newstoday','yes',1);
          }
       }
}
