// popup fenster welches in der mitte des bildschirms zentriert,
// und falls zu gross für die entsprechende auflösung angepasst wird.
function PopThis(url,width,height,name,scroll){
	if(height>window.screen.height) { var height = window.screen.height-60; var width2 = parseInt(width); width2 += 16; width2 = width2.toString(); var scroll = 'yes'; }
	else { var width2 = width; if(!scroll) var scroll = 'no'; }
	if(!name) var name = 'popup';

	var winl = (screen.width-width2)/2 - 4; var wint = (screen.height-height)/2 + 6;
	var PopThis = window.open(url,name,"width=" + width2 + ",height=" + height + ",top=" + wint + ",left=" + winl + ",scrollbars=" + scroll + ",menubar=no,location=yes,directories=no,resizable=no,status=no");
	PopThis.focus();
}


function zoomFenster(ware_id){
	PopThis('/zoom.php?ware_id='+ware_id+'&img_id='+img_id, '555', '740', 'artikel_detail');
}
function zoomFensterOutfit(id){
	PopThis('/zoom.php?outfit_id='+id, '555', '740', 'outfit_detail');
}

function PopGroessenTabelle() {
	PopThis('/groessentabellen.php', '830', '687', 'groessentabellen');
}

var aktuell = "";
function ShowHide(Divname,DontHoldPlace) {
	if(DontHoldPlace) {
		if(aktuell==Divname) { document.getElementById(Divname).style.display = "none"; aktuell = ""; }
		else { document.getElementById(Divname).style.display = "block"; aktuell = Divname; }
	}
	else {
		if(aktuell==Divname) { document.getElementById(Divname).style.visibility = "hidden"; aktuell = ""; }
		else { document.getElementById(Divname).style.visibility = "visible"; aktuell = Divname; }
	}
}


function hideFormOnSubmit(){
	var waitbr = document.createElement('br');

	var waitb = document.createElement('b');
	waitb.appendChild(document.createTextNode('Bitte Warten...'));

/*	var waitimg = document.createElement('img');
	waitimg.setAttribute('src', '/img/icon_wait.gif');
*/
	var waitimg = new Image();
	waitimg.src='/img/icon_wait.gif';
	waitimg.setAttribute('style', 'display: block; margin: 0px auto;');

	var waittag = document.createElement('div');
	waittag.setAttribute('class', 'wait');
	waittag.setAttribute('style', 'display:block; position:relative; height:100px; text-align: center;');
	waittag.appendChild(waitb);
	waittag.appendChild(waitbr);
	waittag.appendChild(waitimg);

	var bodytag = document.getElementsByTagName('body')[0];
	for(var i=0; i<bodytag.childNodes.length; i++){
		if(bodytag.childNodes[i].style)
			bodytag.childNodes[i].style.display="none";
	}

	bodytag.appendChild(waittag);
}
