function oeffnefenster(url) {
	fenster = window.open(url, "bilder", "width=600,height=400,status=yes,scrollbars=yes,resizable=yes");
	fenster.focus();
}
function showMaxPic(pic) {
	$('.prev_' + pic).slideToggle(500);
	$('.big_' + pic).slideToggle(500);
}
function slideToggle(classname) {
	$('.' + classname).slideToggle(500);
}
function completePerson(tid,aid,str) {
	$.ajax({
		url: '/portal/personen.php?tid=' + tid + '&aid=' + aid + '&str=' +str,
		success: function(data) {
			$('.pers_' + aid).html(data);
		}
	});
}
function fillinName(uid,name,id) {
	$(".persval_" + id).val(name);
	$(".persid_" + id).val(uid);
	$(".persneu_" + id).html("Neu: " + name);
}
function showHide(id) {
	if(document.getElementById(id).style.display == 'none') {
		document.getElementById(id).style.display = 'block';
	}else{
		document.getElementById(id).style.display = 'none';
	}
}
function showElement(id) {
	document.getElementById(id).style.display = 'block';
}
function hideElement(id) {
	document.getElementById(id).style.display = 'none';
}
function sleep(ms){
	var zeit=(new Date()).getTime();
	var stoppZeit=zeit+ms;
	while((new Date()).getTime()<stoppZeit){};
}
function submitForm(form) {
	$("#" + form).submit();
}

function IsNumeric(sText) {
	var ValidChars = "0123456789.";
	var IsNumber=true;
	var Char;
	for (i = 0; i < sText.length && IsNumber == true; i++) { 
	Char = sText.charAt(i); 
	if (ValidChars.indexOf(Char) == -1) 
		{
		IsNumber = false;
		}
	}
	return IsNumber;
}
function is_empty(sText) {
	if(sText != null && sText.length > 0 && IsNumeric(sText)) {
		return false;
	}
	return true;
}
function setEnd() {
	if(is_empty($("#beginn_y").val()) || is_empty($("#beginn_m").val()) || is_empty($("#beginn_d").val()) || is_empty($("#beginn_h").val()) || is_empty($("#beginn_i").val())) {
		return false;
	}else{
		beginn = new Date($("#beginn_y").val(), $("#beginn_m").val(), $("#beginn_d").val(), $("#beginn_h").val(), $("#beginn_i").val(), 0);
		tmp = beginn.getTime + 5400000;
		ende   = new Date(tmp);
		$("#ende_y").val(ende.getFullYear());
		$("#ende_m").val(ende.getMonth());
		$("#ende_d").val(ende.getDay());
		$("#ende_h").val(ende.getHours());
		$("#ende_i").val(ende.getMinutes());
		return tmp;
	}
}

/*$(function(){
	var btnUpload=$('#upload');
	var status=$('#status');
	new AjaxUpload(btnUpload, {
		action: 'personenbilder/upload.php',
		//Name of the file input box
		name: 'uploadfile',
		onSubmit: function(file, ext){
			if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
				// check for valid file extension
				status.text('Only JPG, PNG or GIF files are allowed');
				return false;
			}
			status.text('Uploading...');
		},
		onComplete: function(file, response){
			//On completion clear the status
			status.text('');
			//Add uploaded file to list
			if(response!=="error"){
				$('profilbild').attr('src',file);
			}else{
				alert('Fehler beim Hochladen!');
			}
		}
	});
});*/

