function confirm_logout()
{
        input_box=confirm("Are you sure you wish to log out?");
        if(input_box==true)
        {
                window.location="?method=logout";
        }
}

/*
*  Adds trim() function to all Strings
*/
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };

/*
*  Cross-browser helper to attach events to DOM objects
*/
function addEvent( element, evt, handler )
{
	if( element.addEventListener )
		element.addEventListener( evt, handler, false );
	else if( element.attachEvent )
		element.attachEvent( 'on' + evt, handler );
}

sfHover = function()
{
        var navcontainer = document.getElementById("navcontainer");
        if( !navcontainer )
                return;
        var sfEls = navcontainer.getElementsByTagName("LI");
        for (var i=0; i<sfEls.length; i++) {
                sfEls[i].onmouseover=function() {
                        this.className+=" sfhover";
                }
                sfEls[i].onmouseout=function() {
                        this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
                }
        }
}

function makeDoubleDelegate(function1, function2) {
    return function() {
        if (function1)
            function1();
        if (function2)
            function2();
    }
}

if (window.attachEvent) 
	window.onload = makeDoubleDelegate(window.onload, sfHover);

function replaceDivs()
{
        if ( window.$ === undefined )
                return;

        var container = $('#ajax_temp').children('div');
        var x = 0;
        for ( ; x < container.length; x++ )
        {
                var div = $( container[ x ] );
                if ( div.hasClass( 'skipreplace' ) )
                        continue;

                var tmpDivID = div.attr('id');
                var actualDivID = tmpDivID.replace("__ajx_tmp","");
                var actualDiv = $('#' + actualDivID);
                if ( actualDiv.length > 0 )
                        actualDiv.html( div.html() );
        }
}
