﻿<!--

/* copyright 2008 by rainer.wollthan @ rocuments.de */

/*  FUNCTIONS */
var bV=parseInt(navigator.appVersion);
var NS4=(document.layers) ? true : false;
var IE4=((document.all)&&(bV>=4)) ? true : false;
var DOM=(!document.layers && !document.all && bV>=4) ? true : false;
var SAFARI=(navigator.userAgent.toLowerCase().indexOf('safari')!= -1) ? true:false;
var capable = (NS4 || IE4 || DOM || SAFARI) ? true : false;

window.onload=init;

var countdownINTER;

function openWeiterempfehlen(){
	new Ajax.Updater('weiterempfehlen', '/weiterempfehlen.php');
	$('weiterempfehlen').show();
	return false;
}

function changeLand(land){
	
	if($('lperson').value==''){
		$('lland').selectedIndex=$('land').selectedIndex;
	}
}


function checkWeiterlempfehlenform(tform){
	var error=0;
	var error_msg="Bitte alle Felder ausfuellen!";
	if($('yourname').length==0){
		error=1;
	}
	if($('resname').length==0){
		error=1;
	}
	if(!isValidEMail($('yourmail').value)){
		error=1;
		error_msg+="E-Mail bitte richtig eintragen.";
	}
	if(!isValidEMail($('resmail').value)){
		error=1;
		error_msg+="E-Mail bitte richtig eintragen.";
	}
	
	if(error==0){
		var param = $('weiterempfehlenForm').serialize();
		new Ajax.Updater('weiterempfehlen', '/weiterempfehlen.php', {
  			parameters: param,
  			method:'POST'
  			
		});
		return false;		
	} else {
		alert(error_msg);
		return false;
	}
	return false;
}
function isValidEMail(s)
{
 var a = false;
 var res = false;
 if(typeof(RegExp) == 'function')
 {
  var b = new RegExp('abc');
  if(b.test('abc') == true){a = true;}
  }

 if(a == true)
 {
  reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                   '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                   '(\\.)([a-zA-Z]{2,4})$');
  res = (reg.test(s));
 }
 else
 {
  res = (s.search('@') >= 1 &&
         s.lastIndexOf('.') > s.search('@') &&
         s.lastIndexOf('.') >= s.length-5)
 }
 return(res);

}
function init() {
	countdownINTER = setInterval("countdown()",200);
}

function t4(y) {
  return (y < 1000 ? y+1900 : y);
}
function countdown(){

	now=new Date(); // Aktuelles Datum
	//("d.m.Y, H:i");
	
	var d= now.getDate();
  	if  (d <10) {d="0"+d;}
  	
	var m= now.getMonth()+1;
  	if  (m <10) {m="0"+m;}
  	
	var Y= t4(now.getYear());

	var H= now.getHours();
  	if  (H <10) {H="0"+H;}
  	
  	var i= now.getMinutes();
	if  (i <10) {i="0"+i;}
	
	
  	var s= now.getSeconds();
  	if  (s <10) {s="0"+s;}
  
	if(document.getElementById('countdowninput')) {				
	document.getElementById('countdowninput').childNodes[0].nodeValue=d+"."+m+"."+Y+", "+H+":"+i+":"+s;
	}
}



function toogleDisplay(el) {
	if (!capable) return;
	if (IE4) {
		NAVI = document.all[eval('el')];
	} else if(DOM) {
		NAVI = document.getElementById(el);
	} else if(NS4){
		NAVI = eval("document." + el );
	} else {
		return false;
	}
	if(NAVI.className == "show") {
		NAVI.className="hidden";
	} else {
		NAVI.className="show";
	}
	return true;
}

function closeAllByClassName(cname){
	
	if (IE4) {
		tempColl = document.all.tags( "div");
		for (i=0; i<tempColl.length; i++) {
			whichEl = tempColl(i);
			if (whichEl.className == cname){
				whichEl.className="hidden";
			}
		}
	} else {
		tempColl = document.getElementsByTagName( "div");
		for (i=0; i<tempColl.length; i++) {
			whichEl = tempColl[i];
			if (whichEl.className == cname) {
				whichEl.className="hidden";
			}
		}
	}
	
	return true;
}


function toogleByClassName(tag,fromname,toname){
	
	if (IE4) {
		tempColl = document.all.tags( tag);
		for (i=0; i<tempColl.length; i++) {
			whichEl = tempColl(i);
			if (whichEl.className == fromname){
				whichEl.className = toname;
			}
		}
	} else {
		tempColl = document.getElementsByTagName( tag);
		for (i=0; i<tempColl.length; i++) {
			whichEl = tempColl[i];
			if (whichEl.className == fromname) {
				whichEl.className = toname;
			}
		}
	}
	
	return true;
}


function closeDisplay(el) {
	if (!capable) return;
	if (IE4) {
		NAVI = document.all[eval('el')];
	} else if(DOM) {
		NAVI = document.getElementById(el);
	} else if(NS4){
		NAVI = eval("document." + el );
	} else {
		return false;
	}
	NAVI.className="hidden";
	return true;
}

function regExer(str,myreg) {
	 if(typeof(RegExp) == 'function') {
		var b = new RegExp('abc');
  		if(b.test('abc') == true){a = true;}
  	}
	
	if(a == true) {
		/* ... Pr¸fen mit RegExp ... */
		reg = new RegExp(myreg);
 		res = (reg.test(str)); 
		return(res);
 	} else {
 		return false;
 	}

}

function changeBigPic(bigsrc){
	imgimg="IMGBIGPICTURE";
	if(DOM) {
		whichImage = document.getElementById(imgimg);
		if(whichImage){
			whichImage.src=bigsrc;
		}		

	} else if (IE4) {
		if(document.all[eval('imgimg')]){
			document.all[eval('imgimg')].src=bigsrc;
		}
	} else if(NS4) {
		window.open(bigsrc,'bigpic');
	}
}

function changebigpicto(z,w,h){
	imgimg="BIGPRODIMG";

	if(SAFARI){
		whichImage = document.getElementById(imgimg);
		if(whichImage){
			whichImage.src=z;
			whichImage.height=h;
			whichImage.width=w;
		}
	} else if(DOM) {
		whichImage = document.getElementById(imgimg);
		if(whichImage){			
			whichImage.src=z;
			whichImage.height=h;
			whichImage.width=w;
		}
	} else if (IE4) {
		if(document.all[eval('imgimg')]){
			document.all[eval('imgimg')].src=z;
			document.all[eval('imgimg')].height=h;
			document.all[eval('imgimg')].width=w;
		}
	} else if(NS4) {
		document.images[imgimg].src =z;
		document.images[imgimg].height =h;
		document.images[imgimg].width =w;
	}
	return false;
}

//-->