var close_;
var colorHighlight	= '#b2dc20';
var colorLowlight	= '#c0c0c0';
/*
function replaceImage(id, url) {
	obj = findObject(id);
	obj.src = url;
}
*/
function findObject(s) {
    return document.getElementById(s);
}
function setStyle(o, attr, val) {
    try {
        o.style[attr] = val;
    } catch (e) {}
}
function show(id) {
	obj = findObject(id);
    setStyle(obj, 'display', 'block');
}
function hide(id) {
	obj = findObject(id);
    setStyle(obj, 'display', 'none');
}
function highlight(id) {
	obj = findObject(id);
    setStyle(obj, 'border', "1px solid "+colorHighlight);
}
function lowlight(id) {
	obj = findObject(id);
    setStyle(obj, 'border', "1px solid "+colorLowlight);
}
function switchOn(id) {
	try {
	    show('submenu_'+id);
	} catch(e) {}
	try {
    	highlight('m_'+id);
	} catch(e) {}
}
function switchOff(id) {
	try {
    	hide('submenu_'+id);
	} catch(e) {}
	try {
    	lowlight('m_'+id);
	} catch(e) {}
}
function switch_submenu(id) {
/*
    if (id == active_submenu) { return; }
*/
    switchOff(active_submenu);
    switchOn(id);
    active_submenu = id;
}
function open_submenu(id) {
    clearTimeout(close_);
    switch_submenu(id);
}
/*
function close_submenu(id) {
    if (current_folder == active_submenu) { return; }
    close_ = setTimeout("switch_submenu('"+current_folder+"')", 700);
}
*/
function smscount() {
	number	= findObject('telefon').value;

	input	= findObject('anliegen');
	text	= input.value;

/* Umlaute funktionieren jetzt in der SMS
	text	= text.replace(/Ä/g, 'AE');
	text	= text.replace(/ä/g, 'ae');
	text	= text.replace(/Ö/g, 'OE');
	text	= text.replace(/ö/g, 'oe');
	text	= text.replace(/Ü/g, 'UE');
	text	= text.replace(/ü/g, 'ue');
	text	= text.replace(/ß/g, 'ss');
	input.value = text;
*/

	charsUsed = number.length + text.length + 1; // Leerzeichen zwischen Nummer und Text
	findObject('charsleft').innerHTML = (160 - charsUsed);
}

var submitCount = 0;
function submitForm(f) {
	f.btnSubmit.value		= 'Bitte warten ...';
	f.btnSubmit.disabled	= true;
	if (0 == submitCount) {
		f.submit();
	}
	++submitCount;
}