// 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');
}

// 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" />');
}

function abuse(element, comment, data)
{
  element.style.display = 'none';

  if(window.XMLHttpRequest)
    xhr = new XMLHttpRequest();
  else if(window.ActiveXObject)
  {
    xhr = new ActiveXObject('Msxml2.XMLHTTP');
    if(!xhr) xhr = new ActiveXObject('Microsoft.XMLHTTP');
  }

  xhr.open('POST', '/abuse.php?comment='+comment, true);
  xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
  xhr.send(data);
}

// Flash fix

/*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;
  }
}

function clx(sid, bt, width, height)
{
  document.write('<script language=JavaScript src="http://s.clx.ru/main.php?uid=18c91&place=101122&size=468,60&c='+Math.round(Math.random()*100000)+'"'+'><'+'/script>');
}

function adlabs_show()
{
  var __rt= Math.round(Math.random() * 100000);
  document.write('<scr'+'ipt language="javascript" type="text/javascript" src="http://id46061.luxup.ru/show/65652/?div=lx_65652&rt='+__rt+'&r='+escape(document.referrer)+'"><'+'/scr'+'ipt>');
  document.write('<scr'+'ipt language="javascript" type="text/javascript" src="http://id46061.luxup.ru/show/65808/?div=lx_65808&rt='+__rt+'&r='+escape(document.referrer)+'"><'+'/scr'+'ipt>');
}
