// JavaScript Document
function detectBrowser() {
	if (!navigator.cookieEnabled) {
		document.write ('<div class="error">Your browser does not support Cookies</div>');
	}
	if (navigator.appName != "Microsoft Internet Explorer") {
		document.write ('<div class="errorBig">In order to use all Content Management System functions, please use Microsoft Internet Explorer browser.</div>');
	}
}

function showConfirm(msg, redirectUrl) {
	var r = confirm(msg);
	if (r == true) {
		location.href = redirectUrl;
	}
	else {
		
	}
}

// automatinis comboboxu filtravimas
function filterDropdown(name, arr, ind) {
	// pasalinimas visu elementu
	var dropdown = document.getElementById(name);
	var total = dropdown.options.length;
	for (var i=total-1; i>=0; i--) {
		dropdown.remove(i);
	}
	// nauju addinimas
//		alert (ind);
	for (var i=0; i<arr.length; i++) {
		if (ind == arr[i][1] || arr[i][1] == '') {
			var elm = document.createElement('option');
			elm.value = arr[i][0];
			elm.text = arr[i][2];
			elm.selected = arr[i][3];
			arr[i][3] = false;
			try {
				dropdown.add(elm,null); // standards compliant
			}
			catch(ex) {
				dropdown.add(elm); // IE only
			}
		}
	}
}
