function OpenPopup(url,w,h)
{
	window.open(url, '', 'scrollbars=yes,resizable=yes,width='+w+',height='+h+',screenX=100,screenY=100');
	return(false);
}
function dsp(id,disp)
{
	d=document.getElementById(id);
	if (!d) return;
	d.style.display=disp;
}
function dsp_swap(id)
{
	d=document.getElementById(id);
	if (!d) return;
	if (d.style.display=='none') d.style.display='block';
	else d.style.display='none';
}
function _getFormAction(e)
{
    for (var i = 0; i < e.attributes.length; i++) 
    {
    	var a = e.attributes[i];
        var k = a.nodeName;
        if (k == 'action') 	
	{
        	return(a.value);
       	}
    }
    return(false);
}
function _setFormAction(e,action)
{
    for (var i = 0; i < e.attributes.length; i++) 
    {
    	var a = e.attributes[i];
        var k = a.nodeName;
        if (k == 'action') 	
	{
		a.value=action;
        	return(true);
       	}
    }
    return(false);
}
function swap_ssl(c)
{
	var f=document.getElementById('login_form');
	if (!f) return;
	var action=_getFormAction(f);
	if (c) _setFormAction(f, action.replace('http://', 'https://'));
	else _setFormAction(f, action.replace('https://', 'http://'));
}

var xajaxRequestUri="/index.php";
var xajaxDebug=false;
var xajaxStatusMessages=false;
var xajaxWaitCursor=true;
var xajaxDefinedGet=0;
var xajaxDefinedPost=1;
var xajaxLoaded=false;
selected_user=0;

function process_user_link(link_obj)
{
link_obj.find('a.UserLink').bind('click', function(){selected_user=jQuery(this).attr('uid');return false;}).contextMenu('UserMenu',{
	onShowMenu: function(e,menu) {
		var id=selected_user;
		var m=false;
		eval('if (typeof(user_menu'+id+')!="undefined") m=user_menu'+id+';');
		if (typeof(m)!='undefined' && m!=false) {
			jQuery('#jqContextMenu').html(m);
		}
		else {
			jQuery('#jqContextMenu').html('<img src="/image/ajax-loader.gif" width="16" height="16">');
			xajax_user_menu(id);
		}
        return menu;
      }
});
}
jQuery(document).ready(function(){ process_user_link(jQuery(this)); });

/*jQuery(document).ready(function(){ 
	
	
	jQuery('a.UserLink').bind('click', function(){selected_user=jQuery(this).attr('uid');return false;}).contextMenu('UserMenu',{
	onShowMenu: function(e,menu) {
		var id=selected_user;
		var m=false;
		eval('if (typeof(user_menu'+id+')!="undefined") m=user_menu'+id+';');
		if (typeof(m)!='undefined' && m!=false) {
			jQuery('#jqContextMenu').html(m);
		}
		else {
			jQuery('#jqContextMenu').html('<img src="/image/ajax-loader.gif" width="16" height="16">');
			xajax_user_menu(id);
		}
        return menu;
      }
});  

});*/

function xajax_user_menu(){xajaxRequestUri='/index.php';return xajax.call("user_menu",arguments,1);}
function xajax_link_viewed(){xajaxRequestUri='/story.php';return xajax.call("link_viewed",arguments,1);}
function set_user_menu(id,html)
{
	eval('user_menu'+id+'=html;');
	jQuery('#jqContextMenu').html(html);
}