function popUp(URL, w, h)
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + w + ",height=" + h + ",left = 200,top = 200');");
}

function getScrollX()
{
    var scrOfX = 0;
    if( typeof( window.pageYOffset ) == 'number' )
    {
        //Netscape compliant
        scrOfX = window.pageXOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
    {
        //DOM compliant
        scrOfX = document.body.scrollLeft;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
    {
        //IE6 standards compliant mode
        scrOfX = document.documentElement.scrollLeft;
    }
    return scrOfX;
}

function getScrollY()
{
    var scrOfY = 0;
    if( typeof( window.pageYOffset ) == 'number' )
    {
        //Netscape compliant
        scrOfY = window.pageYOffset;
    } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
    {
        //DOM compliant
        scrOfY = document.body.scrollTop;
    } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
    {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
    }
    return scrOfY;
}

/**
* Get a cookie value
* @param string cookie name
*/
function getCookie( name ) {
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) )
    {
        return null;
    }
    if( start == -1 ) return null;
    var end = document.cookie.indexOf( ";", len );
    if( end == -1 ) end = document.cookie.length;
    return unescape( document.cookie.substring( len, end ) );
}

/**
* Set a cookie
* @param string cookie name
* @param string cookie value
* @param string cookie expiration counter in days
* @param string cookie path
* @param string cookie domain
* @param bool secure?
*/
function setCookie( name, value, expires, path, domain, secure ) {
    var today = new Date();
    today.setTime( today.getTime() );
    if( expires )
    {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    document.cookie = name+"="+escape( value ) +
                      ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) +
                      ( ( path ) ? ";path=" + path : "" ) +
                      ( ( domain ) ? ";domain=" + domain : "" ) +
                      ( ( secure ) ? ";secure" : "" );
}

/**
* Remove a cookie
* @param string cookie name
* @param string cookie value
* @param string cookie path
* @param string cookie domain
*/
function deleteCookie( name, path, domain )
{
    if( getCookie( name ) ) document.cookie = name + "=" +
                                              ( ( path ) ? ";path=" + path : "") +
                                              ( ( domain ) ? ";domain=" + domain : "" ) +
                                              ";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function addLoadEvent(func)
{
    var oldonload = window.onload;
    if(typeof window.onload != 'function')
    {
        window.onload = func;
    } else
    {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}
