function popup(what) {
	var fenster = window.open(what, "fenster", "height=600, width=800, top=20, left=20, status=no, location=no, resize=no, scrollbars=yes");
	fenster.focus;
}

//*** MvS, 21.02.2006: setzt das PopUp für die MDB
function popupb(what) {
	var blick = window.open(what, "fenster", "height=500, width=700, top=50, left=100, status=no, location=no, resize=no, scrollbars=yes");
	blick.focus;
}



function doSubmit(docNum, docType) {
	document.refImage.docNum.value = docNum;
	document.refImage.docType.value = docType;
	document.refImage.submit();
	return true;
}

//*** ein Element aus der Liste aller Attribute in die Liste der 
//*** zugeordneten Attribute schreiben (Features)
function assign_att() {
	var allAttr = document.getElementById("all_attr");
	if (allAttr.options.length != 0) {
		if (allAttr.options.selectedIndex != -1) {
			var assigned = document.getElementById("assigned");
			var selEntry = allAttr.options[allAttr.options.selectedIndex];
			var newEntry = new Option(selEntry.text, selEntry.value, false, true);
  		assigned.options[assigned.options.length] = newEntry;
			
			if (selEntry.style.fontWeight == "bold") {
				assigned.options[assigned.options.length - 1].style.fontWeight = "bold";
			}
			
			selEntry = null;
			allAttr.options[allAttr.options.selectedIndex] = null;
		}
		allAttr.options.selectedIndex = 0;
	}
}

//*** ein Element aus der Liste der zugeordneten Attribute in die Liste 
//*** mit allen Attribute schreiben (Features)
function remove_att() {
	var assigned = document.getElementById("assigned");
	if (assigned.options.length != 0) {
		if (assigned.options.selectedIndex != -1) {
			var allAttr = document.getElementById("all_attr");
			var selEntry = assigned.options[assigned.options.selectedIndex]
			var newEntry = new Option(selEntry.text, selEntry.value, false, true);
  		allAttr.options[allAttr.options.length] = newEntry;
  		
  		if (selEntry.style.fontWeight == "bold")
				allAttr.options[allAttr.options.length - 1].style.fontWeight = "bold";
  		
  		assigned.options[assigned.options.selectedIndex] = null;
		}
		if (assigned.options.length != 0)
			assigned.options.selectedIndex = 0;
	}
}

//*** alle zugeordneten Attribute auf einer Seite markieren, so dass
//*** sie via POST verschickt werden können
function submitAttr() {
	
		var myElem = document.getElementById("assigned");
		if (myElem.options.length != 0)
			for (var t = 0; t < myElem.options.length; t++) {
				myElem.options[t].selected = true;
			}
		else
			document.attribute.leer.value = "leer";
	
	//document.subcats.submitted.value = "attr";
}

//*** einen iFrame mit Attributinformationen ein- und ausblenden
function showFrame(i, feature_id, product, spras, start) {
	var frame_src = "iAttribute.php?product=" + product + "&id=" + feature_id + "&lang=" + spras + "&start=" + start;
	servOC(i, frame_src, "#000000");
}


//*** MvS, 15.03.2006: ein iFrame mit den Artikeln zu einem gesuchten Produkt ein- und ausblenden
function showFrame_search(i, normt, spras, start, val) {
	var frame_src = "iSearch.php?normt=" + normt + "&lang=" + spras + "&start=" + start + "&values=" + val;
	servOC(i, frame_src, "#000000");
}

//*** einen iFrame mit Materialinformationen ein- und ausblenden
function showFrame(i, matnr, product, spras, start) {
	var frame_src = "iAttribute.php?product=" + product + "&id=" + matnr + "&lang=" + spras + "&start=" + start;
	servOC(i, frame_src, "#000000");
}

function showText(textId) {
	var myForm = document.attrText;
	
	//*** IE beglücken
	if (textId == null) {
		var mySelect = document.getElementById("assigned");
		if (mySelect.options.selectedIndex == -1)
			return;
		else 
			textId = mySelect.options[mySelect.options.selectedIndex].value;
	}
	
	for (var i = 0; i < myForm.getElementsByTagName("table").length; i++) {
		var curTable = myForm.getElementsByTagName("table")[i];
		if (curTable.id != "table_" + textId)
			curTable.style.display = "none";
	}
	
	document.getElementById("attributes").style.display = "none";
		
	var myTable = document.getElementById("table_" + textId);
	
	if (myTable.style.display == "none") {
		myTable.style.display = "block"
	}
	else {
		myTable.style.display = "none"
	}
}

function show_attributes() {
	var myForm = document.attrText;
	for (var i = 0; i < myForm.getElementsByTagName("table").length; i++) {
		var curTable = myForm.getElementsByTagName("table")[i];
		curTable.style.display = "none";
	}
	
	document.getElementById("attributes").style.display = "block";
}

function showbox(i, ie) {
	var box = document.getElementById('box' + i);
	if (box != null) {
		box.style.display = "block";
		/*if (ie == 1) {
			box.style.top = window.event.clientY-15;
			box.style.left = window.event.clientX+15;
		}*/
	}
}

function hidebox(i) {
	var box = document.getElementById('box' + i);
	if (box != null) 
		box.style.display = "none";
}

function showSubMenu(menuId) {
	var elem = document.getElementById(menuId);
	if (elem.style.visibility == "hidden") elem.style.visibility = "visible";
	else elem.style.visibility = "hidden";
}
