function hide_menu(i) 
{   
	
	    try{
		    var mn = document.getElementById('menu' + i)

		    if (mn)	
		    {
			    mn.style.visibility = 'hidden'
			    document.getElementById('TdMenu' + i).className = 'MenuItemTop';
		    }
		}catch(Ex){}
	
}

function show_menu(i) 
{    
    try{
	    var mn = document.getElementById('menu' + i)

	    if (mn)
	    {			    
		    document.getElementById('TdMenu' + i).className = 'MenuItemTopHover';
		    mn.style.visibility = 'visible'
	    }
	  }catch(Ex){}
}

function divShowHide(div)
{
	if (document.getElementById(div).style.display == 'none')	
		document.getElementById(div).style.display = ''
	else
		document.getElementById(div).style.display = 'none';
}

function readCookie(name) {
	var namearg = name + "=";
	var nlen = namearg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + nlen;
		if (document.cookie.substring(i, j) == namearg) {
			var endpos = document.cookie.indexOf (";", j);
			if (endpos == -1) endpos = document.cookie.length;
			return unescape(document.cookie.substring(j, endpos));
		}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break;
	}
	return 0;
}

function deleteCookie(name) {
   if (readCookie(name)) {
     document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
}

function writeCookie(name, value, expiry) {
	var expdate = new Date();	
	if(expiry) { //horas
		expdate.setTime(expdate.getTime() + 1000 * 60 * 60 * expiry);
		document.cookie = name + "=" + value + "; expires=" + expdate.toGMTString();
	}
	else {
		document.cookie = name + "=" + value;
	}
}

function Go(GoTo, Zone)
{
    if(GoTo != '')
    {
	    if(GoTo.indexOf('ShowFile') != -1 || GoTo.indexOf('ShowPluginsFile') != -1)
        {
	        eval(GoTo);
        }
        else if(GoTo.indexOf('http://') == -1)
	    {
		    deleteCookie('Zone');

		    writeCookie('Zone', Zone, 90);
		    window.location = GoTo;
	    }
	    else window.open(GoTo)
    }	
}

function Init()
{
	writeCookie('Menu', 0, 90);
	FixIt();
}


function updateData (id, cols, current, record_id, edit, url) {
	try {
		window.location = url + 'Id=' + record_id;
	}
	catch(e)
	{
		
	}
}	

function ShowFile(ImgId, Width, Height)
{
	var w = window.open('ShowFile.aspx?ImgId=' + ImgId + '&Width=' + Width + '&Height=' + Height,'','toolbar=0,status=0,menubar=0,fullscreen=no,width=200,height=200,resizable=0,top=100,left=100');
}

function ShowPluginsFile(Img, Width, Height)
{
	var w = window.open(Img);
}

function PrintIt(Url)
{
	var w = window.open(Url,'','toolbar=0,status=0,menubar=0,fullscreen=no,width=550,height=600,resizable=0,top=100,left=100,scrollbars=1');
}

