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 getComingTournaments(typ)
{
		
	createXMLHttp();
	$.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","comingtournament.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 tournamentsNode=doc.documentElement;
				if(tournamentsNode)
				{
					var str="";
					var tournamentNode=tournamentsNode.getElementsByTagName("tournament");
					
					for(var i=0;i<tournamentNode.length;i++)
					{
						var idNode=tournamentNode[i].firstChild;
						var tid=idNode.childNodes[0].nodeValue;
						var tnameNode=idNode.nextSibling;
						var tname=tnameNode.childNodes[0].nodeValue;
						
						switch(typ)
						{
							case 1:
								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; font-family:Arial, Helvetica, sans-serif'><tr height='25' style='background:url(images/heading_grey.gif);font-weight:bold;color:#d7fe01'><td>&nbsp;&nbsp;"+(i+1)+". "+tname +"</td></tr></table>"
								break;

						}
						
						
					}
					
					var strtitle="";
					 	strtitle=strtitle+"&nbsp;<em>Forthcoming Tournaments</em>";
					 
					 
						document.getElementById("toparea1").innerHTML=strtitle;
						document.getElementById("toparea2").style.display="none";
						document.getElementById("toparea2").innerHTML="";
						document.getElementById("toparea4").innerHTML="";
						document.getElementById("toparea3").innerHTML=str;
					
					
					 $.unblockUI();
					 strtournamentlabel=strtitle;
					 strtournament=str;
				}
			}
		}
		objRequest.send('');
	}
}

