var xmlHttp = false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
try {
  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
  try {
    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
  } catch (e2) {
    xmlHttp = false;
  }
}
@end @*/
if (!xmlHttp && typeof XMLHttpRequest != 'undefined') xmlHttp = new XMLHttpRequest();

var tabs_ret = '';

function callServer(url,res) {
  tabs_ret = res;
  xmlHttp.open("GET",url,true);
  xmlHttp.onreadystatechange = updatePage;
  xmlHttp.send(null);
}

function updatePage() { 
  if(xmlHttp.readyState==4) {
    document.getElementById(tabs_ret).innerHTML = xmlHttp.responseText;
  }
}

// ---------------------------------------------------------------------------------------

function id_style(id) {
  var ns=(document.layers);
  var ie=(document.all);
  var w3=(document.getElementById&&!ie);
  
  if (!ns&&!ie&&!w3);
  if (ie)
    am=eval('document.getElementById(id).style');
  else
    if (ns)
      am=eval('document.layers[id]');
    else
      if (w3)
        am=eval('document.getElementById(id).style');
  
  return am;
}

function id_class(id) {
  var ns=(document.layers);
  var ie=(document.all);
  var w3=(document.getElementById&&!ie);
  
  if (!ns&&!ie&&!w3);
  if (ie)
    am=eval('document.getElementById(id)');
  else
    if (ns)
      am=eval('document.layers[id]');
    else
      if (w3)
        am=eval('document.getElementById(id)');
  
  return am;
}

function class_obj(id,iclass) { id_class(id).className = iclass; }
function show_obj(id) { id_style(id).display="block"; }
function close_obj(id) { id_style(id).display="none"; }

function show_or_hide(id) {
  if (id_style(id).display=="none")
    id_style(id).display="block";
  else
    id_style(id).display="none";
}

function show_zak(first,num,cnt) {
  // ñâåòèì òåëî çàêëàäêè
  for(i=0; i<cnt; i++) id_style('body-'+(first+i)).display="none";
  id_style('body-'+num).display="block";
 
  // ñâåòèì ÿðëûêè çàêëàäîê
  for(i=0; i<cnt; i++) id_class('top-'+(first+i)).className="";
  id_class('top-'+num).className="activ";
}

// Bookmark -----------------------------------------------------------------

function bookmark_on(id,url,title,text) { 
  show_obj('bookmark-panel-'+id); 
  callServer('system/bookmark.php?id='+id+'&url='+url+'&title='+title+'&text='+text,'bookmark-panel-'+id); 
}

function bookmark_off(id) { 
  close_obj('bookmark-panel-'+id); 
}

