var t2='';
function rateImg2(rating,itemID)
  {
  var xmlHttp;
  try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
  catch (e)
    {
    // Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
      }
    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
//        document.myForm.time.value=xmlHttp.responseText;
    rating = rating * 20;
    var tmp=document.getElementById(itemID);
    tmp.style.width = rating+'px';
        }
      }
    xmlHttp.open("GET","http://toget.ru/update.php?rating="+rating+"&itemID="+itemID,true);
    xmlHttp.send(null);

  }

  function badLink (itemID, type, divid)
  {
      if (t2!='')
      {
        t2.style.display='none';
        t2.innerHTML ='';
      }
	  t2 = document.getElementById("blt" + divid);

	if (divid!=0)
	{

      img = document.getElementById("screen" + divid);
	  thumb = document.getElementById("thumb" + divid);

	  expandingwidth = 151;
	  expandingheight = 100;
	  img.style.display='block';
	  expandingtop = img.offsetTop;
	  expandingleft = img.offsetLeft;
	  img.style.display='none';
	  myscroll = getScroll();
	  if (expandingtop + thumb.height > myscroll.top + myscroll.height) {
	  finaltop = myscroll.top + myscroll.height - expandingheight;
	  } else {
	  finaltop = expandingtop + thumb.height - expandingheight;
	  }
	  if (finaltop < myscroll.top) { finaltop = myscroll.top; }
	  t2.style.top = (finaltop-11) + 'px';

	  if (expandingleft + thumb.width > myscroll.left + myscroll.width) {
	  finalleft = myscroll.left + myscroll.width - expandingwidth;
	  } else {
	  finalleft = expandingleft + thumb.width - expandingwidth;
	  }
	  if (finalleft < myscroll.left) { finalleft = myscroll.left; }
	  t2.style.left = (finalleft - 102) + 'px';
	}
	else {
	  t2.style.left = '450px';
  	  t2.style.top = '380px';
	}


      t2.innerHTML ='Вы уверены, что это нерабочая ссылка?<br/><br/><a href="#yes" onclick="javascript: closebadlink('+divid+'); badLink2(\''+itemID+'\',\''+type+'\')">Да</a>&nbsp;&nbsp;&nbsp;<a href="#no" onclick="javascript: closebadlink('+divid+');">Нет</a>';
      t2.style.display='block';
  }


  function badLinkImageMode (itemID, type, divid)
  {
    if (t2!='')
    {
          t2.style.display='none';
          t2.innerHTML ='';
    }

     t2 = document.getElementById("blt" + divid);

	if (divid!=0)
	{

      img = document.getElementById("screen" + divid);
	  thumb = document.getElementById("thumb" + divid);

	  myscroll = getScroll();

	  t2.style.top = eval(document.documentElement.scrollTop+300) + 'px';
	  t2.style.left = (window.screen.width-468)/2+'px';
	}
	else {
	  t2.style.left = '450px';
  	  t2.style.top = '380px';
	}


      t2.innerHTML ='Вы уверены, что это нерабочая ссылка?<br/><br/><a href="#yes" onclick="javascript: closebadlink('+divid+'); badLink2(\''+itemID+'\',\''+type+'\')">Да</a>&nbsp;&nbsp;&nbsp;<a href="#no" onclick="javascript: closebadlink('+divid+');">Нет</a>';
      t2.style.display='block';
  }


  function  closebadlink(divid)
  {
        var t3=document.getElementById("blt"+divid);
        t3.style.display='none';
        t3.innerHTML ='';
  }
  function badLink2(itemID, type)
  {


      var xmlHttp;
      try
        {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();
        }
      catch (e)
        {
        // Internet Explorer
        try
          {
          xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
          }
        catch (e)
          {
          try
            {
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
            }
          catch (e)
            {
            alert("Your browser does not support AJAX!");
            return false;
            }
          }
        }
        xmlHttp.onreadystatechange=function()
          {
          if(xmlHttp.readyState==4)
            {
                tmp=document.getElementById("d"+itemID);
                tmp.innerHTML='<img src="http://toget.ru/images/warning_ok_all.png" title="Жалоба отправлена!">';
            }
          }
        xmlHttp.open("GET","http://toget.ru/update.php?isBad=1&itemID="+itemID,true);
        xmlHttp.send(null);
  }

