function OpenWindow( id ) {
	if ( id == 'live') {
		// live popup
		var popup = window.open('/live','LiveScoreboard',config='height=500,width=646,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,scrollbars=yes');
	} else {
		var left = (screen.width  - 300);
		var popup = window.open('/popup.php?id=' + id,'LiveMatch',config='height=500,width=500,top=0,left=' + left + 'toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no,scrollbars=yes');
	}
}

// CMS FUNCTIONS
function confirm_delete(id,name) {
	var answer = confirm("Weet je zeker dat je de competitie '" + name + "' wilt verwijderen? Waarschuwing: sub-items worden ook verwijderd!");
	if (answer) {
		var answer2 = confirm("Weet je echt heel zeker dat je competitie '" + name + "' wilt verwijderen?");
		if (answer2) {
			window.location = "edit.php?id=" + id + "&action=delete";
		}
	}
}

function getSeasons(selected_gsm_season_id) {
	xmlHttp.open('GET', '/cms/get_items.php?type=seasons&selected=' + selected_gsm_season_id);
	xmlHttp.onreadystatechange = function() {
		if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
			document.getElementById('seasons_select').innerHTML = xmlHttp.responseText;
		}
	}
	xmlHttp.send(null);
}

function getRounds(selected_gsm_round_id) {
	season_id = document.getElementById('gsm_season_id').value;
	if (season_id != 0) {
		xmlHttp2.open('GET', '/cms/get_items.php?type=rounds&id=' + season_id + '&selected=' + selected_gsm_round_id);
		xmlHttp2.onreadystatechange = function() {
			if (xmlHttp2.readyState == 4 && xmlHttp2.status == 200) {
				document.getElementById('rounds_select').innerHTML = xmlHttp2.responseText;
			}
		}
		xmlHttp2.send(null);
	}
}

function getGroups(selected_gsm_group_id) {
	round_id = document.getElementById('gsm_round_id').value;
	if (round_id != 0) {
		xmlHttp3.open('GET', '/cms/get_items.php?type=groups&id=' + round_id + '&selected=' + selected_gsm_group_id);
		xmlHttp3.onreadystatechange = function() {
			if (xmlHttp3.readyState == 4 && xmlHttp3.status == 200) {
				document.getElementById('groups_select').innerHTML = xmlHttp3.responseText;
			}
		}
		xmlHttp3.send(null);
	}
}

