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)
{
	
	
	//document.getElementById("tcaption").innerHTML=document.getElementById("txttournament").value;
	$.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+"<div id='header' style='background-color:#000000; height:30px;width:528px;margin: 20px 0px 0px 12px;padding-bottom:5px;'>";
					//str=str+"<div class='caption1'>"+document.getElementById("txttournament").value+"</div>";
					//str=str+"</div><br/>";
					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='600' border='0' cellspacing='2' cellpadding='0' align='center' style='margin-top:15px; text-align:center;'>"
							 str=str+"<tr height='24'>"
							 str=str+"<td rowspan='8' width='120' style='font-weight:bold; color:#000; font-size:14px;background-image:url(image/group-header-bg.png);'>Group - "+groupname+"</td>"
							 str=str+"<td>&nbsp;</td>"
							 str=str+"</tr>"
							 str=str+"</table>"
							 
							var p=0; 
							
							str=str+"<table width='600' border='0' cellspacing='2' cellpadding='0' align='center' style='margin-top:-2px; text-align:center; border:1px solid #999999;'>"
							
							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;'"
								}
								
								if(p%2==0)
								{
									str=str+"<tr height='25'>";
									str=str+"<td width='50%' style='background-color: #333944;color: #FFCC66;font-weight:bold;cursor:pointer;text-decoration:underline' onclick='setValue(\"Group "+groupname+"\",2);showPlayers("+clubid+","+tournamentid+",2);'>"+clubname+"</td>"
								}
								else
								{
									str=str+"<td width='50%' style='background-color: #333944;color: #FFCC66;font-weight:bold;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>"
							
						}
					
						
						
						
                        
										
					}
					str=str+"<br />"
					//document.getElementById("topindex").style.display="none";
					document.getElementById("toparea3").innerHTML=str;
					$.unblockUI();
					strgroupswithoutdetail=str;
					
				}
			}
		}
		objRequest.send('tid='+id);
	}
}

