
// Author:J.K. Zhang webmaster@kimlong-restautant.de

// string[] imgArray = relative bilder-pfade z.B ("index1a.gif","index2a.gif","index3a.gif","index4a.gif","index5a.gif")
// eingesetzt in allen fs-vorlage.htm



function drucken()
{
 window.print();
}


function einblenden(zielurl)  
{
 Fenster =  window.open(zielurl,'','status=no,scrollbars=yes,menubar=no,width=400,height=360,top=20,screenX=20,left=20,screenY=20');
 Fenster.focus();
}


function init(folder,imgArray)
{
	var img = new Image;
	for (i = 0; i < imgArray.length; i++)
	{
		var imgPath = folder+"/"+imgArray[i];
		img.src = imgPath;
	}
}


function openform(zielurl) 
{ 
 Fenster =  window.open(zielurl,'','status=no,scrollbars=yes,menubar=no,width=570,height=350,resizable=yes,top=50,screenX=50,left=100,screenY=100');  
 Fenster.focus();
}



function Standort()
{
   Fenster = window.open("skizze.htm", "Standort",
                        "width=790,height=460,scrollbars,menubar=no,status=yes");
   Fenster.focus();
}



function Ubahnplan()
{
   Fenster = window.open("http://www.rheinbahn.de/bahn/Fahrplan/images/liniennetzplan_rbg_klein.pdf", "Ubahnplan",
                        "width=790,height=460,scrollbars,menubar=no,status=yes");
   Fenster.focus();
}



function swapImage(bildobjekt,dateiname,kastenobjekt,kastendateiname) 
{
	if ((bildobjekt != null) && (dateiname != null))
   		document.images[bildobjekt].src=dateiname;
	if ((kastenobjekt != null) && (kastendateiname != null))
   		document.images[kastenobjekt].src=kastendateiname;
}


//Skript für Formulare

var errfound = false;

function ValidLength (item, len)
{
	return (item.length >= len)
}

var txt = "Text-Meldung";


function error(elem, text) 
{
	if (errfound) return;
	window.alert(text);
	elem.select();
	elem.focus();
	errfound = true;
}


function sel(elem, text) 
{
	elem.select();
	elem.focus();
	errfound = true;
}


function Check()
{
	errfound = false;
	if (!ValidLength(document.form.vorname.value,2))
	  error(document.form.vorname,"Geben Sie bitte Ihren Vornamen ein");
	if (!ValidLength(document.form.nachname.value,2))
	  error(document.form.nachname,"Geben Sie bitte Ihren Nachnamen ein");
	if (!ValidLength(document.form.strasse.value,2))
	  error(document.form.strasse,"Geben Sie bitte Ihre Straße und Hausnummer an");
	if (!ValidLength(document.form.plz.value,5))
	  error(document.form.plz,"Geben Sie bitte Ihre PLZ ein");
	if (!ValidLength(document.form.ort.value,2))
	  error(document.form.ort,"Geben Sie bitte Ihren Wohnort ein");
  
	else
	{
	   return;
	}
 return !errfound; /* true if there are no errors */
}


function newwin(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
