//\//////////////////////////////////////////////////////////////////////////////////
//\  overLIB 3.51  --  This notice must remain untouched at all times.
//\  Copyright Erik Bosrup 1998-2002. All rights reserved.
//\
//\  By Erik Bosrup (erik@bosrup.com).  Last modified 2002-11-01.
//\  Portions by Dan Steinman (dansteinman.com). Additions by other people are
//\  listed on the overLIB homepage.
//\
//\  Get the latest version at http://www.bosrup.com/web/overlib/
//\
//\  This script is published under an open source license. Please read the license
//\  agreement online at: http://www.bosrup.com/web/overlib/license.html
//\  If you have questions regarding the license please contact erik@bosrup.com.
//\
//\  This script library was originally created for personal use. By request it has
//\  later been made public. This is free software. Do not sell this as your own
//\  work, or remove this copyright notice. For full details on copying or changing
//\  this script please read the license agreement at the link above.
//\
//\  Please give credit on sites that use overLIB and submit changes of the script
//\  so other people can use them as well. This script is free to use, don't abuse.
//\//////////////////////////////////////////////////////////////////////////////////
//\mini


////////////////////////////////////////////////////////////////////////////////////
// CONSTANTS
// Don't touch these. :)
////////////////////////////////////////////////////////////////////////////////////
var INARRAY    =  1;
var CAPARRAY    =  2;
var STICKY    =  3;
var BACKGROUND    =  4;
var NOCLOSE    =  5;
var CAPTION    =  6;
var LEFT    =  7;
var RIGHT    =  8;
var CENTER    =  9;
var OFFSETX    =  10;
var OFFSETY    =  11;
var FGCOLOR    =  12;
var BGCOLOR    =  13;
var TEXTCOLOR    =  14;
var CAPCOLOR    =  15;
var CLOSECOLOR    =  16;
var WIDTH    =  17;
var BORDER    =  18;
var STATUS    =  19;
var AUTOSTATUS    =  20;
var AUTOSTATUSCAP  =  21;
var HEIGHT    =  22;
var CLOSETEXT    =  23;
var SNAPX    =  24;
var SNAPY    =  25;
var FIXX    =  26;
var FIXY    =  27;
var FGBACKGROUND  =  28;
var BGBACKGROUND  =  29;
var PADX    =  30; // PADX2 out
var PADY    =  31; // PADY2 out
var FULLHTML    =  34;
var ABOVE    =  35;
var BELOW    =  36;
var CAPICON    =  37;
var TEXTFONT    =  38;
var CAPTIONFONT    =  39;
var CLOSEFONT    =  40;
var TEXTSIZE    =  41;
var CAPTIONSIZE    =  42;
var CLOSESIZE    =  43;
var FRAME    =  44;
var TIMEOUT    =  45;
var FUNCTION    =  46;
var DELAY    =  47;
var HAUTO    =  48;
var VAUTO    =  49;
var CLOSECLICK    =  50;
var CSSOFF    =  51;
var CSSSTYLE    =  52;
var CSSCLASS    =  53;
var FGCLASS    =  54;
var BGCLASS    =  55;
var TEXTFONTCLASS  =  56;
var CAPTIONFONTCLASS  =  57;
var CLOSEFONTCLASS  =  58;
var PADUNIT    =  59;
var HEIGHTUNIT    =  60;
var WIDTHUNIT    =  61;
var TEXTSIZEUNIT  =  62;
var TEXTDECORATION  =  63;
var TEXTSTYLE    =  64;
var TEXTWEIGHT    =  65;
var CAPTIONSIZEUNIT  =  66;
var CAPTIONDECORATION  =  67;
var CAPTIONSTYLE  =  68;
var CAPTIONWEIGHT  =  69;
var CLOSESIZEUNIT  =  70;
var CLOSEDECORATION  =  71;
var CLOSESTYLE    =  72;
var CLOSEWEIGHT    =  73;
var DEBUGPRINT = 74;
var EXTRATIMER = 75;
var DYNAMICFIX = 76;
var JSCLOSE = 77;

////////////////////////////////////////////////////////////////////////////////////
// DEFAULT CONFIGURATION
// You don't have to change anything here if you don't want to. All of this can be
// changed on your html page or through an overLIB call.
////////////////////////////////////////////////////////////////////////////////////

// Main background color (the large area)
// Usually a bright color (white, yellow etc)
if (typeof ag_ol_fgcolor == 'undefined') { var ag_ol_fgcolor = "#dcdcdc";}

// Border color and color of caption
// Usually a dark color (black, brown etc)
if (typeof ag_ol_bgcolor == 'undefined') { var ag_ol_bgcolor = "#000000";}

// Text color
// Usually a dark color
if (typeof ag_ol_textcolor == 'undefined') { var ag_ol_textcolor = "#000000";}

// Color of the caption text
// Usually a bright color
if (typeof ag_ol_capcolor == 'undefined') { var ag_ol_capcolor = "#FFFFFF";}

// Color of "Close" when using Sticky
// Usually a semi-bright color
if (typeof ag_ol_closecolor == 'undefined') { var ag_ol_closecolor = "#9999FF";}

// Font face for the main text
if (typeof ag_ol_textfont == 'undefined') { var ag_ol_textfont = "Verdana,Arial,Helvetica";}

// Font face for the caption
if (typeof ag_ol_captionfont == 'undefined') { var ag_ol_captionfont = "Verdana,Arial,Helvetica";}

// Font face for the close text
if (typeof ag_ol_closefont == 'undefined') { var ag_ol_closefont = "Verdana,Arial,Helvetica";}

// Font size for the main text
// When using CSS this will be very small.
if (typeof ag_ol_textsize == 'undefined') { var ag_ol_textsize = "2";}

// Font size for the caption
// When using CSS this will be very small.
if (typeof ag_ol_captionsize == 'undefined') { var ag_ol_captionsize = "2";}

// Font size for the close text
// When using CSS this will be very small.
if (typeof ag_ol_closesize == 'undefined') { var ag_ol_closesize = "2";}

// Width of the popups in pixels
// 100-300 pixels is typical
if (typeof ag_ol_width == 'undefined') { var ag_ol_width = "100";}

// How thick the ag_ol_border should be in pixels
// 1-3 pixels is typical
if (typeof ag_ol_border == 'undefined') { var ag_ol_border = "1";}

// How many pixels to the right/left of the cursor to show the popup
// Values between 3 and 12 are best
if (typeof ag_ol_offsetx == 'undefined') { var ag_ol_offsetx = 3;}

// How many pixels to the below the cursor to show the popup
// Values between 3 and 12 are best
if (typeof ag_ol_offsety == 'undefined') { var ag_ol_offsety = 3;}

// Default text for popups
// Should you forget to pass something to overLIB this will be displayed.
if (typeof ag_ol_text == 'undefined') { var ag_ol_text = "bitte warten.."; }

// Default caption
// You should leave this blank or you will have problems making non caps popups.
if (typeof ag_ol_cap == 'undefined') { var ag_ol_cap = ""; }

// Decides if sticky popups are default.
// 0 for non, 1 for stickies.
if (typeof ag_ol_sticky == 'undefined') { var ag_ol_sticky = 0; }

// Default background image. Better left empty unless you always want one.
if (typeof ag_ol_background == 'undefined') { var ag_ol_background = ""; }

// Text for the closing sticky popups.
// Normal is "Close".
if (typeof ag_ol_close == 'undefined') { var ag_ol_close = "Close"; }

// Default vertical alignment for popups.
// It's best to leave RIGHT here. Other options are LEFT and CENTER.
if (typeof ag_ol_hpos == 'undefined') { var ag_ol_hpos = RIGHT; }

// Default status bar text when a popup is invoked.
if (typeof ag_ol_status == 'undefined') { var ag_ol_status = ""; }

// If the status bar automatically should load either text or caption.
// 0=nothing, 1=text, 2=caption
if (typeof ag_ol_autostatus == 'undefined') { var ag_ol_autostatus = 0; }

// Default height for popup. Often best left alone.
if (typeof ag_ol_height == 'undefined') { var ag_ol_height = -1; }

// Horizontal grid spacing that popups will snap to.
// 0 makes no grid, anything else will cause a snap to that grid spacing.
if (typeof ag_ol_snapx == 'undefined') { var ag_ol_snapx = 0; }

// Vertical grid spacing that popups will snap to.
// 0 makes no grid, andthing else will cause a snap to that grid spacing.
if (typeof ag_ol_snapy == 'undefined') { var ag_ol_snapy = 0; }

// Sets the popups horizontal position to a fixed column.
// Anything above -1 will cause fixed position.
if (typeof ag_ol_fixx == 'undefined') { var ag_ol_fixx = -1; }

// Sets the popups vertical position to a fixed row.
// Anything above -1 will cause fixed position.
if (typeof ag_ol_fixy == 'undefined') { var ag_ol_fixy = -1; }

// Background image for the popups inside.
if (typeof ag_ol_fgbackground == 'undefined') { var ag_ol_fgbackground = ""; }

// Background image for the popups frame.
if (typeof ag_ol_bgbackground == 'undefined') { var ag_ol_bgbackground = ""; }

// How much horizontal left padding text should get by default when BACKGROUND is used.
if (typeof ag_ol_padxl == 'undefined') { var ag_ol_padxl = 1; }

// How much horizontal right padding text should get by default when BACKGROUND is used.
if (typeof ag_ol_padxr == 'undefined') { var ag_ol_padxr = 1; }

// How much vertical top padding text should get by default when BACKGROUND is used.
if (typeof ag_ol_padyt == 'undefined') { var ag_ol_padyt = 1; }

// How much vertical bottom padding text should get by default when BACKGROUND is used.
if (typeof ag_ol_padyb == 'undefined') { var ag_ol_padyb = 1; }

// If the user by default must supply all html for complete popup control.
// Set to 1 to activate, 0 otherwise.
if (typeof ag_ol_fullhtml == 'undefined') { var ag_ol_fullhtml = 0; }

// Default vertical position of the popup. Default should normally be BELOW.
// ABOVE only works when HEIGHT is defined.
if (typeof ag_ol_vpos == 'undefined') { var ag_ol_vpos = BELOW; }

// Default height of popup to use when placing the popup above the cursor.
if (typeof ag_ol_aboveheight == 'undefined') { var ag_ol_aboveheight = 0; }

// Default icon to place next to the popups caption.
if (typeof ag_ol_capicon == 'undefined') { var ag_ol_capicon = ""; }

// Default frame. We default to current frame if there is no frame defined.
if (typeof ag_ol_frame == 'undefined') { var ag_ol_frame = self; }

// Default timeout. By default there is no timeout.
if (typeof ag_ol_timeout == 'undefined') { var ag_ol_timeout = 0; }

// Default javascript funktion. By default there is none.
if (typeof ag_ol_function == 'undefined') { var ag_ol_function = null; }

// Default timeout. By default there is no timeout.
if (typeof ag_ol_delay == 'undefined') { var ag_ol_delay = 200; }

// If overLIB should decide the horizontal placement.
if (typeof ag_ol_hauto == 'undefined') { var ag_ol_hauto = 1; }

// If overLIB should decide the vertical placement.
if (typeof ag_ol_vauto == 'undefined') { var ag_ol_vauto = 1; }



// If the user has to click to close stickies.
if (typeof ag_ol_closeclick == 'undefined') { var ag_ol_closeclick = 0; }

// This variable determines if you want to use CSS or inline definitions.
// CSSOFF=no CSS    CSSSTYLE=use CSS inline styles    CSSCLASS=use classes
if (typeof ag_ol_css == 'undefined') { var ag_ol_css = CSSOFF; }

// Main background class (eqv of fgcolor)
// This is only used if CSS is set to use classes (ag_ol_css = CSSCLASS)
if (typeof ag_ol_fgclass == 'undefined') { var ag_ol_fgclass = ""; }

// Frame background class (eqv of bgcolor)
// This is only used if CSS is set to use classes (ag_ol_css = CSSCLASS)
if (typeof ag_ol_bgclass == 'undefined') { var ag_ol_bgclass = ""; }

// Main font class
// This is only used if CSS is set to use classes (ag_ol_css = CSSCLASS)
if (typeof ag_ol_textfontclass == 'undefined') { var ag_ol_textfontclass = ""; }

// Caption font class
// This is only used if CSS is set to use classes (ag_ol_css = CSSCLASS)
if (typeof ag_ol_captionfontclass == 'undefined') { var ag_ol_captionfontclass = ""; }

// Close font class
// This is only used if CSS is set to use classes (ag_ol_css = CSSCLASS)
if (typeof ag_ol_closefontclass == 'undefined') { var ag_ol_closefontclass = ""; }

// Unit to be used for the text padding above
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
// Options include "px", "%", "in", "cm"
if (typeof ag_ol_padunit == 'undefined') { var ag_ol_padunit = "px";}

// Unit to be used for height of popup
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
// Options include "px", "%", "in", "cm"
if (typeof ag_ol_heightunit == 'undefined') { var ag_ol_heightunit = "px";}

// Unit to be used for width of popup
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
// Options include "px", "%", "in", "cm"
if (typeof ag_ol_widthunit == 'undefined') { var ag_ol_widthunit = "px";}

// Font size unit for the main text
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_textsizeunit == 'undefined') { var ag_ol_textsizeunit = "px";}

// Decoration of the main text ("none", "underline", "line-through" or "blink")
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_textdecoration == 'undefined') { var ag_ol_textdecoration = "none";}

// Font style of the main text ("normal" or "italic")
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_textstyle == 'undefined') { var ag_ol_textstyle = "normal";}

// Font weight of the main text ("normal", "bold", "bolder", "lighter", ect.)
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_textweight == 'undefined') { var ag_ol_textweight = "normal";}

// Font size unit for the caption
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_captionsizeunit == 'undefined') { var ag_ol_captionsizeunit = "px";}

// Decoration of the caption ("none", "underline", "line-through" or "blink")
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_captiondecoration == 'undefined') { var ag_ol_captiondecoration = "none";}

// Font style of the caption ("normal" or "italic")
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_captionstyle == 'undefined') { var ag_ol_captionstyle = "normal";}

// Font weight of the caption ("normal", "bold", "bolder", "lighter", ect.)
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_captionweight == 'undefined') { var ag_ol_captionweight = "bold";}

// Font size unit for the close text
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_closesizeunit == 'undefined') { var ag_ol_closesizeunit = "px";}

// Decoration of the close text ("none", "underline", "line-through" or "blink")
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_closedecoration == 'undefined') { var ag_ol_closedecoration = "none";}

// Font style of the close text ("normal" or "italic")
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_closestyle == 'undefined') { var ag_ol_closestyle = "normal";}

// Font weight of the close text ("normal", "bold", "bolder", "lighter", ect.)
// Only used if CSS inline styles are being used (ag_ol_css = CSSSTYLE)
if (typeof ag_ol_closeweight == 'undefined') { var ag_ol_closeweight = "normal";}



////////////////////////////////////////////////////////////////////////////////////
// ARRAY CONFIGURATION
// You don't have to change anything here if you don't want to. The following
// arrays can be filled with text and html if you don't wish to pass it from
// your html page.
////////////////////////////////////////////////////////////////////////////////////

// Array with texts.
if (typeof ag_ol_texts == 'undefined') { var ag_ol_texts = new Array("Text 0", "Text 1"); }

// Array with captions.
if (typeof ag_ol_caps == 'undefined') { var ag_ol_caps = new Array("Caption 0", "Caption 1"); }

if (typeof ag_ol_debugprint == 'undefined') { var ag_ol_debugprint = false; }

if (typeof ag_ol_extratimer == 'undefined') { var ag_ol_extratimer = 0; }

if (typeof ag_ol_dynamicfix == 'undefined') { var ag_ol_dynamicfix = false; }

if (typeof ag_ol_olddynfixx == 'undefined') { var ag_ol_olddynfixx = 0; }

if (typeof ag_ol_olddynfixy == 'undefined') { var ag_ol_olddynfixy = 0; }

if (typeof ag_ol_olddynamicfix == 'undefined') { var ag_ol_olddynamicfix = ''; }

if (typeof ag_ol_jsclose == 'undefined') { var ag_ol_jsclose = ''; }


////////////////////////////////////////////////////////////////////////////////////
// END CONFIGURATION
// Don't change anything below this line, all configuration is above.
////////////////////////////////////////////////////////////////////////////////////







////////////////////////////////////////////////////////////////////////////////////
// INIT
////////////////////////////////////////////////////////////////////////////////////

// Runtime variables init. Used for runtime only, don't change, not for config!
var ago3_text = "";
var ago3_cap = "";
var ago3_sticky = 0;
var ago3_background = "";
var ago3_close = "Close";
var ago3_hpos = RIGHT;
var ago3_offsetx = 2;
var ago3_offsety = 2;
var ago3_fgcolor = "";
var ago3_bgcolor = "";
var ago3_textcolor = "";
var ago3_capcolor = "";
var ago3_closecolor = "";
var ago3_width = 100;
var ago3_border = 1;
var ago3_status = "";
var ago3_autostatus = 0;
var ago3_height = -1;
var ago3_snapx = 0;
var ago3_snapy = 0;
var ago3_fixx = -1;
var ago3_fixy = -1;
var ago3_fgbackground = "";
var ago3_bgbackground = "";
var ago3_padxl = 0;
var ago3_padxr = 0;
var ago3_padyt = 0;
var ago3_padyb = 0;
var ago3_fullhtml = 0;
var ago3_vpos = BELOW;
var ago3_aboveheight = 0;
var ago3_capicon = "";
var ago3_textfont = "Verdana,Arial,Helvetica";
var ago3_captionfont = "Verdana,Arial,Helvetica";
var ago3_closefont = "Verdana,Arial,Helvetica";
var ago3_textsize = "1";
var ago3_captionsize = "1";
var ago3_closesize = "1";
var ago3_frame = self;
var ago3_timeout = 0;
var ago3_timerid = 0;
var ago3_allowmove = 0;
var ago3_function = null;
var ago3_delay = 0;
var ago3_delayid = 0;
var ago3_hauto = 0;
var ago3_vauto = 0;
var ago3_closeclick = 0;

var ago3_css = CSSOFF;
var ago3_fgclass = "";
var ago3_bgclass = "";
var ago3_textfontclass = "";
var ago3_captionfontclass = "";
var ago3_closefontclass = "";
var ago3_padunit = "px";
var ago3_heightunit = "px";
var ago3_widthunit = "px";
var ago3_textsizeunit = "px";
var ago3_textdecoration = "";
var ago3_textstyle = "";
var ago3_textweight = "";
var ago3_captionsizeunit = "px";
var ago3_captiondecoration = "";
var ago3_captionstyle = "";
var ago3_captionweight = "";
var ago3_closesizeunit = "px";
var ago3_closedecoration = "";
var ago3_closestyle = "";
var ago3_closeweight = "";

var ago3_debugprint = false;
var ago3_extratimer = 0;
var ago3_dynamicfix = '';
var ago3_olddynamicfix = '';

// Display state variables
var ago3_x = 0;
var ago3_y = 0;
var ago3_allow = 0;
var ago3_showingsticky = 0;
var ago3_removecounter = 0;

var ago3_startx = 0;
var ago3_starty = 0;
// Our layer
var agover = null;
var fnRef;

var ago3_jsclose = '';

// Decide browser version
var ns4 = (navigator.appName == 'Netscape' && parseInt(navigator.appVersion) == 4);
var ns6 = (document.getElementById)? true:false;
var ie4 = (document.all)? true:false;
if (ie4) var docRoot = 'document.body';
var ie5 = false;
if (ns4) {
  var oW = window.innerWidth;
  var oH = window.innerHeight;
  window.onresize = function () {if (oW!=window.innerWidth||oH!=window.innerHeight) location.reload();}
}

//##############################################################################
//##############################################################################

// Microsoft Stupidity Check(tm).
if (ie4) {
  if ((navigator.userAgent.indexOf('MSIE 5') > 0) || (navigator.userAgent.indexOf('MSIE 6') > 0)) {
    if(document.compatMode && document.compatMode == 'CSS1Compat') docRoot = 'document.documentElement';
    ie5 = true;
  }
  if (ns6) {
    ns6 = false;
  }
}

//##############################################################################
//##############################################################################

// Capture events, alt. diffuses the overlib function.

function get_mouseEvent() {
  if ( (ns4) || (ie4) || (ns6)) {
    document.onmousemove = ag_mouseMove;
    if (ns4) document.captureEvents(Event.MOUSEMOVE)
  } else {
    overlib = no_overlib;
    nd = no_overlib;
    ver3fix = true;
  }
}
//##############################################################################
//##############################################################################

if ( (ns4) || (ie4) || (ns6)) {
  document.onmousemove = ag_mouseMove;
  if (ns4) document.captureEvents(Event.MOUSEMOVE)
} else {
  overlib = no_overlib;
  nd = no_overlib;
  ver3fix = true;
}

//##############################################################################
//##############################################################################

// Fake function for 3.0 users.
function no_overlib() {
  return ver3fix;
}

//##############################################################################
//##############################################################################


////////////////////////////////////////////////////////////////////////////////////
// PUBLIC FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////


// overlib(arg0, ..., argN)
// Loads parameters into global runtime variables.
function overlib() {

  // Load defaults to runtime.
  ago3_text = ag_ol_text;
  ago3_cap = ag_ol_cap;
  ago3_sticky = ag_ol_sticky;
  ago3_background = ag_ol_background;
  ago3_close = ag_ol_close;
  ago3_hpos = ag_ol_hpos;
  ago3_offsetx = ag_ol_offsetx;
  ago3_offsety = ag_ol_offsety;
  ago3_fgcolor = ag_ol_fgcolor;
  ago3_bgcolor = ag_ol_bgcolor;
  ago3_textcolor = ag_ol_textcolor;
  ago3_capcolor = ag_ol_capcolor;
  ago3_closecolor = ag_ol_closecolor;
  ago3_width = ag_ol_width;
  ago3_border = ag_ol_border;
  ago3_status = ag_ol_status;
  ago3_autostatus = ag_ol_autostatus;
  ago3_height = ag_ol_height;
  ago3_snapx = ag_ol_snapx;
  ago3_snapy = ag_ol_snapy;
  ago3_fixx = ag_ol_fixx;
  ago3_fixy = ag_ol_fixy;
  ago3_fgbackground = ag_ol_fgbackground;
  ago3_bgbackground = ag_ol_bgbackground;
  ago3_padxl = ag_ol_padxl;
  ago3_padxr = ag_ol_padxr;
  ago3_padyt = ag_ol_padyt;
  ago3_padyb = ag_ol_padyb;
  ago3_fullhtml = ag_ol_fullhtml;
  ago3_vpos = ag_ol_vpos;
  ago3_aboveheight = ag_ol_aboveheight;
  ago3_capicon = ag_ol_capicon;
  ago3_textfont = ag_ol_textfont;
  ago3_captionfont = ag_ol_captionfont;
  ago3_closefont = ag_ol_closefont;
  ago3_textsize = ag_ol_textsize;
  ago3_captionsize = ag_ol_captionsize;
  ago3_closesize = ag_ol_closesize;
  ago3_timeout = ag_ol_timeout;
  ago3_function = ag_ol_function;
  ago3_delay = ag_ol_delay;
  ago3_hauto = ag_ol_hauto;
  ago3_vauto = ag_ol_vauto;
  ago3_closeclick = ag_ol_closeclick;

  ago3_css = ag_ol_css;
  ago3_fgclass = ag_ol_fgclass;
  ago3_bgclass = ag_ol_bgclass;
  ago3_textfontclass = ag_ol_textfontclass;
  ago3_captionfontclass = ag_ol_captionfontclass;
  ago3_closefontclass = ag_ol_closefontclass;
  ago3_padunit = ag_ol_padunit;
  ago3_heightunit = ag_ol_heightunit;
  ago3_widthunit = ag_ol_widthunit;
  ago3_textsizeunit = ag_ol_textsizeunit;
  ago3_textdecoration = ag_ol_textdecoration;
  ago3_textstyle = ag_ol_textstyle;
  ago3_textweight = ag_ol_textweight;
  ago3_captionsizeunit = ag_ol_captionsizeunit;
  ago3_captiondecoration = ag_ol_captiondecoration;
  ago3_captionstyle = ag_ol_captionstyle;
  ago3_captionweight = ag_ol_captionweight;
  ago3_closesizeunit = ag_ol_closesizeunit;
  ago3_closedecoration = ag_ol_closedecoration;
  ago3_closestyle = ag_ol_closestyle;
  ago3_closeweight = ag_ol_closeweight;
  ago3_debugprint =ag_ol_debugprint;
  ago3_extratimer = ag_ol_extratimer;
  ago3_dynamicfix = ag_ol_dynamicfix;
  ago3_olddynamicfix = ag_ol_olddynamicfix

  ago3_jsclose = ag_ol_jsclose;

  fnRef = '';


  // Special for frame support, agover must be reset...
  if ( (ns4) || (ie4) || (ns6) ) {
    if (agover) cClick();
    ago3_frame = ag_ol_frame;
    if (ns4) agover = ago3_frame.document.overDiv
    if (ie4) agover = ago3_frame.overDiv.style
    if (ns6) agover = ago3_frame.document.getElementById("overDiv");
  }


  // What the next argument is expected to be.
  var parsemode = -1, udf, v = null;

  var ar = arguments;
  udf = (!ar.length ? 1 : 0);

  if (typeof ar[0] == 'string') {
    ago3_text = ar[0];
    parsemode = 0;
  }
  if(!ago3_text)return false;

  if (typeof ar[1] == 'object' && ar[1].length>0) {
    var OPT=ar[1];
    ar=OPT;
    parsemode = 0;
  }

  for (i = 0; i < ar.length; i++) {

    if (parsemode < 0) {
      // Arg is maintext, unless its a PARAMETER
      if (typeof ar[i] == 'number') {
        udf = (ar[i] == FUNCTION ? 0 : 1);
        i--;
      } else {
        if(ar[i]) ago3_text = ar[i];
      }
      parsemode = 0;

    } else {

      // Note: NS4 doesn't like switch cases with vars.
      if (ar[i] == INARRAY) { udf = 0; ago3_text = ag_ol_texts[ar[++i]]; continue; }
      if (ar[i] == CAPARRAY) { ago3_cap = ag_ol_caps[ar[++i]]; continue; }
      if (ar[i] == STICKY) { ago3_sticky = 1; continue; }
      if (ar[i] == BACKGROUND) { ago3_background = ar[++i]; continue; }
      if (ar[i] == NOCLOSE) { ago3_close = ""; continue; }
      if (ar[i] == CAPTION) { ago3_cap = ar[++i]; continue; }
      if (ar[i] == CENTER || ar[i] == LEFT || ar[i] == RIGHT) { ago3_hpos = ar[i]; continue; }
      if (ar[i] == OFFSETX) { ago3_offsetx = ar[++i]; continue; }
      if (ar[i] == OFFSETY) { ago3_offsety = ar[++i]; continue; }
      if (ar[i] == FGCOLOR) { ago3_fgcolor = ar[++i]; continue; }
      if (ar[i] == BGCOLOR) { ago3_bgcolor = ar[++i]; continue; }
      if (ar[i] == TEXTCOLOR) { ago3_textcolor = ar[++i]; continue; }
      if (ar[i] == CAPCOLOR) { ago3_capcolor = ar[++i]; continue; }
      if (ar[i] == CLOSECOLOR) { ago3_closecolor = ar[++i]; continue; }
      if (ar[i] == WIDTH) { ago3_width = ar[++i]; continue; }
      if (ar[i] == BORDER) { ago3_border = ar[++i]; continue; }
      if (ar[i] == STATUS) { ago3_status = ar[++i]; continue; }
      if (ar[i] == AUTOSTATUS) { ago3_autostatus = (ago3_autostatus == 1) ? 0 : 1; continue; }
      if (ar[i] == AUTOSTATUSCAP) { ago3_autostatus = (ago3_autostatus == 2) ? 0 : 2; continue; }
      if (ar[i] == HEIGHT) { ago3_height = ar[++i]; ago3_aboveheight = ar[i]; continue; } // Same param again.
      if (ar[i] == CLOSETEXT) { ago3_close = ar[++i]; continue; }
      if (ar[i] == SNAPX) { ago3_snapx = ar[++i]; continue; }
      if (ar[i] == SNAPY) { ago3_snapy = ar[++i]; continue; }
      if (ar[i] == FIXX) { ago3_fixx = ar[++i]; continue; }
      if (ar[i] == FIXY) { ago3_fixy = ar[++i]; continue; }
      if (ar[i] == FGBACKGROUND) { ago3_fgbackground = ar[++i]; continue; }
      if (ar[i] == BGBACKGROUND) { ago3_bgbackground = ar[++i]; continue; }
      if (ar[i] == PADX) { ago3_padxl = ar[++i]; ago3_padxr = ar[++i]; continue; }
      if (ar[i] == PADY) { ago3_padyt = ar[++i]; ago3_padyb = ar[++i]; continue; }
      if (ar[i] == FULLHTML) { ago3_fullhtml = 1; continue; }
      if (ar[i] == BELOW || ar[i] == ABOVE) { ago3_vpos = ar[i]; continue; }
      if (ar[i] == CAPICON) { ago3_capicon = ar[++i]; continue; }
      if (ar[i] == TEXTFONT) { ago3_textfont = ar[++i]; continue; }
      if (ar[i] == CAPTIONFONT) { ago3_captionfont = ar[++i]; continue; }
      if (ar[i] == CLOSEFONT) { ago3_closefont = ar[++i]; continue; }
      if (ar[i] == TEXTSIZE) { ago3_textsize = ar[++i]; continue; }
      if (ar[i] == CAPTIONSIZE) { ago3_captionsize = ar[++i]; continue; }
      if (ar[i] == CLOSESIZE) { ago3_closesize = ar[++i]; continue; }
      if (ar[i] == FRAME) { agopt_FRAME(ar[++i]); continue; }
      if (ar[i] == TIMEOUT) { ago3_timeout = ar[++i]; continue; }
      if (ar[i] == FUNCTION) { udf = 0; if (typeof ar[i+1] != 'number') v = ar[++i]; agopt_FUNCTION(v); continue; }
      if (ar[i] == DELAY) { ago3_delay = ar[++i]; continue; }
      if (ar[i] == HAUTO) { ago3_hauto = (ago3_hauto == 0) ? 1 : 0; continue; }
      if (ar[i] == VAUTO) { ago3_vauto = (ago3_vauto == 0) ? 1 : 0; continue; }
      if (ar[i] == CLOSECLICK) { ago3_closeclick = (ago3_closeclick == 0) ? 1 : 0; continue; }
      if (ar[i] == CSSOFF) { ago3_css = ar[i]; continue; }
      if (ar[i] == CSSSTYLE) { ago3_css = ar[i]; continue; }
      if (ar[i] == CSSCLASS) { ago3_css = ar[i]; continue; }
      if (ar[i] == FGCLASS) { ago3_fgclass = ar[++i]; continue; }
      if (ar[i] == BGCLASS) { ago3_bgclass = ar[++i]; continue; }
      if (ar[i] == TEXTFONTCLASS) { ago3_textfontclass = ar[++i]; continue; }
      if (ar[i] == CAPTIONFONTCLASS) { ago3_captionfontclass = ar[++i]; continue; }
      if (ar[i] == CLOSEFONTCLASS) { ago3_closefontclass = ar[++i]; continue; }
      if (ar[i] == PADUNIT) { ago3_padunit = ar[++i]; continue; }
      if (ar[i] == HEIGHTUNIT) { ago3_heightunit = ar[++i]; continue; }
      if (ar[i] == WIDTHUNIT) { ago3_widthunit = ar[++i]; continue; }
      if (ar[i] == TEXTSIZEUNIT) { ago3_textsizeunit = ar[++i]; continue; }
      if (ar[i] == TEXTDECORATION) { ago3_textdecoration = ar[++i]; continue; }
      if (ar[i] == TEXTSTYLE) { ago3_textstyle = ar[++i]; continue; }
      if (ar[i] == TEXTWEIGHT) { ago3_textweight = ar[++i]; continue; }
      if (ar[i] == CAPTIONSIZEUNIT) { ago3_captionsizeunit = ar[++i]; continue; }
      if (ar[i] == CAPTIONDECORATION) { ago3_captiondecoration = ar[++i]; continue; }
      if (ar[i] == CAPTIONSTYLE) { ago3_captionstyle = ar[++i]; continue; }
      if (ar[i] == CAPTIONWEIGHT) { ago3_captionweight = ar[++i]; continue; }
      if (ar[i] == CLOSESIZEUNIT) { ago3_closesizeunit = ar[++i]; continue; }
      if (ar[i] == CLOSEDECORATION) { ago3_closedecoration = ar[++i]; continue; }
      if (ar[i] == CLOSESTYLE) { ago3_closestyle = ar[++i]; continue; }
      if (ar[i] == CLOSEWEIGHT) { ago3_closeweight = ar[++i]; continue; }
      if (ar[i] == DEBUGPRINT) { ago3_debugprint = true; continue; }
      if (ar[i] == EXTRATIMER) { ago3_extratimer = ar[++i]; continue; }

      if (ar[i] == DYNAMICFIX) { ago3_dynamicfix = ar[++i];
                                 if(ago3_olddynamicfix == ago3_dynamicfix){
                                   if(ag_ol_olddynfixx)ago3_fixx = ag_ol_olddynfixx;
                                   if(ag_ol_olddynfixy)ago3_fixy = ag_ol_olddynfixy;
                                 }else{
                                   ago3_olddynamicfix = ago3_dynamicfix;
                                 }
                                 continue;
                               }
      if (ar[i] == JSCLOSE) { ago3_jsclose = ar[++i]; continue; }
    }
  }

  if(ago3_text) ago3_text = my_decodeURL(ago3_text);
  if(!ago3_text){return;}
  if (udf && ago3_function) ago3_text = ago3_function();

  if(ago3_debugprint)alert(ago3_text);

  if (ago3_delay == 0) {
    return overlib351();
  } else {
    ago3_delayid = setTimeout("overlib351()", ago3_delay);
    return false;
  }
}


//##############################################################################
//##############################################################################

// Clears popups if appropriate
function nd() {
  if ( ago3_removecounter >= 1 ) { ago3_showingsticky = 0 };
  if ( (ns4) || (ie4) || (ns6) ) {
    if ( ago3_showingsticky == 0 ) {
      ago3_allowmove = 0;
      if (agover != null) aghideObject(agover);
    } else {
      ago3_removecounter++;
    }
  }

  ago3_startx = 0;
  ago3_starty = 0;
  if(ago3_delayid) clearTimeout(ago3_delayid);
  if(ago3_extratimer) clearTimeout(ago3_extratimer);

  return true;
}





//##############################################################################
//##############################################################################


////////////////////////////////////////////////////////////////////////////////////
// OVERLIB 3.51 FUNCTION
////////////////////////////////////////////////////////////////////////////////////


// This function decides what it is we want to display and how we want it done.
function overlib351() {

  // Make layer content
  var layerhtml;

  if (ago3_background != "" || ago3_fullhtml) {
    // Use background instead of box.
    layerhtml = ag_ol_content_background(ago3_text, ago3_background, ago3_fullhtml);
  } else {
    // They want a popup box.

    // Prepare popup background
    if (ago3_fgbackground != "" && ago3_css == CSSOFF) {
      ago3_fgbackground = "BACKGROUND=\""+ago3_fgbackground+"\"";
    }
    if (ago3_bgbackground != "" && ago3_css == CSSOFF) {
      ago3_bgbackground = "BACKGROUND=\""+ago3_bgbackground+"\"";
    }

    // Prepare popup colors
    if (ago3_fgcolor != "" && ago3_css == CSSOFF) {
      ago3_fgcolor = "BGCOLOR=\""+ago3_fgcolor+"\"";
    }
    if (ago3_bgcolor != "" && ago3_css == CSSOFF) {
      ago3_bgcolor = "BGCOLOR=\""+ago3_bgcolor+"\"";
    }

    // Prepare popup height
    if (ago3_height > 0 && ago3_css == CSSOFF) {
      ago3_height = "HEIGHT=" + ago3_height;
    } else {
      ago3_height = "";
    }

    // Decide which kinda box.
    if (ago3_cap == "") {
      // Plain
      layerhtml = ag_ol_content_simple(ago3_text);
    } else {
      // With caption
      if (ago3_sticky) {
        // Show close text
        layerhtml = ag_ol_content_caption(ago3_text, ago3_cap, ago3_close);
      } else {
        // No close text
        layerhtml = ag_ol_content_caption(ago3_text, ago3_cap, "");
      }
    }
  }

  // We want it to stick!
  if (ago3_sticky) {
    if (ago3_timerid > 0) {
      clearTimeout(ago3_timerid);
      ago3_timerid = 0;
    }
    ago3_showingsticky = 1;
    ago3_removecounter = 0;
  }

  // Write layer
  layerWrite(layerhtml);

  // Prepare status bar
  if (ago3_autostatus > 0) {
    ago3_status = ago3_text;
    if (ago3_autostatus > 1) {
      ago3_status = ago3_cap;
    }
  }

  // When placing the layer the first time, even stickies may be moved.
  ago3_allowmove = 0;

  // Initiate a timer for timeout
  if (ago3_timeout > 0) {
    if (ago3_timerid > 0) clearTimeout(ago3_timerid);
    ago3_timerid = setTimeout("cClick()", ago3_timeout);
  }

  // Show layer
  disp(ago3_status);

  // Stickies should stay where they are.
  if (ago3_sticky) ago3_allowmove = 0;

  return (ago3_status != '');
}


//##############################################################################
//##############################################################################

////////////////////////////////////////////////////////////////////////////////////
// LAYER GENERATION FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////

// Makes simple table without caption
function ag_ol_content_simple(text) {
  if (ago3_css == CSSCLASS) txt = "<TABLE WIDTH="+ago3_width+" BORDER=0 CELLPADDING="+ago3_border+" CELLSPACING=0 class=\""+ago3_bgclass+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 class=\""+ago3_fgclass+"\"><TR><TD VALIGN=TOP><FONT class=\""+ago3_textfontclass+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
  if (ago3_css == CSSSTYLE) txt = "<TABLE WIDTH="+ago3_width+" BORDER=0 CELLPADDING="+ago3_border+" CELLSPACING=0 style=\"background-color: "+ago3_bgcolor+"; height: "+ago3_height+ago3_heightunit+";\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 style=\"color: "+ago3_fgcolor+"; background-color: "+ago3_fgcolor+"; height: "+ago3_height+ago3_heightunit+";\"><TR><TD VALIGN=TOP><FONT style=\"font-family: "+ago3_textfont+"; color: "+ago3_textcolor+"; font-size: "+ago3_textsize+ago3_textsizeunit+"; text-decoration: "+ago3_textdecoration+"; font-weight: "+ago3_textweight+"; font-style:"+ago3_textstyle+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
  if (ago3_css == CSSOFF)   txt = "<TABLE WIDTH="+ago3_width+" BORDER=0 CELLPADDING="+ago3_border+" CELLSPACING=0 "+ago3_bgcolor+" "+ago3_height+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 "+ago3_fgcolor+" "+ago3_fgbackground+" "+ago3_height+"><TR><TD VALIGN=TOP><FONT FACE=\""+ago3_textfont+"\" COLOR=\""+ago3_textcolor+"\" SIZE=\""+ago3_textsize+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";

  set_background("");
  return txt;
}




//##############################################################################
//##############################################################################
// Makes table with caption and optional close link
function ag_ol_content_caption(text, title, close) {
  closing = "";
  closeevent = "onMouseOver";

  if (ago3_closeclick == 1) closeevent = "onClick";
  if (ago3_capicon != "") ago3_capicon = "<IMG SRC=\""+ago3_capicon+"\"> ";

  if (close != "") {
    if (ago3_css == CSSCLASS) closing = "<TD ALIGN=RIGHT><A HREF=\"javascript:"+ago3_jsclose+"return "+fnRef+"cClick();\" "+closeevent+"=\""+ago3_jsclose+"return " +fnRef + "cClick();\" class=\""+ago3_closefontclass+"\">"+close+"</A></TD>";
    if (ago3_css == CSSSTYLE) closing = "<TD ALIGN=RIGHT><A HREF=\"javascript:"+ago3_jsclose+"return "+fnRef+"cClick();\" "+closeevent+"=\""+ago3_jsclose+"return " +fnRef + "cClick();\" style=\"color: "+ago3_closecolor+"; font-family: "+ago3_closefont+"; font-size: "+ago3_closesize+ago3_closesizeunit+"; text-decoration: "+ago3_closedecoration+"; font-weight: "+ago3_closeweight+"; font-style:"+ago3_closestyle+";\">"+close+"</A></TD>";
    if (ago3_css == CSSOFF)   closing = "<TD ALIGN=RIGHT><A HREF=\"javascript:"+ago3_jsclose+"return "+fnRef+"cClick();\" "+closeevent+"=\""+ago3_jsclose+"return " +fnRef + "cClick();\"><FONT COLOR=\""+ago3_closecolor+"\" FACE=\""+ago3_closefont+"\" SIZE=\""+ago3_closesize+"\">"+close+"</FONT></A></TD>";
  }

  if (ago3_css == CSSCLASS) txt = "<TABLE WIDTH="+ago3_width+" BORDER=0 CELLPADDING="+ago3_border+" CELLSPACING=0 class=\""+ago3_bgclass+"\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><FONT class=\""+ago3_captionfontclass+"\">"+ago3_capicon+title+"</FONT></TD>"+closing+"</TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 class=\""+ago3_fgclass+"\"><TR><TD VALIGN=TOP><FONT class=\""+ago3_textfontclass+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
  if (ago3_css == CSSSTYLE) txt = "<TABLE WIDTH="+ago3_width+" BORDER=0 CELLPADDING="+ago3_border+" CELLSPACING=0 style=\"background-color: "+ago3_bgcolor+"; background-image: url("+ago3_bgbackground+"); height: "+ago3_height+ago3_heightunit+";\"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><FONT style=\"font-family: "+ago3_captionfont+"; color: "+ago3_capcolor+"; font-size: "+ago3_captionsize+ago3_captionsizeunit+"; font-weight: "+ago3_captionweight+"; font-style: "+ago3_captionstyle+"; text-decoration: " + ago3_captiondecoration + ";\">"+ago3_capicon+title+"</FONT></TD>"+closing+"</TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 style=\"color: "+ago3_fgcolor+"; background-color: "+ago3_fgcolor+"; height: "+ago3_height+ago3_heightunit+";\"><TR><TD VALIGN=TOP><FONT style=\"font-family: "+ago3_textfont+"; color: "+ago3_textcolor+"; font-size: "+ago3_textsize+ago3_textsizeunit+"; text-decoration: "+ago3_textdecoration+"; font-weight: "+ago3_textweight+"; font-style:"+o3_ago3_textstyle+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";
  if (ago3_css == CSSOFF)   txt = "<TABLE WIDTH="+ago3_width+" BORDER=0 CELLPADDING="+ago3_border+" CELLSPACING=0 "+ago3_bgcolor+" "+ago3_bgbackground+" "+ago3_height+"><TR><TD><TABLE WIDTH=100% BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD><B><FONT COLOR=\""+ago3_capcolor+"\" FACE=\""+ago3_captionfont+"\" SIZE=\""+ago3_captionsize+"\">"+ago3_capicon+title+"</FONT></B></TD>"+closing+"</TR></TABLE><TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=0 "+ago3_fgcolor+" "+ago3_fgbackground+" "+ago3_height+"><TR><TD VALIGN=TOP><FONT COLOR=\""+ago3_textcolor+"\" FACE=\""+ago3_textfont+"\" SIZE=\""+ago3_textsize+"\">"+text+"</FONT></TD></TR></TABLE></TD></TR></TABLE>";

  set_background("");
  return txt;
}

//##############################################################################
//##############################################################################
// Sets the background picture, padding and lots more. :)
function ag_ol_content_background(text, picture, hasfullhtml) {
  var txt;
  if (hasfullhtml) {
    txt = text;
  } else {
    var pU, hU, wU;
    pU = (ago3_padunit == '%' ? '%' : '');
    hU = (ago3_heightunit == '%' ? '%' : '');
    wU = (ago3_widthunit == '%' ? '%' : '');

    if (ago3_css == CSSCLASS) txt = "<TABLE WIDTH="+ago3_width+" BORDER=0 CELLPADDING=0 CELLSPACING=0 HEIGHT="+ago3_height+"><TR><TD COLSPAN=3 HEIGHT="+ago3_padyt+"></TD></TR><TR><TD WIDTH="+ago3_padxl+"></TD><TD VALIGN=TOP WIDTH="+(ago3_width-ago3_padxl-ago3_padxr)+"><FONT class=\""+ago3_textfontclass+"\">"+text+"</FONT></TD><TD WIDTH="+ago3_padxr+"></TD></TR><TR><TD COLSPAN=3 HEIGHT="+ago3_padyb+"></TD></TR></TABLE>";
    if (ago3_css == CSSSTYLE) txt = "<TABLE WIDTH="+ago3_width+wU+" BORDER=0 CELLPADDING=0 CELLSPACING=0 HEIGHT="+ago3_height+hU+"><TR><TD COLSPAN=3 HEIGHT="+ago3_padyt+pU+"></TD></TR><TR><TD WIDTH="+ago3_padxl+pU+"></TD><TD VALIGN=TOP WIDTH="+(ago3_width-ago3_padxl-ago3_padxr)+pU+"><FONT style=\"font-family: "+ago3_textfont+"; color: "+ago3_textcolor+"; font-size: "+ago3_textsize+ago3_textsizeunit+";\">"+text+"</FONT></TD><TD WIDTH="+ago3_padxr+pU+"></TD></TR><TR><TD COLSPAN=3 HEIGHT="+ago3_padyb+pU+"></TD></TR></TABLE>";
    if (ago3_css == CSSOFF) txt = "<TABLE WIDTH="+ago3_width+" BORDER=0 CELLPADDING=0 CELLSPACING=0 HEIGHT="+ago3_height+"><TR><TD COLSPAN=3 HEIGHT="+ago3_padyt+"></TD></TR><TR><TD WIDTH="+ago3_padxl+"></TD><TD VALIGN=TOP WIDTH="+(ago3_width-ago3_padxl-ago3_padxr)+"><FONT FACE=\""+ago3_textfont+"\" COLOR=\""+ago3_textcolor+"\" SIZE=\""+ago3_textsize+"\">"+text+"</FONT></TD><TD WIDTH="+ago3_padxr+"></TD></TR><TR><TD COLSPAN=3 HEIGHT="+ago3_padyb+"></TD></TR></TABLE>";
  }
  set_background(picture);
  return txt;
}

//##############################################################################
//##############################################################################
// Loads a picture into the div.
function set_background(pic) {
  if (pic == "") {
    if (ns4) agover.background.src = null;
    if (ie4) agover.backgroundImage = "none";
    if (ns6) agover.style.backgroundImage = "none";
  } else {
    if (ns4) {
      agover.background.src = pic;
    } else if (ie4) {
      agover.backgroundImage = "url("+pic+")";
    } else if (ns6) {
      agover.style.backgroundImage = "url("+pic+")";
    }
  }
}



////////////////////////////////////////////////////////////////////////////////////
// HANDLING FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////


//##############################################################################
//##############################################################################
// Displays the popup
function disp(statustext) {
  if ( (ns4) || (ie4) || (ns6) ) {
    if (ago3_allowmove == 0)   {
      placeLayer();
      agshowObject(agover);
      ago3_allowmove = 1;
    }
  }

  if (statustext != "") {
    self.status = statustext;
  }
}
//##############################################################################
//##############################################################################
// Decides where we want the popup.
function placeLayer() {

  var placeX, placeY;

  if(agover.offsetWidth && agover.offsetWidth>ago3_width){
    ago3_width=agover.offsetWidth;
  }
  if(agover.offsetHeight && agover.offsetHeight>ago3_height){
    ago3_height=agover.offsetHeight;
  }

  // HORIZONTAL PLACEMENT
  if (ago3_fixx > -1) {
    // Fixed position
    placeX = ago3_fixx;
  } else {
    winoffset = (ie4) ? eval('ago3_frame.'+docRoot+'.scrollLeft') : ago3_frame.pageXOffset;
    if (ie4) iwidth = eval('ago3_frame.'+docRoot+'.clientWidth');
    if (ns4 || ns6) iwidth = ago3_frame.innerWidth;
    iwidth = (eval(iwidth));

    // If HAUTO, decide what to use.
    if (ago3_hauto == 1) {
      if ( (ago3_x - winoffset) > (iwidth/2)) {
        ago3_hpos = LEFT;
      } else {
        ago3_hpos = RIGHT;
      }
//      alert(ago3_width);
    }

    // From mouse
    if (ago3_hpos == CENTER) { // Center
      placeX = ago3_x+ago3_offsetx-(ago3_width/2);
      if (placeX < winoffset) placeX = winoffset;
    }
    if (ago3_hpos == LEFT) { // Left
      placeX = ago3_x-ago3_offsetx-ago3_width;
      if (placeX < winoffset) placeX = winoffset;
    }
    if (!placeX) { // Right
      placeX = ago3_x+ago3_offsetx;
      if ( (eval(placeX) + eval(ago3_width)) > (winoffset + iwidth) ) {
        placeX = iwidth + winoffset - ago3_width ;
        if (placeX < 0) placeX = 0;
      }
    }

//    if (placeX + ago3_aboveheight > iwidth) placeY = iwidth-ago3_aboveheight;


    // Snapping!
    if (ago3_snapx > 1) {
      var snapping = placeX % ago3_snapx;
      if (ago3_hpos == LEFT) {
        placeX = placeX - (ago3_snapx + snapping);
      } else {
        // CENTER and RIGHT
        placeX = placeX + (ago3_snapx - snapping);
      }
      if (placeX < winoffset) placeX = winoffset;
    }
  }


  // VERTICAL PLACEMENT
  if (ago3_fixy > -1) {
    // Fixed position
    placeY = ago3_fixy;
  } else {
    scrolloffset = (ie4) ? eval('ago3_frame.'+docRoot+'.scrollTop') : ago3_frame.pageYOffset;

    // If VAUTO, decide what to use.
    if (ago3_vauto == 1) {
      if (ie4) iheight = eval('ago3_frame.'+docRoot+'.clientHeight');
      if (ns4 || ns6) iheight = ago3_frame.innerHeight;

      iheight = (eval(iheight)) / 2;
      if ( (ago3_y - scrolloffset) > iheight) {
        ago3_vpos = ABOVE;
      } else {
        ago3_vpos = BELOW;
      }
    }


    // From mouse
    if (ago3_aboveheight == 0) {
      var divref = (ie4) ? ago3_frame.document.all['overDiv'] : agover;
      ago3_aboveheight = (ns4) ? divref.clip.height : divref.offsetHeight;
    }
    if (ago3_vpos == ABOVE) {

      placeY = ago3_y - (ago3_aboveheight + ago3_offsety);

    } else {   // BELOW
      placeY = ago3_y + ago3_offsety;
      if (ie4) iheight = eval('ago3_frame.'+docRoot+'.clientHeight');
      if (ns4 || ns6) iheight = ago3_frame.innerHeight;
      iheight = (eval(iheight));
      if (placeY + ago3_aboveheight > iheight) placeY = iheight-ago3_aboveheight;
//alert(iheight+'-'+ago3_aboveheight);
    }
    if (placeY < scrolloffset) placeY = scrolloffset;

    // Snapping!
    if (ago3_snapy > 1) {
      var snapping = placeY % ago3_snapy;

      if (ago3_aboveheight > 0 && ago3_vpos == ABOVE) {
        placeY = placeY - (ago3_snapy + snapping);
      } else {
        placeY = placeY + (ago3_snapy - snapping);
      }

      if (placeY < scrolloffset) placeY = scrolloffset;
    }
  }

  if(ago3_dynamicfix){
    ag_ol_olddynfixx = placeX;
    ag_ol_olddynfixy = placeY;
  }else{
    ag_ol_olddynfixx = 0;
    ag_ol_olddynfixy = 0;
  }

  // Actually move the object.
  agrepositionTo(agover, placeX, placeY);
}


// Moves the layer
function ag_mouseMove(e) {

  var XY = ag_getXY(e);
  ago3_x=XY[0]; ago3_y=XY[1];
  if (ago3_allowmove == 1) placeLayer();
}

// Get x-y from layer
function ag_getXY(e) {

  var XY=[0,0];
  if ( (ns4) || (ns6) ) {XY= [e.pageX,e.pageY];}
  if (ie4) {XY= [event.x,event.y];}
  if (ie5) {XY= [eval('event.x+ago3_frame.'+docRoot+'.scrollLeft'),eval('event.y+ago3_frame.'+docRoot+'.scrollTop')];}
  return XY;
}

// The Close onMouseOver function for stickies
function cClick() {
  aghideObject(agover);
  ago3_showingsticky = 0;

  return false;
}


// Makes sure target frame has overLIB
function compatibleframe(frameid) {
  if (ns4) {
    if (typeof frameid.document.overDiv =='undefined') return false;
  } else if (ie4) {
    if (typeof frameid.document.all["overDiv"] =='undefined') return false;
  } else if (ns6) {
    if (frameid.document.getElementById('overDiv') == null) return false;
  }

  return true;
}



////////////////////////////////////////////////////////////////////////////////////
// LAYER FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////


// Writes to a layer
function layerWrite(txt) {
//  txt += "<br/>\n";// + ago3_x + "-" + ago3_y;

  if (ns4) {
    var lyr = ago3_frame.document.overDiv.document;
    lyr.write(txt);
    lyr.close();
  } else if (ie4) {
    ago3_frame.document.all["overDiv"].innerHTML = txt;
  } else if (ns6) {
    range = ago3_frame.document.createRange();
    range.setStartBefore(agover);
    domfrag = range.createContextualFragment(txt);
    while (agover.hasChildNodes()) {
      agover.removeChild(agover.lastChild);
    }
    agover.appendChild(domfrag);
  }

  if(agover.offsetWidth)  ago3_width=agover.offsetWidth;
  if(agover.offsetHeight) ago3_height=agover.offsetHeight;
  ago3_startx = ago3_x;
  ago3_starty = ago3_y;

  if(SBMDebug)AddValue('SBMDebugDiv','agover.offsetWidth='+agover.offsetWidth+'\n');

}

// Make an object visible
function agshowObject(obj) {
  if (ns4) obj.visibility = "show";
  else if (ie4) obj.visibility = "visible";
  else if (ns6) obj.style.visibility = "visible";
}

// Hides an object
function aghideObject(obj) {
  if (ns4) obj.visibility = "hide";
  else if (ie4) obj.visibility = "hidden";
  else if (ns6) obj.style.visibility = "hidden";

  if (ago3_timerid > 0) clearTimeout(ago3_timerid);
  if (ago3_delayid > 0) clearTimeout(ago3_delayid);
  ago3_timerid = 0;
  ago3_delayid = 0;
  self.status = "";
}

// Move a layer
function agrepositionTo(obj,xL,yL) {
  if ( (ns4) || (ie4) ) {
    obj.left = (ie4 ? xL + 'px' : xL);
    obj.top = (ie4 ? yL + 'px' : yL);
  } else if (ns6) {
    obj.style.left = xL + "px";
    obj.style.top = yL+ "px";
  }

}

function aggetFrameRef(thisFrame, ofrm) {
  var retVal = '';
  for (var i=0; i<thisFrame.length; i++) {
    if (thisFrame[i].length > 0) {
      retVal = aggetFrameRef(thisFrame[i],ofrm);
      if (retVal == '') continue;
    } else if (thisFrame[i] != ofrm) continue;

    retVal = '['+i+']' + retVal;
    break;
  }

  return retVal;
}




////////////////////////////////////////////////////////////////////////////////////
// PARSER FUNCTIONS
////////////////////////////////////////////////////////////////////////////////////


// Defines which frame we should point to.
function agopt_FRAME(frm) {
  ago3_frame = compatibleframe(frm) ? frm : ag_ol_frame;

  if (ago3_frame != ag_ol_frame) {
    var tFrm = aggetFrameRef(top.frames, ago3_frame);
    var sFrm = aggetFrameRef(top.frames, ag_ol_frame);

    if (sFrm.length == tFrm.length) {
      l = tFrm.lastIndexOf('[');
      if (l) {
        while(sFrm.substring(0,l) != tFrm.substring(0,l)) l = tFrm.lastIndexOf('[',l-1);
        tFrm = tFrm.substr(l);
        sFrm = sFrm.substr(l);
      }
    }

    var cnt = 0, p = '', str = tFrm;

    while((k = str.lastIndexOf('[')) != -1) {
      cnt++;
      str = str.substring(0,k);
    }

    for (var i=0; i<cnt; i++) p = p + 'parent.';
    fnRef = p + 'frames' + sFrm + '.';
  }

  if ( (ns4) || (ie4 || (ns6)) ) {
    if (ns4) agover = ago3_frame.document.overDiv;
    if (ie4) agover = ago3_frame.overDiv.style;
    if (ns6) agover = ago3_frame.document.getElementById("overDiv");
  }

  return 0;
}

// Calls an external function
function agopt_FUNCTION(callme) {
  ago3_text = (callme ? callme() : (ago3_function ? ago3_function() : 'No Function'));
  return 0;
}




//end (For internal purposes.)
////////////////////////////////////////////////////////////////////////////////////
// OVERLIB 2 COMPATABILITY FUNCTIONS
// If you aren't upgrading you can remove the below section.
////////////////////////////////////////////////////////////////////////////////////

// Converts old 0=left, 1=right and 2=center into constants.
function vpos_convert(d) {
  if (d == 0) {
    d = LEFT;
  } else {
    if (d == 1) {
      d = RIGHT;
    } else {
      d = CENTER;
    }
  }

  return d;
}

// Simple popup
function dts(d,text) {
  ago3_hpos = vpos_convert(d);
  overlib(text, ago3_hpos, CAPTION, "");
}

// Caption popup
function dtc(d,text, title) {
  ago3_hpos = vpos_convert(d);
  overlib(text, CAPTION, title, ago3_hpos);
}

// Sticky
function stc(d,text, title) {
  ago3_hpos = vpos_convert(d);
  overlib(text, CAPTION, title, ago3_hpos, STICKY);
}

// Simple popup right
function drs(text) {
  dts(1,text);
}

// Caption popup right
function drc(text, title) {
  dtc(1,text,title);
}

// Sticky caption right
function src(text,title) {
  stc(1,text,title);
}

// Simple popup left
function dls(text) {
  dts(0,text);
}

// Caption popup left
function dlc(text, title) {
  dtc(0,text,title);
}

// Sticky caption left
function slc(text,title) {
  stc(0,text,title);
}

// Simple popup center
function dcs(text) {
  dts(2,text);
}

// Caption popup center
function dcc(text, title) {
  dtc(2,text,title);
}

// Sticky caption center
function scc(text,title) {
  stc(2,text,title);
}
