function checkemail(email){
reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)'+'([a-zA-Z0-9\\-\\.]+)'+'(\\.)'+'([a-zA-Z]{2,4})$');
return reg.test(email);
}
function sortalph(a,b){
  return a - b;
}

function in_array(item,arr) {
for(p=0;p<arr.length;p++) if (item == arr[p]) return true;
return false;
}
function delete_from_array(item,arr){
for(p=0;p<arr.length;p++) if (item == arr[p]){arr[p]=''; return true;}
return false;
}
function include(path,divid,waitmsg)
{
if(typeof waitmsg !=undefined) document.getElementById(divid).innerHTML=waitmsg;

myAjax = new Ajax(path, {method: 'get', update: $(divid), evalScripts: true}).request();
}
function include_p(path,params,divid,waitmsg)
{
if(typeof waitmsg !=undefined) document.getElementById(divid).innerHTML=waitmsg;

myAjax = new Ajax(path, {method: 'post', update: $(divid), evalScripts: true}).request(params);

}

function getStyleClass (className) {
	for (var s = 0; s < document.styleSheets.length; s++)
	{
		if(document.styleSheets[s].rules)
		{
			for (var r = 0; r < document.styleSheets[s].rules.length; r++)
			{
				if (document.styleSheets[s].rules[r].selectorText == '.' + className)
				{
					return document.styleSheets[s].rules[r];
				}
			}
		}
		else if(document.styleSheets[s].cssRules)
		{
			for (var r = 0; r < document.styleSheets[s].cssRules.length; r++)
			{
				if (document.styleSheets[s].cssRules[r].selectorText == '.' + className)
					return document.styleSheets[s].cssRules[r];
			}
		}
	}
	
	return null;
}

function showcountdown(divid,cfromdig,ctodig,cinterval,fixeddig){ // Ziel, Von, Zu, Interval, Nachkommastellen
$(divid).innerHTML = cfromdig.toFixed(fixeddig);
for(var i=0;i<=Math.round((cfromdig-ctodig)*1000/cinterval);i++)
setTimeout("$('"+divid+"').innerHTML = "+(cfromdig-cinterval*i/1000).toFixed(fixeddig)+";",(cinterval*i));

}