// sehr einfache Browserweiche
var browser = document.all ? 'ie' : 'ff';


// formchecker
var arrMandatoryFlds = new Array();
var arrAlternateFlds = new Array();

arrMandatoryFlds['frm-contact'] = new Array("inp-nachname", "inp-vorname", "inp-email", "txt-nachricht");
arrAlternateFlds['frm-contact'] = false;

function check_form(frmName)
{
	var f = document.forms[frmName];
	var error = false;
	
	for (fld in arrMandatoryFlds[frmName]) {
		fldID = arrMandatoryFlds[frmName][fld];
		if (!document.getElementById(fldID).value || document.getElementById(fldID).value == '') {
			alert(unescape("Bitte f%FCllen Sie alle mit '*' gekennzeichneten Felder aus, damit wir uns ggf. bei Ihnen zur%FCckmelden k%F6nnen"));
			document.getElementById(fldID).focus();
			return false;
		}
	}
	
	if (arrAlternateFlds[frmName].length > 0) {
		alert('gr. 0');
		error = true;	
	}
	for (fldList in arrAlternateFlds[frmName]) {
		for (fld in arrAlternateFlds[frmName][fldList]) {
			fldID = arrAlternateFlds[frmName][fldList][fld];
			if (document.getElementById(fldID).checked == true) {
				error = false;		
			}
		}
	}
	if (error == true) {
		alert(unescape("2 Bitte f%FCllen Sie alle mit '*' gekennzeichneten Felder aus, damit wir uns ggf. bei Ihnen zur%FCckmelden k%F6nnen"));
		return false;
	}
	
	return true;
}

function openWindow(windowURL,windowName,windowWidth,windowHeight,coordX,coordY,windowScroll,windowStatus,windowLocation,windowToolbar)
{
	newWindow = window.open(windowURL,windowName,'width='+windowWidth+',height='+windowHeight+',left='+coordX+',top='+coordY+',screenX='+coordX+',screenY='+coordY+',scrollbars='+windowScroll+',status='+windowStatus+',location='+windowLocation+',toolbar='+windowToolbar+'');
}

function open_centered_window(windowURL,windowName,windowWidth,windowHeight,windowScroll,windowStatus,windowLocation,windowToolbar)
{
	if (browser == 'ie') {
			coordX = document.body.offsetWidth / 2 - windowWidth / 2;
			coordY = document.body.offsetHeight / 2 - windowHeight / 2;
	} else {
			coordX = window.innerWidth / 2 - windowWidth / 2;
			coordY = window.innerHeight / 2 - windowHeight / 2;
	}
	newWindow = window.open(windowURL,windowName,'width='+windowWidth+',height='+windowHeight+',left='+coordX+',top='+coordY+',screenX='+coordX+',screenY='+coordY+',scrollbars='+windowScroll+',status='+windowStatus+',location='+windowLocation+',toolbar='+windowToolbar);
}

function set_imgstyle(imgID, styleNrm, styleHlt)
{
	var compareString = /imgfullsize_*/;
	for (var i = 0; i < document.getElementsByTagName("img").length; i++) {
		var compareID = document.getElementsByTagName("img")[i].id;
		if (compareString.exec(compareID)) {
			document.getElementsByTagName("img")[i].className = styleNrm;
		}
	}
	elClassName = document.getElementById(imgID).className;
	document.getElementById(imgID).className = elClassName + ' ' + styleHlt;
}
