// Showes/hides a side bar
function side_bar_control() {
  if (document.getElementById('side_bar').style.display=='none') {
    document.getElementById('side_bar').style.display = 'block';
    JSPsetCookie('sbs_wp_side_bar', 'block');
  } else {
    document.getElementById('side_bar').style.display = 'none';
    JSPsetCookie('sbs_wp_side_bar', 'none');
  }
}

// Context help
function show_context_help(e, help_id, folder, img_pref, title_close)
{
  var content = '<div id="context_help_div">' +
	'<a href="javascript:JSPcloseWindow(\'context_help_div\')" class="close_a"><img src="' + img_pref + 'sbs_wp_cp/pics/icon_close.gif" alt="' + title_close + '" /></a>' +
	'<div id="context_help_content"></div>' +
	'</div>';
  JSPopenWindow("context_help_div", content, 0, 0, e);

  document.getElementById("context_help_div").style.display = "none";

  simpleRequest("context_help.php", {id:help_id,folder:folder});
}

// "Whois"-info
function show_whois(address, img_pref, title_close)
{
  var content = '<div id="whois_block">' +
      '<a href="javascript:JSPcloseWindow(\'whois_block\')" class="close_a"><img src="' + img_pref + 'sbs_wp_cp/pics/icon_close.gif" alt="' + title_close + '" /></a>' +
      '<div id="whois_block_content"></div>' +
      '</div>';
  JSPopenWindow("whois_block", content, "center", 10);

  document.getElementById("whois_block").style.display = "none";

  simpleRequest("whois.php", {address:address});
}

// Show image in CP
function show_image(url)
{
  var content = '<div id="image_block">' +
      '<a href="javascript:JSPcloseWindow(\'image_block\')" id="image_block_content"></a>' +
      '</div>';
  JSPopenWindow("image_block", content, 250, 10);

  document.getElementById("image_block").style.display = "none";

  simpleRequest("show_image.php", {url:url});
}

// Window for changing of attributes
function attributes_window(table, id, attrs, img_pref, title_close)
{
  var content = '<div id="attr_window">' +
      '<a href="javascript:JSPcloseWindow(\'attr_window\')" class="close_a"><img src="' + img_pref + 'sbs_wp_cp/pics/icon_close.gif" alt="' + title_close + '" /></a>' +
      '<div id="attr_window_content"></div>' +
      '</div>';
  JSPopenWindow("attr_window", content, "center", 200);

  document.getElementById("attr_window").style.display = "none";

  simpleRequest("attributes.php", {table:table,id:id,attrs:attrs});
}
