function image($url,$w,$h)
{
 window.open($url,"image","menubar=0,toolbar=0,location=0,directories=0,status=0,resizable=0,scrollbars=0,width="+($w+20)+",height="+($h+20))
}

function open_win(url,width,height)
{
 defaultLeft = ((screen.width - width) / 2) + PositionX;
 defaultTop = ((screen.height - height) / 2) + PositionY;
 popupWin = window.open(url,'obr', 'scrollbars=0,resizable=0,top='+defaultTop+',left='+defaultLeft+',menubar=0,width='+width+',height='+height);
}

// 
// funkce Validate plus konstruktory prvku formulare
function MeText( strName, fAllowEmpty ){
    this.strName = strName
    this.fAllowEmpty = fAllowEmpty
    this.Validate = function( field ) {
        if ( (!this.fAllowEmpty) && (field.value=="") ) {
            alert('Vyplňte prosím "' + this.strName + '".')
            field.focus()
            return false
        }
        return true
    }
}

function MeRadio( strName, iFirstIndex ){
    this.strName = strName
    this.iFirstIndex = iFirstIndex
    this.Validate = function( field ) {
    if (field.checked == false) {
            alert('Vyberte prosím "' + this.strName + '".');
            field.focus()
            return false
        }
        return true
    }
}

// schvali pokud je hodnota selectu vetsi nez iFirstIndex
function MeSelect( strName, iFirstIndex ){
    this.strName = strName
    this.iFirstIndex = iFirstIndex
    this.Validate = function( field ) {
        if (field.selectedIndex<this.iFirstIndex) {
            alert('Vyberte prosím "' + this.strName + '".');
            field.focus()
            return false
        }
        return true
    }
}



function ValidateForm(theForm,arr) {
    for( var i=0; i<theForm.length; i++ ) {
        if( arr[i] ) {
            if( !arr[i].Validate(theForm.elements[i]) )
                return false
        }
    }
    return true;
}
