var strEmailCheck   = 'Bitte geben Sie eine gültige E-Mail Adresse ein.';
var strInputCheck1  = 'Das Feld "';
var strInputCheck2  = '" muss zwischen ';
var strInputCheck3  = ' und ';
var strInputCheck4  = ' Zeichen lang sein.';

function formChecker(id)
{
    this.form = document.getElementById(id);
    
    this.checkInputSize = function(id, descr, min, max)
    {
        var input = this.form[id].value;
        
        if(min <= input.length && max >= input.length) {
            return true;
        } else {
            alert(strInputCheck1+descr+strInputCheck2+min+strInputCheck3+max+strInputCheck4);
            return false;
        }
    }
    
    this.checkEmail = function(id)
    {
        var a = false;
        var res = false;
        var email = this.form[id].value;
        
        if(typeof(RegExp) == 'function') {
            var b = new RegExp('abc');
            a = b.test('abc');
        }
        
        if(a == true) {
            reg = new RegExp('^([a-zA-Z0-9\\-\\.\\_]+)'+
                             '(\\@)([a-zA-Z0-9\\-\\.]+)'+
                             '(\\.)([a-zA-Z]{2,4})$');
            res = (reg.test(email));
        } else {
            res = (email.search('@') >= 1 &&
                email.lastIndexOf('.') > email.search('@') &&
                email.lastIndexOf('.') >= email.length-5);
        }
        
        if(!res) {
            alert(strEmailCheck);
        }
        
        return(res);
    }
    
    this.reset = function()
    {
        this.form.reset();
    }
}

// Initializing scripts on document load
jQuery(function($) {
    // Delete default text on focus
    $('input.text').live('focus', function() {
        if($(this).val() == $(this)[0].title) {
            $(this).removeClass('inputTextNoFocus');
            $(this).val('');
        }
    });
    $('input.text').live('blur', function() {
        if($(this).val() == '') {
            $(this).addClass('inputTextNoFocus');
            $(this).val($(this)[0].title);
        }
    });
    $('input.text').focus();
    $('input.text').blur();
});
