// JavaScript Document
// JavaScript Document
var loginuser=new Array();
var loginuserto=new Array();
function GetXMLHttpRequestObject()
	{
	try
		 {
 // Firefox, Opera 8.0+, Safari
		   return new XMLHttpRequest();
		 }
	catch (e)
		 {
 // Internet Explorer
			 try
			  {
			     return new ActiveXObject("Msxml2.XMLHTTP");
			  }
	 catch (e)
  		{
			  return new ActiveXObject("Microsoft.XMLHTTP");
	    }
	 }
	 if (xmlHttp==null)
{
	alert ("Browser does not support HTTP Request")
 	return
} 

	}

function openpopup(fromuser,touser,path)
	{xpos2=0;
ypos2=0;
iWidth2=526;
iHeight2=500;
xpos2=(screen.width-iWidth2)/2;
ypos2=(screen.height-iHeight2)/2;
		if(loginuserto[touser]!=1)
			{
				window.open(path+"tychat/chat.php?curruser="+fromuser+"&touser="+touser,'','width=525,height=500,screenx='+xpos2+',screeny='+ypos2+',left='+xpos2+',top='+ypos2+'');
				loginuser[fromuser]=1;
				loginuserto[touser]=1;
			}
	}
function resetuserwindow(fromuser,touser)
	{
		loginuser[fromuser]=0;
		loginuserto[touser]=0;
	}
function chkmsgsendbyuser(userid,path)
	{
		if(userid!="")
			{
		var HTTP_Actmsg=GetXMLHttpRequestObject();
		HTTP_Actmsg.onreadystatechange=function()
	      {
			  if(HTTP_Actmsg.readyState==4 )
					{	
					 var xmldoc = HTTP_Actmsg.responseText;
					 //alert(xmldoc);
					if(xmldoc!="")
						{
							loopvar=xmldoc.split(",");
							//alert(loopvar);
							for(a=0;a<loopvar.length;a++)
								{
								 openpopup(userid,loopvar[a],path);
								}
						}
					}
		 }
		//alert(path)
	    HTTP_Actmsg.open("GET",path+"tychat/ajax/readchat.php?isacitve=1&fromuser="+userid,true);
		HTTP_Actmsg.send(null); 
			}
	}
function logoutuser(userid,islogin)
	{
		var HTTP_logout=GetXMLHttpRequestObject();
			  if(HTTP_logout.readyState==4 )
					{	
					 var xmldoc = HTTP_logout.responseText;
					if(xmldoc!="")
						{
					alert(xmldoc);
					    }
					}
			if(islogin==1)
			{
				HTTP_logout.open("GET","tychat/ajax/logout.php?userid="+userid+"&islogin=1",true);
				HTTP_logout.send(null); 
			}
		else
			{
				HTTP_logout.open("GET","tychat/ajax/logout.php?userid="+userid,true);
				HTTP_logout.send(null); 
			}
		
	}
function ListOnlineuser(curruser)
{

	var xmlHttp=null;
	try
		 {
 // Firefox, Opera 8.0+, Safari
		   xmlHttp=new XMLHttpRequest();
		 }
	catch (e)
		 {
 // Internet Explorer
			 try
			  {
			    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
			  }
	 catch (e)
  		{
			  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	    }
	 }
	 if (xmlHttp==null)
{
	alert ("Browser does not support HTTP Request")
 	return
} 
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4 )
        {

	
		 var ajaxDisplay = document.getElementById('loginuser');
ajaxDisplay.innerHTML="";
		ajaxDisplay.innerHTML = xmlHttp.responseText;
        }
      }
    xmlHttp.open("GET","ajax/listuser.php?curruser="+curruser,true);
  xmlHttp.send(null); 
	 }	  
	 
	 function test(fromuser,touser,val)
	 {
		loginuser[fromuser]=val;
		loginuserto[touser]=val;
	}
	

/*Agricultural tires, Agricultural tire, Agricultural tyre,  Agricultural tyres, Agricultural tyres dealer, Agricultural tyre dealer, Agricultural tires dealer, Agricultural tire dealer,  agricultural tractor tyres, auto tire dealer, buy car tires, general tyres, general tires, general tire, general tyre, local tire dealers, local tire sales, local tires sale, otr tyres, passenger car tires, passenger tyres, tire dealers, truck tire, truck tyre, B2B online marketplace, OTR tyres, OTR tires, Agricultural tractor tires, truck tires, truck tyres, passenger car tyres, general tires, Radial truck tyres, Radial truck tires, industrial tyres, industrial tires, tyres, tyre, tires, tire, vehicles tires, vehicles tire, vehicles tyres, vehicles tyre, wheels, wheel, wheels and tires, wheels and tyres, tire stores, tires stores, tyres stores, tyre stores, solid tyres, solid tyre, solid tires, solid tire, OTR Tire Dealer, OTR Tyres Dealer, OTR Tyre Dealer, OTR Tires Dealer,  Passenger Tire Dealer, Passenger Tires Dealer, Passenger Tyre Dealer, Passenger Tyres Dealer*/