var win = null;

// ===============================================================================================================================

function NewWindow(mypage, myname, w, h, scroll)
{	
	
	if (win && !win.closed) win.close();
	
	

	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
	win = window.open(mypage, myname, settings);
	if (win.window.focus) { win.window.focus(); }
}

// ===============================================================================================================================

function gaGetViewport(returnmode)
{
	// Gibt Höhe oder Breite des Viewports zurück
	// returnmode == 1 gibt viewportheight zurück
	// returnmode == 2 gibt viewportwidth zurück
	var viewportwidth;
	var viewportheight;
	 
	// standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
	if (typeof(window.innerWidth) != 'undefined')
	{
		viewportwidth = window.innerWidth;
		viewportheight = window.innerHeight;
	}
	 
	// IE6 in standards compliant mode
	else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
	{
		viewportwidth = document.documentElement.clientWidth;
		viewportheight = document.documentElement.clientHeight;
	}
	 
	// older versions of IE 
	else
	{
		viewportwidth = document.getElementsByTagName('body')[0].clientWidth;
		viewportheight = document.getElementsByTagName('body')[0].clientHeight;
	}
	
	if (returnmode == 1) return viewportheight;
	else return viewportwidth;
	
}

// ===============================================================================================================================

function gaSetHeightSpacer(myValue)
{
	// Setzt Höhe für pt.gif
	var spacerHeight;
	var myHeight = gaGetViewport(1); // aktuelle Höhe Viewport holen
	myValue = myValue || 265; 
	
	if (document.all) myValue = myValue - 0; // Wenn IE
	
	if (myHeight > 0)
	{
		spacerHeight = myHeight - myValue;
		document.getElementById("hoehenspacer").style.height = spacerHeight + "px";
	}
}

// ===============================================================================================================================

function check_email(email) 
{

 	var usr    = "([a-zA-Z0-9][a-zA-Z0-9_.-]*|\"([^\\\\\x80-\xff\015\012\"]|\\\\[^\x80-\xff])+\")";
  	var domain = "([a-zA-Z0-9][a-zA-Z0-9._-]*\\.)*[a-zA-Z0-9][a-zA-Z0-9._-]*\\.[a-zA-Z]{2,6}";
  	var regex  = "^" + usr + "\@" + domain + "$";
  	var rgx    = new RegExp(regex);
  	return rgx.exec(email) ? true : false;
}

// ===============================================================================================================================

function makebild(bild,width,height)
	{
	var leftpos = (screen.width) ? (screen.width-width)/2 : 0;
	var toppos = (screen.height) ? (screen.height-height)/2 : 0;
        picwin = window.open("/images/pics/popup.php3?image="+bild,"bild","resizable=no,width="+width+",height="+height+",status=0,menubar=0,scrollbars=0,left="+leftpos+",top="+toppos+"");
        }
        
function maildecode (input)
	{
	var output=input;
	output=output.replace(/\|/, '@');
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	output=output.replace("#xxcom#", ".");
	return (output);
	}

function writemaillink ($inputmail,$showtext)
	{
	if ($showtext=='') $showtext=maildecode($inputmail);
	document.write ("<a href=\"javascript:makemail('"+$inputmail+"')\">");
	document.write ($showtext);
	document.write ('</a>');
	}

function makemail($link)
	{
	$link=maildecode($link);
	this.location.href="mailto:"+$link;
	}        