function infobar(title,text,color,button,img){
	var infobar_color = document.getElementById('infobar_color');
	var infobar_img = document.getElementById('infobar_img');

	if (color == 'green') {
		infobar_color.style.backgroundImage = "url(./tools/ico/infobar/green.png)";
		infobar_img.src = "./tools/ico/infobar/greenImg.png";
		infobar_color.style.backgroundColor = "#c4fb9c";
	}
	else if (color == 'yelow') {
		infobar_color.style.backgroundImage = "url(./tools/ico/infobar/yelow.png)";
		infobar_img.src = "./tools/ico/infobar/yelowImg.png";
		infobar_color.style.backgroundColor = "#ffda75";
	}
	else if (color == 'red') {
		infobar_color.style.backgroundImage = "url(./tools/ico/infobar/red.png)";
		infobar_img.src = "./tools/ico/infobar/redImg.png";
		infobar_color.style.backgroundColor = "#ff7575";
	}


	if (button == 'InstAll')
		text += "<button class='infobar_button' onclick='chkManual(\"driver_available\"); run_button(true);'>"+infobar_buttonInstAll+"</button>";
	if (button == 'UpdAll')
		text += "<button class='infobar_button' onclick='chkManual(\"driver_new\"); run_button(true);'>"+infobar_buttonUpdAll+"</button>";
	if (img)
		infobar_img.src = "./tools/ico/infobar/"+img+".png";

	document.getElementById('infobar_title').innerHTML = title;
	document.getElementById('infobar_info').innerHTML = text;
}

function chkManual(div){
	ClearChk();
	for (var i = 0; i < buttonCount; i++) {
		var checkbox = document.getElementById('chk'+i);
		var divname = document.getElementById('type'+i).value;

		if (divname == div) { checkbox.checked="true"; ChangeChkCount(1); }
		else { checkbox.checked=""; }
	}
}

function infobar_update(){
	if (doc_num['driver_available'] > 0) {
		infobar(
			infobar_titleDriverAvailable,
			'<b>'+doc_num['driver_available']+'</b> - '+infobar_infoDriverAvailable,
			'red',
			'InstAll'
		);
	}
	else if (doc_num['no_driver'] > 0) {
		infobar(
			infobar_titleNoDriver,
			'<b>'+doc_num['no_driver']+'</b> - '+infobar_infoNoDriver,
			'red'
		);
	}
	else if (doc_num['driver_new'] > 0) {
		infobar(
			infobar_titleDriverNew,
			'<b>'+doc_num['driver_new']+'</b> - '+infobar_infoDriverNew,
			'yelow',
			'UpdAll'
		);
	}
	else {
		infobar(
			infobar_titleAllInst,
			infobar_infoAllInst,
			'green'
		);
	}
}

function infobar_loading(){
	infobar(
		infobar_titleLoading,
		infobar_infoLoading,
		'yelow',
		'',
		'loading'
	);
}

infobar_update();