var folded = new Object();
function slide(el)
{
    if(folded[el] == 1) {
        Effect.SlideUp(el);
        folded[el] = 0;
    } else {
        Effect.SlideDown(el);
        folded[el] = 1;
    }
}


function mailstuff(user,domain) {
	locationstring = "mailto:" + user + "@" + domain;
	window.location = locationstring;
}

function validateForm(){

	if (document.mailform.name.value == "") {
		document.mailform.name.focus();
		return false;
	}

	else if (document.mailform.email.value == "") {
		document.mailform.email.focus();
		return false;
	}

	else if (document.mailform.message.value == "") {
		document.mailform.message.focus();
		return false;
	}

	else if (document.mailform.email.value.indexOf ('@',0) == -1 || document.mailform.email.value.indexOf ('.',0) == -1){
		document.mailform.email.select();
		document.mailform.email.focus();
		return false;
	}

	else if ( document.mailform.mail_offer.checked == true) {
	}



	return true;
}

function displayOffer(changed) {
	flag=document.getElementById("mail_offer").checked;
	if (flag == true) {
		new Effect.SlideDown("angebot", { duration:0.5 } );
	} else {
		if (changed == 1 ) new Effect.SlideUp("angebot", { duration:0.5 } );
	}
}

function insertOtherCountry(changed) {
	country=document.getElementById("mail_country").value;

	if (country == "5") {
		new Effect.BlindDown("otherCountry", { duration:0.5 } );
	} else {
	     if (changed == 1) { new Effect.BlindUp("otherCountry", { duration:0.5 } );}
	     else { document.getElementById("otherCountry").style.display = "none";}
	}
}

function displayPrivacyPolicy( state )  {
    if (state == 'open' ) {
        $('privacyStatement').style.display = "none";
        new Effect.Fade("privacyStatementLink", {duration:0.1});
        new Effect.BlindDown("privacyStatement", {delay:0.2});
    }
    else {
        if (state == "close") {
            new Effect.SlideUp("privacyStatement", {duration:1.0});
            new Effect.Appear("privacyStatementLink", {delay:1.0});
            //$('privacyStatementLink').style.display = "block";
        }
    }
}

function init_all() {
	displayOffer();
	insertOtherCountry();
	displayPrivacyPolicy();
}