/****************************************************************************************************
** Browser Erkennung
****************************************************************************************************/

/* Variabledefinitionen - Browser
----------------------------------------------------------------------------------------*/
var bNav 				= false;		// wahr wenn Netscape Navigator Browser (noch keine Version)
var bIE 				= false;		// wahr wenn Internet Explorer Browser (noch keine Version)
var bMoz 				= false;		// wahr wenn Mozilla Browser (noch keine Version)
var bOpe 				= false;		// wahr wenn Opera Browser (noch keine Version)

/* Auslesen des UserAgent und Konvertierung in Kleinbuchstaben
-------------------------------------------------------------*/
var uAgent 		= navigator.userAgent.toLowerCase();

/****************************************************************************************************
** WELCHER BROWSER
****************************************************************************************************/
/* Welcher Browser (ohne Version)
-- Variablen im Bereich 'Variabledefinitionen - Browser' (weiter oben) werden
-- auf wahr gesetzt
----------------------------------------------------------------------------*/
if ((uAgent.indexOf('mozilla') != -1) && (uAgent.indexOf('spoofer')== -1) && (uAgent.indexOf('compatible') == -1) && (uAgent.indexOf('opera') == -1)) {
	if ((uAgent.indexOf('rv:1.') != -1) && (uAgent.indexOf("netscape") == -1)) {
		bMoz = true;					// Mozilla Browser
	} else {
		bNav = true;					// Netscape Browser
	}
}

if ((uAgent.indexOf("msie") != -1) && (uAgent.indexOf("opera") == -1))
	bIE = true;						// Internet Explorer Browser

if (uAgent.indexOf("opera") != -1)
	bOpe = true;						// Opera Browser
/****************************************************************************************************
****************************************************************************************************/
	
	

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function DrawFadeLine ()
{
	window.document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"\/pics/horizont_linie.gif\">");
//	window.document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" >");
	window.document.write("<tr>");
//	window.document.write("<td><img src=\"\/pics\/horizont_linie_fade_in.gif\" height=\"1\" width=\"129\"><\/td>");
	window.document.write("<td><img src=\"\/pics\/horizont_linie.gif\" height=\"1\" width=\"129\"><\/td>");

	window.document.write("<td width=\"100%\"><img src=\"\/pics\/horizont_linie.gif\" height=\"1\" width=\"100%\"><\/td>");
	
//	window.document.write("<td align=\"right\"><img src=\"\/pics/horizont_linie_fade_out.gif\" height=\"1\" width=\"129\"><\/td>");
	window.document.write("<td align=\"right\"><img src=\"\/pics/horizont_linie.gif.gif\" height=\"1\" width=\"129\"><\/td>");
	window.document.write("<\/tr>");
	window.document.write("<\/table>");
	
}


function DrawFadeInLine ()
{
	window.document.write("<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" background=\"\/pics/horizont_linie.gif\">");
	window.document.write("<tr>");
	window.document.write("<td><img src=\"\/pics\/horizont_linie_fade_in.gif\" height=\"1\" width=\"129\"><\/td>");
	window.document.write("<\/tr>");
	window.document.write("<\/table>");
}

function openWindowPIC(url,lang,title,description){
	
	if (document.images[0].complete == "undefined")
	    {
			if(lang=="de")
				 alert("Ihre Browserversion unterstuetzt diese Funktion leider nicht.");
			else
				alert("Your browser does not support this function.");
		 return;
		}
	
	if (url == null || url == "")
		return;


	var winProperties = "toolbar=no,location=no,directories=no,status=no,width=200,height=100,resizable=yes";
	var url_neu="/minicms/zeigbild_seite.php?url="+url;
	if (title!=null && title!="")
		url_neu +="&title="+title;
	if (description!=null && description!="")
		url_neu +="&description="+description;
	if (lang!=null && lang!="")
		url_neu +="&lang="+lang;

	var windowPIC = window.open(url_neu, "PopupFenster", winProperties);
}

function openPopup(url,b,h){
	
	var breite = 640;
	var hoehe = 600;
	if (b != null )
	{
		if (b > breite)
			breite = b;
	}

	if (h != null)
		hoehe = h;
	var winProperties = "scrollbars=yes,toolbar=no,location=no,directories=no,status=no,width="+breite+",height="+hoehe+",resizable=yes";
	var windowPIC = window.open(url, "PopupFenster", winProperties);
}

function openReportsWindow(type,lang,title){
	
	if (document.images[0].complete == "undefined")
	    {
			if(lang=="de")
				 alert("Ihre Browserversion unterstuetzt diese Funktion leider nicht.");
			else
				alert("Your browser does not support this function.");
		 return;
		}
	
	
	var breite = 200;
	var hoehe =100;
	if (navigator.appName.indexOf("Explorer") != -1)
		{
			
			breite += 50;
			hoehe += 10;
		}
	
	var winProperties = "scrollbars=yes,resizable=yes,toolbar=no,location=no,status=no,width="+breite+",height="+hoehe;
	var url_neu="/minicms/reports_gross.php?type="+type;
	if (title!=null && title!="")
		url_neu +="&title="+title;
	if (lang!=null && lang!="")
		url_neu +="&lang="+lang;

	var windowPIC = window.open(url_neu, "PopupFenster", winProperties);
}

function IsEmailValid(email)
{
	var regEmail = /[^(\w|\.|\-|@)]/; // alles außer Zeichen,Zahlen,@s oder einem Punkt oder Bindestrichen
	var result = email.search(/@/);
					
	if ( (result == -1) // no at-sign
		|| (result >= (email.length-3) ) // at least 3 chars must be after the @
		|| (email.length < 4 )// total length too short
		|| (email.lastIndexOf(".") >= (email.length-2) )// the last 2 chars are a dot
		|| (email.lastIndexOf(".") < result )// no dot after @
		|| (email.search(regEmail) != -1 )// not valid characters
	)
		return false;
	else 
		return true;
}


function IsTelValid(tel)
{
	var regtel = /^[^\+|0]/; // am Anfang 0 oder ein +
	if ( tel.match(regtel) || tel.length < 5 )
		return false;
		
	tel = tel.substr(1,tel.length-1);
	regtel = /[^\d| |-]/;
	if ( tel.match(regtel) )
		return false;
	return true;
}
function IsPlzValid(plz)
{
	var regplz = /^[1-9]\d\d\d\d/;
	if (! plz.match(regplz) )
		return false;
	return true;
}

