var MAX_AMEC_COOKIE_DAYS = 1;

function changeLanguage(locale) {
	var txt = '?';
	if ('' != ('' + window.location['search'])) {
		var search = window.location['search'];
		var start = search.indexOf ('lang=');
		var end = search.indexOf ('&', start);
		if (start > 0) {
			txt = search.substr (0, start)
			if (end > start) {
				txt += search.substr (end + 1);
			}
			if ('&' != txt.substr (txt.length - 1, 1)) {
				txt += '&';
			}
		} else {
			txt = search + '&';
		}
	}

	window.location = window.location.pathname + txt + 'lang=' + locale;
}

function opencatalogue(cat) {
	window.open('literature/catalogues/' + cat, null, 'status=no,menubar=no,toolbar=no,resizable=yes,height=600,width:800');
	return false;
}

function showReportGroupMembers(id) {
	window.location = 'sf_report_group.php?id=' + id;
}

function openSalesMatrix(year, id) {
	if (('' + year) == '') {
		year = prompt('Please enter the budget year');
	}
	if (year) {
		window.open('sf_sales_matrix.php?year=' + year + '&id=' + id);
	}

	return false;
}

function openSalesMatrixRG(year, id) {
	if (('' + year) == '') {
		year = prompt('Please enter the budget year');
	}
	if (year) {
		window.open('sf_sales_matrix.php?year=' + year + '&account_group=' + id);
	}

	return false;
}

function openDRS(year, id) {
	if (('' + year) == '') {
		year = prompt('Please enter the budget year');
	}
	if (year) {
		window.open('sf_drs_report.php?year=' + year + '&id=' + id);
	}

	return false;
}

function openDRSRG(year, id) {
	if (('' + year) == '') {
		year = prompt('Please enter the budget year');
	}
	if (year) {
		window.open('sf_drs_report.php?year=' + year + '&account_group=' + id);
	}

	return false;
}

function showMembers(id) {
	window.location = 'sf_product_groups.php?id=' + id;
}
