//
// -- functions for the header preset selection dropdown.
//
function open_request () 
{
  var xmlHttp;
  try {
    xmlHttp=new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari
  }
  catch (e) { // Internet Explorer
    try {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) {
      try {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch (e) {
        alert("Selaimesi ei tue AJAXia \n Your browser does not support AJAX!");
        return false;
      }
    }
  }
  return xmlHttp;
}

function selection_show(obj) 
{
  obj.style.height = '180px';
  obj.style.display = 'block';

  var listing = document.getElementById('selection_body');
  listing.style.display = 'block';
}

function selection_hide(obj) 
{
  obj.style.height = '39px';
  obj.style.display = 'inline';

  var listing = document.getElementById('selection_body');
  listing.style.display = 'none';
}

function hide_loading () 
{
  document.getElementById('loading').style.display = 'none';
  if (document.getElementById('ptotal')) { // set totals in listings
    set_stats_totals ();
  }
  return false;
}
function show_loading () 
{
  document.getElementById('loading').style.display = 'block';
  return false;
}

// -- OPEN GUIDE
function open_guide(section) 
{
   var obj = document.getElementById("guide_container");
   // set object visibility !
   
   if (obj.style.display=='' || obj.style.display=='none') {
     obj.style.display = 'block';
     obj.style.float =  'left';
     obj.style.width = '450px';
     obj.style.top = '150px'; 
     obj.style.left = '120px'; 
   } else {
     obj.style.display = 'none';
   }
      
   // get content for this section
   var xmlHttp = open_request();
   xmlHttp.onreadystatechange=function() {
    if(xmlHttp.readyState==4) {
      document.getElementById("guide_container").innerHTML = xmlHttp.responseText;
      // set draggability!
      var mHandle = document.getElementById("page_guide_header");  // these values are set in backend/guild.php
      var mRoot = document.getElementById("guide_container");
      Drag.init(mHandle, mRoot);
    }
  }
  
  xmlHttp.open("GET","/backend/guide.php?section=" + section,true);
  xmlHttp.send(null);
}

function popup_renew () {
    var foox=document.getElementById('renew');
    if(foox.style.display == 'none') {
        foox.style.display = 'block';
    }
    else {
        foox.style.display = 'none';
    }
}

function multi_domain () {
  var af = document.getElementById('multi_domain');
  if (af.style.display=='none') {
    af.style.display = 'block';
  } else {
    af.style.display = 'none';
  }
}