﻿function commentcheck() {
    var zeichen =": Bitte vollständig ausfüllen!"
    var next = document.createTextNode(zeichen);
    hinWeis = document.getElementById('aufforderung');
    myCommentForm = document.getElementById('commentform');
    commentName = document.getElementById('comment_name');
    commentMail = document.getElementById('comment_mail');
    commentWeb = document.getElementById('comment_web');
    commentText = document.getElementById('comment_textarea');
    commentSubmit = document.getElementById('comment_submit');
    

        hinWeis.firstChild.nodeValue = "";


        myCommentForm.onsubmit = function() {
                if(commentName.value == commentName.defaultValue) {
                       commentName.style.borderBottomColor = "#F00";
                       commentName.style.borderBottomWidth = "0.2em";
                }

                if(commentMail.value == commentMail.defaultValue) {
                       commentMail.style.borderBottomColor = "#F00";
                       commentMail.style.borderBottomWidth = "0.2em";
                }

                if(commentWeb.value == commentWeb.defaultValue) {
                       commentWeb.style.borderBottomColor = "#F00";
                       commentWeb.style.borderBottomWidth = "0.2em";
                }

                if(commentText.value == commentText.defaultValue) {
                       commentText.style.borderBottomColor = "#F00";
                       commentText.style.borderBottomWidth = "0.2em";
                }
                if(commentMath.value == commentMath.defaultValue) {
                       commentMath.style.borderBottomColor = "#F00";
                       commentMath.style.borderBottomWidth = "0.2em";
                }


                if(commentName.value == commentName.defaultValue || commentMail.value == commentMail.defaultValue || commentWeb.value == commentWeb.defaultValue || commentText.value == commentText.defaultValue || commentMath.value == commentMath.defaultValue) {
                       hinWeis.firstChild.nodeValue = "Bitte vollständig ausfüllen!";
                       return false;
        }

	}


        commentName.onblur = function() {
                if ( this.value == '') {
                        this.value = this.defaultValue;
                }
        }
        commentName.onkeydown = function() {
                if ( this.value != '' && this.value != this.defaultValue) {
                      commentSubmit.disabled = false;  
                }
        }         
        commentName.onfocus = function() {
                if ( this.value == this.defaultValue ) {
                        this.value = '';
                } else {
                      commentSubmit.disabled = false;  
                }
        }  



        commentMail.onblur = function() {
                if ( this.value == '') {
                        this.value = this.defaultValue;
                }
        }
        commentMail.onkeydown = function() {
                if ( this.value != '' && this.value != this.defaultValue) {
                      commentSubmit.disabled = false;  
                }
        }         
        commentMail.onfocus = function() {
                if ( this.value == this.defaultValue ) {
                        this.value = '';
                } else {
                      commentSubmit.disabled = false;  
                }
        } 


        commentWeb.onkeydown = function() {
                if ( this.value != '' && this.value != this.defaultValue) {
                      commentSubmit.disabled = false;  
                }
        }         
        commentWeb.onfocus = function() {
                if ( this.value == this.defaultValue ) {
                        this.value = '';
                } else {
                      commentSubmit.disabled = false;  
                }
        }



        commentText.onblur = function() {
                if ( this.value == '') {
                        this.value = this.defaultValue;
                }
        }
        commentText.onkeydown = function() {
                if ( this.value != '' && this.value != this.defaultValue) {
                      commentSubmit.disabled = false;  
                }
        }         
        commentText.onfocus = function() {
                if ( this.value == this.defaultValue ) {
                        this.value = '';
                } else {
                      commentSubmit.disabled = false;  
                }
        }


        commentMath.onblur = function() {
                if ( this.value == '') {
                        this.value = this.defaultValue;
                }
        }
        commentMath.onkeydown = function() {
                if ( this.value != '' && this.value != this.defaultValue) {
                      commentSubmit.disabled = false;  
                }
        }         
        commentMath.onfocus = function() {
                if ( this.value == this.defaultValue ) {
                        this.value = '';
                } else {
                      commentSubmit.disabled = false;  
                }
        } 
   	return false;
}
