function registerFormAntiDoubleSubmit() {
	if(document.forms) {
		for(i=0;i<document.forms.length;i++) {
			if (document.forms[i].name.substr(0,5)=='noads') continue;	//Formulare mit Namenspräfix noads werden nicht gesperrt!
			document.forms[i].onsubmit = formSubmitHandler;
		}
	}
}

var formslocked = false;
function formSubmitHandler(e) {
	if (formslocked == true) return false;

	// Alle Submits und Buttons deaktivieren
	if(document.forms) {
		for(i=0;i<document.forms.length;i++) {
			if (document.forms[i].name.substr(0,5)=='noads') continue;	//Formulare mit Namenspräfix noads werden nicht gesperrt!
			if (document.forms[i].elements) {
				for(j=0;j<document.forms[i].elements.length;j++) {
					type=document.forms[i].elements[j].type;
					if ((type=='submit') || (type=='button')) {
						document.forms[i].elements[j].disabled=true;
					}
				}
			}
		}
	}
	formslocked=true;
	return true;
}

function openPopUpWindow(url, width, height) {
	var posX = 50;
	var posY = 50;
	var urlstr = url;

	urlstr = encodeURIComponent(urlstr.replace(/\./g, '_'));
	urlstr = encodeURIComponent(urlstr.replace(/%/g, '_'));

	if (navigator.appName == 'Microsoft Internet Explorer') {
		height += 20; // title bar (approx)
	}

	if (navigator.appName == 'Opera') {
		posX = Math.round(top.innerWidth/2 - width/2);
		posY = Math.round(top.innerHeight/2 - height/2);
	} else {
		posX = Math.round(screen.availWidth/2 - width/2);
		posY = Math.round(screen.availHeight/2 - height/2);
	}

	if (posX < 0) posX = 0;
	if (posY < 0) posY = 0;

	popup = window.open(url, 'popUpWindow'+width.toString()+height.toString()+urlstr, 'width='+width+','+'height='+height+','+'resizable=no'+','+'scrollbars=no'+','+'status=no'+','+'toolbar=no'+','+'menubar=no'+','+'location=no'+','+'dependent=no'+','+'left='+posX+','+'top='+posY);
	popup.focus();
//	if (navigator.appName == 'Opera') {
//		moveX = Math.round(top.innerWidth/2 - width/2);
//		moveY = Math.round(top.innerHeight/2 - height/2);
//		if (moveX < 0) moveX = 0;
//		if (moveY < 0) moveY = 0;
//		popup.moveTo(moveX, moveY);
//	}
}

function ifPicPopUp(e) {
	msg="© of this edit: InterFriendship";
	if (navigator.appName == 'Netscape' && e.which == 3) {
		alert(msg);
		return false;
	}
	if (navigator.appName == 'Microsoft Internet Explorer' && event.button==2) {
		alert(msg);
		return false;
	}
	else return true;
}

function rightClickOnPic() {
	if(document.images)
	for(i=0;i<document.images.length;i++)
	document.images[i].onmousedown = ifPicPopUp;
}

function openShowPic(ifcode) {
	var width;
	var height;
	if (navigator.appName == 'Opera') {
		width = top.innerWidth;
		height = top.innerHeight;
	} else {
		width = screen.availWidth;
		height = screen.availHeight;
	}
	var w=Math.min(width-100,1280);
	var h=Math.min(height-120,1000);
	openPopUpWindow("/de/daten/showpic.php?ifcode="+ifcode,w,h);
}
