2 //\ overLIB 4.00 - You may not remove or change this notice.
\r
3 //\ Copyright Erik Bosrup 1998-2004. All rights reserved.
\r
5 //\ Contributors are listed on the homepage.
\r
6 //\ This file might be old, always check for the latest version at:
\r
7 //\ http://www.bosrup.com/web/overlib/
\r
9 //\ Please read the license agreement (available through the link above)
\r
10 //\ before using overLIB. Direct any licensing questions to erik@bosrup.com.
\r
12 //\ Do not sell this as your own work or remove this copyright notice.
\r
13 //\ For full details on copying or changing this script please read the
\r
14 //\ license agreement at the link above. Please give credit on sites that
\r
15 //\ use overLIB and submit changes of the script so other people can use
\r
17 // $Revision: 1.68.2.1 $ $Date: 2004/03/23 16:29:38 $
\r
23 // Ignore these lines, configuration is below.
\r
25 var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pms = new Array(); var olInfo = new Info('4.00', 1);
\r
26 var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3;
\r
27 var olHideForm=0; // parameter for hiding SELECT and ActiveX elements in IE5.5+
\r
28 registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass');
\r
31 // DEFAULT CONFIGURATION
\r
32 // Settings you want everywhere are set here. All of this can also be
\r
33 // changed on your html page or through an overLIB call.
\r
35 if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#CCCCFF";
\r
36 if (typeof ol_bgcolor=='undefined') var ol_bgcolor="#333399";
\r
37 if (typeof ol_textcolor=='undefined') var ol_textcolor="#000000";
\r
38 if (typeof ol_capcolor=='undefined') var ol_capcolor="#FFFFFF";
\r
39 if (typeof ol_closecolor=='undefined') var ol_closecolor="#9999FF";
\r
40 if (typeof ol_textfont=='undefined') var ol_textfont="Verdana,Arial,Helvetica";
\r
41 if (typeof ol_captionfont=='undefined') var ol_captionfont="Verdana,Arial,Helvetica";
\r
42 if (typeof ol_closefont=='undefined') var ol_closefont="Verdana,Arial,Helvetica";
\r
43 if (typeof ol_textsize=='undefined') var ol_textsize="1";
\r
44 if (typeof ol_captionsize=='undefined') var ol_captionsize="1";
\r
45 if (typeof ol_closesize=='undefined') var ol_closesize="1";
\r
46 if (typeof ol_width=='undefined') var ol_width="200";
\r
47 if (typeof ol_border=='undefined') var ol_border="1";
\r
48 if (typeof ol_cellpad=='undefined') var ol_cellpad=2;
\r
49 if (typeof ol_offsetx=='undefined') var ol_offsetx=10;
\r
50 if (typeof ol_offsety=='undefined') var ol_offsety=10;
\r
51 if (typeof ol_text=='undefined') var ol_text="Default Text";
\r
52 if (typeof ol_cap=='undefined') var ol_cap="";
\r
53 if (typeof ol_sticky=='undefined') var ol_sticky=0;
\r
54 if (typeof ol_background=='undefined') var ol_background="";
\r
55 if (typeof ol_close=='undefined') var ol_close="Close";
\r
56 if (typeof ol_hpos=='undefined') var ol_hpos=RIGHT;
\r
57 if (typeof ol_status=='undefined') var ol_status="";
\r
58 if (typeof ol_autostatus=='undefined') var ol_autostatus=0;
\r
59 if (typeof ol_height=='undefined') var ol_height=-1;
\r
60 if (typeof ol_snapx=='undefined') var ol_snapx=0;
\r
61 if (typeof ol_snapy=='undefined') var ol_snapy=0;
\r
62 if (typeof ol_fixx=='undefined') var ol_fixx=-1;
\r
63 if (typeof ol_fixy=='undefined') var ol_fixy=-1;
\r
64 if (typeof ol_relx=='undefined') var ol_relx=null;
\r
65 if (typeof ol_rely=='undefined') var ol_rely=null;
\r
66 if (typeof ol_fgbackground=='undefined') var ol_fgbackground="";
\r
67 if (typeof ol_bgbackground=='undefined') var ol_bgbackground="";
\r
68 if (typeof ol_padxl=='undefined') var ol_padxl=1;
\r
69 if (typeof ol_padxr=='undefined') var ol_padxr=1;
\r
70 if (typeof ol_padyt=='undefined') var ol_padyt=1;
\r
71 if (typeof ol_padyb=='undefined') var ol_padyb=1;
\r
72 if (typeof ol_fullhtml=='undefined') var ol_fullhtml=0;
\r
73 if (typeof ol_vpos=='undefined') var ol_vpos=BELOW;
\r
74 if (typeof ol_aboveheight=='undefined') var ol_aboveheight=0;
\r
75 if (typeof ol_capicon=='undefined') var ol_capicon="";
\r
76 if (typeof ol_frame=='undefined') var ol_frame=self;
\r
77 if (typeof ol_timeout=='undefined') var ol_timeout=0;
\r
78 if (typeof ol_function=='undefined') var ol_function=null;
\r
79 if (typeof ol_delay=='undefined') var ol_delay=0;
\r
80 if (typeof ol_hauto=='undefined') var ol_hauto=0;
\r
81 if (typeof ol_vauto=='undefined') var ol_vauto=0;
\r
82 if (typeof ol_closeclick=='undefined') var ol_closeclick=0;
\r
83 if (typeof ol_wrap=='undefined') var ol_wrap=0;
\r
84 if (typeof ol_followmouse=='undefined') var ol_followmouse=1;
\r
85 if (typeof ol_mouseoff=='undefined') var ol_mouseoff=0;
\r
86 if (typeof ol_closetitle=='undefined') var ol_closetitle='Close';
\r
87 if (typeof ol_css=='undefined') var ol_css=CSSOFF;
\r
88 if (typeof ol_fgclass=='undefined') var ol_fgclass="";
\r
89 if (typeof ol_bgclass=='undefined') var ol_bgclass="";
\r
90 if (typeof ol_textfontclass=='undefined') var ol_textfontclass="";
\r
91 if (typeof ol_captionfontclass=='undefined') var ol_captionfontclass="";
\r
92 if (typeof ol_closefontclass=='undefined') var ol_closefontclass="";
\r
95 // ARRAY CONFIGURATION
\r
98 // You can use these arrays to store popup text here instead of in the html.
\r
99 if (typeof ol_texts=='undefined') var ol_texts = new Array("Text 0", "Text 1");
\r
100 if (typeof ol_caps=='undefined') var ol_caps = new Array("Caption 0", "Caption 1");
\r
103 // END OF CONFIGURATION
\r
104 // Don't change anything below this line, all configuration is above.
\r
114 // Runtime variables init. Don't change for config!
\r
118 var o3_background="";
\r
119 var o3_close="Close";
\r
125 var o3_textcolor="";
\r
126 var o3_capcolor="";
\r
127 var o3_closecolor="";
\r
132 var o3_autostatus=0;
\r
140 var o3_fgbackground="";
\r
141 var o3_bgbackground="";
\r
148 var o3_aboveheight=0;
\r
150 var o3_textfont="Verdana,Arial,Helvetica";
\r
151 var o3_captionfont="Verdana,Arial,Helvetica";
\r
152 var o3_closefont="Verdana,Arial,Helvetica";
\r
153 var o3_textsize="1";
\r
154 var o3_captionsize="1";
\r
155 var o3_closesize="1";
\r
159 var o3_allowmove=0;
\r
160 var o3_function=null;
\r
165 var o3_closeclick=0;
\r
167 var o3_followmouse=1;
\r
169 var o3_closetitle='';
\r
173 var o3_textfontclass="";
\r
174 var o3_captionfontclass="";
\r
175 var o3_closefontclass="";
\r
177 // Display state variables
\r
180 var o3_showingsticky = 0;
\r
181 var o3_removecounter = 0;
\r
185 var fnRef, hoveringSwitch = false;
\r
187 // Decide browser version
\r
188 var isMac = (navigator.userAgent.indexOf("Mac") != -1);
\r
189 var olOp = (navigator.userAgent.toLowerCase().indexOf('opera 7.') > -1);
\r
190 var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4);
\r
191 var olNs6 = (document.getElementById) ? true : false;
\r
192 var olIe4 = (document.all) ? true : false;
\r
193 var olIe5 = false;
\r
194 var olIe55 = false; // Added additional variable to identify IE5.5+
\r
195 var docRoot = 'document.body';
\r
197 // Resize fix for NS4.x to keep track of layer
\r
199 var oW = window.innerWidth;
\r
200 var oH = window.innerHeight;
\r
201 window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); }
\r
204 // Microsoft Stupidity Check(tm).
\r
206 var versNum=parseFloat(navigator.userAgent.match(/MSIE (\d\.\d+)\.*/i)[1]);
\r
209 olIe55=(versNum>=5.5&&!olOp) ? true : false;
\r
210 if (olNs6) olNs6=false;
\r
212 if (olNs6) olIe4 = false;
\r
215 // Check for compatability mode.
\r
216 if (document.compatMode && document.compatMode == 'CSS1Compat') {
\r
217 docRoot= ((olIe4 && !olOp) ? 'document.documentElement' : docRoot);
\r
220 // Add window onload handlers to indicate when all modules have been loaded
\r
221 // For Netscape 6+ and Mozilla, uses addEventListener method on the window object
\r
222 // For IE it uses the attachEvent method of the window object and for Netscape 4.x
\r
223 // it sets the window.onload handler to the OLonload_handler function
\r
224 if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,true);
\r
225 else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler);
\r
226 else window.onload=OLonLoad_handler;
\r
228 // Capture events, alt. diffuses the overlib function.
\r
229 var olCheckMouseCapture = true;
\r
230 if ((olNs4 || olNs6 || olIe4)) {
\r
233 overlib = no_overlib;
\r
240 // PUBLIC FUNCTIONS
\r
243 // overlib(arg0,...,argN)
\r
244 // Loads parameters into global runtime variables.
\r
245 function overlib() {
\r
246 if (!olLoaded || isExclusive(overlib.arguments)) return true;
\r
247 if (olCheckMouseCapture) olMouseCapture();
\r
248 if (over) cClick();
\r
250 // Load defaults to runtime.
\r
253 o3_sticky=ol_sticky;
\r
254 o3_background=ol_background;
\r
257 o3_offsetx=ol_offsetx;
\r
258 o3_offsety=ol_offsety;
\r
259 o3_fgcolor=ol_fgcolor;
\r
260 o3_bgcolor=ol_bgcolor;
\r
261 o3_textcolor=ol_textcolor;
\r
262 o3_capcolor=ol_capcolor;
\r
263 o3_closecolor=ol_closecolor;
\r
265 o3_border=ol_border;
\r
266 o3_cellpad=ol_cellpad;
\r
267 o3_status=ol_status;
\r
268 o3_autostatus=ol_autostatus;
\r
269 o3_height=ol_height;
\r
276 o3_fgbackground=ol_fgbackground;
\r
277 o3_bgbackground=ol_bgbackground;
\r
282 o3_fullhtml=ol_fullhtml;
\r
284 o3_aboveheight=ol_aboveheight;
\r
285 o3_capicon=ol_capicon;
\r
286 o3_textfont=ol_textfont;
\r
287 o3_captionfont=ol_captionfont;
\r
288 o3_closefont=ol_closefont;
\r
289 o3_textsize=ol_textsize;
\r
290 o3_captionsize=ol_captionsize;
\r
291 o3_closesize=ol_closesize;
\r
292 o3_timeout=ol_timeout;
\r
293 o3_function=ol_function;
\r
297 o3_closeclick=ol_closeclick;
\r
299 o3_followmouse=ol_followmouse;
\r
300 o3_mouseoff=ol_mouseoff;
\r
301 o3_closetitle=ol_closetitle;
\r
303 o3_fgclass=ol_fgclass;
\r
304 o3_bgclass=ol_bgclass;
\r
305 o3_textfontclass=ol_textfontclass;
\r
306 o3_captionfontclass=ol_captionfontclass;
\r
307 o3_closefontclass=ol_closefontclass;
\r
309 setRunTimeVariables();
\r
313 // Special for frame support, over must be reset...
\r
314 o3_frame = ol_frame;
\r
317 over = o3_frame.document.layers['overDiv'];
\r
318 } else if (document.all) {
\r
319 over = o3_frame.document.all['overDiv'];
\r
320 } else if (document.getElementById) {
\r
321 over = o3_frame.document.getElementById("overDiv");
\r
324 parseTokens('o3_', overlib.arguments);
\r
325 if (!postParseChecks()) return false;
\r
327 if (o3_delay == 0) {
\r
328 return runHook("olMain", FREPLACE);
\r
330 o3_delayid = setTimeout("runHook('olMain', FREPLACE)", o3_delay);
\r
335 // Clears popups if appropriate
\r
336 function nd(time) {
\r
337 if (olLoaded && !isExclusive()) {
\r
338 if (time && !o3_delay) {
\r
339 if (o3_timerid > 0) clearTimeout(o3_timerid);
\r
341 o3_timerid = setTimeout("cClick()",(o3_timeout = time));
\r
343 if (o3_removecounter >= 1) { o3_showingsticky = 0 };
\r
345 if (o3_showingsticky == 0) {
\r
347 if (over != null && o3_timerid == 0) runHook("hideObject", FREPLACE, over);
\r
349 o3_removecounter++;
\r
356 // The Close onMouseOver function for stickies
\r
357 function cClick() {
\r
359 runHook("hideObject", FREPLACE, over);
\r
360 o3_showingsticky = 0;
\r
365 // Method for setting page specific defaults.
\r
366 function overlib_pagedefaults() {
\r
367 parseTokens('ol_', overlib_pagedefaults.arguments);
\r
372 // OVERLIB MAIN FUNCTION
\r
375 // This function decides what it is we want to display and how we want it done.
\r
376 function olMain() {
\r
377 var layerhtml, styleType;
\r
378 runHook("olMain", FBEFORE);
\r
380 if (o3_background!="" || o3_fullhtml) {
\r
381 // Use background instead of box.
\r
382 layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml);
\r
384 // They want a popup box.
\r
385 styleType = (pms[o3_css-1-pmStart] == "cssoff" || pms[o3_css-1-pmStart] == "cssclass");
\r
387 // Prepare popup background
\r
388 if (o3_fgbackground != "") o3_fgbackground = "background=\""+o3_fgbackground+"\"";
\r
389 if (o3_bgbackground != "") o3_bgbackground = (styleType ? "background=\""+o3_bgbackground+"\"" : o3_bgbackground);
\r
391 // Prepare popup colors
\r
392 if (o3_fgcolor != "") o3_fgcolor = (styleType ? "bgcolor=\""+o3_fgcolor+"\"" : o3_fgcolor);
\r
393 if (o3_bgcolor != "") o3_bgcolor = (styleType ? "bgcolor=\""+o3_bgcolor+"\"" : o3_bgcolor);
\r
395 // Prepare popup height
\r
396 if (o3_height > 0) o3_height = (styleType ? "height=\""+o3_height+"\"" : o3_height);
\r
397 else o3_height = "";
\r
399 // Decide which kinda box.
\r
402 layerhtml = runHook('ol_content_simple', FALTERNATE, o3_css, o3_text);
\r
407 layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, o3_close);
\r
410 layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, "");
\r
415 // We want it to stick!
\r
417 if (o3_timerid > 0) {
\r
418 clearTimeout(o3_timerid);
\r
421 o3_showingsticky = 1;
\r
422 o3_removecounter = 0;
\r
425 // Created a separate routine to generate the popup to make it easier
\r
426 // to implement a plugin capability
\r
427 if (!runHook("createPopup", FREPLACE, layerhtml)) return false;
\r
429 // Prepare status bar
\r
430 if (o3_autostatus > 0) {
\r
431 o3_status = o3_text;
\r
432 if (o3_autostatus > 1) o3_status = o3_cap;
\r
435 // When placing the layer the first time, even stickies may be moved.
\r
438 // Initiate a timer for timeout
\r
439 if (o3_timeout > 0) {
\r
440 if (o3_timerid > 0) clearTimeout(o3_timerid);
\r
441 o3_timerid = setTimeout("cClick()", o3_timeout);
\r
445 runHook("disp", FREPLACE, o3_status);
\r
446 runHook("olMain", FAFTER);
\r
448 if (o3_status != '') {
\r
456 // LAYER GENERATION FUNCTIONS
\r
458 // These functions just handle popup content with tags that should adhere to the W3C standards specification.
\r
460 // Makes simple table without caption
\r
461 function ol_content_simple(text) {
\r
462 txt='<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="' + o3_cellpad + '" cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' : '>')+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>';
\r
464 set_background("");
\r
468 // Makes table with caption and optional close link
\r
469 function ol_content_caption(text,title,close) {
\r
472 closeevent="onmouseover";
\r
473 if (o3_closeclick==1) closeevent= (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick";
\r
474 if (o3_capicon!="") {
\r
475 nameId=' hspace=\"5\"'+' align=\"middle\" alt=\"\"';
\r
476 if (typeof o3_dragimg!='undefined'&&o3_dragimg) nameId=' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';
\r
477 o3_capicon='<img src=\"'+o3_capicon+'\"'+nameId+' />';
\r
480 if (close != "") closing='<td '+(o3_closefontclass ? 'class="'+o3_closefontclass : 'align="RIGHT')+'"><a href="javascript:return '+fnRef+'cClick();" '+closeevent+'="return '+fnRef+'cClick();">'+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+'</a></td>';
\r
481 txt='<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_bgbackground+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td'+(o3_captionfontclass ? ' class="'+o3_captionfontclass+'">' : '>')+(o3_captionfontclass ? '' : '<b>'+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'</b>')+'</td>'+closing+'</tr></table><table width="100%" border="0" cellpadding="' + o3_cellpad + '" cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' :'>')+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + '</td></tr></table></td></tr></table>';
\r
483 set_background("");
\r
487 // Sets the background picture,padding and lots more. :)
\r
488 function ol_content_background(text,picture,hasfullhtml) {
\r
492 txt='<table width="'+o3_width+'" border="0" cellpadding="0" cellspacing="0" height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'+o3_padxl+'"></td><td valign="TOP" width="'+(o3_width-o3_padxl-o3_padxr)+'">'+wrapStr(0,o3_textsize,'text')+text+wrapStr(1,o3_textsize)+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>';
\r
495 set_background(picture);
\r
499 // Loads a picture into the div.
\r
500 function set_background(pic) {
\r
503 over.background.src = null;
\r
504 } else if (over.style) {
\r
505 over.style.backgroundImage = "none";
\r
509 over.background.src = pic;
\r
510 } else if (over.style) {
\r
511 over.style.backgroundImage = "url("+pic+")";
\r
517 // HANDLING FUNCTIONS
\r
520 // Displays the popup
\r
521 function disp(statustext) {
\r
522 runHook("disp", FBEFORE);
\r
524 if (o3_allowmove == 0) {
\r
525 runHook("placeLayer", FREPLACE);
\r
526 runHook("showObject", FREPLACE, over);
\r
527 o3_allowmove = (o3_sticky || o3_followmouse==0) ? 0 : 1;
\r
530 runHook("disp", FAFTER);
\r
532 if (statustext != "") self.status = statustext;
\r
535 // Creates the actual popup structure
\r
536 function createPopup(lyrContent){
\r
537 runHook("createPopup", FBEFORE);
\r
539 if (o3_wrap && !(olNs4 || olOp)) {
\r
541 over.style.pixelWidth = 0;
\r
542 } else if (olNs6) {
\r
543 repositionTo(over, 0, -over.offsetHeight);
\r
547 layerWrite(lyrContent);
\r
549 // Have to set o3_width for placeLayer() routine if o3_wrap is turned on
\r
550 if (o3_wrap) o3_width=(olNs4 ? over.clip.width : over.offsetWidth);
\r
552 runHook("createPopup", FAFTER, lyrContent);
\r
557 // Decides where we want the popup.
\r
558 function placeLayer() {
\r
559 var placeX, placeY, widthFix = 0;
\r
561 // HORIZONTAL PLACEMENT
\r
562 if (eval('o3_frame.'+docRoot) && eval("typeof o3_frame."+docRoot+".clientWidth=='number'") && eval('o3_frame.'+docRoot+'.clientWidth')) {
\r
563 iwidth = eval('o3_frame.'+docRoot+'.clientWidth');
\r
564 } else if (typeof(o3_frame.innerWidth) == 'number') {
\r
565 widthFix = Math.ceil(1.2*(o3_frame.outerWidth - o3_frame.innerWidth));
\r
566 iwidth = o3_frame.innerWidth;
\r
569 // Horizontal scroll offset
\r
570 winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : o3_frame.pageXOffset;
\r
571 var parsedWidth = parseInt(o3_width);
\r
573 if (o3_fixx > -1 || o3_relx != null) {
\r
575 placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx);
\r
577 // If HAUTO, decide what to use.
\r
578 if (o3_hauto == 1) {
\r
579 if ((o3_x - winoffset) > (iwidth / 2)) {
\r
587 if (o3_hpos == CENTER) { // Center
\r
588 placeX = o3_x+o3_offsetx-(parsedWidth/2);
\r
590 if (placeX < winoffset) placeX = winoffset;
\r
593 if (o3_hpos == RIGHT) { // Right
\r
594 placeX = o3_x+o3_offsetx;
\r
596 if ((placeX+parsedWidth) > (winoffset+iwidth - widthFix)) {
\r
597 placeX = iwidth+winoffset - parsedWidth - widthFix;
\r
598 if (placeX < 0) placeX = 0;
\r
601 if (o3_hpos == LEFT) { // Left
\r
602 placeX = o3_x-o3_offsetx-parsedWidth;
\r
603 if (placeX < winoffset) placeX = winoffset;
\r
607 if (o3_snapx > 1) {
\r
608 var snapping = placeX % o3_snapx;
\r
610 if (o3_hpos == LEFT) {
\r
611 placeX = placeX - (o3_snapx+snapping);
\r
613 // CENTER and RIGHT
\r
614 placeX = placeX+(o3_snapx - snapping);
\r
617 if (placeX < winoffset) placeX = winoffset;
\r
621 // VERTICAL PLACEMENT
\r
622 if (eval('o3_frame.'+docRoot) && eval("typeof o3_frame."+docRoot+".clientHeight=='number'") && eval('o3_frame.'+docRoot+'.clientHeight')) {
\r
623 iheight = eval('o3_frame.'+docRoot+'.clientHeight');
\r
624 } else if (typeof(o3_frame.innerHeight)=='number') {
\r
625 iheight = o3_frame.innerHeight;
\r
628 // Vertical scroll offset
\r
629 scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : o3_frame.pageYOffset;
\r
630 var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight));
\r
632 if (o3_fixy > -1 || o3_rely != null) {
\r
634 placeY=(o3_rely != null ? (o3_rely < 0 ? scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy);
\r
636 // If VAUTO, decide what to use.
\r
637 if (o3_vauto == 1) {
\r
638 if ((o3_y - scrolloffset) > (iheight/2)) {
\r
646 if (o3_vpos == ABOVE) {
\r
647 if (o3_aboveheight == 0) o3_aboveheight = parsedHeight;
\r
649 placeY = o3_y - (o3_aboveheight+o3_offsety);
\r
650 if (placeY < scrolloffset) placeY = scrolloffset;
\r
653 placeY = o3_y+o3_offsety;
\r
657 if (o3_snapy > 1) {
\r
658 var snapping = placeY % o3_snapy;
\r
660 if (o3_aboveheight > 0 && o3_vpos == ABOVE) {
\r
661 placeY = placeY - (o3_snapy+snapping);
\r
663 placeY = placeY+(o3_snapy - snapping);
\r
666 if (placeY < scrolloffset) placeY = scrolloffset;
\r
670 // Actually move the object.
\r
671 repositionTo(over, placeX, placeY);
\r
675 function olMouseMove(e) {
\r
676 var e = (e) ? e : event;
\r
681 } else if (e.clientX) {
\r
682 o3_x = eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft');
\r
683 o3_y = eval('e.clientY+o3_frame.'+docRoot+'.scrollTop');
\r
686 if (o3_allowmove == 1) runHook("placeLayer", FREPLACE);
\r
688 // MouseOut handler
\r
689 if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) {
\r
691 hoveringSwitch = !hoveringSwitch;
\r
695 // Fake function for 3.0 users.
\r
696 function no_overlib() { return ver3fix; }
\r
698 // Capture the mouse and chain other scripts.
\r
699 function olMouseCapture() {
\r
700 capExtent = document;
\r
701 var fN, mseHandler = olMouseMove;
\r
702 var re = /function[ ]+(\w+)\(/;
\r
704 if (document.onmousemove || (!olIe4 && window.onmousemove)) {
\r
705 if (window.onmousemove) capExtent = window;
\r
706 fN = capExtent.onmousemove.toString().match(re);
\r
708 if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove') {
\r
709 olCheckMouseCapture = false;
\r
712 var str = fN[1]+'(e); ' + 'olMouseMove(e); ';
\r
713 mseHandler = new Function('e', str);
\r
716 capExtent.onmousemove = mseHandler;
\r
717 if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE);
\r
722 // PARSING FUNCTIONS
\r
725 // Does the actual command parsing.
\r
726 function parseTokens(pf, ar) {
\r
727 // What the next argument is expected to be.
\r
728 var v, mode=-1, par = (pf != 'ol_');
\r
729 var fnMark = (par && !ar.length ? 1 : 0);
\r
731 for (i = 0; i < ar.length; i++) {
\r
733 // Arg is maintext,unless its a number between pmStart and pmUpper
\r
734 // then its a command.
\r
735 if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {
\r
736 fnMark = (par ? 1 : 0);
\r
737 i--; // backup one so that the next block can parse it
\r
741 ol_text = ar[i].toString();
\r
744 o3_text=ar[i].toString();
\r
749 // Note: NS4 doesn't like switch cases with vars.
\r
750 if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; }
\r
751 if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; }
\r
752 if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; }
\r
753 if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; }
\r
754 if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; }
\r
755 if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; }
\r
756 if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; }
\r
757 if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); continue; }
\r
758 if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; }
\r
759 if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; }
\r
760 if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; }
\r
761 if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; }
\r
762 if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; }
\r
763 if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; }
\r
764 if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; }
\r
765 if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; }
\r
766 if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; }
\r
767 if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; }
\r
768 if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; }
\r
769 if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; }
\r
770 if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; }
\r
771 if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again.
\r
772 if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; }
\r
773 if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; }
\r
774 if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; }
\r
775 if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; }
\r
776 if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; }
\r
777 if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; }
\r
778 if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; }
\r
779 if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; }
\r
780 if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; }
\r
781 if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; }
\r
782 if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; }
\r
783 if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; }
\r
784 if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); continue; }
\r
785 if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; }
\r
786 if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; }
\r
787 if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; }
\r
788 if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; }
\r
789 if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; }
\r
790 if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; }
\r
791 if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; }
\r
792 if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; }
\r
793 if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i]; opt_FUNCTION(v); } continue; }
\r
794 if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; }
\r
795 if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; }
\r
796 if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; }
\r
797 if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; }
\r
798 if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; }
\r
799 if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; }
\r
800 if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff == 0) ? 1 : 0'); continue; }
\r
801 if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; }
\r
802 if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; }
\r
803 if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[++i]+'"'); continue; }
\r
804 if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[++i]+'"'); continue; }
\r
805 if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[++i]+'"'); continue; }
\r
806 if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[++i]+'"'); continue; }
\r
807 if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[++i]+'"'); continue; }
\r
808 i = parseCmdLine(pf, i, ar);
\r
812 if (fnMark && o3_function) o3_text = o3_function();
\r
814 if ((pf == 'o3_') && o3_wrap) {
\r
817 if (olOp || (olIe4 && isMac)) {
\r
818 var tReg=/<.*\n*>/ig;
\r
819 if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, ' ');
\r
820 if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, ' ');
\r
823 if ((pf == 'o3_') && o3_sticky) {
\r
824 if (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close;
\r
825 if (o3_mouseoff && (o3_frame == ol_frame)) opt_NOCLOSE(' ');
\r
834 // Writes to a layer
\r
835 function layerWrite(txt) {
\r
838 var lyr = o3_frame.document.overDiv.document
\r
841 } else if (typeof over.innerHTML != 'undefined') {
\r
842 if (olIe5 && isMac) over.innerHTML = '';
\r
843 over.innerHTML = txt;
\r
845 range = o3_frame.document.createRange();
\r
846 range.setStartAfter(over);
\r
847 domfrag = range.createContextualFragment(txt);
\r
849 while (over.hasChildNodes()) {
\r
850 over.removeChild(over.lastChild);
\r
853 over.appendChild(domfrag);
\r
857 // Make an object visible
\r
858 function showObject(obj) {
\r
859 runHook("showObject", FBEFORE);
\r
861 var theObj=(olNs4 ? obj : obj.style);
\r
862 theObj.visibility = 'visible';
\r
864 runHook("showObject", FAFTER);
\r
868 function hideObject(obj) {
\r
869 runHook("hideObject", FBEFORE);
\r
871 var theObj=(olNs4 ? obj : obj.style);
\r
872 theObj.visibility = 'hidden';
\r
874 if (o3_timerid > 0) clearTimeout(o3_timerid);
\r
875 if (o3_delayid > 0) clearTimeout(o3_delayid);
\r
881 if (over.onmouseout || over.onmouseover) {
\r
882 if (olNs4) over.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER);
\r
883 over.onmouseout = over.onmouseover = null;
\r
886 runHook("hideObject", FAFTER);
\r
890 function repositionTo(obj, xL, yL) {
\r
891 var theObj=(olNs4 ? obj : obj.style);
\r
892 theObj.left = xL + (!olNs4 ? 'px' : 0);
\r
893 theObj.top = yL + (!olNs4 ? 'px' : 0);
\r
896 // Check position of cursor relative to overDiv DIVision; mouseOut function
\r
897 function cursorOff() {
\r
898 var left = parseInt(over.style.left);
\r
899 var top = parseInt(over.style.top);
\r
900 var right = left+over.offsetWidth;
\r
901 var bottom = top+ over.offsetHeight;
\r
903 if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return true;
\r
910 // COMMAND FUNCTIONS
\r
913 // Calls callme or the default function.
\r
914 function opt_FUNCTION(callme) {
\r
915 o3_text = (callme ? (typeof callme=='string' ? (/.+\(.*\)/.test(callme) ? eval(callme) : callme) : callme()) : (o3_function ? o3_function() : 'No Function'));
\r
921 function opt_NOCLOSE(unused) {
\r
922 if (!unused) o3_close = "";
\r
925 over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER);
\r
926 over.onmouseover = function () { if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid = 0; } }
\r
927 over.onmouseout = cClick;
\r
929 over.onmouseover = function () {hoveringSwitch = true; if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } }
\r
935 // Function to scan command line arguments for multiples
\r
936 function opt_MULTIPLEARGS(i, args, parameter) {
\r
937 var k = i, l, re, pV, str = '';
\r
939 for(k=i; k<args.length; k++) {
\r
940 str += args[k] + ',';
\r
941 if(typeof args[k] == 'number'&&args[k]>pmStart) break;
\r
943 if(k >= args.length) l = str.length-1;
\r
945 re = eval('/,' + args[k] + '/');
\r
946 l = str.search(re);
\r
949 k--; // reduce by one so the for loop this is in works correctly
\r
950 str = str.substring(0, l);
\r
951 pV = (olNs4&&/cellpad/i.test(parameter)) ? str.split(',')[0] : str;
\r
952 eval(parameter + '="' + pV + '"');
\r
957 // Remove in texts when done.
\r
958 function nbspCleanup() {
\r
959 if (o3_wrap && (olOp || (olIe4 && isMac))) {
\r
960 o3_text = o3_text.replace(/\ /g, ' ');
\r
961 o3_cap = o3_cap.replace(/\ /g, ' ');
\r
965 // Escape embedded single quotes in text strings
\r
966 function escSglQuote(str) {
\r
967 return str.toString().replace(/'/g,"\\'");
\r
970 // Onload handler for window onload event
\r
971 function OLonLoad_handler(e) {
\r
972 if (!olLoaded) olLoaded=1; // indicates that all modules have loaded now
\r
974 // remove the OLonload_handler for Ns6+, Mozilla based browsers, and IE
\r
975 if (window.removeEventListener) window.removeEventListener("load",OLonLoad_handler,true);
\r
976 else if (window.detachEvent) window.detachEvent("onload",OLonLoad_handler);
\r
978 // Route the event to the normal handler in Nx4.x
\r
979 if (olNs4) routeEvent(e);
\r
982 // Wraps strings in Layer Generation Functions with the correct tags
\r
983 // endWrap true(if end tag) or false if start tag
\r
984 // fontSizeStr - font size string such as '1' or '10px'
\r
985 // whichString is being wrapped -- 'text', 'caption', or 'close'
\r
986 function wrapStr(endWrap,fontSizeStr,whichString) {
\r
987 var fontStr, fontColor, isClose=((whichString=='close') ? 1 : 0), hasDims=/[%\-a-z]+$/.test(fontSizeStr);
\r
988 fontSizeStr = (olNs4) ? (!hasDims ? fontSizeStr : '1') : fontSizeStr;
\r
989 if (endWrap) return (hasDims&&!olNs4) ? (isClose ? '</span>' : '</div>') : '</font>';
\r
991 fontStr='o3_'+whichString+'font';
\r
992 fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color';
\r
993 return (hasDims&&!olNs4) ? (isClose ? '<span style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">' : '<div style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">') : '<font face="'+eval(fontStr)+'" color="'+eval(fontColor)+'" size="'+(parseInt(fontSizeStr)>7 ? '7' : fontSizeStr)+'">';
\r
997 // Quotes Multi word font names; needed for CSS Standards adherence in font-family
\r
998 function quoteMultiNameFonts(theFont) {
\r
999 var v, pM=theFont.split(',');
\r
1000 for (var i=0; i<pM.length; i++) {
\r
1002 v=v.replace(/^\s+/,'').replace(/\s+$/,'');
\r
1003 if(/\s/.test(v) && !/['"]/.test(v)) {
\r
1011 // dummy function which will be overridden
\r
1012 function isExclusive(args) {
\r
1016 // PLUGIN ACTIVATION FUNCTIONS
\r
1019 // Runs plugin functions to set runtime variables.
\r
1020 function setRunTimeVariables(){
\r
1021 if (typeof runTime != 'undefined' && runTime.length) {
\r
1022 for (var k = 0; k < runTime.length; k++) {
\r
1028 // Runs plugin functions to parse commands.
\r
1029 function parseCmdLine(pf, i, args) {
\r
1030 if (typeof cmdLine != 'undefined' && cmdLine.length) {
\r
1031 for (var k = 0; k < cmdLine.length; k++) {
\r
1032 var j = cmdLine[k](pf, i, args);
\r
1043 // Runs plugin functions to do things after parse.
\r
1044 function postParseChecks(){
\r
1045 if (typeof postParse != 'undefined' && postParse.length) {
\r
1046 for (var k = 0; k < postParse.length; k++) {
\r
1047 if (postParse[k]()) continue;
\r
1048 return false; // end now since have an error
\r
1056 // PLUGIN REGISTRATION FUNCTIONS
\r
1059 // Registers commands and creates constants.
\r
1060 function registerCommands(cmdStr) {
\r
1061 if (typeof cmdStr!='string') return;
\r
1063 var pM = cmdStr.split(',');
\r
1064 pms = pms.concat(pM);
\r
1066 for (var i = 0; i< pM.length; i++) {
\r
1067 eval(pM[i].toUpperCase()+'='+pmCount++);
\r
1071 // Register a function to hook at a certain point.
\r
1072 function registerHook(fnHookTo, fnRef, hookType, optPm) {
\r
1073 var hookPt, last = typeof optPm;
\r
1075 if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return;
\r
1076 if (typeof hookPts == 'undefined') hookPts = new Array();
\r
1077 if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference();
\r
1079 hookPt = hookPts[fnHookTo];
\r
1081 if (hookType != null) {
\r
1082 if (hookType == FREPLACE) {
\r
1083 hookPt.ovload = fnRef; // replace normal overlib routine
\r
1084 if (fnHookTo.indexOf('ol_content_') > -1) hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef;
\r
1086 } else if (hookType == FBEFORE || hookType == FAFTER) {
\r
1087 var hookPt=(hookType == 1 ? hookPt.before : hookPt.after);
\r
1089 if (typeof fnRef == 'object') {
\r
1090 hookPt = hookPt.concat(fnRef);
\r
1092 hookPt[hookPt.length++] = fnRef;
\r
1095 if (optPm) hookPt = reOrder(hookPt, fnRef, optPm);
\r
1097 } else if (hookType == FALTERNATE) {
\r
1098 if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = fnRef;
\r
1105 // Register a function that will set runtime variables.
\r
1106 function registerRunTimeFunction(fn) {
\r
1107 if (isFunction(fn)) {
\r
1108 if (typeof runTime == 'undefined') runTime = new Array();
\r
1109 if (typeof fn == 'object') {
\r
1110 runTime = runTime.concat(fn);
\r
1112 runTime[runTime.length++] = fn;
\r
1117 // Register a function that will handle command parsing.
\r
1118 function registerCmdLineFunction(fn){
\r
1119 if (isFunction(fn)) {
\r
1120 if (typeof cmdLine == 'undefined') cmdLine = new Array();
\r
1121 if (typeof fn == 'object') {
\r
1122 cmdLine = cmdLine.concat(fn);
\r
1124 cmdLine[cmdLine.length++] = fn;
\r
1129 // Register a function that does things after command parsing.
\r
1130 function registerPostParseFunction(fn){
\r
1131 if (isFunction(fn)) {
\r
1132 if (typeof postParse == 'undefined') postParse = new Array();
\r
1133 if (typeof fn == 'object') {
\r
1134 postParse = postParse.concat(fn);
\r
1136 postParse[postParse.length++] = fn;
\r
1142 // PLUGIN REGISTRATION FUNCTIONS
\r
1145 // Runs any hooks registered.
\r
1146 function runHook(fnHookTo, hookType) {
\r
1147 var l = hookPts[fnHookTo], optPm, arS, ar = runHook.arguments;
\r
1149 if (hookType == FREPLACE) {
\r
1150 arS = argToString(ar, 2);
\r
1152 if (typeof l == 'undefined' || !(l = l.ovload)) return eval(fnHookTo+'('+arS+')');
\r
1153 else return eval('l('+arS+')');
\r
1155 } else if (hookType == FBEFORE || hookType == FAFTER) {
\r
1156 if (typeof l == 'undefined') return;
\r
1157 l=(hookType == 1 ? l.before : l.after);
\r
1159 if (!l.length) return;
\r
1161 arS = argToString(ar, 2);
\r
1162 for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')');
\r
1164 } else if (hookType == FALTERNATE) {
\r
1166 arS = argToString(ar, 3);
\r
1168 if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') {
\r
1169 return eval(fnHookTo+'('+arS+')');
\r
1171 return eval('l('+arS+')');
\r
1177 // UTILITY FUNCTIONS
\r
1180 // Checks if something is a function.
\r
1181 function isFunction(fnRef) {
\r
1184 if (typeof fnRef == 'object') {
\r
1185 for (var i = 0; i < fnRef.length; i++) {
\r
1186 if (typeof fnRef[i]=='function') continue;
\r
1190 } else if (typeof fnRef != 'function') {
\r
1197 // Converts an array into an argument string for use in eval.
\r
1198 function argToString(array, strtInd, argName) {
\r
1199 var jS = strtInd, aS = '', ar = array;
\r
1200 argName=(argName ? argName : 'ar');
\r
1202 if (ar.length > jS) {
\r
1203 for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], ';
\r
1204 aS = aS.substring(0, aS.length-2);
\r
1210 // Places a hook in the correct position in a hook point.
\r
1211 function reOrder(hookPt, fnRef, order) {
\r
1212 if (!order || typeof order == 'undefined' || typeof order == 'number') return;
\r
1214 var newPt = new Array(), match;
\r
1216 if (typeof order=='function') {
\r
1217 if (typeof fnRef=='object') {
\r
1218 newPt = newPt.concat(fnRef);
\r
1220 newPt[newPt.length++]=fnRef;
\r
1223 for (var i = 0; i < hookPt.length; i++) {
\r
1225 if (typeof fnRef == 'function' && hookPt[i] == fnRef) {
\r
1228 for(var j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {
\r
1233 if (!match) newPt[newPt.length++] = hookPt[i];
\r
1236 newPt[newPt.length++] = order;
\r
1238 } else if (typeof order == 'object') {
\r
1239 if (typeof fnRef == 'object') {
\r
1240 newPt = newPt.concat(fnRef);
\r
1242 newPt[newPt.length++] = fnRef;
\r
1245 for (var j = 0; j < hookPt.length; j++) {
\r
1247 if (typeof fnRef == 'function' && hookPt[j] == fnRef) {
\r
1250 for (var i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {
\r
1255 if (!match) newPt[newPt.length++]=hookPt[j];
\r
1258 for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
\r
1261 for (var j = 0; j < hookPt.length; j++) {
\r
1263 for (var i = 0; i < order.length; i++) {
\r
1264 if (hookPt[j] == order[i]) {
\r
1269 if (!match) newPt[newPt.length++] = hookPt[j];
\r
1271 newPt = newPt.concat(order);
\r
1274 for(i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
\r
1280 // OBJECT CONSTRUCTORS
\r
1283 // Object for handling hooks.
\r
1284 function FunctionReference() {
\r
1285 this.ovload = null;
\r
1286 this.before = new Array();
\r
1287 this.after = new Array();
\r
1288 this.alt = new Array();
\r
1291 // Object for simple access to the overLIB version used.
\r
1292 // Examples: simpleversion:351 major:3 minor:5 revision:1
\r
1293 function Info(version, prerelease) {
\r
1294 this.version = version;
\r
1295 this.prerelease = prerelease;
\r
1297 this.simpleversion = parseInt(this.version*100);
\r
1298 this.major = parseInt(this.simpleversion / 100);
\r
1299 this.minor = parseInt(this.simpleversion / 10) - this.major * 10;
\r
1300 this.revision = parseInt(this.simpleversion) - this.major * 100 - this.minor * 10;
\r
1306 // STANDARD REGISTRATIONS
\r
1308 registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSOFF);
\r
1309 registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSOFF);
\r
1310 registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSOFF);
\r
1311 registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS);
\r
1312 registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS);
\r
1313 registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSCLASS);
\r
1314 registerHook("hideObject", nbspCleanup, FAFTER);
\r