function menuItem(id,pic)
{
		var obj = document.getElementById(id)
		obj.src = "images/" + pic + ".gif"  //.src
}

function adminItems(id,pic)
{
	obj = document.getElementById(id);
	if (document.all)
	{
		obj.style.filter="blendTrans(duration=0.5)"
		obj.filters.blendTrans.Apply()      
	}
	
	obj.src = 'images/' + pic + '.gif';
	
	if (document.all)
		obj.filters.blendTrans.Play()	
}

var querywindow = '';
function open_window( url,w,h )
{
	var left = (screen.availWidth/2) - (w/2);
	var top  = (screen.availHeight/2) - (h/2);
	
    if ( ! url ) {
        url = 'login.php';
    }

    if (!querywindow.closed && querywindow.location) {
        querywindow.focus();
    } else {
        querywindow=window.open( url, '',
            'toolbar=0,location=0,directories=0,status=1,menubar=0,' +
            'scrollbars=yes,resizable=0,' +
            'width=' + w + ', height=' + h + ',' +
			'left=' + left + ', top=' + top );
    }

    if ( ! querywindow.opener ) {
       querywindow.opener = window.window;
    }

    if ( window.focus ) {
        querywindow.focus();
    }

    return true;
}
function show_hide(id,status)
{
	obj = document.getElementById(id);
	if (document.all)
	{
		obj.style.filter="blendTrans(duration=0.5)"
		obj.filters.blendTrans.Apply()      
	}
	
	if(status == 'hide')
		obj.style.visibility = "hidden";

	else
		obj.style.visibility = "visible";
	
	if (document.all)
		obj.filters.blendTrans.Play()		
}

function AdminMenuItem(id,status)
{
	obj = document.getElementById(id);
	switch(status)
	{
		case 0:
			obj.style.backgroundImage = "url('images/glb_mainmenubar.gif')";
			break;
		case 1:
			obj.style.backgroundImage = "url('images/glb_main_over.gif')";
			break;
		case 2:
			obj.style.backgroundImage = "url('images/glb_submenubar.gif')";
			break;
		case 3:
			obj.style.backgroundImage = "url('images/glb_submenu_over.gif')";
			break;
	}
}
function setStatus(msg)
{
	divobj = document.getElementById('status');
	divobj.innerHTML = msg;
}

function setStr(str)
{
	while(str.indexOf('&') != -1)
	{
		str = str.replace('&','%amp;');
	}
	while(str.indexOf('"') != -1)
	{
		str = str.replace('"','%dquot;');
	}
	while(str.indexOf("'") != -1)
	{
		str = str.replace("'",'%quot;');
	}
	while(str.indexOf("+") != -1)
	{
		str = str.replace("+",'%addm;');
	}	
	return str;
}

function getStr(str)
{
	while(str.indexOf('%dquot;') != -1)
	{
		str = str.replace('%dquot;','"');
	}
	while(str.indexOf('%amp;') != -1)
	{
		str = str.replace('%amp;','&');
	}
	while(str.indexOf("%quot;") != -1)
	{
		str = str.replace("%quot;","'");
	}
	while(str.indexOf("%addm;") != -1)
	{
		str = str.replace("%addm;","+");
	}
	return str;
}