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;
}

function prizpusobDoruceni(select){
  // zachytit "osobni odber Kladno" a "osobni odber Praha" 
  if(select.value.indexOf('odb') > 0){
    document.getElementById('f_platba').value='hotově';
  }
}
function prizpusobPlatbu(select){
  // zachytit "osobni odber Kladno" a "osobni odber Praha"
  if(select.value.indexOf('hotov') >= 0 && document.getElementById('f_doprava').value.indexOf('odb') < 0){
    alert("platba hotově je možna pouze při osobním odběru na prodejně");
  }
} 
