var req;
var url = "modules/ajax_listmodel.php";
function sendcat(id)
{				
	request = "catid="+id		
	SendQuery(request,url,'POST',"LoadMessage()",1);
	//document.getElementById("msg").innerHTML = "aaaa";	
}

function LoadMessage()
{		
	var html=req.responseText;
	if(html!=''){
		document.getElementById("model").innerHTML = html;
	}
	else{
		//document.getElementById("msg1").innerHTML = "<div class='Loading'><img src='style/images/loader.white.gif'></div";
	}
}

	
function Initialize()
{
	try
	{
		req=new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch(e)
	{
		try
		{
			req=new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch(oc)
		{
			req=null;
		}
	}

	if(!req&&typeof XMLHttpRequest!="undefined")
	{
		req=new XMLHttpRequest();
	}

}

function SendQuery(request,ajax_url,method,callbackFunction,cache)
{
	Initialize();
	if ( (req!=null) )
	{		
		req.onreadystatechange = function()
								{
									if (req.readyState == 4)
								    {
							        	if (req.status == 200)
										{
											eval(callbackFunction);
										}
									}
								};
		// Cache data or not								
		if ( cache==0 )
		{
			request += "&rand="+Math.random()*100;
		}
		
		// Use POST or GET method , default is GET
		if ( method == 'POST' )
		{
			req.open("POST", ajax_url, true);
	        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	        req.send(request);
		}
		else
		{						
			req.open("GET",ajax_url+"?"+request, true);
			req.send(null);
		}
	}
}

function SendRequest(request,method)
{
	Initialize();
	
	if ( (req!=null) )
	{		
		if ( method == 'POST' )
		{
			req.open("POST", ajax_url, true);
	        req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	        req.send(request);
		}
		else
		{						
			req.open("GET",ajax_url+"?"+request, true);
			req.send(null);
		}
	}
}