// JavaScript Document
function checkMessage(lang)
{
    // get the fields
    var first_name  = document.getElementById("firstname").value;
    var last_name  = document.getElementById("surname").value;
    var email = document.getElementById("email").value;

    // did errors happen?
    var noErrors = true;
    
    // check the last_name
    if(last_name.length <= 0) { // error
        noErrors = false;
        document.getElementById("surname").className = "news_textfield emptyInput";
    } else {
        document.getElementById("surname").className = "news_textfield";
	}
    
    // check the first_name
    if(first_name.length <= 0) { // error
        noErrors = false;
        document.getElementById("firstname").className = "news_textfield emptyInput";
    } else {
        document.getElementById("firstname").className = "news_textfield";
	}
    
    // check the email
    if(!email.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) { // error
        noErrors = false;
        document.getElementById("email").className = "news_textfield emptyInput";
    } else {
        document.getElementById("email").className = "news_textfield";
	}
    
    // return the error var
	if(!noErrors) {
		if(lang=="en") {
			alert("Please fill out all required fields.");
		} else {
			alert("Bitte füllen Sie alle mit * gekennzeichneten Felder aus.");
		}
	}
    return noErrors;
}


function checkMessagePrint(lang)
{
    // get the fields
    var first_name  = document.getElementById("vorname").value;
    var last_name  = document.getElementById("name").value;
    var email = document.getElementById("email").value;
    var message = document.getElementById("msg").value;
	var code = document.getElementByID("code").value;

    // did errors happen?
    var noErrors = true;
    
    // check the last_name
    if(last_name.length <= 0) { // error
        noErrors = false;
        document.getElementById("name").className = "textfield emptyInput";
    } else {
        document.getElementById("name").className = "textfield";
	}
    
    // check the first_name
    if(first_name.length <= 0) { // error
        noErrors = false;
        document.getElementById("vorname").className = "textfield emptyInput";
    } else {
        document.getElementById("vorname").className = "textfield";
	}
    
    // check the email
    if(!email.match(/^[A-Z0-9._%-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i)) { // error
        noErrors = false;
        document.getElementById("email").className = "textfield emptyInput";
    } else {
        document.getElementById("email").className = "textfield";
	}
    
    // check the message
    if(message.length <= 0) { // error
        noErrors = false;
        document.getElementById("msg").className = "emptyInput";
    } else {
        document.getElementById("msg").className = "";
	}
	
	// check the code
    if(code.length <= 0) { // error
        noErrors = false;
        document.getElementById("code").className = "textfield emptyInput";
    } else {
        document.getElementById("code").className = "textfield";
	}
    
    // return the error var
	if(!noErrors) {
		if(lang=="en") {
			alert("Please fill out all required fields.");
		} else {
			alert("Bitte füllen Sie alle mit * gekennzeichneten Felder aus.");
		}
	}
    return noErrors;
}

function openSponsoringPix(url) 
{
	sponsoringWindow = window.open(url, "Sponsoring", "width=800,height=650,toolbar=no,status=no,resizable=no,menubar=no,location=no,scrollbars=yes");
	sponsoringWindow.focus();
}
function openHotelPix(url) 
{
	hotelWindow = window.open(url, "Hotel", "width=850,height=650,toolbar=no,status=no,resizable=no,menubar=no,location=no,scrollbars=yes");
	hotelWindow.focus();
}
function openSpeedNetworking(url) 
{
	speedWindow = window.open(url, "Speednetworking", "width=700,height=650,toolbar=no,status=no,resizable=no,menubar=no,location=no,scrollbars=yes");
	speedWindow.focus();
}


function hidePostit (id) {
    var postit  = document.getElementById(id);
	postit.style.display = "none";
}

