// Copyright 2005, scalp.de
// this code may be reproduced as long as the above copyright notice is maintained.

// aufruf ueber: javascript:noSpam('info','apple','de');
function noSpam(user,domain,tld) {
	locationstring = "mailto:" + user + "@" + domain + "." + tld + "?subject=contact via homepage";
	window.location = locationstring;
}


function winopen(url,name,style) { 
	var newWin     = window.open(url,name,style);
	newWin.focus();
}


function nl_form_submit(){
	var alerttext = "";

	// email
	var zeichen="/ ;:,δόφ";
	eingabe = document.getElementById("nl_email_id").value;
	laenge = eingabe.length;
	for(i=0; i<laenge; i++) {
	  	badchar = eingabe.charAt(i);
	  	if (zeichen.indexOf(badchar)>-1) {
			alerttext += "\nEmail contains bad characters.";
		}
	}   		
     	var PosEt = document.getElementById("nl_email_id").value.indexOf("@");
     	var PosPt = document.getElementById("nl_email_id").value.indexOf(".", PosEt);
     	if ((document.getElementById("nl_email_id").value == '') || (PosPt == -1) || (PosPt - PosEt < 2) || (document.getElementById("nl_email_id").value.length - PosPt < 3) || (PosEt == -1) || (PosEt == 0) || (document.getElementById("nl_email_id").value.indexOf("@", PosEt + 1) > PosEt)) {
		alerttext += "\nEmail is not valid.";	
	}

	var zeichen="/;:,<>";

	// nl_pers_firstname_id   
    if (document.getElementById("nl_pers_firstname_id").value == ""){      
		alerttext += "\nFirstname missing."; 
    }
	eingabe = document.getElementById("nl_pers_firstname_id").value;
	laenge = eingabe.length;
	for(i=0; i<laenge; i++) {
	  	badchar = eingabe.charAt(i);
	  	if (zeichen.indexOf(badchar)>-1) {
			alerttext += "\nFirstname contains bad characters.";
		}
	}
	
	// final check
	if (alerttext != "") {
		alerttext = "Error, please check:\n" + alerttext;
		alert(alerttext);
		return false;
	} else {
		// alerttext = "No errors :)";
		document.getElementById("nl_submit_id").disabled = true;			
		document.getElementById("nl_submit_id").value = 'PLEASE WAIT';
		return true;
	}	

}


function submitnewsabo_delete(){
	if (document.forms.newsabo_delete.email_delete.value.indexOf('@') == '-1' || document.forms.newsabo_delete.email_delete.value == '')  {
		alert('Check your email!');			
	} else {		
		document.forms.newsabo_delete.submit();
	}
}


function scrollTop(){
	scroll(0,0);
}


function setClass(id, classname) { 
	// alert("node= " + id + " classname= " + classname);
	node = document.getElementById(id);
	if (node) {
		document.getElementById(id).setAttribute("class", classname); 
		document.getElementById(id).setAttribute("className", classname); // ie fix
	}
}


function hilite(type, modus) {
	// type =  scenarium, nycirkus, yoga
	// modus = off, on
	setClass("navlink_" + type + "_id", "navlink navlink_" + type + " navlink_" + modus);
	setClass("logolink_" + type + "_id", "logolink logolink_" + type + " logolink_" + modus);
}


// --- peace out ---
