var xmlHttp;
function GetXmlHttpObject()
{
    var xmlHttp=null;
    try
    {
        // Firefox, Opera 8.0+, Safari
        xmlHttp=new XMLHttpRequest();  
    }
    catch (e)
    {
        // Internet Explorer
        try
        {
            xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");    
        }
        catch (e)
        {
            try
            {
                xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");      
            }
            catch (e)
            {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    return xmlHttp;
 }
 
 function loaddata(idtin,id)
 {
 	xmlHttp = GetXmlHttpObject();
    if(xmlHttp==null) 
    {    
        alert("Trinh duyet k ho tro");
        return;
    }
    else
    {
		if(idtin = 347)
		{
        xmlHttp.onreadystatechange = xulydulieutrave;
        xmlHttp.open('GET','content/homeajax/menu.php',true);
        xmlHttp.send(null);
		}
		if(idtin = 344)
		{
        xmlHttp.onreadystatechange = xulydulieutrave;
        xmlHttp.open('GET','content/homeajax/newsindex.php',true);
        xmlHttp.send(null);
		}
    }
 }
 function xulydulieutrave()
 {
    	document.getElementById("txtshow").innerHTML=xmlHttp.responseText;

 }

/*---------------------------------*/
 function loadsp()
 {
 	xmlHttp = GetXmlHttpObject();
    if(xmlHttp==null) 
    {    
        alert("Trinh duyet k ho tro");
        return;
    }
    else
    {
        xmlHttp.onreadystatechange = loadsp_lenmanhinh;
        xmlHttp.open('GET','content/sanpham/sanphammoi.php',true);
        xmlHttp.send(null);
    }
 }
  function loadsp1()
 {
 	xmlHttp = GetXmlHttpObject();
    if(xmlHttp==null) 
    {    
        alert("Trinh duyet k ho tro");
        return;
    }
    else
    {
        xmlHttp.onreadystatechange = loadsp_lenmanhinh;
        xmlHttp.open('GET','content/sanpham/sanphambanchay.php',true);
        xmlHttp.send(null);
    }
 }
 function loadsp_lenmanhinh()
 {
 	 if(xmlHttp.readyState==4)
      {
 			document.getElementById("show1").innerHTML=xmlHttp.responseText;
       }
 }

/*---------------------------------*/
 function loadtext(id,i)
 {
 	xmlHttp = GetXmlHttpObject();
    if(xmlHttp==null) 
    {    
        alert("Trinh duyet k ho tro");
        return;
    }
    else
    {
    	if(i==1)
        {
        	xmlHttp.onreadystatechange = loadsp_lenmanhinh1;
       	}
        else
        {
        	xmlHttp.onreadystatechange = loadsp_lenmanhinh2;
        }
		if(id == 347)
		{
        xmlHttp.open('GET','content/homeajax/menu.php',true);
        xmlHttp.send(null);
		}
		if(id == 344)
		{
        xmlHttp.open('GET','content/homeajax/newsindex.php',true);
        xmlHttp.send(null);
		}
    }
 }
  function loadsp_lenmanhinh2()
 {
 	 if(xmlHttp.readyState==4)
      {
 			document.getElementById("show2").innerHTML=xmlHttp.responseText;
      }
 }
   function loadsp_lenmanhinh1()
 {
 	 if(xmlHttp.readyState==4)
      {
 			document.getElementById("show1").innerHTML=xmlHttp.responseText;
      }
 }
 /*--------------------------------------------------------*/
  function loadsanpham(idtin,cmd)
 {
 	xmlHttp = GetXmlHttpObject();
    if(xmlHttp==null) 
    {    
        alert("Trinh duyet k ho tro");
        return;
    }
    else
    {
        xmlHttp.onreadystatechange = xulydulieutrave;
        xmlHttp.open('GET','content/sanpham/showthongtin1.php?idtin=' + idtin +'&ac='+cmd,true);
        xmlHttp.send(null);
    }
 }
 function xulydulieutrave()
 {
 	if(xmlHttp.readyState==4)
      {
    	document.getElementById("txtshow").innerHTML=xmlHttp.responseText;
       }
 }
 function remove_image(name)
 {
 	xmlHttp = GetXmlHttpObject();
    if(xmlHttp==null) 
    {    
        alert("Trinh duyet k ho tro");
        return;
    }
    else
    {
        xmlHttp.onreadystatechange = removeimage;
        xmlHttp.open('GET','remoimage.php?name='+name,true);
        xmlHttp.send(null);
    }
 }
 function removeimage()
 {
 	if(xmlHttp.readyState==4)
      {
    	document.getElementById("abc").innerHTML=xmlHttp.responseText;
	  }
 }
//Xu ly menu ngang

			var not_hover_Image = "url(images/bg_sp_left.png)";
			function change_bg_image1(idmanu){
				hover_Image = "url(images/hover_bg_sp_left.png)";
				document.getElementById('tab_sp_left1').style.backgroundImage = hover_Image;
				document.getElementById('tab_sp_left2').style.backgroundImage = not_hover_Image;
				document.getElementById('tab_sp_left3').style.backgroundImage = not_hover_Image;
				document.getElementById('tab_sp_left4').style.backgroundImage = not_hover_Image;
				
				//su ly data
				xmlHttp = GetXmlHttpObject();
					if(xmlHttp==null) 
					{    
						alert("Trinh duyet k ho tro");
						return;
					}
					else
					{
						xmlHttp.onreadystatechange = loaddatamenungang;
						xmlHttp.open('GET','content/sanpham/sanphamtheodanhmuc.php?idtab=' + idmanu,true);
						xmlHttp.send(null);
					}
				
			}
			function loaddatamenungang()
			{
				if(xmlHttp.readyState==4)
				  {
					document.getElementById("sanphamhome").innerHTML=xmlHttp.responseText;
				   }
			}
			
			function change_bg_image2(idmanu){
		
				hover_Image = "url(images/hover_bg_sp_left.png)";
				document.getElementById('tab_sp_left2').style.backgroundImage = hover_Image;
				document.getElementById('tab_sp_left1').style.backgroundImage = not_hover_Image;
				document.getElementById('tab_sp_left3').style.backgroundImage = not_hover_Image;
				document.getElementById('tab_sp_left4').style.backgroundImage = not_hover_Image;
				xmlHttp = GetXmlHttpObject();
					if(xmlHttp==null) 
					{    
						alert("Trinh duyet k ho tro");
						return;
					}
					else
					{
						xmlHttp.onreadystatechange = loaddatamenungang;
						xmlHttp.open('GET','content/sanpham/sanphamtheodanhmuc.php?idtab=' + idmanu,true);
						xmlHttp.send(null);
					}
			}
			function change_bg_image3(idmanu){
				hover_Image = "url(images/hover_bg_sp_left.png)";
				document.getElementById('tab_sp_left3').style.backgroundImage = hover_Image;
				document.getElementById('tab_sp_left1').style.backgroundImage = not_hover_Image;
				document.getElementById('tab_sp_left2').style.backgroundImage = not_hover_Image;
				document.getElementById('tab_sp_left4').style.backgroundImage = not_hover_Image;
				xmlHttp = GetXmlHttpObject();
					if(xmlHttp==null) 
					{    
						alert("Trinh duyet k ho tro");
						return;
					}
					else
					{
						xmlHttp.onreadystatechange = loaddatamenungang;
						xmlHttp.open('GET','content/sanpham/sanphamtheodanhmuc.php?idtab=' + idmanu,true);
						xmlHttp.send(null);
					}
			}
			function change_bg_image4(idmanu){
				hover_Image = "url(images/hover_bg_sp_left.png)";
				document.getElementById('tab_sp_left4').style.backgroundImage = hover_Image;
				document.getElementById('tab_sp_left1').style.backgroundImage = not_hover_Image;
				document.getElementById('tab_sp_left2').style.backgroundImage = not_hover_Image;
				document.getElementById('tab_sp_left3').style.backgroundImage = not_hover_Image;
				xmlHttp = GetXmlHttpObject();
					if(xmlHttp==null) 
					{    
						alert("Trinh duyet k ho tro");
						return;
					}
					else
					{
						xmlHttp.onreadystatechange = loaddatamenungang;
						xmlHttp.open('GET','content/sanpham/sanphamtheodanhmuc.php?idtab=' + idmanu,true);
						xmlHttp.send(null);
					}
			}
//end menu ngang
