﻿ //JS IN Menu top 
 
var onload=true;
//Set delay before submenu disappears after mouse moves out of it (in milliseconds)
var delay_hide=500

/////No need to edit beyond here

var menuobj=document.getElementById("ChildMenuTop"); 
if(VisitedChannel=='undefined') var VisitedChannel=-1;
if (VisitedChildChannel=='undefined') var VisitedChildChannel=-1;

if(onload)
{
   startShowit()
   buildsubmenus();
   onload = false;
}


function showit(which)
{

    clear_delayhide()
    var thecontent="";
    thecontent=(which==-1)? "" : submenu[which]
    if (document.getElementById||document.all)
    menuobj.innerHTML=thecontent
    else if (document.layers)
    {
        menuobj.document.write(thecontent)
        menuobj.document.close()
    }
}
function startShowit()
{
    
    if(VisitedChannel!=null)
    {
        showit(VisitedChannel);
        var nav=document.getElementById("Channel_"+VisitedChannel);
        if(nav!=null)
        {
           nav.className="parentmenuItemHover";
           if(VisitedChildChannel!=VisitedChannel)
           {
               var nalChild=document.getElementById("Channel_"+VisitedChildChannel);
               if(nalChild!=null)
               {
                   nalChild.className="childmenuItemhover";
               }
           }          
         
         }
    }
}

function resetit(e)
{
    if (document.all&&!menuobj.contains(e.toElement))
    delayhide=setTimeout("DefaultDisplay()",delay_hide)
    else if (document.getElementById&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
    delayhide=setTimeout("DefaultDisplay()",delay_hide)
}
function DefaultDisplay()
{
    if(VisitedChannel!=null)
    {
        showit(VisitedChannel);
        var nav=document.getElementById("Channel_"+VisitedChannel);
        if(nav!=null)
        {
            var parentmenu=document.getElementById("parentmenu");
            if (!parentmenu) 
            return false;
            
            var navListItems = parentmenu.getElementsByTagName("li");				           
            for ( var j = 0; j < navListItems.length; j++) 
            {		               
                var nodeOther = navListItems[j];
                if ((nodeOther.nodeName == "LI"))
                {    
                   nodeOther.className = "parentmenuItem"; 
                   
                }            
            } 
            
           nav.className="parentmenuItemHover";
           if(VisitedChannel!=VisitedChildChannel)
           {
               var nalChild=document.getElementById("Channel_"+VisitedChildChannel);
               if(nalChild!=null)
               {
                   nalChild.className="childmenuItemhover";
               }
           }
        }
    }
    else
    {
        showit(-1)
    }
    
}

function clear_delayhide()
{
    if (window.delayhide)
    clearTimeout(delayhide)
}

function contains_ns6(a, b) 
{
	if(b==null) return false;
    while (b.parentNode)
    if ((b = b.parentNode) == a)
    return true;
    return false;
}
function Mouseover(obj)
{
    var parentmenu=document.getElementById("parentmenu");
    if (!parentmenu) 
    return false;
    
    var navListItems = parentmenu.getElementsByTagName("li");				           
    for ( var j = 0; j < navListItems.length; j++) 
    {		               
        var nodeOther = navListItems[j];
        if ((nodeOther.nodeName == "LI"))
        {    
           nodeOther.className = "parentmenuItem"; 
           
        }            
    } 
    obj.className="parentmenuItemHover";  
}
function ChildMenuMousever(obj)
{
     var parentmenu=document.getElementById("ChildMenuTop");
    if (!parentmenu) 
    return false;
    
    var navListItems = parentmenu.getElementsByTagName("li");				           
    for ( var j = 0; j < navListItems.length; j++) 
    {		               
        var nodeOther = navListItems[j];
        if ((nodeOther.nodeName == "LI"))
        {    
           nodeOther.className = "childmenuItem"; 
           
        }            
    } 
    obj.className="childmenuItemhover";
    
}


 
 
// JScript File
function SearchBoxLostFocus()
{	
	if (txtKeyword.value=='')
	{
		txtKeyword.value='Tìm kiếm';
		txtKeyword.className='searchBoxLostFocus';
	}
}
function SearchBoxFocus()
{
	if (txtKeyword.value=='Tìm kiếm')
	{
		txtKeyword.value='';
		txtKeyword.className='searchBox';
	}
}
function DoSearch()
{
	var pathNames = window.location.pathname.split("/");	
	window.location.href = window.location.protocol + "//" + window.location.host + "/" + pathNames[1] + "/Search.aspx?keyword="+txtKeyword.value;
}
function SearchPress(e)
{
	e = e ||window.event;
	if(e.keyCode==13)
	{
		DoSearch();
		return false;		
	}
};

OnKeydown=function( e)
{
	e = e ||window.event
	if(e.keyCode==13)
	{
		document.getElementById("BthSearch").onclick();	
		return false;
	}
}

SearchOnClick = function()
{
	 var keyword=document.getElementById("txtKeyword");
	 var fromDate = document.getElementById("txtFromDate");
	 var toDate = document.getElementById("txtToDate");
	 
	 var channel=document.getElementById(cboChannel);
	 var url=href
	 if(keyword!=null &&channel!=null)
	 {
		url=url+"keyword="+keyword.value +"&pageIndex="+pageIndex + "&fromDate="+fromDate.value+"&toDate="+toDate.value;
	 }
	 var channelID = channel.value;
	 
	url =url+"&ChannelID="+channelID;
	document.location.href=url;
}

function displayInfo(info)
{	
    if (info == 'weather')
	    showDialog('http://ictnews.vn/Transweb/ThoiTiet.htm',769,600);
    if (info == 'forex')
	    showDialog('http://ictnews.vn/Transweb/Tiente.htm',550,490);
    if (info == 'gold')
	    showDialog('http://ictnews.vn/Transweb/giavang.htm',300,450);
    if (info == 'tvguide')
	    showWindow('http://ictnews.vn/Transweb/TruyenHinh.aspx', false, false, true, false, false, false, true, true, 450, 650, 0, 0);
    if (info == 'stock')
	    showDialog('http://ictnews.vn/Transweb/chungkhoan.htm',870,680);
	    if (info == 'fontguide')
	    showDialog('/font/vietuni.html', 540, 650);
    if (info == 'lottery')
	    showWindow('http://ictnews.vn/Transweb/XoSo.html', false, false, true, false, false, false, true, true, 740, 600, 0, 0);
}
function displayConditions()
{
    var pathNames = window.location.pathname.split("/");
    showDialog(window.location.protocol + "//" + window.location.host + "/" + pathNames[1]+'/Quidinhcomment.html',540,460);
}
function showDialog(url, width, height)
{
    return showWindow(url, false, false, false, false, false, false, true, true, width, height, 0, 0);
}
function showDialog(url, width, height,isScrollbars)
{
    return showWindow(url, false, false, isScrollbars, false, false, isScrollbars, true, true, width, height, 0, 0);
}

function showWindow(url, isStatus, isResizeable, isScrollbars, isToolbar, isLocation, isFullscreen, isTitlebar, isCentered, width, height, top, left)
{
    if (isCentered)
    {
	    top = (screen.height - height) / 2;
	    left = (screen.width - width) / 2;
    }

    open(url, '_blank', 'status=' + (isStatus ? 'yes' : 'no') + ','
    + 'resizable=' + (isResizeable ? 'yes' : 'no') + ','
    + 'scrollbars=' + (isScrollbars ? 'yes' : 'no') + ','
    + 'toolbar=' + (isToolbar ? 'yes' : 'no') + ','
    + 'location=' + (isLocation ? 'yes' : 'no') + ','
    + 'fullscreen=' + (isFullscreen ? 'yes' : 'no') + ','
    + 'titlebar=' + (isTitlebar ? 'yes' : 'no') + ','
    + 'height=' + height + ',' + 'width=' + width + ','
    + 'top=' + top + ',' + 'left=' + left);
}
var showDetailAuthor = false;
function AuthorInfoDetail()
{
    var obj = document.getElementById("DetailAuthor");
    if (obj != null)
    {
        if(showDetailAuthor)
        {
            obj.style.display = "none";
        }
        else
        {
            obj.style.display = "block";
        }
        showDetailAuthor = !showDetailAuthor;
    }
}

// js of date in menutop.ascx

window.onload
{
    setTimeout("startclock()",100);
}

function startclock()
{
    var thetime=new Date();

    var nday=thetime.getDay();
    var nmonth=thetime.getMonth();
    var ntoday=thetime.getDate();
    var nyear=thetime.getYear();

    if (nday==0)
      nday="Chủ nhật";
    if (nday==1)
      nday="Thứ 2";
    if (nday==2)
      nday="Thứ 3";
    if (nday==3)
      nday="Thứ 4";
    if (nday==4)
      nday="Thứ 5";
    if (nday==5)
      nday="Thứ 6";
    if (nday==6)
      nday="Thứ 7";

    nmonth+=1;

    if (nyear<=99)
      nyear= "19"+nyear;

    if ((nyear>99) && (nyear<2000))
     nyear+=1900;
        
    var nodeOther = document.getElementById("ClockdateNow");;
    if(nodeOther == null) return;
    nodeOther.innerHTML=" "+nday+" ngày "+ntoday+ " tháng  "+nmonth+" năm "+nyear;       
}

function varitext(text)
{
    text=document
    print(text)
}
 

// this LRU Cache  Test
var CachePriority = {
    Low: 1,
    Normal: 2,
    High: 4
}
Cache = function(maxSize)
{
    this.Initialize.apply(this,arguments);
}
Cache.prototype = 
{
    Initialize : function(maxSize)
    {
         this.items = {};
        this.count = 0;
        if (maxSize == null)
            maxSize = 100;
        this.maxSize = maxSize;
        this.fillFactor = .75;
        this.purgeSize = Math.round(this.maxSize * this.fillFactor);
        
        this.stats = {}
        this.stats.hits = 0;
        this.stats.misses = 0;
    },
    GetItem:function(key)
    {
         // retrieve the item from the cache
        var item = this.items[key];
        
        if (item != null) {
            if (!this._isExpired(item)) {
                // if the item is not expired
                // update its last accessed date
                item.lastAccessed = new Date().getTime();
            } else {
                // if the item is expired, remove it from the cache
                this._removeItem(key);
                item = null;
            }
        }
        
        // return the item value (if it exists), or null
        var returnVal = null;
        if (item != null) {
            returnVal = item.value;
            this.stats.hits++;
        } else {
            this.stats.misses++;
        }
        return returnVal;
    }
    

    ,SetItem:function(key, value, options)
    {
        function CacheItem(k, v, o) 
        {
            if ((k == null) || (k == ''))
                throw new Error("key cannot be null or empty");
            this.key = k;
            this.value = v;
            if (o == null)
                o = {};
            if (o.expirationAbsolute != null)
                o.expirationAbsolute = o.expirationAbsolute.getTime();
            if (o.priority == null)
                o.priority = CachePriority.Normal;
            this.options = o;
            this.lastAccessed = new Date().getTime();
        }

        // add a new cache item to the cache
        if (this.items[key] != null)
            this._removeItem(key);
        this._addItem(new CacheItem(key, value, options));
        
        // if the cache is full, purge it
        if ((this.maxSize > 0) && (this.count > this.maxSize)) {
            this._purge();
        }
    }
    ,_addItem:function(item)
    {
        this.items[item.key] = item;
        this.count++;
    }
    ,_removeItem:function(key)
    {
         var item = this.items[key];
        delete this.items[key];
        this.count--;
        
        // if there is a callback function, call it at the end of execution
        if (item.options.callback != null) {
            var callback = function() {
                item.options.callback(item.key, item.value);
            }
            setTimeout(callback, 0);
        }
    }
    ,_isExpired:function(item)
    {
         var now = new Date().getTime();
        var expired = false;
        if ((item.options.expirationAbsolute) && (item.options.expirationAbsolute < now)) {
            // if the absolute expiration has passed, expire the item
            expired = true;
        } 
        if ((expired == false) && (item.options.expirationSliding)) {
            // if the sliding expiration has passed, expire the item
            var lastAccess = item.lastAccessed + (item.options.expirationSliding * 1000);
            if (lastAccess < now) {
                expired = true;
            }
        }
        return expired;
    }
    ,_purge:function()
    {
        var tmparray = new Array();
    
        // loop through the cache, expire items that should be expired
        // otherwise, add the item to an array
        for (var key in this.items) {
            var item = this.items[key];
            if (this._isExpired(item)) {
                this._removeItem(key);
            } else {
                tmparray.push(item);
            }
        }
        
        if (tmparray.length > this.purgeSize) {

            // sort this array based on cache priority and the last accessed date
            tmparray = tmparray.sort(function(a, b) { 
                if (a.options.priority != b.options.priority) {
                    return b.options.priority - a.options.priority;
                } else {
                    return b.lastAccessed - a.lastAccessed;
                }
            });
            
            // remove items from the end of the array
            while (tmparray.length > this.purgeSize) {
                var ritem = tmparray.pop();
                this._removeItem(ritem.key);
            }
        }
    }
    ,clear:function()
    {
        // loop through each item in the cache and remove it
        for (var key in this.items) {
          this._removeItem(key);
        }  
    }
    
}
cache = new Cache();


// this code js of CommentLoader module use load commentInfo of Article 

CommentLoader = function()
{
    this.Initialize.apply(this,arguments);
}

CommentLoader.prototype = 
{
    Initialize : function()
    {
        this.ApplicationPath = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname.split("/")[1]; 
        this.HandlerDataUrl = this.ApplicationPath+ "/CommentLoader.aspx"; 	
        this.DivCommentList =document.getElementById("DivCommentList");
        this.DivPaging = document.getElementById("MyPaging");
        this.HandlerPagingUrl = this.ApplicationPath+"/PagingLoader.aspx";
        this.currentIndex = 0;
        this.ArticleID = -1;
       
    },
    DataLoading : function( articleID,pageIndex )
	{
	    var options = 
		{
			parameters:{action:"get",ArticleID:articleID,PageIndex:pageIndex},
			onSuccess : this.DataLoadSuccess,
			onFailure :this.DataLoadFailure
		};
		
		new MX.XHR(options).send(this.HandlerDataUrl); 
		
	},
	DataLoadSuccess : function(r)
    {
        commentLoader.RenderData(r.text,false);
    },
    DataLoadFailure : function()
    {
      return;   
    },
    RenderData:function(text,cached)
    {
        if(!cached)
        {
            var cacheKey = "CacheDataArticle_"+this.ArticleID+"PageIndex"+ this.currentIndex
            cache.SetItem(cacheKey,text);
        }
        this.DivCommentList.innerHTML="";
        this.DivCommentList.innerHTML=text;
    }
    
    ,PagingLoading : function( articleID,pageIndex )
	{
	    var options = 
		{
			parameters:{action:"get",ArticleID:articleID,PageIndex:pageIndex},
			onSuccess : this.PagingLoadSuccess,
			onFailure :this.PagingLoadFailure
		};
		
		new MX.XHR(options).send(this.HandlerPagingUrl); 
		
	},
	PagingLoadSuccess : function(r)
    {
        commentLoader.RenderPaging(r.text,false);
    },
    PagingLoadFailure : function()
    {
      return;    
    }
    ,RenderPaging:function(text,cached)
    {
        if(!cached)
        {
            var cacheKey = "CachePagingArticle_"+this.ArticleID+"PageIndex"+ this.currentIndex
            cache.SetItem(cacheKey,text);
        }

         this.DivPaging.innerHTML=""; 
         this.DivPaging.innerHTML=text; 
    }
    ,Loader:function( articleID,pageIndex)
    {
        if(pageIndex ==  this.currentIndex) return;
	    this.currentIndex = pageIndex;
	    this.ArticleID = articleID;
        var cacheDataKey = "CacheDataArticle_"+this.ArticleID+"PageIndex"+ this.currentIndex
        var dataText = cache.GetItem(cacheDataKey);
        if(dataText!=null)
        {
           this.RenderData(dataText,true); 
        }
        else
        {
            this.DataLoading(articleID,pageIndex);
        }
        var cachePaghingKey = "CachePagingArticle_"+this.ArticleID+"PageIndex"+ this.currentIndex
        var pagingText = cache.GetItem(cachePaghingKey);
        if(pagingText!=null)
        {
            this.RenderPaging(pagingText,true);
        }
        else
        {
            this.PagingLoading(articleID,pageIndex);
        }
    }
}
commentLoader = new CommentLoader(); 

/***********************************************
* Vega code library
***********************************************/

var offsetxpoint=30 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function Showtip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function Hidetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}

document.onmousemove=positiontip;


//begin is of mostlist 
function vcmsMostPopularTabs( intWhich ) {
	for(i=1;i<3;i++) {
		if(i==intWhich)
		 {
			if(document.getElementById('vcmsMostPopularTabs' + i) !=null)    document.getElementById('vcmsMostPopularTabs' + i).style.display = 'block';
			
			if (intWhich == 1)
			 {
				if(document.getElementById('vcmsMostPopularTabs' + i) !=null)  document.getElementById('vcmsMostPopularTab' + i).className = 'vcmsMostPopularTabFirstOn';
			}
			else {
				if(document.getElementById('vcmsMostPopularTabs' + i) !=null)  document.getElementById('vcmsMostPopularTab' + i).className = 'vcmsMostPopularTabOn';
			}
		}
		else 
		{
			if(document.getElementById('vcmsMostPopularTabs' + i) !=null)  document.getElementById('vcmsMostPopularTabs' + i).style.display = 'none';
			if(document.getElementById('vcmsMostPopularTabs' + i) !=null)  document.getElementById('vcmsMostPopularTab' + i).className = '';
			if (intWhich != 1) {
				if(document.getElementById('vcmsMostPopularTabs' + i) !=null)  document.getElementById('vcmsMostPopularTab' + 1).className = 'vcmsMostPopularTabFirst';
			}

		}
	}         
}
function vcmsMpStories( intWhich ) {
	for(i=1;i<3;i++) 
	{
		if(i==intWhich) 
		{
	        if(document.getElementById('vcmsMpStories' + i) !=null)     document.getElementById('vcmsMpStories' + i).style.display = 'block';
			if(document.getElementById('vcmsMpStoriesTab' + i)!=null) document.getElementById('vcmsMpStoriesTab' + i).className = 'active';
		
		}
		else 
		{
			if(document.getElementById('vcmsMpStories' + i) !=null)  document.getElementById('vcmsMpStories' + i).style.display = 'none';
			if(document.getElementById('vcmsMpStoriesTab' + i)!=null) document.getElementById('vcmsMpStoriesTab' + i).className = '';
		}
	}
}

if(typeof(viewDefauleid)!='undefined')
{
    vcmsMostPopularTabs(viewDefauleid)
}
function SwitchTopicCloud(id1,id2,id3,id4) 
{
    if(document.getElementById(id2)!=null)	document.getElementById(id2).style.display = 'none';
	if(document.getElementById(id1)!=null)  document.getElementById(id1).style.display = 'block';
	
	if(document.getElementById(id4)!=null)	document.getElementById(id4).style.display = 'none';
	if(document.getElementById(id3)!=null)  document.getElementById(id3).style.display = 'block';


}

//// this code js of CommentLoader module use load commentInfo of Article 

CommentLoader = function()
{
    this.Initialize.apply(this,arguments);
}

CommentLoader.prototype = 
{
    Initialize : function()
    {
        this.ApplicationPath = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname.split("/")[1]; 
        this.HandlerDataUrl = this.ApplicationPath+ "/CommentLoader.aspx"; 	
        this.DivCommentList = document.getElementById("DivCommentList");
        this.DivPaging = document.getElementById("MyPaging");
        this.HandlerPagingUrl = this.ApplicationPath+"/PagingLoader.aspx";
        this.currentIndex = 0;
        this.ArticleID = -1;
        this.imagWaiting = document.getElementById("DivCommenImageLoading");
    },              
    DataLoading : function( articleID,pageIndex )
	{
	    this.imagWaiting.style.display = "block";
	    this.DivCommentList.style.visibility = "hidden";
	    var options = 
		{
			parameters:{action:"get",ArticleID:articleID,PageIndex:pageIndex},
			onSuccess : MX.Delegate(this,this.DataLoadSuccess),
			onFailure :MX.Delegate(this,this.DataLoadFailure)
		};                                         
		window.setTimeout(MX.Delegate(this,this.callServer,options,this.HandlerDataUrl),1000);		
	},
	callServer : function(options,Handler)
	{
	    new MX.XHR(options).send(Handler); 
	},
	DataLoadSuccess : function(r)
    {
        this.DivCommentList.style.visibility = "visible";
        this.RenderData(r.text,false);
    },
    DataLoadFailure : function()
    {   
        this.DivCommentList.style.visibility = "visible";
        return;   
    },
    RenderData:function(text,cached)
    {
        if(!cached)
        {
            var cacheKey = "CacheDataArticle_"+this.ArticleID+"PageIndex"+ this.currentIndex
            cache.SetItem(cacheKey,text);
        }
        this.imagWaiting.style.display = "none";        
        this.DivCommentList.innerHTML=text;
    }
    
    ,PagingLoading : function( articleID,pageIndex )
	{
	    var options = 
		{
			parameters:{action:"get",ArticleID:articleID,PageIndex:pageIndex},
			onSuccess : MX.Delegate(this,this.PagingLoadSuccess), 
			onFailure :MX.Delegate(this,this.PagingLoadFailure)
		};
		
		window.setTimeout(MX.Delegate(this,this.callServer,options,this.HandlerPagingUrl),1000);		
		
	},
	PagingLoadSuccess : function(r)
    {
        this.RenderPaging(r.text,false);
    },
    PagingLoadFailure : function()
    {
      return;    
    }
    ,RenderPaging:function(text,cached)
    {
        if(!cached)
        {
            var cacheKey = "CachePagingArticle_"+this.ArticleID+"PageIndex"+ this.currentIndex
            cache.SetItem(cacheKey,text);
        }

         this.DivPaging.innerHTML=""; 
         this.DivPaging.innerHTML=text; 
    }
    ,Loader:function( articleID,pageIndex)
    {
        if(pageIndex ==  this.currentIndex) return;
	    this.currentIndex = pageIndex;
	    this.ArticleID = articleID;
        var cacheDataKey = "CacheDataArticle_"+this.ArticleID+"PageIndex"+ this.currentIndex
        var dataText = cache.GetItem(cacheDataKey);
        if(dataText!=null)
        {
           this.RenderData(dataText,true); 
        }
        else
        {
            this.DataLoading(articleID,pageIndex);
        }
        var cachePaghingKey = "CachePagingArticle_"+this.ArticleID+"PageIndex"+ this.currentIndex
        var pagingText = cache.GetItem(cachePaghingKey);
        if(pagingText!=null)
        {
            this.RenderPaging(pagingText,true);
        }
        else
        {
            this.PagingLoading(articleID,pageIndex);
        }
    }
}
commentLoader = new CommentLoader(); 
function showImage(url)
{
	var pathNames = window.location.pathname.split("/");	
	showDialog(window.location.protocol + "//" + window.location.host + "/" + pathNames[1] +"/ImageView.htm?" + url.substr(url.indexOf('?') + 1), 524, 524);
}

function check_strlen(object1, id2, strlen){
	object2	= document.getElementById(id2);
	if(object1!=null &&object2!=null)
	{
	    if(object1.value.length > strlen){
		    object2.innerHTML = 0;
		    alert("Bạn đã nhập đủ " + strlen + " ký tự.");
		    object1.value = object1.value.substr(0,strlen);
		    return false;
	    }
	    object2.innerHTML = parseInt(strlen - object1.value.length);
	}
}

//js for menu left

function buildsubmenus()
{
       
    if(document.getElementById("Ask-CategoryMenu")!=null)
    {
        var ultags=document.getElementById("Ask-CategoryMenu").getElementsByTagName("ul")
        if(ultags !=null)
        {     
            for (var t=0; t<ultags.length; t++)
            {
                if(ultags[t].parentNode.getElementsByTagName("a").length >1)
                {  
                    ultags[t].parentNode.getElementsByTagName("a")[0].innerHTML = ultags[t].parentNode.getElementsByTagName("a")[0].innerHTML +'<img src="'+window.location.protocol + "//" + window.location.host + "/" +window.location.pathname.split("/")[1]+ '/images/Ask/arrow-right.gif" class="rightarrowclass" style="border:0;" />';
	                    if (ultags[t].parentNode.parentNode.id=="Ask-CategoryMenu") //if this is a first level submenu
		                    ultags[t].style.left=ultags[t].parentNode.offsetWidth+"px" //dynamically position first level submenus to be width of main menu item
	                    else //else if this is a sub level submenu (ul)
	                      ultags[t].style.left=ultags[t-1].getElementsByTagName("a")[0].offsetWidth+"px" //position menu to the right of menu item that activated it
                    ultags[t].parentNode.onmouseover=function()
                    {
                        this.getElementsByTagName("ul")[0].style.display="block"
                    }
                    ultags[t].parentNode.onmouseout=function()
                    {
                        this.getElementsByTagName("ul")[0].style.display="none"
                    }
                }
            }
            for (var t=ultags.length-1; t>-1; t--)
            { //loop through all sub menus again, and use "display:none" to hide menus (to prevent possible page scrollbars
                ultags[t].style.visibility="visible"
                ultags[t].style.display="none"
            }
        }
    }

}

if (window.addEventListener)
    window.addEventListener("load", buildsubmenus, false)
else if (window.attachEvent)
    window.attachEvent("onload", buildsubmenus)
// end js of mostlist
