﻿function nofr() {
	
	if(self != top){
		top.location.href = self.location.href;
	}	
}



function checkCookie(){

	function getCookieVal (offset) {
				var endstr = document.cookie.indexOf (";", offset);
				if (endstr == -1)
					endstr = document.cookie.length;
					return unescape(document.cookie.substring(offset, endstr));
			}
			
			function GetCookie (name) {
				var arg = name + "=";
				var alen = arg.length;
				var clen = document.cookie.length;
				var i = 0;
				while (i < clen) {
				var j = i + alen;
				if (document.cookie.substring(i, j) == arg)
					return getCookieVal (j);
					i = document.cookie.indexOf(" ", i) + 1;
					if (i == 0) break;
				}
				return null;
			}
			
			function SetCookie (name, value) {
				var argv = SetCookie.arguments;
				var argc = SetCookie.arguments.length;
				var expires = (argc > 2) ? argv[2] : null;
				var path = (argc > 3) ? argv[3] : null;
				var domain = (argc > 4) ? argv[4] : null;
				var secure = (argc > 5) ? argv[5] : false;
				document.cookie = name + "=" + escape (value) +
				((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
				((path == null) ? "" : ("; path=" + path)) +
				((domain == null) ? "" : ("; domain=" + domain)) +
				((secure == true) ? "; secure" : "");
			}
			var enabled="";
			var exp = new Date(); 
			exp.setTime(exp.getTime() + (60*1000));

			SetCookie ('wannasomecookie', 1, exp);
			enabled = GetCookie('wannasomecookie');

	if (enabled==null){
		document.write('<p align="center">Ihr Browser akzeptiert keine Cookies.<br />Bitte &auml;ndern Sie diese Einstellung, damit Sie den Bereich sicher betreten k&ouml;nnen. Danke.</p><p align="center">&nbsp;</p><p align="center">Your Browser does not accept Cookies.<br />Please change your settings to enter this site savely. Thanks. </p>');
	}
}



function checkLanguage(){
cookie = getCookie("lippelift.de_lang");

	if(cookie.indexOf('de') != -1){
		document.location.href = "deutsch/";
	}
	if(cookie.indexOf('en') != -1){
		document.location.href = "english/";
	}
}



function setLanguage(wert){

var variable = "lippelift.de_lang";
var ms = 86400000;

	if(navigator.cookieEnabled){
		if(ms != 0){
			datum = new Date();
			jetzt = datum.getTime();
			ende = jetzt + ms;
			datum.setTime(ende);
			endzeit = datum.toGMTString();
			cookieende = "; expires="+endzeit;
		}else{
			cookieende = "";
		}
		cookiestring = variable + "=" + wert + cookieende;
		document.cookie = cookiestring;
	}
}







function getCookie(variable){
	cookie = document.cookie;
	for(i=0;i<cookie.length;i++){
		suchstring = variable + "=";
		suchstringlaenge = suchstring.length;
		if(cookie.substring(i,i+suchstringlaenge) == suchstring){
			startpos = cookie.indexOf("=",i)+1;
			endpos = cookie.indexOf(";",i);
			if(endpos == -1){
				endpos = cookie.length;
			}
			wert = cookie.substring(startpos,endpos);
			return wert;
		}
	}
	return "";
}




function preload(){

	img = new Array();

		for(i=0;i<preload.arguments.length;i++){
			img[i] = new Image();
			img[i].src = preload.arguments[i];
		}
}




function openWindow(seite,name,optionen) {
	window.open(seite,name,optionen);
}



function checkform() {

		if (document.kontaktformular.vorname.value == "") {
    		document.kontaktformular.pfeilvorname.value = " <--  Bitte korrekt eingeben";
			document.kontaktformular.vorname.focus();
		return false;

  		}else{
		document.kontaktformular.pfeilvorname.value = "";
		}
  	
	
		if (document.kontaktformular.nachname.value == "") {
    		document.kontaktformular.pfeilname.value = " <--  Bitte korrekt eingeben";
    		document.kontaktformular.nachname.focus();
		return false;
  		

		}else{
		document.kontaktformular.pfeilname.value = "";
		}
		
		
		if (document.kontaktformular.adresse.value == "") {
    		document.kontaktformular.pfeiladresse.value = " <--  Bitte korrekt eingeben";
    		document.kontaktformular.adresse.focus();
		return false;
  		

		}else{
		document.kontaktformular.pfeiladresse.value = "";
		}
		
		
		
		if (document.kontaktformular.nr.value == "") {
    		document.kontaktformular.pfeiladresse.value = " <--  Bitte korrekt eingeben";
    		document.kontaktformular.nr.focus();
		return false;
  		

		}else{
		document.kontaktformular.pfeiladresse.value = "";
		}
		
		
		
		if (document.kontaktformular.plz.value == "") {
    		document.kontaktformular.pfeilort.value = " <--  Bitte korrekt eingeben";
    		document.kontaktformular.plz.focus();
		return false;
  		

		}else{
		document.kontaktformular.pfeilort.value = "";
		}
		
		
		
		
		if (document.kontaktformular.ort.value == "") {
    		document.kontaktformular.pfeilort.value = " <--  Bitte korrekt eingeben";
    		document.kontaktformular.ort.focus();
		return false;
  		

		}else{
		document.kontaktformular.pfeilort.value = "";
		}
		
		if (!checkKontaktMail()) {		// wenn die Funktion "checkNewsMail" den Wert "False" hat, wird die Funktion abgebrochen
			document.kontaktformular.pfeilemail.value = " <--  Bitte korrekt eingeben";
    		document.kontaktformular.email.focus();
    	return false;

		}else{
			document.kontaktformular.pfeilemail.value = "";
		}
	
		
		if (document.kontaktformular.betreff.value == "") {
    		document.kontaktformular.pfeilbetreff.value = " <--  Bitte korrekt eingeben";
    		document.kontaktformular.betreff.focus();
		return false;

  		}else{
		document.kontaktformular.pfeilbetreff.value = "";
		}
		
		
		if (document.kontaktformular.nachricht.value == "") {
    		document.kontaktformular.nachricht.value = "Bitte geben Sie Ihre Nachricht ein.";
    		document.kontaktformular.nachricht.focus();
		return false;
  		}

}







function checkKontaktMail(){

	content = document.kontaktformular.email.value;
	atpos = content.indexOf('@');
	if(atpos != -1){
		pointpos = content.lastIndexOf('.');
		if(atpos < pointpos){
			return true;
		}else{
			return false;
		}
	}else{
		return false;
	}

}






function PictureZoom(picture){

	newWindow=window.open("","","width=800,height=600,top=10,left=10,scrollbars=no,resizable=no,menubar=yes");
	newWindow.document.open();
	newWindow.document.write ("<html>\n\n<head>\n\n<title>\n\n&nbsp;\n\n</title>\n\n</head>\n\n<body bgcolor='#ffffff' leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>\n\n<table align='center' border='0' cellpadding='0' cellspacing='0'>\n\n<tr>\n\n<td align='center' valign='top'>\n\n<img src='");
	newWindow.document.write (picture);
	newWindow.document.write ("' height='600' border='0' alt=''>\n\n</td>\n\n</tr>\n\n</table>\n\n</body>\n\n</html>");
	newWindow.document.close();
	newWindow.focus();

}
