// JavaScript Document

// global variables content id of box 
var menu_name       = new Array('changeLinkConf', 'changeTabName', 'sign_up', 'changePassword', 'renewPassword');

function showMenu(id)
{
	// tim kiem trong danh sach xem id co la khong ?!
	var r = false;
	for(var i = 0; i < menu_name.length; i++)
	{
	    if(id == menu_name[i]) r = true;
	}
	
	// khong hop le
	if(!r) return false;
	
	try {
	    // client height and width
	    var width   = parseInt(document.documentElement.clientWidth);
	    var obj     = document.getElementById(id);
	    var boxW    = 320;
	    
	    
	    // can chinh cho ngay chinh giua
	    var top     = 300;
	    var left    = width/2 - boxW/2;
	    
	    obj.style.top   = top + parseInt(document.documentElement.scrollTop) + 'px';
	    obj.style.left  = left + 'px';
	    
	    // show off cac box khac
	    for(var j = 0; j < menu_name.length; j++)
	    {
            try {	            
	            var elem    = document.getElementById(menu_name[j]);
	            
	            elem.style.display  = 'none';
	        
	        } catch(e) { break; }
	    }
	    
	    
	    // show code anti-spam
	   if (id == 'sign_up')
		{
			///////////////////////////////////////////
			document.getElementById('antispam_code').innerHTML	= '<img src="modules/antispam.code.php?tmp=' + Math.random() + '" />';
			////////////////////////////////////////////
			
		}

		
		// show div
	    obj.style.display   = 'block';
	    
	    return true;
	    
    } catch(e) { return false; }
	
	
}


function showLISTURL(id)
{
	window.open('showLIST.php?id=' + id,"SHOW","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=800, height=300");
}


/*
 * Special function to open a box to change link configuration
 */
function open_change_link (node)
{
    document.getElementById('new_link_name').value  = node.innerHTML;
    document.getElementById('new_url').value        = node.getAttribute('title');
    
    // client height and width
	    var width   = parseInt(document.documentElement.clientWidth);
	    var obj     = document.getElementById('changeLinkConf');
	    var boxW    = 320;
	    
	    
	    // can chinh cho ngay chinh giua
	    var top     = 300;
	    var left    = width/2 - boxW/2;
	    
	    obj.style.top   = top + parseInt(document.documentElement.scrollTop) + 'px';
	    obj.style.left  = left + 'px';
	    obj.style.display   = 'block';
}