function clearFormField(frm, fld, dft){
	if (document.forms[frm].elements[fld].value == dft)
		{
		document.forms[frm].elements[fld].value = '';
		}
}

function blocking(nr, img)
{
	if (document.layers)
	{
		if (document.layers[nr].display == 'none')
		{
		document.layers[nr].display = 'block';
		document.images[img].src = icn_minus.src;
		}
			else
		{
		document.layers[nr].display = 'none';
		document.images[img].src = icn_plus.src;
		}
	}
	else if (document.all)
	{
		if (document.all[nr].style.display == 'none')
		{
		document.all[nr].style.display = 'block';
		document.images[img].src = icn_minus.src;
		}
			else
		{
		document.all[nr].style.display = 'none';
		document.images[img].src = icn_plus.src;
		}
	}
	else if (document.getElementById)
	{
		if (document.getElementById(nr).style.display == 'none')
		{
		document.getElementById(nr).style.display = 'block';
		document.images[img].src = icn_minus.src;
		}
			else
		{
		document.getElementById(nr).style.display = 'none';
		document.images[img].src = icn_plus.src;
		}
	}
}

function jump_chck(idskup_prod, nr, img)
{
	if (document.forms['jump_form'].elements[nr].value == 0)
	{
		document.forms['jump_form'].elements[nr].value = idskup_prod;
		document.images[img].src = icn_chckd.src;
	}
		else
	{
		document.forms['jump_form'].elements[nr].value = 0;
		document.images[img].src = icn_unchckd.src;
	}
}

function reg_chck(nr, img)
{
	if (document.forms['registrace'].elements[nr].value == 0)
	{
		document.forms['registrace'].elements[nr].value = 1;
		document.images[img].src = icn_chckd_w.src;
	}
		else
	{
		document.forms['registrace'].elements[nr].value = 0;
		document.images[img].src = icn_unchckd_w.src;
	}
}

function cnd_chck(new_idl)
{
	var nr = 'LOGISTIKA';
	var cur_idl = document.forms['registrace'].elements[nr].value;
	document.images['log_rdo_'+cur_idl].src = icn_unchckd_w.src;
	document.forms['registrace'].elements[nr].value = new_idl;
	document.images['log_rdo_'+new_idl].src = icn_chckd_w.src;
}

function setCookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function deleteCookie ( cookie_name )
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}

function getCookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}

function setVisibility(objId, sVisibility) {
	/* setVisibility(objId, sVisibility)
	* Parameters: 
	* objId - the id of an element (case sensitive)
	* sVisibility - "block" | "inherit" | "none" (case insensitive)
	*/         
	var obj = document.getElementById(objId);
//    obj.style.visibility = sVisibility;
		obj.style.display = sVisibility;
      }

function collapse(blockId){
	if (document.getElementById(blockId)) {
	setVisibility(blockId, 'none') ; }
}

function expand(blockId, grpId){
  var obj = document.getElementById(blockId);
  if (obj.style.display=='none'){
	  obj.style.display='block' ;
	  visibleBlock.push(grpId) ;
	  //Effect.SlideDown($(blockId));
	  }
	  else{
	  i = visibleBlock.indexOf(grpId) ;
	  visibleBlock.splice ( i, 1 );
	  Effect.SlideUp(blockId);
	  }
  setCookie('MenuStatus', visibleBlock.join ( ", " )) ;
}



