/* ---  JavaScript für www.fmoser.ch --- Mai 2008 --- */
/* --- made by SUTANET Webpublishing - www.sutanet.ch --- */

begruessung();

function begruessung()
{
window.defaultStatus="F.Moser AG - Kanalreinigung - Rohrreinigung - Schachtreinigung";
}
// --------------------------------------------------------------------------
// -----------------------------------------------------------------------------
function chkFormular()
{

if(document.contact.Nachname.value=="")
{
alert("Bitte Ihren Namen eingeben!");
document.contact.Nachname.focus();
return false;
}
if(document.contact.Ort.value=="")
{
alert("Bitte Ihren Wohnort eingeben!");
document.contact.Ort.focus();
return false;
}
if(document.contact.Strasse.value=="")
{
alert("Bitte geben Sie Ihre Adresse an!");
document.contact.Strasse.focus();
return false;
}
if(document.contact.Telefon.value=="")
{
alert("Bitte geben Sie Ihre Telefonnummer ohne Leerzeichen etc. an!");
document.contact.Telefon.focus();
return false;
}
var chkZ = 1;
for(i=0;i<document.contact.Telefon.value.length; ++i)
{
if(document.contact.Telefon.value.charAt(i) < "0" || document.contact.Telefon.value.charAt(i) > "9")
{chkZ = -1;}
}
if(chkZ == -1)
{
alert("Bitte geben Sie Ihre Telefonnummer ohne Leerzeichen etc. an. Danke!");
document.contact.Telefon.focus();
return false;
}


if(document.contact.Email.value=="")
{
alert("Bitte Ihre E-Mail-Adresse eingeben!");
document.contact.Email.focus();
return false;
}

if(document.contact.Email.value.indexOf('@')== -1)
{
alert("Keine g"+unescape('%FC')+"ltige E-Mail-Adresse!");
document.contact.Email.focus();
return false;
}

}


function chkFormular1()
{
if(document.contact.Nachname.value=="")
{
alert("Bitte Ihren Namen eingeben!");
document.contact.Nachname.focus();
return false;
}

if(document.contact.Ort.value=="")
{alert("Bitte Ihren Wohnort eingeben!");
document.contact.Ort.focus();
return false;}

if(document.contact.Strasse.value=="")
{alert("Bitte geben Sie Ihre Adresse an!");
document.contact.Strasse.focus();
return false;}

if(document.contact.Email.value=="")
{alert("Bitte Ihre E-Mail-Adresse eingeben!");
document.contact.Email.focus();
return false;}

if(document.contact.Email.value.indexOf('@')== -1)
{alert("Keine g"+unescape('%FC')+"ltige E-Mail-Adresse!");
document.contact.Email.focus();
return false;}
}

// Suckerfish-Script für Internet-Explorer :focus, :hover etc.
function suckerfish(type, tag, parentId) {
	if (window.attachEvent) {
		window.attachEvent("onload", function() {
			var sfEls;								  
			if (parentId==null)
			{
				sfEls = document.getElementsByTagName(tag);
			}
			else
			{
				sfEls = document.getElementById(parentId).getElementsByTagName(tag);
			}
//			var sfEls = (parentId==null)?document.getElementsByTagName(tag):document.getElementById(parentId).getElementsByTagName(tag);
			type(sfEls);
		});
	}
}

sfHover = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}

sfFocus = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onfocus=function() {
			this.className+=" sffocus";
		}
		sfEls[i].onblur=function() {
			this.className=this.className.replace(new RegExp(" sffocus\\b"), "");
		}
	}
}

sfActive = function(sfEls) {
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmousedown=function() {
			this.className+=" sfactive";
		}
		sfEls[i].onmouseup=function() {
			this.className=this.className.replace(new RegExp(" sfactive\\b"), "");
		}
	}
}

sfTarget = function(sfEls) {
	var aEls = document.getElementsByTagName("A");
	document.lastTarget = null;
	for (var i=0; i<sfEls.length; i++) {
		if (sfEls[i].id) {
			if (location.hash==("#" + sfEls[i].id)) {
				sfEls[i].className+=" sftarget";
				document.lastTarget=sfEls[i];
			}
			for (var j=0; j<aEls.length; j++) {
				if (aEls[j].hash==("#" + sfEls[i].id)) aEls[j].targetEl = sfEls[i];
				aEls[j].onclick = function() {
					if (document.lastTarget) docu.lastTarget.className = document.lastTarget.className.replace(new RegExp(" sftarget\\b"), "");
					if (this.targetEl) this.targetEl.className+=" sftarget";
					document.lastTarget=this.targetEl;
					return true;
				}
			}
		}
	}
}
// hier werden alle Elemente aufgeführt, die angesprochen werden sollen (funktion, tag, id mutter-element)
//suckerfish(sfFocus, "input", "kontaktformular");
//suckerfish(sfFocus, "textarea", "kontaktformular");
//suckerfish(sfFocus, "select", "kontaktformular");

suckerfish(sfFocus, "input");
suckerfish(sfFocus, "textarea");
suckerfish(sfFocus, "select");
// -----------------------------------------------------------------------------

