﻿// JScript File
function popup (name,width,height) { 
     var options = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=0,width="+width+",height="+height; 
     Cal2=window.open(name,"popup",options); 
}

function popup2 (name,width,height) { 
     var options = "toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1, width="+width+",height="+height; 
     Cal2=window.open(name,"popup",options); 
}

function _showGroup(id, c_show, c_hide)
{
	_showElement(id)
	_showElement(c_hide)
	_hideElement(c_show)
}

function _hideGroup(id, c_show, c_hide)
{
	_hideElement(id)
	_hideElement(c_hide)
	_showElement(c_show)
}

function _showElement(id)
{
	var element = document.getElementById(id);
	if(!element) return;
	var style = element.style;
	if(!style) return;
	style.display = "";
}

function _hideElement(id)
{
	var element = document.getElementById(id);
	if(!element) return;
	var style = element.style;
	if(!style) return;
	style.display = "none";
}

function move(nameCtrl)
{
	var ctrl = document.getElementById(nameCtrl);

	if(ctrl)
	{
		var st_top = ctrl.style.top;
		st_top = st_top.replace('px', '');
		var top = eval(st_top);
		var scroll = document.body.scrollTop;
		var delta_up = ctrl.height;
		var delta_down=screen.height-delta_up;

		if(top < scroll + 100)
		{
			if(scroll - top > 500) top = scroll - 500;
			top += 10;
		}
		if(top > scroll + 100)
		{
			if(top - scroll > 800) top = scroll + 800;
			top -= 10;
		}
		ctrl.style.top = top;
	}
}

function reset_post(nameCtrl, panel)
{
	var ctrl = document.getElementById(nameCtrl);
	if(ctrl) 
	{
		if(screen.width >= 1024) {
			if(panel == 6)
				ctrl.style.left = screen.width-140;
			else ctrl.style.left = 0;
			ctrl.style.display = '';
		}
		else {
			ctrl.style.display = 'none';
			ctrl.style.left = -200;
		}
	}
}

function to_delete_url(url)
{
    if(confirm('Ban co muon xoa khong?'))
        window.location.href=url;
}

function _showHide(id)
{
	var element = document.getElementById(id);
	var style = element.style;
	if(style.display == "none")
	    style.display = "";
    else
	    style.display = "none";
}
