﻿function expandcollapseDiv(postid) 
{
	whichpost = document.getElementById(postid);
	if (whichpost.style.display=="none") 
	{
		whichpost.style.display="block";
	}
	else 
	{
		whichpost.style.display="none";
	}
	//Đổi tiếp style cho nút
	whichpic = document.getElementById('img'+postid);
	path = whichpic.src;
	filename = path.substring(path.length - 9,path.length);
	filepath = path.substring(0,path.length - 9);
	//alert(filepath);
	if (filename == 'plusi.gif')
	{
		filename = 'minus.gif';
	}
	else
	{
		filename = 'plusi.gif';
	}
	whichpic.src = filepath + filename;	
} 
function expandcollapseTD(postid) 
{
	re = new RegExp(postid + '$')  //generated control name starts with a colon
    for(i = 0; i < document.all.length; i++) 
    {        
        if (re.test(document.all[i].name)) 
        {
			whichpost = document.all[i];
			if (whichpost.style.display=="none") 
			{
				whichpost.style.display="block";
			}
			else 
			{
				whichpost.style.display="none";
			}          
        }
    }

	//Đổi tiếp style cho nút
	whichpic = document.getElementById('img'+postid);
	path = whichpic.src;
	filename = path.substring(path.length - 9,path.length);
	filepath = path.substring(0,path.length - 9);
	//alert(filepath);
	if (filename == 'plusi.gif')
	{
		filename = 'minus.gif';
	}
	else
	{
		filename = 'plusi.gif';
	}
	whichpic.src = filepath + filename;	
} 
//Đoạn dưới là của menu
var menu_status;
//Đoạn dành cho menu panel
function collapseAll(selObj)
{
	//alert(menu_status.length);
	//alert(document.forms[j].name);
	for(var i = 0; i < document.all.length; i++) 
	{
		//elm = document.all[i];
		//if(elm.id)//=="radio")
		//{
			//alert(elm.id);
			if(document.all[i].id.indexOf(selObj)>-1 && document.all[i].className != 'hide'){
				document.all[i].className = 'hide';
				var theid = document.all[i].id.substring(9,document.all[i].id.length);				
				//Đổi tiếp style cho nút
				whichpic = document.getElementById('img'+theid);
				path = whichpic.src;
				filename = path.substring(path.length - 9,path.length);
				filepath = path.substring(0,path.length - 9);
				//alert(filepath);
				filename = '_down.gif';
				whichpic.src = filepath + filename;	    
				break;
			}
		//}
	}
}
function showSpan(theid){
    if (document.getElementById) {
		var switch_id = document.getElementById(theid);
        switch_id.className = 'show';
    }
}
function hideSpan(theid){
    if (document.getElementById) {
		var switch_id = document.getElementById(theid);
        switch_id.className = 'hide';
    }
}
function showHideMenuABC(theid){
    if (document.getElementById) {
		var switch_id = document.getElementById('divColExp'+theid);
		var cur = switch_id.className;

		collapseAll('divColExp');
        if(cur != 'show') {
           switch_id.className = 'show';
          // menu_status[theid] = 'show';
        }else{
           switch_id.className = 'hide';
          // menu_status[theid] = 'hide';
        }
    }
	//Đổi tiếp style cho nút
	whichpic = document.getElementById('img'+theid);
	path = whichpic.src;
	filename = path.substring(path.length - 9,path.length);
	filepath = path.substring(0,path.length - 9);
	//alert(filepath);
	if (switch_id.className != 'show')
	{
		filename = '_down.gif';
	}
	else
	{
		filename = '___up.gif';
	}
	whichpic.src = filepath + filename;	    
}
function showMenu(theid)
{
	if (document.getElementById){
		var switch_id = document.getElementById(theid);
		
		switch_id.className = 'show';
		menu_status[theid] = 'show';
	}
}
function hideMenu(theid)
{
	//alert('abc');
	if (document.getElementById){
		var switch_id = document.getElementById(theid);
		
		switch_id.className = 'hide';
		menu_status[theid] = 'hide';		
	}
}
//Hết đoạn dành cho panel
