﻿/* Custom Javascript ______________________________________________*/

/* Cufon __________________________________________________________ */

	Cufon.replace('div.oben ul.menu li', {

	   fontFamily: 'helvetica-neue-condensed',
	   hover:true

     });
             

	Cufon.set('fontFamily', 'helvetica-neue-condensed');

        Cufon.replace('.helvetica');
				
	Cufon.set('fontFamily', 'segoe-script');

		Cufon.replace('.segoe');
				
				
				
/* Datumsfunktionen ____________________________________*/

	var sNoNumberError;
	
	function dateAdd (dtDate, lDay) {
	
		var aDate = new Array();
		var aMonths = new Array();
		
		aDate = dtDate.split('.');
		
		if (aDate[0].indexOf('0') == 0) {
			aDate[0] = aDate[0].substring(1, aDate[0].length);
		}
		
		if (aDate[1].indexOf('0') == 0) {
			aDate[1] = aDate[1].substring(1, aDate[1].length);
		}

		aMonths[1] = 31;
		
		if ((parseInt(aDate[2]) - 2004) % 4 == 0) {
			aMonths[2] = 29;
		} else { 
			aMonths[2] = 28;
		}
		
		aMonths[3] = 31;
		aMonths[4] = 30;
		aMonths[5] = 31;
		aMonths[6] = 30;
		aMonths[7] = 31;
		aMonths[8] = 31;
		aMonths[9] = 30;
		aMonths[10] = 31;
		aMonths[11] = 30;
		aMonths[12] = 31;
		
		aDate[0] = parseInt(aDate[0]) + parseInt(lDay);
		
		while (parseInt(aDate[0]) > parseInt(aMonths[parseInt(aDate[1])])) {
		
			aDate[0] = parseInt(aDate[0]) - parseInt(aMonths[parseInt(aDate[1])]);
			
			aDate[1] = parseInt(aDate[1]) + 1;
			
			if (parseInt(aDate[1]) > 12) {
				aDate[1] = 1;
				aDate[2] = parseInt(aDate[2]) + 1;
			}
		
		}
		
		return aDate[0] + '.' + aDate[1] + '.' + aDate[2];
	
	}
	
	
	function insertAbreiseDatum () {
	
		var dtDate;
		var aDate = new Array();
		
		dtDate = document.getElementById('bp_from_day').options[document.getElementById('bp_from_day').selectedIndex].value;
		dtDate = dtDate + '.' + document.getElementById('bp_from_month').options[document.getElementById('bp_from_month').selectedIndex].value;
		dtDate = dtDate + '.' + document.getElementById('bp_from_year').options[document.getElementById('bp_from_year').selectedIndex].value;
		
		
		if (isNaN(parseInt(document.getElementById('tage').value))) {
		
			alert(sNoNumberError);
			return false;
		
		} else {
		
			dtDate = dateAdd(dtDate, document.getElementById('tage').value);
			
			var aDate = new Array();
			var aMonths = new Array();
			
			aDate = dtDate.split('.');
			
			if (aDate[0].length == 1) {
				aDate[0] = '0' + aDate[0];
			}
			
			if (aDate[1].length == 1) {
				aDate[1] = '0' + aDate[1];
			}
			
			document.getElementById('bp_to_day').value = aDate[0];
			document.getElementById('bp_to_month').value = aDate[1];
			document.getElementById('bp_to_year').value = aDate[2];
			
			return true;
		
		}
	
	}

