
var MyCookie = {
        Write:function(name,value,days) {
                var D = new Date();
				// platnost 1 hodina: 60*60*1000*1
                D.setTime(D.getTime()+3600*1000*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 iWidth = 475;   // sirka okna
var iHeight = 690;  // vyska okna
var iXoff=100;       // offset zleva
var iX2off=100;      // offset zprava
var iYoff=10;       // -"- shora
var iY2off=20;      // -"- 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( "files/pop-praha.htm", "PopupNews", "location=no,status=no,toolbar=no,menubar=no,width="+iWidth+",height="+iHeight)
                    // Show_JS('files/pop-praha.htm?v01', 'PopupNews',iWidth,iHeight);
                    // Show_js_akce_3('files/detail_akce_sleva.php', 'akcni_sleva_nabidka', 720, 720);
                    //Show_js_akce_3('files/detail_akce_201001.php', 'akcni_sleva_nabidka', 720, 515);
                    MyCookie.Write('newstoday','yes',1);
          }
       }
}
