﻿function createXMLHTTPRequest(){
	
	if (window.ActiveXObject){
	
	return new ActiveXObject("Microsoft.XMLHTTP");
	
	}
	
	else if(window.XMLHttpRequest){
	
	return new XMLHttpRequest();
	
	}

}

function myAjax(id,url,para){
	
	if(!id || !url){
		
		return;	
		
	}
	
	var xmlhttp = createXMLHTTPRequest();
	
	if(xmlhttp != null){	
	
		xmlhttp.onreadystatechange=function (){
			
			if(xmlhttp.readyState==4){
				
				if(xmlhttp.status==200)
				{
					document.getElementById(id).innerHTML=unescape(xmlhttp.responseText);					
				}
				
				else{alert("error!");}
				
			}
			
			else {
				
				if(document.getElementById(id)) document.getElementById(id).innerHTML="<div class='loding'></div>"				
			}
		}
		
		xmlhttp.open("GET",url+"?z="+Math.random()+"&"+para);
		
		xmlhttp.send(null); 
		
	}
	
}

function lodingnav(){
	
	myAjax("lcontent","category/mainnav.asp","")
	
}

function lodingsubnav(Id){
	
	myAjax("subnav"+Id,"category/subnav.asp","id="+Id)	
	
}