// RunActiveContent 
function StartFlash() {
	AC_FL_RunContent(
		'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
		'width', '450',
		'height', '60',
		'src', 'many-media',
		'quality', 'high',
		'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
		'align', 'middle',
		'play', 'true',
		'loop', 'true',
		'scale', 'showall',
		'wmode', 'transparent',
		'devicefont', 'false',
		'id', 'many-media',
		'bgcolor', '#000000',
		'name', 'many-media',
		'menu', 'false',
		'allowFullScreen', 'false',
		'allowScriptAccess','sameDomain',
		'movie', 'many-media',
		'salign', ''
	);
}

// mouse over beim menü
function MenuMausOver(wert) {
   var Knoten = wert.firstChild;
    if(Knoten.nodeType == 1) {
   		Knoten = Knoten.nextSibling;
   		Knoten = Knoten.previousSibling;
  	} else {
  		Knoten = Knoten.nextSibling;
  	}
   Knoten.style.backgroundPosition='0px -40px';
   var infoinhalt = "";
   switch (wert.getAttribute('id')) {
		  case "Menu-Link-1":
		    infoinhalt = "<p style='letter-spacing:2px;'>PROJEKTE und REFERENZEN</p><p>Hier finden Sie eine Übersicht der bisherigen und aktuell betreuten Webseiten.</p>";
		    break;
		  case "Menu-Link-2":
		    infoinhalt = "<p style='letter-spacing:2px;'>SERVICE und LEISTUNGEN</p><p>Hier beschreiben wir unser grundsätzliches Leistungsspektrum und Serviceangebot.</p>";
		    break;
		  case "Menu-Link-3":
		    infoinhalt = "<p style='letter-spacing:2px;'>PREISE und ZEITEN</p><p>Hier finden Sie die gängigen Preis und Ausführungszeiten bei Standardanfragen.</p>";
		    break;
		  case "Menu-Link-4":
		    infoinhalt = "<p style='letter-spacing:2px;'>SUPPORT und LOGIN</p><p>Hier können Sie als Kunde auf den Supportservice zurückgreifen.</p>";
		    break;
		  case "Menu-Link-5":
		    infoinhalt = "<p style='letter-spacing:2px;'>KONTAKT und IMPRESSUM</p><p>Hier finden Sie alle Kontaktmöglichkeiten bei Fragen zu unserem Leistungsangebot.</p>";
		    break;
		  default:
		    infoinhalt = "&nbsp;";
		    break;
   }
   document.getElementById("infotext").innerHTML = infoinhalt;
}

function MenuMausOut(wert) {
   var Knoten = wert.firstChild;
   	if(Knoten.nodeType == 1) {
   		Knoten = Knoten.nextSibling;
   		Knoten = Knoten.previousSibling;
  	} else {
  		Knoten = Knoten.nextSibling;
  	}
   Knoten.style.backgroundPosition='0px 0px';
   document.getElementById("infotext").innerHTML = "&nbsp;";
}

// email adresse verschlüsseln
function UnCrypt(s) {
    var r = '';
    for (i = 0; i < s.length; i++) {
        n = s.charCodeAt(i);        
        r += String.fromCharCode(n - 3);
    }
    return r;
}

function CryptLink(s,typ) {
    if(typ==2) window.open(UnCrypt(s),"_blank");
    else location.href = UnCrypt(s);
}

// kontaktformular überprüfen
function checkform(formobject) {
    var processform = true;
    var fields = findcheckfields(formobject,formobject.id+'_');
    for (var x = 0; x < fields.length; x++) {
        var fielderror = false;
        if (getfieldvaluebyname(fields[x]) == '') {
            fielderror = true;
        } else if ((fields[x] == 'E-Mail') && (!checkmail(getfieldvaluebyname(fields[x])))) {          
            fielderror = true;
        }
        if (fielderror == true) {
            processform = false;
            document.getElementById(formobject.id+'_'+fields[x]).style.color = '#ff0000';
        } else {
            document.getElementById(formobject.id+'_'+fields[x]).style.color = '#B4B4B4';
        }
    }
    if (processform == false) {
    	document.getElementById('fehler').style.display = '';
    	window.location.href = '#top';
    } else {
    	document.getElementById('fehler').style.display = 'none';
    }
    return processform;
}
 
function findcheckfields(parentobject,prefix) {
    var checkfields = new Array();
    for (var x = 0; x < parentobject.childNodes.length; x++) {
        if (parentobject.childNodes[x].id) {
            if (parentobject.childNodes[x].id.indexOf(prefix) == 0) {
                checkfields[checkfields.length] = parentobject.childNodes[x].id.substr(prefix.length);
            }
        }
        if (parentobject.childNodes[x].childNodes.length > 0) {
            var subs = findcheckfields(parentobject.childNodes[x],prefix);
            if (subs.length > 0) {
                checkfields = checkfields.concat(subs);
            }
        }
    }
    return checkfields;
}
 
function getfieldvaluebyname(name) {
    var index = document.getElementsByName(name).length-1;
    if (index < 0) {
        return false;
    }
    return document.getElementsByName(name)[index].value;
}
 
function checkmail(mail) {
    var reg = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
		return reg.test(mail);
}

