// base functions
//
// COPYRIGHT DAVID GRUDL 2004, ALL RIGHTS RESERVED
// http://davidgrudl.com

$(function(){

$('div.image').each(function() {
    $('.imageBox', this).cycle({ 
        fx:     'shuffle', 
        speed:  'fast', 
        timeout: 0, 
        next:   $('.next', this), 
        prev:   $('.prev', this)
    })
});

$('.imageBox img').css('display', 'inline');

});



////////////////////// POPUP WINDOWS


// otevře vyskakovací okénko
function popup(url, title) {
  url = url + ((url.indexOf('?') == -1) ? '?' : '&') + 'popup';
  var wnd = window.open(url, title,'status=0,toolbar=0,location=0,scrollbars=1,width=350,height=300,resizable=1,left=150');
  var opened = (typeof(wnd) == "object");
  return (opened);
}



////////////////////// FORMS


function trim(s) 
{
    return s.replace(/^\s+/, '').replace(/\s+$/, '');
}


// ověřování formulářů
function validX(e, errormsg, re) {
  var ok;
  var value = trim(e.value);
  if (re) ok = (new RegExp(re)).test(value);
  else ok = value != '';

  if (!ok) {
    e.focus();
    if (errormsg) alert(errormsg);
  }
  
  return ok;
}


function validEmail(e, errormsg) {
  return validX(e, errormsg, '^$|^[^@]+@[^.]+\\..+$');
}



