
function value_delete(el, text, type)
{
  if (el.value == text)
  {
    el.value = '';
    removeClass(el,'gray');
    type_change(el, type);
  }
}

function value_insert(el, text, type)
{
  if (el.value == '')
  {
    el.value = text;
    addClass(el, 'gray');
    type_change(el, type);
  }
}

function textarea_delete(el, text)
{
  if (el.innerHTML == text)
    el.innerHTML= '';
}

function textarea_insert(el, text)
{
  if (el.innerHTML == '')
    el.innerHTML = text;
}

function type_change(el, type)
{
  if (type == '' || type == undefined)
    return;
  
  el.type = type;
}

/* JS prace s CSS tridami (hodnoty HTML atributu class) */
function hasClass(ele,cls) {
  return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
}
function addClass(ele,cls) {
  if (!this.hasClass(ele,cls)) ele.className += " "+cls;
}
function removeClass(ele,cls) {
  if (hasClass(ele,cls)) {
    var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
    ele.className=ele.className.replace(reg,' ');
  }
}

