/**
 * Function for popping-up window with an image
 */
function popup_image(script, image, resize)
{
  if (resize) {
    window.open(script+'?image='+image+'&resize=1','','height=650,width=850,scrollbars=yes');
  } else {
    window.open(script+'?image='+image,'','height=650,width=850,scrollbars=yes');
  }
  return false;
}

/**
 * Function for confirming an action.
 *
 * When user presses YES, document is redirected to specified URL
 */
function action_confirm(url, text) {
 	action = confirm(text);
 	if (action) {
    document.location = url;
  }
  return false;
}


/**
 * Function for creating window for associating images
 */
function popup_associate_image_window(url, image, field, button) {
  window.open(url+'&image='+image+'&field='+field+'&button='+button, '', 'scrollbars=yes');
  return false;
}

/**
 * Function for show / hide element
 */
function toggle_visibility(id) {
  var e = document.getElementById(id);

  if(e.style.display == 'none')
    e.style.display = 'block';
  else
    e.style.display = 'none';

  return false;
}
