var oc_history = new Array();

function oc(area,competition,state) {
	if (oc_history[area]!=null) {
		if (oc_history[area]!=competition) {
			c = document.getElementById('a'+area+'c'+oc_history[area]);
			c.style.display='none';
		}
	}
	c = document.getElementById('a'+area+'c'+competition);
	if (c.style.display=='none' || state=='open') {
		c.style.display = '';
		symbol = '-';
	} else {
		c.style.display = 'none';
		symbol = '+';
	}
	oc_history[area] = competition;
	l = document.getElementById('oc'+area);
	l.href = 'javascript:oc('+area+','+competition+');';
	l.innerHTML = symbol;
	l = document.getElementById('link'+area);
	l.href = 'competitions.php?competition='+competition;
}

function ocm(area,competition,state,comp) {
	var newstate;
	if (oc_history[area]!=null) {
		if (oc_history[area]!=competition) {
			c = document.getElementById('a'+area+'c'+oc_history[area]);
			c.style.display='none';
		}
	}
	c = document.getElementById('a'+area+'c'+competition);
	if (c.style.display=='none' || state=='open') {
		c.style.display = '';
		symbol = '-';
		newstate='close';
	} else {
		c.style.display = 'none';
		symbol = '+';
		newstate='open';
	}
	oc_history[area] = competition;
	l = document.getElementById('oc'+area);
	l.href = 'javascript:ocm('+area+','+competition+','+newstate+',"'+comp+'");';
	l.innerHTML = symbol;
	l = document.getElementById('link'+area);
	//l.href = '/soccer-stats/c/'+area+'/'+compname+'/';
	l.href = '/soccer-stats/c/'+comp+'/';
}

function ocEvent(id) {
	box = document.getElementById('eventbox'+id);
	button = document.getElementById('eventbutton'+id);
	if (box.style.display=='none') {
		box.style.display='';
		button.innerHTML = '-';
	} else {
		box.style.display='none';
		button.innerHTML = '+';
	}
}
