// Pop-up window

function blank(link, width, height, scrollbars)
{
  scrollwidth = scrollbars? 16: 0;
  window.open(link, '', 'width='+(width+scrollwidth)+', height='+height+', left='+(screen.width-width-scrollwidth)/2+', top='+(screen.height-50-height)/2+', titlebar=no, menubar=no, toolbar=no, location=no, status=no, scrollbars='+(scrollbars? 'yes': 'no')+', resizable=yes');
}

/*function file(name)
{
  blank('/files?name='+name, 640+20, 640+20, false);
}*/

// Flash

function flash(src, width, height)
{
  document.write('<embed '+
    //'name="'+id+'" '+
    'width="'+width+'" '+
    'height="'+height+'" '+
    'align="middle" '+
    'type="application/x-shockwave-flash" '+
    'pluginspage="http://macromedia.com/go/getflashplayer" '+
    ''+
    'src="'+src+'" '+
    'quality="high" '+
    'wmode="transparent" '+
    'bgcolor="transparent" '+
    'menu="false" '+
    'allowScriptAccess="sameDomain"/>');
}

// Flash

/*function flash_fix(id)
{
  if(document.getElementById)
  {
    element = document.getElementById(id);
    element.outerHTML = element.outerHTML;
  }
}*/

// AJAX

// module  - Module name
// id      - Value ID
// element - Element ID
// loading - URL encoded string
// data    - FF fix

function ajax(module, group, item, element, loading, reload, data)
{
  document.getElementById(element).innerHTML = loading;

  if(window.XMLHttpRequest)
    xhr = new XMLHttpRequest();
  else if(window.ActiveXObject)
  {
    xhr = new ActiveXObject('Msxml2.XMLHTTP');
    if(!xhr) xhr = new ActiveXObject('Microsoft.XMLHTTP');
  }

  xhr.onreadystatechange = function xhr_response() {
    if(xhr.readyState == 4 && xhr.status == 200)
      document.getElementById(element).innerHTML = xhr.responseText;};

  xhr.open('POST', '/ajax.php?module='+module+'&group='+group+'&item='+item+'&reload='+reload, true);
  xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
  xhr.send(data);
}

// FORM

function field_focus(field, value, color)
{
  if(field.value == value)
  {
    field.value = '';
    field.style.color = color;
  }
}

function field_blur(field, value, color)
{
  if(!field.value)
  {
    field.value = value;
    field.style.color = color;
  }
}

// COUNTER

/*function counter10()
{
  a = ';r='+escape(document.referrer);
  js = 10;
}

function counter11()
{
  a += ';j='+navigator.javaEnabled();
  js = 11;
}

function counter12()
{
  a += ';s='+screen.width+'*'+screen.height;
  a += ';d='+(screen.colorDepth? screen.colorDepth: screen.pixelDepth);
  js = 12;
}

function counter13()
{
  js = 13;
}

function counter(id, theme, alt)
{
  if(theme)
    document.write(
      '<a href="http://top.mail.ru/dynamics?period=today&what=hosts&id='+id+'" target="_blank">'+
      '<img src="http://d3.c5.b9.a0.top.list.ru/counter?id='+id+';t='+theme+';js='+js+a+';rand='+Math.random()+'" width="88" height="31" alt="'+alt+'"/>'+
      '</a>');
  else
    document.write('<img src="http://d3.c5.b9.a0.top.list.ru/counter?id='+id+';js='+js+a+';rand='+Math.random()+'"'+' width="1" height="1" alt=""/>');
}*/

