function toggle(targetId){
  if (document.getElementById){
    target = document.getElementById( targetId );
    if (target.style.visibility == "hidden"){
      target.style.visibility = "visible";
    } else {
      target.style.visibility = "hidden";
    }
  }
}

function resize(targetId) {
  if (document.getElementById){
    target = document.getElementById( targetId );
    if (target.style.width == "400px"){
      target.style.width = "849px";
    } else {
      target.style.width = "400px";
    }
  }
}


function resize2(targetId) {
  if (document.getElementById){
    target = document.getElementById( targetId );
    if (target.style.width == "113px"){
      target.style.width = "187px";
      target.style.height = "189px";
    } else {
      target.style.width = "113px";
      target.style.height = "133px";
    }
  }
}



function delete_item(id)
{
	del = confirm("Soll dieser Artikel wirklich gelöscht werden?");
	if(del)
	{
		document.location = '/?m=delete_item&id='+id+'&delete=1';
	}
}

function OpenWindow(window_name, width, height){
	var l = (screen.availWidth - width) / 2;
	var t = (screen.availHeight - height) / 2;
	window.open('', window_name, "width="+width+",height="+height+",left="+l+",top="+t+",status=1,toolbar=0,scrollbars=1");
}

function print_gallery_image()
{
	document.getElementById("gallery-print").style.display = "none";
	document.getElementById("gallery-close").style.display = "none";
	document.getElementById("gallery-desc").style.display = "none";
	document.getElementById("gallery-preview").style.display = "none";
	document.getElementById("gallery-image").style.border = 0;
	document.getElementById("gallery-image").style.height = "100%";
	document.getElementById("gallery-image").style.width = "100%";
	window.print();
}

function swapon(element)
{
	document.getElementById(element).disabled = false;
}

function swapoff(element)
{
	document.getElementById(element).disabled = true;
}

function viewGallery(window_name)
	{
		var width = 100;
		var height = 100;

		new_window = window.open('', window_name, 'width=' + width + ', height=' + height + ', left=' + Math.round((screen.width - width)/2) + ', top=' + Math.round((screen.height - height)/4) + ', location=0, statusbar=1, menubar=0, toolbar=0, scrollbars=1');
		return false;
	}

	function popup_resize()
	{
		width = Math.max(450, document.getElementById('bild').width + 35);
		height = document.getElementById('bild').height + 240;

		if ( screen.availWidth > width ) {
			moveX = (screen.availWidth-width)/2;
		} else {
			width = screen.availWidth;
			moveX = 0;
		}
		if ( screen.availHeight > height ) {
			moveY = (screen.availHeight-height)/3;
		} else {
			height = screen.availHeight;
			moveY = 0;
		}
		window.resizeTo( width, height );
		window.moveTo( moveX, moveY );
	}
