function getXhttp (){
    var ajax_request;
    if (  window.ActiveXObject  )  { 
	var mSoftVersions = [
            'MSXML2.DOMDocument.5.0',
            'MSXML2.DOMDocument.4.0',
            'MSXML2.DOMDocument.3.0',
            'MSXML2.DOMDocument.2.0',
            'MSXML2.DOMDocument',
            'Microsoft.XmlDom',
            'Msxml2.XMLHTTP',
            'Microsoft.XMLHTTP'
        ];

        for (  i=0; i<mSoftVersions.length; i++  )  {
            try {
                ajax_request = new ActiveXObject (  mSoftVersions[i]  );
            }  catch (  e  )  {    }
        }
    }  else if (  !ajax_request && typeof XMLHttpRequest != 'undefined'  )  {
        try {
            ajax_request = new XMLHttpRequest;
        }  catch (  e  )  {    }
    }  else if (  !ajax_request && window.createRequest  )  {
        try {
            ajax_request = window.createRequest;
        }  catch (  e  )  {    }
    }  else  {
        ajax_request = false;
    }
    return ajax_request;
}

function rating(uid,score){
  var xml = getXhttp();
  if (!xml){
    return false;
  }
  xml.open('POST', '/js/rating.php');
  xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  xml.send('rating_uid=' + uid + '&rating_score=' + score + '&rating_submit=' + score);
  document.getElementById('thumbs_up').style.background = 'none';
  document.getElementById('thumbs_up').innerHTML = 'Thanks!';
  document.getElementById('thumbs_down').style.display = 'none';
}

function remove_link(link_id){
  var xml = getXhttp();
  if (!xml){
    return false;
  }
  xml.open('POST', '/js/remove_link.php');
  xml.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  xml.send('link_id=' + link_id);
  document.getElementById('link_id_' + link_id).style.display = 'none';
}

