function part(elementname,focusfield){
	if(self[elementname] == 'open') {
		document.getElementById(elementname).style.display='none';
		self[elementname] = 'close';
		
	} else {
		document.getElementById(elementname).style.display='block';
		self[elementname] = 'open';
		if(focusfield) {
			document.getElementById(focusfield).focus();
		}
	}
}

function popup(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function ConfirmAction(text, afterEvent) {
	if(confirm(text)) {
		eval(afterEvent);
	} else {
		return false;
	}
}
function openObject(setrank) {
	var w=760;
	var h=250;
	var sx=(screen.width-w)/2;
	var sy=(screen.height-h)/2;
	
	props = "width="+w+",height="+h+",resizable=yes,menubar=no,status=no,toolbar=no,scrollbars=no,location=no";
	objects_window = window.open("contor/contents/3/popup.php?setrank="+setrank+"&area=public","objects",props);
	objects_window.moveTo(sx,sy); 
	objects_window.focus();
}

function save(rank) {
	document.forms[0].submit();
}

function as() {
	if(!changes) {
		changes = true;
	}
}

function delConfirm (type,id) {
	
	switch(type) {
		case "image":
			text = 'Möchten Sie dieses Bild löschen?';
			dellink = '?delpic='+id;
			break;
		case "object":
			text = 'Möchten Sie dieses Objekt löschen?';
			dellink = '?delobject='+id;
			break;
	}
	
	if(confirm(text)) {
		document.location.href=dellink;
	} else {
		return false;
	}	
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }
window.attachEvent("onload", correctPNG);
