function voteToInner(){
	if(xml.readyState == 4){
		if(xml.status == 200){
			document.getElementById("rateDiv").innerHTML = xml.responseText;
		}
	}
}
function voteTo(download,vote){
	xmlRequest("post","http://www.vins.co.il/index.php?action=ajax","place=download&requested=vote&download="+download+"&vote="+vote,voteToInner);
}
var lastCatagory = "sameDownloads";
var lastFullList=1;
var catagoriesValues = [];
var currentInCatagories = [];
function changeCatagory(catagory,number){
	if(catagory != lastCatagory){
		document.getElementById("catagory_"+lastCatagory).className = "clipsbuttonoff";
		document.getElementById("catagory_"+catagory).className = "clipsbuttonon";
		document.getElementById("div_"+lastCatagory).className = "hidden";
		document.getElementById("div_"+catagory).className = "shown";
		if(lastFullList != number){
			document.getElementById("fullList"+lastFullList).className = "hidden";
			document.getElementById("fullList"+number).className = "fulllink2";
			lastFullList = number;
		}
		lastCatagory = catagory;
	}
}
function makeMoveButtomInner(){
	if(xml.readyState == 4){
		if(xml.status == 200){
			catagoriesValues[lastCatagory][currentInCatagories[lastCatagory]] = xml.responseText;
			document.getElementById("div_"+lastCatagory).innerHTML = xml.responseText;
		}
	}
}
function makeMoveButtom(where,catagory,keywords,id){
	if(currentInCatagories[lastCatagory] === undefined || currentInCatagories[lastCatagory] === 0){
		currentInCatagories[lastCatagory] = 1;
		catagoriesValues[lastCatagory] = [];
		catagoriesValues[lastCatagory][0] = document.getElementById("div_"+lastCatagory).innerHTML;
	}
	if(where == "right"){
		currentInCatagories[lastCatagory]--;
		if(currentInCatagories[lastCatagory] === 0){
			currentInCatagories[lastCatagory] = 3;
		}
	}else{
		currentInCatagories[lastCatagory]++;
		if(currentInCatagories[lastCatagory] == 4){
			currentInCatagories[lastCatagory] = 1;
		}
	}
	if(catagoriesValues[lastCatagory][currentInCatagories[lastCatagory]] !== undefined && catagoriesValues[lastCatagory][currentInCatagories[lastCatagory]] !== 0){
		document.getElementById("div_"+lastCatagory).innerHTML = catagoriesValues[lastCatagory][currentInCatagories[lastCatagory]];
	}else{
		xmlRequest("post","http://www.vins.co.il/index.php?action=ajax","place=download&requested=buttom&id="+id+"&keywords="+keywords+"&catagory="+catagory+"&type="+lastCatagory+"&current="+currentInCatagories[lastCatagory],makeMoveButtomInner);
	}
}
