window.onload = function ()
{
	var obj = document.getElementsByTagName('input');
	var area = document.getElementsByTagName('textarea');

	for (var i = 0; i < obj.length; i++){
		if ((obj[i].type == 'text') || (obj[i].type == 'password')){
			obj[i].onfocus = function () { formFocus(this.id); }
			obj[i].onblur = function () { formBlur(this.id); }
		}
	}

	for (var j = 0; j < area.length; j++){
		area[j].onfocus = function () { formFocus(this.id); }
		area[j].onblur = function () { formBlur(this.id); }
	}

	if (typeof(xajax) == 'function'){
		xajax.callback.global.onRequest = function() { xajax.$('loading').style.display = 'block'; }
		xajax.callback.global.beforeResponseProcessing = function() { xajax.$('loading').style.display='none'; }
	}
}
function formFocus(id){
    document.getElementById(id).style.borderColor = '#903';
}
function formBlur(id){
    document.getElementById(id).style.borderColor = '#999';
}
function showAgb(wintype){
	SmallWin=window.open(wintype,"SmallWin","toolbar=no, directories=no, status=no, scrollbars=yes, menubar=no, width=850, height=600"); SmallWin.window.focus()
}
function toggleDisplay(id){
    if (document.getElementById){
        var mydiv = document.getElementById(id);
        mydiv.style.display = (mydiv.style.display == 'block' ? 'none' : 'block');
    }
}
function toggleDisplayImgInvert(id){

    if (document.getElementById){
        var mydiv = document.getElementById(id);
        var imgsplit = id.split('listCard');

        if (mydiv.style.display == 'block'){
            mydiv.style.display = 'none';
            document.getElementById('HideHandle' + imgsplit[1]).src = '/images/plus.gif';
        }
        else{
            mydiv.style.display = 'block';
            document.getElementById('HideHandle' + imgsplit[1]).src = '/images/minus.gif';
        }

    }
}
function QuickJump(form){
	var order=form.group_items.selectedIndex;
	if ( form.group_items.options[order].value != 0 ){
		location=form.group_items.options[order].value;
	}
}
function limiter(id){
	var count = eval('count_'+id);
	var tex = document.getElementById(id).value;
	var len = tex.length;
	if( len > count ){
        tex = tex.substring(0,count);
        document.getElementById(id).value =tex;
        return false;
	}
	
	var visibleLength = count-len;
	document.getElementById(id+'_counter').innerHTML = '(' + visibleLength + ' Zeichen verbleibend)';
}

