function popup(w,h) {
        x = screen.availWidth/2-w/2;
        y = screen.availHeight/2-h/2;
        var popupWindow = window.open(
            'http://www.tenne-stanton.at/includes/popup.php','Guestbook','width='+w+',height='+h+',left='+x+',top='+y+',screenX='+x+',screenY='+y);
}
function checkForm(formID){
	myForm = document.getElementById(formID);
	if (typeof(myForm) != "object") return false;
	myElements = myForm.elements;
	myError = new Array();
	for (f=0; f<myElements.length; f++){
		myElement = myElements[f];
		if (myElement.id.indexOf('_req') != -1){
			// REQUIRED FIELD
			if (myElement.value == "" || (myElement.type == "checkbox" && myElement.checked != true)) {
				myError.push(myElement);
			}
		}
	}
	if (myError.length > 0){
		alert("Bitte füllen Sie alle Pflichtfelder aus!");
		myError[0].focus();
		return false;
	} else { 
		return true;
	}
	return false;
}

var tenne = {
	checkForm : function (form) {
		form = (typeof(form) === 'string') ? document.getElementById(form) : form;
		var fields = ['name', 'personcount', 'date', 'time', 'smoker', 'mail'];
		var check = true;
		for (i=0; i<fields.length; ++i) {
			var fieldId = [form.id, '_', fields[i]].join('');
			if (!document.getElementById(fieldId)) {
				continue;
			}
			if (document.getElementById(fieldId).value.length <1) {
				document.getElementById([fieldId, '_error'].join('')).style.display = 'block';
				check = false;
			} else {
				document.getElementById([fieldId, '_error'].join('')).style.display = 'none';
			}
		}
		if (check === true) {
			form.submit();
		}
		return false;
	}
};
 
function impression(date, sprache) {
	var myWindow = window.open('http://www.tenne-stanton.at/media/stanton-' + (date == 'summer' ? 'sommer' : 'winter')+'-'+sprache+'.swf', '', "width=980,height=350");
	myWindow.focus();
}