function zmianaClassyOn(element,activ){
   if(!activ) element.setAttribute("class", "top top1");
}

function zmianaClassyOff(element,activ){
   if(!activ) element.setAttribute("class", "top top2");
}

img=1;
function imgPrevListN()
{
  if(img>1){ img -= 1; }
  else return false;
  advAJAX.get({
    url: 'index.php?a=partnersList&img='+img,
    onInitialization: function() { 
      document.getElementById('par_1').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';
      document.getElementById('par_2').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';
      document.getElementById('par_3').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';
      document.getElementById('par_4').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
      document.getElementById('par_5').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
      document.getElementById('par_6').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
      document.getElementById('par_7').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
      document.getElementById('par_8').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';
      document.getElementById('par_9').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';   
    },
    onSuccess : function(obj) { 
      document.getElementById('parners').innerHTML = obj.responseText; 
    },
    //onComplete : function() { document.getElementById('cn_prev').src = 'gfx/left.gif'; },
    onError : function(obj) { alert("Error: " + obj.status); }
  });
  return false;
}

function imgNextListN()
{
  img += 1;
  advAJAX.get({
    url: 'index.php?a=partnersList&img='+img,
    onInitialization: function() { 
      document.getElementById('par_1').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';
      document.getElementById('par_2').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';
      document.getElementById('par_3').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';
      document.getElementById('par_4').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
      document.getElementById('par_5').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
      document.getElementById('par_6').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
      document.getElementById('par_7').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
      document.getElementById('par_8').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />';
      document.getElementById('par_9').innerHTML = '<img style="margin:20px 0 0 40px; border:none;" src="gfx/loading.gif" />'; 
    },
    onSuccess : function(obj)
    {
      //alert(obj.responseText.length);
      if(obj.responseText && obj.responseText.length>1000) document.getElementById('parners').innerHTML = obj.responseText;
      else{ imgPrevListN(); }
    },
    //onComplete : function() { document.getElementById('cn_next').src = 'gfx/right.gif'; },
    onError : function(obj) { alert("Error: " + obj.status); }
  });
  return false;
}

function openWindow(link) // inspired by porneL - http://pornel.net/pups/
{
  try
  {
    var new_window = window.open(link, '_blank');
    if(new_window) return false;
  }
  catch(e){}
  return true;
}

function checkRequiredFields(form_id)
{
  ok = true;
  fields = document.getElementsByTagName('input');
  for(var i in fields) if(fields[i].className=='text required')
  {
    if(fields[i].parentNode.parentNode.parentNode.id==form_id && !fields[i].value) ok = false;
  }
  fields = document.getElementsByTagName('textarea');
  for(var i in fields) if(fields[i].className=='required')
  {
    if(fields[i].parentNode.parentNode.parentNode.id==form_id && !fields[i].value) ok = false;
  }
  if(ok)
  {
    //document.getElementById('submit_'+form_id).disabled = 'disabled';
    return true;
  }
  alert('You have to fill all the required fields (marked with asterisk).');
  return false;
}

function addMenuHover()
{
  m = document.getElementsByTagName('li');
  for(var i in m) if(m[i].innerHTML && m[i].parentNode.parentNode.id=='header' && m[i].className=='dd')
  {
    id = m[i].id;
    m[i].onmouseover = function()
    {
      document.getElementById('s'+id).style.display = 'block';
    }
    m[i].onmouseout = function()
    {
      document.getElementById('s'+id).style.display = 'none';
    }
  }
}

onload = function()
{
  a = document.getElementsByTagName('a');
  for(var i in a) if(a[i].innerHTML && (a[i].className=='nw' || a[i].className=='photo nw'))
  {
    a[i].target = '_blank';
  }
}

