var objRequest=false;

function createXMLHttp()
{
		
	if(window.XMLHttpRequest)
	{
		objRequest=new XMLHttpRequest();
		
		if(objRequest==null)
			objRequest=new ActiveXObject("Microsoft.XMLHTTP");
		if(objRequest==null)
			objRequest=new ActiveXObject("MSXML2.XMLHTTP");
		if(objRequest==null)
			objRequest=new ActiveXObject("MSXML2.XMLHTTP.3.0");
		if(objRequest==null)
			objRequest=new ActiveXObject("Msxml2.XMLHTTP.4.0");
		if(objRequest==null)
			objRequest=new ActiveXObject("Msxml2.XMLHTTP.5.0");
		if(objRequest==null)
			objRequest=new ActiveXObject("Msxml2.XMLHTTP.6.0");
		if(objRequest==null)
			objRequest=new ActiveXObject("Msxml2.XMLHTTP.7.0")
		//objRequest.overrideMimeType("text/xml");
		
	}
	else if(window.ActiveXObject)
	{

		objRequest=new ActiveXObject("Microsoft.XMLHTTP");
		if(objRequest==null)
			objRequest=new ActiveXObject("MSXML2.XMLHTTP");
		if(objRequest==null)
			objRequest=new ActiveXObject("MSXML2.XMLHTTP.3.0");
		if(objRequest==null)
			objRequest=new ActiveXObject("Msxml2.XMLHTTP.4.0");
		if(objRequest==null)
			objRequest=new ActiveXObject("Msxml2.XMLHTTP.5.0");
		if(objRequest==null)
			objRequest=new ActiveXObject("Msxml2.XMLHTTP.6.0");
		if(objRequest==null)
			objRequest=new ActiveXObject("Msxml2.XMLHTTP.7.0");

	}
	
}

function getGroupsWithoutDetail(id)
{
	
	
	$.blockUI({ message: '<img src=image/loader.gif></img>',css: { backgroundColor: '#292929', color: '#fff', width: '100', height: '100', border: '0px solid #f00', left: '50%', top: '50%'} });
	if(objRequest)
	{
		objRequest.open("POST","onlygroup.php?r="+ new Date().getTime());
		objRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		objRequest.onreadystatechange=function()
		{
		if(objRequest.readyState==4 && objRequest.status==200)
			{
				var doc=objRequest.responseXML;
				var groupsNode=doc.documentElement;
				if(groupsNode)
				{
					var str="";
					var groupNode=groupsNode.getElementsByTagName("group");
					
					str=str+" <table width='670' border='0' cellspacing='0' cellpadding='0' style='margin:10px 0 1px 10px; border:1px solid #666666'><tr height='25' bgcolor='#666666'><td style='color:#ffffff; font-weight:bold'>&nbsp;&nbsp;"+fromsession+" - "+tosession+" > "+document.getElementById("txttournament").value+"</td></tr></table>";
					
					for(var i=0;i<groupNode.length;i++)
					{
						var idNode=groupNode[i].firstChild;
						var gid=idNode.childNodes[0].nodeValue;
						
						var groupnameNode=idNode.nextSibling;
						var groupname=groupnameNode.childNodes[0].nodeValue;
						var clubNode=groupnameNode.childNodes[0].nextSibling;
						var tournamentidnode=groupnameNode.nextSibling;
						var tournamentid=tournamentidnode.childNodes[0].nodeValue;
						
						var cnt=clubNode.childNodes.length;
						var clubidNode;
						var clubid;
						var clubnameNode;
						var clubname;
						
						if(cnt>0)
						{
							var isOddRow=true
							
							
						
						
							str=str+"<table width='200' border='0' cellspacing='0' cellpadding='0' style='margin:10px 0 0px 60px; text-align:center;'>"
								str=str+"<tr height='30'>"
								str=str+"<td bgcolor='#7A8289' style='color:#FFFFFF; font-size:14px; font-weight:bold'>Group - "+groupname+"</td>"
								str=str+"</tr>"
								str=str+"</table>"
								
							var p=0; 
							
							str=str+"<table align='center' width='570' border='0' cellspacing='0' cellpadding='0' style='border:1px solid #7A8289;text-align:center'>"
							
							for(var j=0;j<clubNode.childNodes.length;j=j+2)
							{
								var color=""
								clubidNode=clubNode.childNodes[j];
								clubid=clubidNode.childNodes[0].nodeValue;
								clubnameNode=clubidNode.nextSibling
								clubname=clubnameNode.childNodes[0].nodeValue;
								if(isOddRow)
								{
									//color="style='background-color:#000000;'"
									color="";
								}
								
								if(p%2==0)
								{
									str=str+"<tr height='35'>";
									str=str+"<td width='50%' style='border-bottom:1px solid #B2B3B5;border-right:1px solid #B2B3B5;cursor:pointer;text-decoration:underline' onclick='setValue(\"Group "+groupname+"\",2);showPlayers("+clubid+","+tournamentid+",2);'>"+clubname+"</td>"
								}
								else
								{
									str=str+"<td width='50%' style='border-bottom:1px solid #B2B3B5;cursor:pointer;text-decoration:underline' onclick='setValue(\"Group "+groupname+"\",2);showPlayers("+clubid+","+tournamentid+",2);'>"+clubname+"</td>"
									str=str+"</tr>"
								}
								
								                      		
								isOddRow=!isOddRow
								p=p+1;
							}
							str=str+"</table>"
							
						}
					
						
  
										
					}
					
				document.getElementById("toparea2").style.display="none";
				document.getElementById("toparea2").innerHTML="";
				document.getElementById("toparea4").innerHTML=str;
					
					$.unblockUI();
					strgroupswithoutdetail=str;
					
				}
			}
		}
		objRequest.send('tid='+id);
	}
}

