function changeVac(obj){
	startop();
	$.get("index.php?service=server&op=vac&s="+server,function(data){
		obj.src = data;
		stopop();
	});
}
function changeboot(obj){
	startop();
	if(status == 2){
		$.get("index.php?service=server&op=shutdown&s="+server,function(data){
			obj.src = 'image/buttons/boot.png';
			status = 1;
			stopop();
		});
	}else{
		$.get("index.php?service=server&op=boot&s="+server,function(data){
			obj.src = 'image/buttons/shutdown.png';
			status = 2;
			stopop();
		});
	}
}
function reboot(){
	startop();
	$.get("index.php?service=server&op=reboot&s="+server,function(data){
		status = 2;
		document.getElementById('oner1').src = 'image/buttons/shutdown.png';
		stopop();
	});
}
function changeslotup(){
	startop();
	$.getJSON("index.php?service=server&s="+server+"&op=slotup&slotcount="+document.getElementById('slotcount').value,function(data){
		changeBalance(data["balance"]);
		changeSlots(data["slots"]);
		document.getElementById('slotup').style.display = 'none';
		stopop();
	});
}
function changeMapStatus(maper,name){
	startop();
	if(map[name] == 2){
		$.get("index.php?service=server&op=maps&del="+name+"&s="+server,function(data){
			maper.src = 'image/buttons/setMap.png';
			map[name] = 1;
			stopop();
		});
	}else{
		$.get("index.php?service=server&op=maps&set="+name+"&s="+server,function(data){
			maper.src = 'image/buttons/delMap.png';
			map[name] = 2;
			stopop();
		});
	}
}

function changePluginStatus(pluginer,id){
	startop();
	if(plugin[id] == 2){
		$.get("index.php?service=server&op=plugin&del="+id+"&s="+server,function(data){
			pluginer.src = 'image/buttons/setPlugin.png';
			plugin[id] = 1;
			document.getElementById('cfg'+id).innerHTML = data;
			stopop();
		});
	}else{
		$.get("index.php?service=server&op=plugin&set="+id+"&s="+server,function(data){
			pluginer.src = 'image/buttons/delPlugin.png';
			plugin[id] = 2;
			document.getElementById('cfg'+id).innerHTML = data;
			stopop();
		});
	}
}

function changeBalance(ammount){
	document.getElementById('balanceWindow').innerHTML = 'Ваш баланс: <b>'+ammount+' руб.</b>';
	balance = ammount;
}
function changeSlots(ammount){
	up = document.getElementById('slotcount');
	while(up.options.length != 0)up.remove(0);
	down = document.getElementById('slotcount2');
	while(down.options.length != 0)down.remove(0);
	while(up.options.length < (32 - ammount)){
		y = document.createElement('option');
		y.text = up.options.length + 1;
		y.value = up.options.length +1;
		try{
			up.add(y,null); // standards compliant
		}catch(ex){
			up.add(y); // IE only
		}
	}
	while(down.options.length < (ammount-9)){
		y = document.createElement('option');
		y.text = down.options.length + 10;
		y.value = down.options.length + 10;
		try{
			down.add(y,null); // standards compliant
		}catch(ex){
			down.add(y); // IE only
		}
	}
	document.getElementById('slc').innerHTML = ammount;
}