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: '#000000', 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 align='center' width='99%' border='0' cellspacing='0' cellpadding='5' style='color:#ffffff; border:1px solid #596166; margin-top:15px; margin-bottom:7px'><tr height='25' style='background:url(images/heading_grey.gif);font-weight:bold;color:#d7fe01'><td>&nbsp;&nbsp;"+fromsession+" - "+tosession+" > "+document.getElementById("txttournament").value+"</td></tr>";
					
					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+"<tr><td><table width='100%' border='0' cellspacing='0' cellpadding='0' style='margin-top:5px; text-align:center; background:url(images/heading_blue.gif);color:#FFFFFF; font-size:13px; font-weight:bold'>"
							str=str+"<tr height='30'>"
							str=str+"<td>Group - "+groupname+"</td>"
							str=str+"</tr>"
							str=str+"</table>"
								
							var p=0; 
							
							str=str+"<table align='center' width='100%' border='0' cellspacing='0' cellpadding='0' style='border:1px solid #596166; border-top:none; 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 #596166; border-right:1px solid #596166; 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 #596166; 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;
					str=str+"</td></tr></table>"
				}
			}
		}
		objRequest.send('tid='+id);
	}
}

