function SetCookie(pv_c_name,pv_c_value,pv_c_expiredays)
{
        var expiredate= new Date();
        expiredate.setDate(expiredate.getDate()+pv_c_expiredays);
        document.cookie=pv_c_name+"="+escape(pv_c_value)+";expires="+expiredate.toGMTString();
}
function getCookie(c_name)
{
        if (document.cookie.length>0)
        {
        c_start=document.cookie.indexOf(c_name + "=");
        if (c_start!=-1)
        {
        c_start=c_start + c_name.length+1;
        c_end=document.cookie.indexOf(";",c_start);
        if (c_end==-1) c_end=document.cookie.length;
        return unescape(document.cookie.substring(c_start,c_end));
        }
        }
        return "";
}
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)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
document.write('<input type="hidden" value="1" id="InputIndexArticleCat">');
document.write('<input type="hidden" value="21" id="InputIndexArticleCat2">');
function GetArticleCat(s,page)
{
        var xmlHttp=GetXmlHttpObject();
        if(!page) page=0;
        if(document.getElementById("DivArticleInCat1"))
        xmlHttp.onreadystatechange=function()
        {
                if(xmlHttp.readyState==1)
                {
                        document.getElementById("DivArticleInCat1").innerHTML='<div style="padding:75px 0px 0px 150px;color:#008000;font-size:20px"> Đang tải dữ liệu <img src="http://phanvien.com/templates/phanvien/images/waiting.gif"></div>';
                }
                else if (xmlHttp.readyState==4)
                {
                        document.getElementById("DivArticleInCat1").innerHTML=xmlHttp.responseText;
                        document.getElementById("TdCat"+document.getElementById("InputIndexArticleCat").value).className="TdSwitchNormal";
                        document.getElementById("TdCat"+s).className="TdSwitchCurrent";
                        document.getElementById("InputIndexArticleCat").value=s;
                        SetCookie("IndexTdCatID",s,365);
                }
        }
        xmlHttp.open("GET","/ajax_article_cat_"+s+"-"+page+".htm");
        xmlHttp.send(null);
}
var t=document.getElementsByTagName("body");
t=function()
{
var CookieValue=getCookie("IndexTdCatID");
if(document.getElementById("TdCat"+CookieValue)) GetArticleCat(CookieValue);
else GetArticleCat(1);
}
function InitDiv(src)
{
        src.className="DivArticleCatIndex2";

}
function InitDiv2(src)
{
        src.className="DivArticleCatIndex1";
        document.getElementById("DivMenuIndex"+document.getElementById("InputIndexArticleCat2").value).className="DivArticleCatIndex2";
}
function SwitchArticleType2(s,page)
{
        var xmlHttp=GetXmlHttpObject();
        if(!page) page=0;
        if(document.getElementById("DivContentCat2"))
        xmlHttp.onreadystatechange=function()
        {
                if(xmlHttp.readyState==1)
                {
                        document.getElementById("DivContentCat2").innerHTML='<div style="padding:75px 0px 0px 150px;color:#008000;font-size:20px"> Đang tải dữ liệu <img src="http://phanvien.com/templates/phanvien/images/waiting.gif"></div>';
                }
                else if (xmlHttp.readyState==4)
                {
                        document.getElementById("DivContentCat2").innerHTML=xmlHttp.responseText;
                        document.getElementById("DivMenuIndex"+document.getElementById("InputIndexArticleCat2").value).className="DivArticleCatIndex1";
                        document.getElementById("DivMenuIndex"+s).className="DivArticleCatIndex2";
                        document.getElementById("InputIndexArticleCat2").value=s;
                        SetCookie("IndexTdCatID2",s,365);
                }
        }
        xmlHttp.open("GET","/ajax_article_cat2_"+s+"-"+page+".htm");
        xmlHttp.send(null);
}
//Load Cat 2
var CookieValueZZZ=getCookie("IndexTdCatID2");
if(document.getElementById("DivMenuIndex"+CookieValueZZZ)) SwitchArticleType2(CookieValueZZZ);
else SwitchArticleType2(21);
//Load Cat 2
t();