//################
//### DIV CONTENT
//################
function changeFormContent(what,content)
	{
		document.getElementById(what).value=content;
	}
	
function hilite(element)	{ 
	element.className = 'tForm_Color3';
	}
	
function restore(element)	{
	element.className = 'tForm_Color2';
	}
	
function funcToggle(what,frm) { 
 		var janein=frm;
		if (janein=="ja") {
   			 window.document.getElementById("div"+what+"").style.display = "block"; 
			
		}else{
		 	window.document.getElementById("div"+what+"").style.display = "none"; 
		} 
	} 
	
function isEmpty(elem, helperMsg){
	if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}else{
		return true;
	}
	
}

function funcHover(css) {
	
	css.className='tdCocktailhover';
	
	}
	
function funcHoverOut(css) {
	css.className='tdCocktail';
	}


function isNum(strString, helperMsg)
   //  check for valid numeric strings	
   {
	 
   var strValidChars = "0123456789.,-";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) blnResult= false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }

	if (blnResult==false) {
		alert(helperMsg);
	}
	  
   return blnResult;
   
 }



function isAlphabet(elem, helperMsg){
	var alphaExp = /^[a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isAlphanumeric(elem, helperMsg){
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(elem.value.match(alphaExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function lengthRestriction(elem, min, max){
	var uInput = elem.value;
	if(uInput.length >= min && uInput.length <= max){
		return true;
	}else{
		alert("Please enter between " +min+ " and " +max+ " characters");
		elem.focus();
		return false;
	}
}

function madeSelection(elem, helperMsg){
	if(elem.value == "Please Choose"){
		alert(helperMsg);
		elem.focus();
		return false;
	}else{
		return true;
	}
}

function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

	
function validate_frmStundenInput(){
	// Make quick references to our fields
	//if(isNumeric(stunden, "Stunden sind Zahlen! Zumindest in dieser Dimension, Spock")){
	//if(isAlphanumeric(addr, "Numbers and Letters Only for Address")){
	//if(madeSelection(state, "Please Choose a State")){
	//if(lengthRestriction(username, 6, 8)){
	//if(emailValidator(email, "Please enter a valid email address")){
		
	var kunde = document.getElementById('frmStundenInsert_Kundenname');
	var bemerkung = document.getElementById('frmStundenInsert_Bemerkung');
	var stunden = document.getElementById('frmStundenInsert_Stunden').value;
	var projekt = document.getElementById('frmStundenInsert_Projektname');
		
	// Check each input in the order that it appears in the form!
	if (isEmpty(kunde, "Knut befielt: Kunden auswählen!")==false){
		return false;
	} else if (isEmpty (projekt, "Knut befiehlt: Projekt auswählen!")==false){
		return false;
	} else if (isEmpty (bemerkung, "Knut befiehlt: Beschreibung ausfüllen!")==false){
		return false;
	} else if (isNum (stunden, "Knut befiehlt: Stunden ausfüllen!")==false){
		return false;
	} else {
		return true;
	}


}

function validate_frmAjaxBemerkung(){
	
		
	var bemerkung = document.getElementById('frmStundenUpdate_Projektbeschreibung');

	if (isEmpty (bemerkung, "Wenn wir die Beschreibung schon ändern wollen, dann füllen wir sie auch aus! Klarerweise")==false){
		return false;
	
	} else {
		
		return true;
	}


}

