// JavaScript Document
//  #######################
function FSnD_preloadImages() 
{ 
  var d=document; 
  
    if( d.images )
	{ 
	   if( !d.FSnD_p )
	   {
	      d.FSnD_p = new Array();
	   }
       var i, 
	       j = d.FSnD_p.length,
		   a = FSnD_preloadImages.arguments; 
  
       for( i=0; i < a.length; i++ )
	   {
		   if( a[i].indexOf("#") != 0 )
		   { 
			  d.FSnD_p[j] = new Image; 
			  d.FSnD_p[j++].src = a[i];
			}
		}
    }
}

// GET ELEMENT ID MULTI BROWSER
function FSnD_getElement(id) 
{
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

//  ##################
function FSnD_swapImgRestore() 
{ 
  var i,
      x,
	  l,
	  a = document.FSnD_sr; 
	  
	for( i=0; a && i < a.length && (x=a[i]) && x.oSrc; i++ )
	{
	   x.src = x.oSrc;
	}
}

//  #######################
function FSnD_findObj(n, d) 
{ 
  var p,
      i,
	  x; 
	   
	if( !d )
	{
	  d=document;
	} 
	if( (p = n.indexOf("?")) > 0 && parent.frames.length) 
	{
       d = parent.frames[n.substring(p+1)].document; 
	   n = n.substring(0,p);
	}
    if( !(x=d[n]) && d.all )
	{
	   x = d.all[n]; 
	}
	for( i=0; !x && i < d.forms.length; i++ )
	{
	   x = d.forms[i][n];
	}
    for( i=0; !x && d.layers && i<d.layers.length; i++ )
	{
	   x = FSnD_findObj( n, d.layers[i].document );
	}
    if( !x && d.getElementById )
    {
       x=d.getElementById(n);
    }
    return x;
}

//  ############################
function FSnD_swapImage() 
{ 
 var i,         // loop variable
     j=0,       // source id
	 x,         // object
	 l,         // layer
	 a=FSnD_swapImage.arguments,
	 d = document;        // layer id
	 
	if( !d.FSnD_sr )
	{
	   d.FSnD_sr = new Array; 
	}
	for( i=0; i < (a.length-2); i+=3 )
	{
	    if( a[i+1] == 1 )
		{
			if( (x = FSnD_findObj(a[i])) )
			{
			   d.FSnD_sr[j++] = x; 
			   if( !x.oSrc )
			   { 
				 x.oSrc = x.src;
			   } 
			   x.src = a[i+2];
			}
		}
		else if( a[i+1] == 2 )
		{
		    //alert( "Searching: " + a[i] );
			if( (l = FSnD_getElement(a[i])) )
			{
			   l.style.visibility = "hidden";
			   //alert( "Hidden: " + a[i] + "\nVisibility: " + l.style.visibility );
			   if( (l = document.all(a[i+2])) )
			   {
			       l.style.visibility = "visible";
				   //alert( "Visible: " + a[i+2] + "\nVisibility: " + l.style.visibility );
			   }
			}
			else
			{
			    alert( "Couldn't find: " + a[i] );
			}
		}
		else if( a[i+1] == 3 )
		{
		    //alert( "Restoring" );
		    FSnD_swapImgRestore();
		}
	}
}

function FSnD_openBrWindow( theURL, winName, features) 
{ 
  features = features + ',screenX=100,screenY=20,top=20,left=100,location=no,toolbar=no,scrollbars=no,resizable=no,menubar=no,status=no,dependent=yes';
  //alert( "Features: " + features );
  winName = window.open( theURL, winName, features );
  if( winName.scrollbars )
  {
     winName.scrollbars.visible = FALSE;
	 //alert( "Scrollbars are: " winName.scrollbars.visible );
  }
  winName.focus();
}

function FSnD_Form_Validator(theForm)
{

  if (theForm.Von.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Ihr Name\" ein.");
    theForm.Von.focus();
    return (false);
  }

  if (theForm.eMail.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Ihre E-Mail Adresse\" ein.");
    theForm.eMail.focus();
    return (false);
  }

  if(theForm.eMail.value.indexOf('@') == -1)
  {
       alert("Keine gültige E-Mail-Adresse!");
       theForm.eMail.focus();
       return (false);
  }

  if (theForm.Betreff.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Betreff\" ein.");
    theForm.Betreff.focus();
    return (false);
  }

  if (theForm.Nachricht.value == "")
  {
    alert("Geben Sie einen Wert in das Feld \"Ihre Nachricht an uns\" ein.");
    theForm.Nachricht.focus();
    return (false);
  }
  return (true);
}

