var fenster;

function popupimage(url, ww, hh)
{if(fenster) { fenster.close(); }
ww = ww + 20;
hh = hh + 20;
fenster = window.open('', '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,width='+ww+',height='+hh);
fenster.document.open();
fenster.document.write("<html><head></head><body bgcolor=\"#DBDBDB\" onClick=\"javascript:window.close();\"><center><img src=\""+url+"\" alt=\"\"></center></body></html>");
fenster.document.close();
fenster.focus();}

function popupurl(url, ww, hh)
{if(fenster) { fenster.close(); }
fenster = window.open(url, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizeable=no,width='+ww+',height='+hh);
fenster.focus();}

function fensterschliessen()
{if(fenster) { fenster.close(); } }

function uservalue()
 {
 if(document.loginform.username.value == 'Username / eMail') { document.loginform.username.value = ''; }
 }

function uservalue2()
 {
 if(document.loginform.username.value == '') { document.loginform.username.value = 'Username / eMail'; }
 }
    
function passvalue()
 {
 if(document.loginform.passwort.value == 'Passwort') { document.loginform.passwort.value = ''; }
 }

function passvalue2()
 {
 if(document.loginform.passwort.value == '') { document.loginform.passwort.value = 'Passwort'; }
 }
      
function newslettervalue()
 {
 if(document.newsletter.email.value == 'eMail-Adresse') { document.newsletter.email.value = ''; }
 }

function newslettervalue2()
 {
 if(document.newsletter.email.value == '') { document.newsletter.email.value = 'eMail-Adresse'; }
 }
 
 // Div Fade-In/Fade-Out Funktionen

var fading_div;
var fade_in_function = false;
var fade_out_function = false;
var fade_speed = 6;
var div_opacity;

function fade_toggle_div(div_name, speed, fade_in_func, fade_out_func) {
	clearInterval(fading_div);
	
	if(typeof speed != "undefined" && speed != '') { fade_speed = speed; }
	if(document.getElementById(div_name).style.display == '') {
		div_opacity = 1;
		if(typeof fade_out_func != "undefined" && fade_out_func != '') { fade_out_function = fade_out_func; }
		fading_div = setInterval("fade_div(false, '" + div_name + "')", 10);
	} else {
		div_opacity = 0;
		if(typeof fade_in_func != "undefined" && fade_in_func != '') { fade_in_function = fade_in_func; }
		fading_div = setInterval("fade_div(true, '" + div_name + "')", 10);
	}
}

function fade_div(increase, div_name) {
	if(div_opacity == 0 && increase) {
		document.getElementById(div_name).style.display = '';
	}
	
	if(div_opacity > 0 && !increase) {
		div_opacity -= fade_speed / 100;
	}
	
	if(div_opacity < 1 && increase) {
		div_opacity += fade_speed / 100;
	}
	
	document.getElementById(div_name).style.filter = "alpha(opacity=" + (div_opacity * 100) + ")";
	document.getElementById(div_name).style.opacity = div_opacity;
	
	if(div_opacity < 0) {
		div_opacity = 0;
		clearInterval(fading_div);
		document.getElementById(div_name).style.display = 'none';
		
		if(fade_out_function) {
			setTimeout(fade_out_function, 1);
			fade_out_function = false;
		}
	}
	
	if(div_opacity > 0.99 && increase) {
		div_opacity = 1;
		clearInterval(fading_div);
		
		if(fade_in_function) {
			setTimeout(fade_in_function, 1);
			fade_in_function = false;
		}
	}
}

function microtime(get_as_float) {
	var now = new Date().getTime() / 1000;
	var s = parseInt(now, 10);
	
	return (get_as_float) ? now : (Math.round((now - s) * 1000) / 1000) + ' ' + s;
}
