/* <![CDATA[ */

function writeAlternativeNavi()
{
  // Flash ist veraltet, oder das Plug-In wurde nicht ermittelt
    var alternateContent = '<div id="noFlashDiv"><ul id="flashNaviUL">'
    + '<li><a href="index" title="home">Home</li>'
    + '<li><a href="services" title="Services">Services</li>'
		+ '<li><a href="referenzen" title="Referenzen">Referenzen</li>'
		+ '<li><a href="produkte" title="Produkte">Produkte</li>'
		+ '<li><a href="login" title="Login">Login</li>'
		+ '<li><a href="kontakt" title="Kontakt">Kontakt</li>'
		+ '</ul>'
		+ '</div>'
		+ '';
    document.write(alternateContent);
}


/*-------------------------------------------------------------------------------------------------
---------------------------------------<(( Button ))>--------------------------------------------
--------------------------------------------------------------------------------------------------*/
function setBt (pfad, id, type){
	var bt = (type == 1) ? "On" : "Off";
	document.getElementById(id).src=pfad+"bt"+id+bt+".jpg";
}

function setBtRef (pfad, id, type){
	var bt = (type == 1) ? "btRefWebOn.jpg" : "btRefWebOff.jpg";
	document.getElementById(id).src=pfad+bt;
}

function setBtRef2 (pfad, id, type){
	var bt = (type == 1) ? "btRefInfosOn.jpg" : "btRefInfosOff.jpg";
	document.getElementById(id).src=pfad+bt;
}


/*--------------------------------------------------------------------------------------------------
---------------------------------- (( Newslettersubmit )) ------------------------------------------
--------------------------------------------------------------------------------------------------*/
function newsletterForm(pfad){
var email=document.getElementById("newsletterInput").value;
if(!EMail(email)){
		fehler=true;
		document.getElementById("newsletterInput").style.color="#FFA600";
	}else{
	 popUpNL (pfad+'newsletter.php?id='+email, 147, 250, false);
	}
}

/*--------------------------------------------------------------------------------------------------
---------------------------------- (( checkKontaktForm )) ------------------------------------------
--------------------------------------------------------------------------------------------------*/
function checkKontaktForm() {
var doc=document.forms[0];
var vorname=doc.vorname.value;
var nachname=doc.nachname.value;
var email=doc.email.value;
var nachricht=doc.nachricht.value;

var strFehler="";
var fehler=false;

document.getElementById("formNachricht").style.color="#000";
document.getElementById("formEmail").style.color="#000";
document.getElementById("formVorname").style.color="#000";
document.getElementById("formNachname").style.color="#000";

	if(!EMail(email)){
		fehler=true;
		document.getElementById("formEmail").style.color="#FFA600";
	}
	if(vorname==""){
		fehler=true;
		document.getElementById("formVorname").style.color="#FFA600";		
	}
	if(nachname==""){
		fehler=true;
		document.getElementById("formNachname").style.color="#FFA600";
	}
	if(nachricht==""){
		fehler=true;
		document.getElementById("formNachricht").style.color="#FFA600";
	}
	
	if(fehler){
	document.getElementById("formAntwort").innerHTML="Eingabefehler! Das Formular konnte nicht versendet werden.";
	}else{
		doc.submit();
	}
}

/*--------------------------------------------------------------------------------------------------
--------------------------------------- (( POPUPS )) -----------------------------------------------
--------------------------------------------------------------------------------------------------*/
function popUp (con, hoehe, breite, zentrieren) {

	if (zentrieren)
	{
		myLeft = (screen.width / 2) - breite/2;
		myTop = (screen.height / 2) - hoehe/2;
	}
	else
	{
		myLeft=100;
		myTop=100;
	}
	window.open(con,'','dependent=yes menubar=no,scrollbars=yes, resizable=yes,left='+ myLeft+ ',top='+myTop+' status=no,width='+breite+',height='+hoehe+',');
}

function popUpNL (con, hoehe, breite, zentrieren) {

	if (zentrieren)
	{
		myLeft = (screen.width / 2) - breite/2;
		myTop = (screen.height / 2) - hoehe/2;
	}
	else
	{
		myLeft=100;
		myTop=100;
	}
	window.open(con,'','dependent=no menubar=yes,scrollbars=no, resizable=no,left='+ myLeft+ ',top='+myTop+' status=no,width='+breite+',height='+hoehe+',');
}

function galOpen(id)
{
	myLeft=100;
	myTop=100;
	breite=482;
	hoehe=340;
	con="galerieAnzeigen.php?id="+id;
	window.open(con,'','dependent=yes menubar=no,scrollbars=no, resizable=no,left='+ myLeft+ ',top='+myTop+' status=no,width='+breite+',height='+hoehe+',');
}

function singleImage (pfad, x) 
 {
		var con=pfad+"viewSingleImage.php";
		var breite=10;
		var hoehe=10;
		
		var myLeft = 100;
		var myTop = 100;
		mywin=window.open(con+"?id="+x ,'mywin','dependent=yes menubar=no, resizable=no,left='+ myLeft+ ',top='+myTop+' status=yes,width='+breite+',height='+hoehe+',');
		mywin.focus();
		
}

function popup2(con,b,h) 
 {

		mywin=window.open(con, 'mywin','dependent=yes menubar=yes,   scrollbars=yes, resizable=no,left=50,top=50 status=yes,width='+b+',height='+h+',');
		mywin.focus();
}

/*--------------------------------------------------------------------------------------------------
--------------------------------------- (( DIVERSE )) ----------------------------------------------
--------------------------------------------------------------------------------------------------*/

function CheckLen(Target,maxlength)
{
	StrLen=Target.value.length;
	
	if (StrLen==1&&Target.value.substring(0,1)==" ")
	{
	Target.value=""; 
	StrLen=0;
	}
	if (StrLen>maxlength )
	{
	Target.value=Target.value.substring(0,maxlength);
	CharsLeft=0;
	}
}

function EMail(s)
  {
  var a = false;
  var res = false;
  if(typeof(RegExp) == 'function')
    {
    var b = new RegExp('abc');
    if(b.test('abc') == true){a = true;}
    }

  if(a == true)
    {
    reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                     '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                     '(\\.)([a-zA-Z]{2,4})$');
    res = (reg.test(s));
    }
  else
    {
    res = (s.search('@') >= 1 &&
           s.lastIndexOf('.') > s.search('@') &&
           s.lastIndexOf('.') >= s.length-5)
    }
  return(res);
  }
			

/* ]]> */
