function MeText( strName, fAllowEmpty, num ){
    this.strName = strName    
    this.fAllowEmpty = fAllowEmpty
	this.num = num
    this.Validate = function( field ) {
        if ( (!this.fAllowEmpty) && (field.value=="")) {
            alert('Vyplňte prosím hodnotu do pole "' + this.strName + '".')
            field.focus()
            return false     
        }
		if ( (this.num) && isNaN(field.value) ){
            alert('Vyplňte prosím číselnou hodnotu do pole "' + this.strName + '".')
            field.focus()
            return false     
        }
        return true
    }
} 

function MeSelect( strName, iFirstIndex ){
    this.strName = strName    
    this.iFirstIndex = iFirstIndex
    this.Validate = function( field ) {
        if (field.selectedIndex<this.iFirstIndex) {
            alert('Vyberte prosím hodnotu v poli "' + this.strName + '".');
            field.focus()
            return false     
        }
        return true
    }
} 

function Validate(theForm,arr) {
    for( var i=0; i<theForm.length; i++ ) {
        if( arr[i] ) {
            if( !arr[i].Validate(theForm.elements[i]) )
                return false
        }
    }
    return true;
} 
