

var interval;
var status = 'zu';
var i = 1; 
var max_height = 160;

function aufmachen() { 
	status = 'akt';
	document.getElementById("main_div").style.overflow = "hidden";
	if (i >= max_height) {
		window.clearInterval(interval);
		document.getElementById("main_div").style.height = max_height + "px";
		status = 'auf';
	} else {
		document.getElementById("main_div").style.height = i + "px"; 
		i = i + 5; 
	}
} 

function zumachen() {
	status = 'akt';
	document.getElementById("main_div").style.overflow = "hidden";
	if (i <= 1) {
		window.clearInterval(interval); 
		document.getElementById("main_div").style.height = "1px";
		status = 'zu';
	} else {
		document.getElementById("main_div").style.height = i + "px"; 
		i = i - 5;
	}
} 

function aufklappen() {
	// status = 'auf';
	interval = window.setInterval("aufmachen()", 1);
}

function zuklappen() {
	// status = 'zu';
	interval = window.setInterval("zumachen()", 1);
}

function teste_div() {
	if ( status != 'akt' ) {
		if ( status == 'zu' ) { aufklappen(); } else { zuklappen(); }
	}
}


// Preisformartierung
function number_format( number, decimals, dec_point, thousands_sep ) {
	var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
	var d = dec_point == undefined ? "." : dec_point;
	var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
	var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
	return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}

