function writeindiv(divid,urlname){
  var xmlhttp=false;
  try {
    xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
  } catch (e) {
    try {
      xmlhttp = new
      ActiveXObject('Microsoft.XMLHTTP');
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  var url = urlname;
  xmlhttp.open('GET', url, true);
  xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4) {
      var content = xmlhttp.responseText;
      if( content ){
         document.getElementById(divid).innerHTML = "" ;
	 document.getElementById(divid).innerHTML = content; 
      }
    }
  }
  xmlhttp.send(null);
}

function vicing(tip, spanid, vot){
  var xmlhttp=false;
  try {
    xmlhttp = new ActiveXObject('Msxml2.XMLHTTP');
  } catch (e) {
    try {
      xmlhttp = new
      ActiveXObject('Microsoft.XMLHTTP');
    } catch (E) {
      xmlhttp = false;
    }
  }
  if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
    xmlhttp = new XMLHttpRequest();
  }
  xmlhttp.open('GET', './blocks/reiting.php?type='+tip+'&id='+spanid+'&thumbs='+vot, true);
  xmlhttp.onreadystatechange=function() {
    if (xmlhttp.readyState==4) {
      var content = xmlhttp.responseText;
      if(content == 'yes'){
		if(vot == 'up') {
			document.getElementById('vic_'+spanid).innerHTML = parseInt(document.getElementById('vic_'+spanid).innerHTML)+1;
		}
		else {
			document.getElementById('vic_'+spanid).innerHTML = parseInt(document.getElementById('vic_'+spanid).innerHTML)-1;
		}
      }
	  else {
		if(tip == '2') {
		alert('Вече сте гласували за това клипче!');
		}
		else {
		alert('Вече сте гласували за този виц!');
		}
	  }
    }
  }
  xmlhttp.send(null);
}

function confirmIt(ask, url) {
	if(confirm(ask)) {
		window.location.href=url;
	}
}
