var gMatchWorking = false;
	
function selectMatchPaged(actionURL, matchIndex,page) 
{
	if (gMatchWorking == true)
	  return;
	  
	gMatchWorking = true;  
	
	document.getElementById("loadingIndicator").innerHTML ="<img hspace='6' src='/images/indicator.gif' align='absmiddle'/> Loading...";
	  
	var url = actionURL + "?action=setMatch&matchIndex=" + matchIndex + "&page="+page+"&ts="+new Date().getTime();
	sendEvent(url, handleMatchHttpResponse);
}

function selectMatch(actionURL, matchIndex) 
{
	selectMatchPaged(actionURL, matchIndex,0) 
}


function handleMatchHttpResponse() {
  
   if (http.readyState != 4)  
	 return;
	
   gMatchWorking = false;	
	
   var matchesElement = document.getElementById("matches");
   matchesElement.innerHTML = http.responseText;	   
}

function selectRadio(index)
{
	var rb = document.comment_form.radiobutton;
	for(var i = 0; i < rb.length; i++) {
		rb[i].checked = false;
		if(rb[i].value == index.toString()) {
			rb[i].checked = true;
		}
	}
}

function setShowMore(listID,maxShowItems,isShow)
	{		
		
		list = document.getElementById(listID);
		items = list.getElementsByTagName("li");
		for(i=maxShowItems ; i < items.length; i++){
			
			nextClass = items.item(i).className;
			if(isShow){
				re = /\s*hidden/
				items.item(i).className = nextClass.replace(re,"");
			}
			else{
			
				items.item(i).className = items.item(i).className+" hidden";
			}
		}
		
		links = list.getElementsByTagName("a");
		for(i=0 ; i < links.length; i++){
			
			next = links.item(i);
			if(isShow && next.className.indexOf("moreItemsLink")>=0){
			
				next.className = next.className+" hidden";
			}
			if(isShow && next.className.indexOf("lessItemsLink")>=0){
			
				
				re = /\s*hidden/
				next.className = next.className.replace(re,"");
			}
			if(!isShow && next.className.indexOf("moreItemsLink")>=0){
			
				re = /\s*hidden/
				next.className = next.className.replace(re,"");
			}
			if(!isShow && next.className.indexOf("lessItemsLink")>=0){
			
				next.className =next.className+" hidden";
			}
		}
	}
	
