/**
 * Copyright (C) 2002-2003, CodeHouse.com. All rights reserved.
 * CodeHouse(TM) is a registered trademark.
 *
 * THIS SOURCE CODE MAY BE USED FREELY PROVIDED THAT
 * IT IS NOT MODIFIED OR DISTRIBUTED, AND IT IS USED
 * ON A PUBLICLY ACCESSIBLE INTERNET WEB SITE.
 *
 * CodeHouse.com JavaScript Library Module: Cookie Utility Class
 *
 * You can obtain this script at http://www.codehouse.com
 */
function CJL_CookieUtil(name, duration, path, domain, secure)
{
   this.affix = "";
 
   if( duration )
   {
      var date = new Date();
          var curTime = new Date().getTime();
 
          date.setTime(curTime + (1000 * 60 * duration));
          this.affix = "; expires=" + date.toGMTString();
   }
 
   if( path )
   {
      this.affix += "; path=" + path;
   }
 
   if( domain )
   {
      this.affix += "; domain=" + domain;
   }
 
   if( secure )
   {
      this.affix += "; secure=" + secure;
   }
 
 
   function getValue()
   {
      var m = document.cookie.match(new RegExp("(" + name + "=[^;]*)(;|$)"));
 
      return m ? m[1] : null;
   }
 
   this.cookieExists = function()
   {
      return getValue() ? true : false;
   }
 
   this.expire = function()
   {
      var date = new Date();
          date.setFullYear(date.getYear() - 1);
          document.cookie=name + "=noop; expires=" + date.toGMTString();
   }
 
   this.setSubValue = function(key, value)
   {
      var ck = getValue();
 
      if( /[;, ]/.test(value) )
      {
         //Mac IE doesn't support encodeURI
                 value = window.encodeURI ? encodeURI(value) : escape(value);
      }
 
 
      if( value )
      {
         var attrPair = "@" + key + value;
 
         if( ck )
         {
             if( new RegExp("@" + key).test(ck) )
                 {
                        document.cookie =
                                   ck.replace(new RegExp("@" + key + "[^@;]*"), attrPair) + this.affix;
                 }
                 else
                 {
                        document.cookie =
                                   ck.replace(new RegExp("(" + name + "=[^;]*)(;|$)"), "$1" + attrPair) + this.affix;
                 }
         }
         else
         {
                document.cookie = name + "=" + attrPair + this.affix;
         }
      }
      else
      {
             if( new RegExp("@" + key).test(ck) )
             {
                document.cookie = ck.replace(new RegExp("@" + key + "[^@;]*"), "") + this.affix;
             }
      }
   }
 
 
   this.getSubValue = function(key)
   {
      var ck = getValue();
 
      if( ck )
      {
         var m = ck.match(new RegExp("@" + key + "([^@;]*)"));
 
             if( m )
             {
                var value = m[1];
 
                if( value )
                {
                   //Mac IE doesn't support decodeURI
                           return window.decodeURI ? decodeURI(value) : unescape(value);
                }
             }
      }
   }
}
 
 
function setActiveFontSize(font_size) 
{
    if (font_size)
    {
        document.body.style.fontSize = font_size + 'pt';
        ckUtil.setSubValue('fontSize', font_size);
    }
}
 
var ckUtil = new CJL_CookieUtil("beznb_styles", 10080, '/');
var cookieVal = ckUtil.getSubValue('fontSize');

function test()
{
    if (cookieVal) 
        setActiveFontSize(cookieVal);
    else 
      setActiveFontSize('fontSize', '9');
}

function BackOrClose()
{
	if (navigator.appName == "Netscape")
	{
		if(history.length == 1)
			window.close(); 
	}
	else
	{
	if(history.length == '0')
		window.close(); 
	}
	history.back();
}

function showPic_X(pid,url,uschrift)
{
	window.open('/red/showPic.asp?seite_id='+pid+'&url=' + url + '&uschrift=' + uschrift, 'Bildansicht','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars,resizable=no,copyhistory=no,width=800,height=600');
}

function showPicGal_X(pid,url,uschrift,msgid)
{
	window.open('/red/showPicGal.asp?seite_id='+pid+'&url=' + url + '&uschrift=' + uschrift + '&msgid=' + msgid, 'Bildergalerie','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars,resizable=yes,copyhistory=no,width=800,height=600');
}

function showPicClose(x)
{
	window.open("/red/show.asp?pic=" + x + "&close=yes", "Bildanzeige", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,scrolling=no,resizeable=no,copyhistory=no,width=20,height=20");
}

function showPdf_X(r,f,x,y)
{
	window.open("/red/images_"+r+"/pdf/" + f, "PdfAnzeige", "toolbar=no,location=no,directories=no,status=no,resizable=yes,menubar=no,copyhistory=no,width=" + x + ",height=" + y);
}
