// --------------------------------------------
// PAGIX - java - script - datei
// --------------------------------------------
// programmer nilius 2k3 jan
// in memory of Uta Haase, your "dick"
// --------------------------------------------

	var px_clip_id = '';

	function px_clip(id) {
		 px_clip_id = id;
	  if(document.getElementById("span_" + id).style.display == 'none') {
	    document.getElementById("img_" + id).src = "/symbols/px/icons/16/icon16_helparrow2.png";
	    document.getElementById("span_" + id).style.display = "block";
	  }
	  else {
	    document.getElementById("img_" + id).src = "/symbols/px/icons/16/icon16_helparrow.png";
	    document.getElementById("span_" + id).style.display = "none";
	  }
	}

	var clip_id = '';

	function clip(id) {
		clip_id = id;
		if (document.getElementById("clip_" + id).style.display == 'none') {
			document.getElementById("clip_" + id).style.display = "block";
		}
		else {
			document.getElementById("clip_" + id).style.display = "none";
		}
	}

	var px_bbclip_id = '';

	function px_bbclip(id) {
		 px_bbclip_id = id;
	  if(document.getElementById("span_" + id).style.display == 'none') {
	    document.getElementById("img_" + id).src = "/symbols/px/icons/icon_minus.png";
	    document.getElementById("span_" + id).style.display = "block";
	  }
	  else {
	    document.getElementById("img_" + id).src = "/symbols/px/icons/icon_plus.png";
	    document.getElementById("span_" + id).style.display = "none";
	  }
	}


	// Search and List
	function pageset(wert)
        {
	document.form1.page_no.value = wert;
	document.form1.submit();
        }
        function pageset2()
        {
	document.form1.page_no.value = document.form1.page.value;
	document.form1.submit();
        }

/*********************************************************************************
 NAV HIDE FUNKTION DEFAULT NONE (closed)
*********************************************************************************/
	function showhide(name) {
         var display = document.getElementById(name).style.display;
 	expires = new Date(); expires.setTime(expires.getTime() + (1000 * 86400 * 365));
 	if (display == 'block') {
  	document.getElementById(name).style.display='none';
        set_cookie(name,'');
 	}else{
        document.getElementById(name).style.display='block';
        set_cookie(name,'hide',expires);
 	}
	}

/*********************************************************************************
 NAV HIDE FUNKTION DEFAULT NONE (open)
*********************************************************************************/
	function showhide2(name) {
         var display = document.getElementById(name).style.display;
 	expires = new Date(); expires.setTime(expires.getTime() + (1000 * 86400 * 365));
 	if (display == 'none') {
  	document.getElementById(name).style.display='block';
        set_cookie(name,'');
 	}else{
        document.getElementById(name).style.display='none';
        set_cookie(name,'hide',expires);
 	}
	}


	function set_cookie(name, value, expires) {
		if (!expires) expires = new Date();
		document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() +  "; path=/";
	}


        function lib_bwcheck(){ //Browsercheck (needed)
                this.ver=navigator.appVersion
                this.agent=navigator.userAgent
                this.dom=document.getElementById?1:0
                this.opera5=this.agent.indexOf("Opera 5")>-1
                this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0;
                this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
                this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
                this.ie=this.ie4||this.ie5||this.ie6
                this.mac=this.agent.indexOf("Mac")>-1
                this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0;
                this.ns4=(document.layers && !this.dom)?1:0;
                this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
                return this
        }
        var bw=new lib_bwcheck()

/*********************************************************************************
BB CODE INSERT (NEW)
*********************************************************************************/

function addText_insert(aTag,eTag, name) {

    var input = document.getElementById(name);
    input.focus();
    /* für Internet Explorer */

    if(typeof document.selection != 'undefined') {
    /* Einfügen des Formatierungscodes */

        var range = document.selection.createRange();
        var insText = range.text;
        range.text = aTag + insText + eTag;
        /* Anpassen der Cursorposition */

        range = document.selection.createRange();
        if(insText.length == 0) {
          range.move('character', -eTag.length);
        } else {
          range.moveStart('character', aTag.length + insText.length + eTag.length);
        }
        range.select();
    }

    /* für neuere auf Gecko basierende Browser */

    else if(typeof input.selectionStart != 'undefined')
    {
    /* Einfügen des Formatierungscodes */

        var start = input.selectionStart;
        var end = input.selectionEnd;
        var insText = input.value.substring(start, end);
        input.value = input.value.substr(0, start) + aTag + insText + eTag + input.value.substr(end);
        /* Anpassen der Cursorposition */
        var pos;
        if(insText.length == 0) {
          pos = start + aTag.length;
        } else {
          pos = start + aTag.length + insText.length + eTag.length;
        }
        input.selectionStart = pos;
        input.selectionEnd = pos;
    }
    /* für die übrigen Browser */
    else
    {
    /* Abfrage der Einfügeposition */
        var pos;
        var re = new RegExp('^[0-9]{0,3}$');
        while(!re.test(pos)) {
          pos = prompt("Einfügen an Position (0.." + input.value.length + "):", "0");
        }
        if(pos > input.value.length) {
          pos = input.value.length;
        }
        /* Einfügen des Formatierungscodes */
        var insText = prompt("Bitte geben Sie den zu formatierenden Text ein:");
        input.value = input.value.substr(0, pos) + aTag + insText + eTag + input.value.substr(pos);
    }
}
/* -------------------------------BB CODE INSERT END----------------------------------------*/

/*********************************************************************************
Digital Zeitanzeige
*********************************************************************************/
var loaded = false;
if (document.layers)
  document.write(
'<STYLE>.rewritable { position: absolute; }<\/STYLE>'
  );
function Clock (offsetSec, style) {
  this.id = Clock.cnt;
  Clock.clocks[Clock.cnt++] = this;
  this.offsetSec = offsetSec || 0;
  this.style = style || '';
  this.writeHTML();
  this.startTimer();
}
function Clock_writeHTML () {
  var html = '';
  if (document.layers) {
    html += '<SPAN';
    html += ' ID="Clock' + this.id + '"';
    html += ' CLASS="rewritable"';
    html += '>';
    html += '<SPAN';
    html += this.style ? ' CLASS="' + this.style + '"' : '';
    html += '>';
    html += this.formatTime();
    html += '<\/SPAN>';
    html += '<\/SPAN>';
  }
  else {
    html += '<SPAN';
    html += ' ID="Clock' + this.id + '"';
    html += this.style ? ' CLASS="' + this.style + '"' : '';
    html += '>';
    html += this.formatTime();
    html += '<\/SPAN>';
  }
  document.write(html);
}
Clock.prototype.writeHTML = Clock_writeHTML;
function Clock_formatTime () {
  var time = new Date();
  time.setTime(time.getTime() + this.offsetSec * 1000);
  var hours = time.getHours();
  var minutes = time.getMinutes();
  var seconds = time.getSeconds();
  var html = '';
  html += hours < 10 ? '0' + hours : hours;
  html += ':';
  html += minutes < 10 ? '0' + minutes : minutes;
  html += ':';
  html += seconds < 10 ? '0' + seconds : seconds;
  return html;
}
Clock.prototype.formatTime = Clock_formatTime;
function Clock_startTimer () {
  this.tid = setInterval('Clock.clocks[' + this.id + '].updateTime()',
1000);
}
Clock.prototype.startTimer = Clock_startTimer;
function Clock_updateTime () {
  if (document.all)
    document.all['Clock' + this.id].innerHTML = this.formatTime();
  else if (document.getElementById)
    document.getElementById('Clock' + this.id).firstChild.nodeValue =
      this.formatTime();
  else if (document.layers && loaded) {
    var l = document['Clock' + this.id];
    if (!l.ol) {
      var ol = l.ol = new Layer(l.clip.width);
      ol.clip.height = l.clip.height;
      ol.left = l.pageX; ol.top = l.pageY;
      ol.visibility = 'show';
      l.visibility = 'hide';
    }
    var ol = l.ol;
    var html = '';
    html += '<SPAN';
    html += this.style ? ' CLASS="' + this.style + '"' : '';
    html += '>';
    html += this.formatTime();
    html += '<\/SPAN>';
    ol.document.open();
    ol.document.write(html);
    ol.document.close();
  }
}
Clock.prototype.updateTime = Clock_updateTime;
Clock.cnt = 0;
Clock.clocks = new Array();
function init () {
  loaded = true;
}

function px_chmod_CheckChange(Checkbox, Value) {

	if (document.getElementById(Checkbox).checked == true) {

		document.getElementById('chmod').value = parseInt(document.getElementById('chmod').value) + Value;

	} else {

		document.getElementById('chmod').value = parseInt(document.getElementById('chmod').value) - Value;

	}

}

function px_chmod_TextChange() {

	var chmod = parseInt(document.getElementById('chmod').value);

	document.getElementById('owner_read').checked = false;
	document.getElementById('owner_write').checked = false;
	document.getElementById('owner_execute').checked = false;

	document.getElementById('group_read').checked = false;
	document.getElementById('group_write').checked = false;
	document.getElementById('group_execute').checked = false;

	document.getElementById('public_read').checked = false;
	document.getElementById('public_write').checked = false;
	document.getElementById('public_execute').checked = false;

	if (chmod >= 400) {
		document.getElementById('owner_read').checked = true;
		chmod = chmod - 400;
	}
	if (chmod >= 200) {
		document.getElementById('owner_write').checked = true;
		chmod = chmod - 200;
	}
	if (chmod >= 100) {
		document.getElementById('owner_execute').checked = true;
		chmod = chmod - 100;
	}

	if (chmod >= 40) {
		document.getElementById('group_read').checked = true;
		chmod = chmod - 40;
	}
	if (chmod >= 20) {
		document.getElementById('group_write').checked = true;
		chmod = chmod - 20;
	}
	if (chmod >= 10) {
		document.getElementById('group_execute').checked = true;
		chmod = chmod - 10;
	}

	if (chmod >= 4) {
		document.getElementById('public_read').checked = true;
		chmod = chmod - 4;
	}
	if (chmod >= 2) {
		document.getElementById('public_write').checked = true;
		chmod = chmod - 2;
	}
	if (chmod >= 1) {
		document.getElementById('public_execute').checked = true;
		chmod = chmod - 1;
	}
}

/* -------------------------------EMAIL SECURE----------------------------------------*/
function _em( e, a, x ) {
        var r = document.getElementById( e );
        var i = 0;
        var t = '';

        if ( ! r )
                return;

        r.innerHTML = '';

        for ( i = 0; a[ i ] != null; i++ )
                t += String.fromCharCode( a[ i ] ^ x );
        r.innerHTML = t;
}

/* -------------------------------Zeichen zaehlen in Textarea----------------------------------------*/
var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}


function displaylimit(theform,thelimit){
var limit_text='<b><span id="'+theform.toString()+'">'+thelimit+'</span></b>'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
}
}
/* ------------------------------- JS Menue ----------------------------------------*/
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose;

//	externes Fenster oeffnen
function isDemoOk()
{
	IsOk=true;
	bver=Math.round(parseFloat(navigator.appVersion) * 1000);
    if (navigator.appName.substring(0,8) == "Netscape")
    {
		if ((bver<5000) && (navigator.appVersion.indexOf("Mac")> 0))
		IsOk=false;

        else if (bver<4060)

        IsOk=false;
     }

	 if (navigator.appName.substring(0,9) == "Microsoft")
     {
         if(bver<4000)
         IsOk=false;
     }

     plugins=navigator.plugins;

     if (plugins!=null && IsOk==false)
     {
         for(i=0;i!=plugins.length;i++)

              if((plugins[i].name.indexOf("1.0")<0) && (plugins[i].name.indexOf("Java Plug-in")>=0))
              IsOk=true;
     }
     return IsOk;
}

function openDemo(htmlFile,htmlWidth,htmlHeight)
{

	var bua = navigator.userAgent;
    s = 'resizable=0,toolbar=0,menubar=0,scrollbars=0,status=0,location=0,directory=0,width=350,height=200';
    if(!isDemoOk())
    {
		open("http://www.eprison.de",'',s);
    }
    else
    {
		if (bua.indexOf("Opera")!= -1)
		{
          window.open(htmlFile+".htm",'','width='+htmlWidth+',height='+htmlHeight+',top=10,left=10');
		}
		else
		{
			window.open(htmlFile+".htm",'','width='+htmlWidth+',height='+htmlHeight+',top=10,left=10');
		}
     }
}