/*********************
 Bound archive scripts
 *********************/


function votePopup() {
  votehelpwin = window.open("/botwhelp.php", "votehelpwindow", "location=no,width=625,height=270");
}

function changeRange() {
  if (document.diff_range.diff_showme.value == "Easy") {
    document.diff_range.diff_min.value = "1.0";
    document.diff_range.diff_max.value = "4.0";
  } else if (document.diff_range.diff_showme.value == "Medium") {
    document.diff_range.diff_min.value = "4.0";
    document.diff_range.diff_max.value = "7.0";
  } else if(document.diff_range.diff_showme.value == "Hard") {
    document.diff_range.diff_min.value = "7.0";
    document.diff_range.diff_max.value = "10.0";
  } else if (document.diff_range.diff_showme.value == "All") {
    document.diff_range.diff_min.value = "0";
    document.diff_range.diff_max.value = "10";
  } else if (document.diff_range.diff_showme.value == "Unrated") {
    document.diff_range.diff_min.value = "0";
    document.diff_range.diff_max.value = "0";
  } else {
    // i love you
  }
}


var xmlhttp=false;
/*@cc_on @*/
/*@if (@_jscript_version >= 5)
// JScript gives us Conditional compilation, we can cope with old IE versions.
// and security blocked creation of the objects.
 try {
 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
 } catch (e) {
 try {
 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
 } catch (E) {
 xmlhttp = false;
 }
 }
@end @*/
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
 xmlhttp = new XMLHttpRequest();
}

function drate(rate,id) {
	var element = document.getElementById(id);
	element.innerHTML = 'Rating..';
	xmlhttp.open("GET", 'bdiff_rate.php?id=' + id + '&rate=' + rate);
	xmlhttp.onreadystatechange = function() {
		if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			element.innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}

/* Shows / Hides the prove box in beat.php (I beat a bound, now prove it) */
function showprove() {
  var provebox = document.getElementById("provebox");

  if(provebox.className == 'provehide') {
    provebox.className = 'proveshow';
  } else {
    provebox.className = 'provehide';
  }
}