
function openPPage(page) {
	var sw = screen.width - 50;
	var sh = screen.height - 100;
	popp = window.open(page, 'FCKEditor', 'height='+sh+',width='+sw+',scrollbars=yes,resizable=yes,status=no,menubar=no,location=no,toolbar=no,left=25,top=25');
	popp.focus();
}


  function PopupWindow(href, w, h, settings) {
    leftpos = (screen.width) ? (screen.width/2)-(w/2) : 0;
    toppos = (screen.height) ? (screen.height/2)-(h/2) : 0;
    settings = 'height='+h+',width='+w+',top='+toppos+',left='+leftpos+','+settings;
    var popupwindow = window.open(href, 'popupwindow', settings);
    popupwindow.focus();
  }

  var myWidth = 0;
  function getSize() {
    if( typeof( window.innerWidth ) == 'number' ) {
      //Non-IE
      myWidth = window.innerWidth;
    } else if( document.documentElement && ( document.documentElement.clientWidth ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
    } else if( document.body && ( document.body.clientWidth ) ) {
      //IE 4 compatible
      myWidth = document.body.clientWidth;
    }
  }

  function RTrim(str) {
    var whitespace = new String(" \t\n\r"); var s = new String(str);
    if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      var i = s.length - 1; while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) i--; s = s.substring(0, i+1);
    }
    return s;
  }

	function makeProgress(progressbar,textarea,maxlength) {
    var str = RTrim(textarea.value); var strlen = str.length;
    if (strlen > maxlength) {
      textarea.value = str.substring(0,maxlength);
      strlen = maxlength;
      document.getElementById(progressbar).style.borderBottom = '0px solid black';
      alert('Die Obergrenze von '+maxlength+' Zeichen ist erreicht!');
    } else {
      document.getElementById(progressbar).style.borderBottom = '1px solid black';
    }
    taheight = parseInt(textarea.style.height)-2;
    document.getElementById(progressbar).style.height = taheight - (taheight * strlen)/maxlength + 'px';
    return true;
  }

	function display_tog(cell_id) {
		div = cell_id + '_div';
		img = cell_id + '_img';
		if(document.getElementById(div).style.display == 'block') {
			document.getElementById(div).style.display = 'none';
			document.getElementById(img).src = "images/amn/sub_closed.gif";
			document.getElementById(img).alt = "maximize";
		} else {
			document.getElementById(div).style.display = 'block';
			document.getElementById(img).src = "images/amn/sub_open.gif";
			document.getElementById(img).alt = "minimize";
		}
	}


function moveright() {
	var selectitems = 0;
	for (var i=0; i < document.site.imgcat1.length; i++) {
		if (document.site.imgcat1.options[i].selected) {
			selectitems++;
			var j = document.site.imgcat2.length;
			document.site.imgcat2.options[j] = new Option(document.site.imgcat1.options[i].text,'');
			document.site.imgcat2.options[j].style.backgroundColor = document.site.imgcat1.options[i].style.backgroundColor;
			document.site.imgcat2.options[j].style.color = document.site.imgcat1.options[i].style.color;
		}
	}
	for (var k=0; k < selectitems; k++) {
		for (var i=0; i < document.site.imgcat1.length; i++) {
			if (document.site.imgcat1.options[i].selected) {
				document.site.imgcat1.options[i] = null;
			}
		}
	}
}

function addright(s) {
	var r = '';
	if (document.site.imgcat3.value != '') {
		for (var i=0; i < document.site.imgcat4.length; i++) {
			if (document.site.imgcat4.options[i].selected) {
				r = document.site.imgcat4.options[i].text;
				s1 = document.site.imgcat4.options[i].style.backgroundColor;
				s2 = document.site.imgcat4.options[i].style.color;
			}
		}
		var j = document.site.imgcat2.length;
		document.site.imgcat2.options[j] = new Option(document.site.imgcat3.value+' ['+r+']','');
		document.site.imgcat2.options[j].style.backgroundColor = s1;
		document.site.imgcat2.options[j].style.color = s2;
		document.site.imgcat3.value = '';
		l =document.site.imgcat4.length;
		document.site.imgcat4.options[l-1].selected = true;
	}
}

function moveleft() {
	var selectitems = 0;
	for (var i=0; i < document.site.imgcat2.length; i++) {
		if (document.site.imgcat2.options[i].selected) {
			selectitems++;
			var j = document.site.imgcat1.length;
			document.site.imgcat1.options[j] = new Option(document.site.imgcat2.options[i].text,'');
			document.site.imgcat1.options[j].style.backgroundColor = document.site.imgcat2.options[i].style.backgroundColor;
			document.site.imgcat1.options[j].style.color = document.site.imgcat2.options[i].style.color;
		}
	}
	for (var k=0; k < selectitems; k++) {
		for (var i=0; i < document.site.imgcat2.length; i++) {
			if (document.site.imgcat2.options[i].selected) {
				document.site.imgcat2.options[i] = null;
			}
		}
	}
}

function moveresult() {
	var DR1 = new Array()
	var DR2 = new Array()
	for (var i=0; i < document.site.imgcat1.length; i++) {
		DR1.push(document.site.imgcat1.options[i].text);
	}
	for (var i=0; i < document.site.imgcat2.length; i++) {
		DR2.push(document.site.imgcat2.options[i].text);
	}
	document.site.imgcat11.value = DR1.join('|')
	document.site.imgcat12.value = DR2.join('|')
}


