Close #595.
[platal.git] / htdocs / javascript / overlib.js
1 //\/////
2 //\ overLIB 4.14 - You may not remove or change this notice.
3 //\ Copyright Erik Bosrup 1998-2004. All rights reserved.
4 //\
5 //\ Contributors are listed on the homepage.
6 //\ This file might be old, always check for the latest version at:
7 //\ http://www.bosrup.com/web/overlib/
8 //\
9 //\ Please read the license agreement (available through the link above)
10 //\ before using overLIB. Direct any licensing questions to erik@bosrup.com.
11 //\
12 //\ Do not sell this as your own work or remove this copyright notice.
13 //\ For full details on copying or changing this script please read the
14 //\ license agreement at the link above. Please give credit on sites that
15 //\ use overLIB and submit changes of the script so other people can use
16 //\ them as well.
17 // $Revision: 1.107 $ $Date: 2004/12/26 15:34:56 $
18 //\/////
19 //\mini
20
21 ////////
22 // PRE-INIT
23 // Ignore these lines, configuration is below.
24 ////////
25 var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.14', 1);
26 var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3; var FCHAIN=4;
27 var olHideForm=0; // parameter for hiding SELECT and ActiveX elements in IE5.5+
28 var olHautoFlag = 0; // flags for over-riding VAUTO and HAUTO if corresponding
29 var olVautoFlag = 0; // positioning commands are used on the command line
30 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,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass');
31
32 ////////
33 // DEFAULT CONFIGURATION
34 // Settings you want everywhere are set here. All of this can also be
35 // changed on your html page or through an overLIB call.
36 ////////
37 if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#CCCCFF";
38 if (typeof ol_bgcolor=='undefined') var ol_bgcolor="#333399";
39 if (typeof ol_textcolor=='undefined') var ol_textcolor="#000000";
40 if (typeof ol_capcolor=='undefined') var ol_capcolor="#FFFFFF";
41 if (typeof ol_closecolor=='undefined') var ol_closecolor="#9999FF";
42 if (typeof ol_textfont=='undefined') var ol_textfont="Verdana,Arial,Helvetica";
43 if (typeof ol_captionfont=='undefined') var ol_captionfont="Verdana,Arial,Helvetica";
44 if (typeof ol_closefont=='undefined') var ol_closefont="Verdana,Arial,Helvetica";
45 if (typeof ol_textsize=='undefined') var ol_textsize="1";
46 if (typeof ol_captionsize=='undefined') var ol_captionsize="1";
47 if (typeof ol_closesize=='undefined') var ol_closesize="1";
48 if (typeof ol_width=='undefined') var ol_width="200";
49 if (typeof ol_border=='undefined') var ol_border="1";
50 if (typeof ol_cellpad=='undefined') var ol_cellpad=2;
51 if (typeof ol_offsetx=='undefined') var ol_offsetx=10;
52 if (typeof ol_offsety=='undefined') var ol_offsety=10;
53 if (typeof ol_text=='undefined') var ol_text="Default Text";
54 if (typeof ol_cap=='undefined') var ol_cap="";
55 if (typeof ol_sticky=='undefined') var ol_sticky=0;
56 if (typeof ol_background=='undefined') var ol_background="";
57 if (typeof ol_close=='undefined') var ol_close="Close";
58 if (typeof ol_hpos=='undefined') var ol_hpos=RIGHT;
59 if (typeof ol_status=='undefined') var ol_status="";
60 if (typeof ol_autostatus=='undefined') var ol_autostatus=0;
61 if (typeof ol_height=='undefined') var ol_height=-1;
62 if (typeof ol_snapx=='undefined') var ol_snapx=0;
63 if (typeof ol_snapy=='undefined') var ol_snapy=0;
64 if (typeof ol_fixx=='undefined') var ol_fixx=-1;
65 if (typeof ol_fixy=='undefined') var ol_fixy=-1;
66 if (typeof ol_relx=='undefined') var ol_relx=null;
67 if (typeof ol_rely=='undefined') var ol_rely=null;
68 if (typeof ol_fgbackground=='undefined') var ol_fgbackground="";
69 if (typeof ol_bgbackground=='undefined') var ol_bgbackground="";
70 if (typeof ol_padxl=='undefined') var ol_padxl=1;
71 if (typeof ol_padxr=='undefined') var ol_padxr=1;
72 if (typeof ol_padyt=='undefined') var ol_padyt=1;
73 if (typeof ol_padyb=='undefined') var ol_padyb=1;
74 if (typeof ol_fullhtml=='undefined') var ol_fullhtml=0;
75 if (typeof ol_vpos=='undefined') var ol_vpos=BELOW;
76 if (typeof ol_aboveheight=='undefined') var ol_aboveheight=0;
77 if (typeof ol_capicon=='undefined') var ol_capicon="";
78 if (typeof ol_frame=='undefined') var ol_frame=self;
79 if (typeof ol_timeout=='undefined') var ol_timeout=0;
80 if (typeof ol_function=='undefined') var ol_function=null;
81 if (typeof ol_delay=='undefined') var ol_delay=0;
82 if (typeof ol_hauto=='undefined') var ol_hauto=0;
83 if (typeof ol_vauto=='undefined') var ol_vauto=0;
84 if (typeof ol_closeclick=='undefined') var ol_closeclick=0;
85 if (typeof ol_wrap=='undefined') var ol_wrap=0;
86 if (typeof ol_followmouse=='undefined') var ol_followmouse=1;
87 if (typeof ol_mouseoff=='undefined') var ol_mouseoff=0;
88 if (typeof ol_closetitle=='undefined') var ol_closetitle='Close';
89 if (typeof ol_compatmode=='undefined') var ol_compatmode=0;
90 if (typeof ol_css=='undefined') var ol_css=CSSOFF;
91 if (typeof ol_fgclass=='undefined') var ol_fgclass="";
92 if (typeof ol_bgclass=='undefined') var ol_bgclass="";
93 if (typeof ol_textfontclass=='undefined') var ol_textfontclass="";
94 if (typeof ol_captionfontclass=='undefined') var ol_captionfontclass="";
95 if (typeof ol_closefontclass=='undefined') var ol_closefontclass="";
96
97 ////////
98 // ARRAY CONFIGURATION
99 ////////
100
101 // You can use these arrays to store popup text here instead of in the html.
102 if (typeof ol_texts=='undefined') var ol_texts = new Array("Text 0", "Text 1");
103 if (typeof ol_caps=='undefined') var ol_caps = new Array("Caption 0", "Caption 1");
104
105 ////////
106 // END OF CONFIGURATION
107 // Don't change anything below this line, all configuration is above.
108 ////////
109
110
111
112
113
114 ////////
115 // INIT
116 ////////
117 // Runtime variables init. Don't change for config!
118 var o3_text="";
119 var o3_cap="";
120 var o3_sticky=0;
121 var o3_background="";
122 var o3_close="Close";
123 var o3_hpos=RIGHT;
124 var o3_offsetx=2;
125 var o3_offsety=2;
126 var o3_fgcolor="";
127 var o3_bgcolor="";
128 var o3_textcolor="";
129 var o3_capcolor="";
130 var o3_closecolor="";
131 var o3_width=100;
132 var o3_border=1;
133 var o3_cellpad=2;
134 var o3_status="";
135 var o3_autostatus=0;
136 var o3_height=-1;
137 var o3_snapx=0;
138 var o3_snapy=0;
139 var o3_fixx=-1;
140 var o3_fixy=-1;
141 var o3_relx=null;
142 var o3_rely=null;
143 var o3_fgbackground="";
144 var o3_bgbackground="";
145 var o3_padxl=0;
146 var o3_padxr=0;
147 var o3_padyt=0;
148 var o3_padyb=0;
149 var o3_fullhtml=0;
150 var o3_vpos=BELOW;
151 var o3_aboveheight=0;
152 var o3_capicon="";
153 var o3_textfont="Verdana,Arial,Helvetica";
154 var o3_captionfont="Verdana,Arial,Helvetica";
155 var o3_closefont="Verdana,Arial,Helvetica";
156 var o3_textsize="1";
157 var o3_captionsize="1";
158 var o3_closesize="1";
159 var o3_frame=self;
160 var o3_timeout=0;
161 var o3_timerid=0;
162 var o3_allowmove=0;
163 var o3_function=null;
164 var o3_delay=0;
165 var o3_delayid=0;
166 var o3_hauto=0;
167 var o3_vauto=0;
168 var o3_closeclick=0;
169 var o3_wrap=0;
170 var o3_followmouse=1;
171 var o3_mouseoff=0;
172 var o3_closetitle='';
173 var o3_compatmode=0;
174 var o3_css=CSSOFF;
175 var o3_fgclass="";
176 var o3_bgclass="";
177 var o3_textfontclass="";
178 var o3_captionfontclass="";
179 var o3_closefontclass="";
180
181 // Display state variables
182 var o3_x = 0;
183 var o3_y = 0;
184 var o3_showingsticky = 0;
185 var o3_removecounter = 0;
186
187 // Our layer
188 var over = null;
189 var fnRef, hoveringSwitch = false;
190 var olHideDelay;
191
192 // Decide browser version
193 var isMac = (navigator.userAgent.indexOf("Mac") != -1);
194 var olOp = (navigator.userAgent.toLowerCase().indexOf('opera') > -1 && document.createTextNode); // Opera 7
195 var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4);
196 var olNs6 = (document.getElementById) ? true : false;
197 var olKq = (olNs6 && /konqueror/i.test(navigator.userAgent));
198 var olIe4 = (document.all) ? true : false;
199 var olIe5 = false;
200 var olIe55 = false; // Added additional variable to identify IE5.5+
201 var docRoot = 'document.body';
202
203 // Resize fix for NS4.x to keep track of layer
204 if (olNs4) {
205 var oW = window.innerWidth;
206 var oH = window.innerHeight;
207 window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); }
208 }
209
210 // Microsoft Stupidity Check(tm).
211 if (olIe4) {
212 var agent = navigator.userAgent;
213 if (/MSIE/.test(agent)) {
214 var versNum = parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]);
215 if (versNum >= 5){
216 olIe5=true;
217 olIe55=(versNum>=5.5&&!olOp) ? true : false;
218 if (olNs6) olNs6=false;
219 }
220 }
221 if (olNs6) olIe4 = false;
222 }
223
224 // Check for compatability mode.
225 if (document.compatMode && document.compatMode == 'CSS1Compat') {
226 docRoot= ((olIe4 && !olOp) ? 'document.documentElement' : docRoot);
227 }
228
229 // Add window onload handlers to indicate when all modules have been loaded
230 // For Netscape 6+ and Mozilla, uses addEventListener method on the window object
231 // For IE it uses the attachEvent method of the window object and for Netscape 4.x
232 // it sets the window.onload handler to the OLonload_handler function for Bubbling
233 if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,false);
234 else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler);
235
236 // Capture events, alt. diffuses the overlib function.
237 var olCheckMouseCapture = true;
238 if ((olNs4 || olNs6 || olIe4)) {
239 olMouseCapture();
240 } else {
241 overlib = no_overlib;
242 nd = no_overlib;
243 ver3fix = true;
244 }
245
246
247 ////////
248 // PUBLIC FUNCTIONS
249 ////////
250
251 // overlib(arg0,...,argN)
252 // Loads parameters into global runtime variables.
253 function overlib() {
254 if (!olLoaded || isExclusive(overlib.arguments)) return true;
255 if (olCheckMouseCapture) olMouseCapture();
256 if (over) {
257 over = (typeof over.id != 'string') ? o3_frame.document.all['overDiv'] : over;
258 cClick();
259 }
260
261 // Load defaults to runtime.
262 olHideDelay=0;
263 o3_text=ol_text;
264 o3_cap=ol_cap;
265 o3_sticky=ol_sticky;
266 o3_background=ol_background;
267 o3_close=ol_close;
268 o3_hpos=ol_hpos;
269 o3_offsetx=ol_offsetx;
270 o3_offsety=ol_offsety;
271 o3_fgcolor=ol_fgcolor;
272 o3_bgcolor=ol_bgcolor;
273 o3_textcolor=ol_textcolor;
274 o3_capcolor=ol_capcolor;
275 o3_closecolor=ol_closecolor;
276 o3_width=ol_width;
277 o3_border=ol_border;
278 o3_cellpad=ol_cellpad;
279 o3_status=ol_status;
280 o3_autostatus=ol_autostatus;
281 o3_height=ol_height;
282 o3_snapx=ol_snapx;
283 o3_snapy=ol_snapy;
284 o3_fixx=ol_fixx;
285 o3_fixy=ol_fixy;
286 o3_relx=ol_relx;
287 o3_rely=ol_rely;
288 o3_fgbackground=ol_fgbackground;
289 o3_bgbackground=ol_bgbackground;
290 o3_padxl=ol_padxl;
291 o3_padxr=ol_padxr;
292 o3_padyt=ol_padyt;
293 o3_padyb=ol_padyb;
294 o3_fullhtml=ol_fullhtml;
295 o3_vpos=ol_vpos;
296 o3_aboveheight=ol_aboveheight;
297 o3_capicon=ol_capicon;
298 o3_textfont=ol_textfont;
299 o3_captionfont=ol_captionfont;
300 o3_closefont=ol_closefont;
301 o3_textsize=ol_textsize;
302 o3_captionsize=ol_captionsize;
303 o3_closesize=ol_closesize;
304 o3_timeout=ol_timeout;
305 o3_function=ol_function;
306 o3_delay=ol_delay;
307 o3_hauto=ol_hauto;
308 o3_vauto=ol_vauto;
309 o3_closeclick=ol_closeclick;
310 o3_wrap=ol_wrap;
311 o3_followmouse=ol_followmouse;
312 o3_mouseoff=ol_mouseoff;
313 o3_closetitle=ol_closetitle;
314 o3_css=ol_css;
315 o3_compatmode=ol_compatmode;
316 o3_fgclass=ol_fgclass;
317 o3_bgclass=ol_bgclass;
318 o3_textfontclass=ol_textfontclass;
319 o3_captionfontclass=ol_captionfontclass;
320 o3_closefontclass=ol_closefontclass;
321
322 setRunTimeVariables();
323
324 fnRef = '';
325
326 // Special for frame support, over must be reset...
327 o3_frame = ol_frame;
328
329 if(!(over=createDivContainer())) return false;
330
331 parseTokens('o3_', overlib.arguments);
332 if (!postParseChecks()) return false;
333
334 if (o3_delay == 0) {
335 return runHook("olMain", FREPLACE);
336 } else {
337 o3_delayid = setTimeout("runHook('olMain', FREPLACE)", o3_delay);
338 return false;
339 }
340 }
341
342 // Clears popups if appropriate
343 function nd(time) {
344 if (olLoaded && !isExclusive()) {
345 hideDelay(time); // delay popup close if time specified
346
347 if (o3_removecounter >= 1) { o3_showingsticky = 0 };
348
349 if (o3_showingsticky == 0) {
350 o3_allowmove = 0;
351 if (over != null && o3_timerid == 0) runHook("hideObject", FREPLACE, over);
352 } else {
353 o3_removecounter++;
354 }
355 }
356
357 return true;
358 }
359
360 // The Close onMouseOver function for stickies
361 function cClick() {
362 if (olLoaded) {
363 runHook("hideObject", FREPLACE, over);
364 o3_showingsticky = 0;
365 }
366 return false;
367 }
368
369 // Method for setting page specific defaults.
370 function overlib_pagedefaults() {
371 parseTokens('ol_', overlib_pagedefaults.arguments);
372 }
373
374
375 ////////
376 // OVERLIB MAIN FUNCTION
377 ////////
378
379 // This function decides what it is we want to display and how we want it done.
380 function olMain() {
381 var layerhtml, styleType;
382 runHook("olMain", FBEFORE);
383
384 if (o3_background!="" || o3_fullhtml) {
385 // Use background instead of box.
386 layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml);
387 } else {
388 // They want a popup box.
389 styleType = (pms[o3_css-1-pmStart] == "cssoff" || pms[o3_css-1-pmStart] == "cssclass");
390
391 // Prepare popup background
392 if (o3_fgbackground != "") o3_fgbackground = "background=\""+o3_fgbackground+"\"";
393 if (o3_bgbackground != "") o3_bgbackground = (styleType ? "background=\""+o3_bgbackground+"\"" : o3_bgbackground);
394
395 // Prepare popup colors
396 if (o3_fgcolor != "") o3_fgcolor = (styleType ? "bgcolor=\""+o3_fgcolor+"\"" : o3_fgcolor);
397 if (o3_bgcolor != "") o3_bgcolor = (styleType ? "bgcolor=\""+o3_bgcolor+"\"" : o3_bgcolor);
398
399 // Prepare popup height
400 if (o3_height > 0) o3_height = (styleType ? "height=\""+o3_height+"\"" : o3_height);
401 else o3_height = "";
402
403 // Decide which kinda box.
404 if (o3_cap=="") {
405 // Plain
406 layerhtml = runHook('ol_content_simple', FALTERNATE, o3_css, o3_text);
407 } else {
408 // With caption
409 if (o3_sticky) {
410 // Show close text
411 layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, o3_close);
412 } else {
413 // No close text
414 layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, "");
415 }
416 }
417 }
418
419 // We want it to stick!
420 if (o3_sticky) {
421 if (o3_timerid > 0) {
422 clearTimeout(o3_timerid);
423 o3_timerid = 0;
424 }
425 o3_showingsticky = 1;
426 o3_removecounter = 0;
427 }
428
429 // Created a separate routine to generate the popup to make it easier
430 // to implement a plugin capability
431 if (!runHook("createPopup", FREPLACE, layerhtml)) return false;
432
433 // Prepare status bar
434 if (o3_autostatus > 0) {
435 o3_status = o3_text;
436 if (o3_autostatus > 1) o3_status = o3_cap;
437 }
438
439 // When placing the layer the first time, even stickies may be moved.
440 o3_allowmove = 0;
441
442 // Initiate a timer for timeout
443 if (o3_timeout > 0) {
444 if (o3_timerid > 0) clearTimeout(o3_timerid);
445 o3_timerid = setTimeout("cClick()", o3_timeout);
446 }
447
448 // Show layer
449 runHook("disp", FREPLACE, o3_status);
450 runHook("olMain", FAFTER);
451
452 return (olOp && event && event.type == 'mouseover' && !o3_status) ? '' : (o3_status != '');
453 }
454
455 ////////
456 // LAYER GENERATION FUNCTIONS
457 ////////
458 // These functions just handle popup content with tags that should adhere to the W3C standards specification.
459
460 // Makes simple table without caption
461 function ol_content_simple(text) {
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>';
463
464 set_background("");
465 return txt;
466 }
467
468 // Makes table with caption and optional close link
469 function ol_content_caption(text,title,close) {
470 var nameId;
471 closing="";
472 closeevent="onmouseover";
473 if (o3_closeclick==1) closeevent= (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick";
474 if (o3_capicon!="") {
475 nameId=' hspace=\"5\"'+' align=\"middle\" alt=\"\"';
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\"';
477 o3_capicon='<img src=\"'+o3_capicon+'\"'+nameId+' />';
478 }
479
480 if (close != "")
481 closing='<td '+(!o3_compatmode && o3_closefontclass ? 'class="'+o3_closefontclass : 'align="RIGHT')+'"><a href="javascript:return '+fnRef+'cClick();"'+((o3_compatmode && o3_closefontclass) ? ' class="' + o3_closefontclass + '" ' : ' ')+closeevent+'="return '+fnRef+'cClick();">'+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+'</a></td>';
482 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>';
483
484 set_background("");
485 return txt;
486 }
487
488 // Sets the background picture,padding and lots more. :)
489 function ol_content_background(text,picture,hasfullhtml) {
490 if (hasfullhtml) {
491 txt=text;
492 } else {
493 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)+(o3_textfontclass ? '" class="'+o3_textfontclass : '')+'">'+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>';
494 }
495
496 set_background(picture);
497 return txt;
498 }
499
500 // Loads a picture into the div.
501 function set_background(pic) {
502 if (pic == "") {
503 if (olNs4) {
504 over.background.src = null;
505 } else if (over.style) {
506 over.style.backgroundImage = "none";
507 }
508 } else {
509 if (olNs4) {
510 over.background.src = pic;
511 } else if (over.style) {
512 over.style.width=o3_width + 'px';
513 over.style.backgroundImage = "url("+pic+")";
514 }
515 }
516 }
517
518 ////////
519 // HANDLING FUNCTIONS
520 ////////
521 var olShowId=-1;
522
523 // Displays the popup
524 function disp(statustext) {
525 runHook("disp", FBEFORE);
526
527 if (o3_allowmove == 0) {
528 runHook("placeLayer", FREPLACE);
529 (olNs6&&olShowId<0) ? olShowId=setTimeout("runHook('showObject', FREPLACE, over)", 1) : runHook("showObject", FREPLACE, over);
530 o3_allowmove = (o3_sticky || o3_followmouse==0) ? 0 : 1;
531 }
532
533 runHook("disp", FAFTER);
534
535 if (statustext != "") self.status = statustext;
536 }
537
538 // Creates the actual popup structure
539 function createPopup(lyrContent){
540 runHook("createPopup", FBEFORE);
541
542 if (o3_wrap) {
543 var wd,ww,theObj=(olNs4 ? over : over.style);
544 theObj.top=theObj.left=-10000 + (!olNs4 ? 'px' : 0);
545 layerWrite(lyrContent);
546 wd = (olNs4 ? over.clip.width : over.offsetWidth);
547 if (wd > (ww=windowWidth())) {
548 lyrContent=lyrContent.replace(/\&nbsp;/g, ' ');
549 o3_width=ww;
550 o3_wrap=0;
551 }
552 }
553
554 layerWrite(lyrContent);
555
556 // Have to set o3_width for placeLayer() routine if o3_wrap is turned on
557 if (o3_wrap) o3_width=(olNs4 ? over.clip.width : over.offsetWidth);
558
559 runHook("createPopup", FAFTER, lyrContent);
560
561 return true;
562 }
563
564 // Decides where we want the popup.
565 function placeLayer() {
566 var placeX, placeY, widthFix = 0;
567
568 // HORIZONTAL PLACEMENT, re-arranged to work in Safari
569 if (o3_frame.innerWidth) widthFix=18;
570 iwidth = windowWidth();
571
572 // Horizontal scroll offset
573 winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : o3_frame.pageXOffset;
574
575 placeX = runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix);
576
577 // VERTICAL PLACEMENT, re-arranged to work in Safari
578 if (o3_frame.innerHeight) {
579 iheight=o3_frame.innerHeight;
580 } else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')) {
581 iheight=eval('o3_frame.'+docRoot+'.clientHeight');
582 }
583
584 // Vertical scroll offset
585 scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : o3_frame.pageYOffset;
586 placeY = runHook('verticalPlacement',FCHAIN,iheight,scrolloffset);
587
588 // Actually move the object.
589 repositionTo(over, placeX, placeY);
590 }
591
592 // Moves the layer
593 function olMouseMove(e) {
594 var e = (e) ? e : event;
595
596 if (e.pageX) {
597 o3_x = e.pageX;
598 o3_y = e.pageY;
599 } else if (e.clientX) {
600 o3_x = eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft');
601 o3_y = eval('e.clientY+o3_frame.'+docRoot+'.scrollTop');
602 }
603
604 if (o3_allowmove == 1) runHook("placeLayer", FREPLACE);
605
606 // MouseOut handler
607 if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) {
608 (olHideDelay ? hideDelay(olHideDelay) : cClick());
609 hoveringSwitch = !hoveringSwitch;
610 }
611 }
612
613 // Fake function for 3.0 users.
614 function no_overlib() { return ver3fix; }
615
616 // Capture the mouse and chain other scripts.
617 function olMouseCapture() {
618 capExtent = document;
619 var fN, str, l, k, f, mseHandler = olMouseMove;
620 var re = /function[ ]*(\w*)\(/;
621
622 if (document.onmousemove || (!olIe4 && window.onmousemove)) {
623 if (window.onmousemove) capExtent = window;
624 f = capExtent.onmousemove.toString();
625 fN = f.match(re);
626
627 if (fN==null) {
628 str=f+'(e); ';
629 } else if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove') {
630 olCheckMouseCapture = false;
631 return;
632 } else {
633 if (fN[1]) str = fN[1]+'(e); ';
634 else {
635 l=f.indexOf('{')+1;
636 k=f.lastIndexOf('}');
637 str=f.substring(l,k) + '\n';
638 }
639 }
640
641 str += 'olMouseMove(e); ';
642 mseHandler = new Function('e', str);
643 }
644
645 capExtent.onmousemove = mseHandler;
646 if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE);
647 }
648
649 ////////
650 // PARSING FUNCTIONS
651 ////////
652
653 // Does the actual command parsing.
654 function parseTokens(pf, ar) {
655 // What the next argument is expected to be.
656 var v, mode=-1, par = (pf != 'ol_');
657 var fnMark = (par && !ar.length ? 1 : 0);
658
659 for (i = 0; i < ar.length; i++) {
660 if (mode < 0) {
661 // Arg is maintext,unless its a number between pmStart and pmUpper
662 // then its a command.
663 if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {
664 fnMark = (par ? 1 : 0);
665 i--; // backup one so that the next block can parse it
666 } else {
667 switch(pf) {
668 case 'ol_':
669 ol_text = ar[i].toString();
670 break;
671 default:
672 o3_text=ar[i].toString();
673 }
674 }
675 mode = 0;
676 } else {
677 // Note: NS4 doesn't like switch cases with vars.
678 if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; }
679 if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; }
680 if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; }
681 if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; }
682 if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; }
683 if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; }
684 if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; }
685 if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; }
686 if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; }
687 if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; }
688 if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; }
689 if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; }
690 if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; }
691 if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; }
692 if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; }
693 if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; }
694 if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; }
695 if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; }
696 if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; }
697 if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; }
698 if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; }
699 if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again.
700 if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; }
701 if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; }
702 if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; }
703 if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; }
704 if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; }
705 if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; }
706 if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; }
707 if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; }
708 if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; }
709 if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; }
710 if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; }
711 if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; }
712 if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; }
713 if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; }
714 if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; }
715 if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; }
716 if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; }
717 if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; }
718 if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; }
719 if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; }
720 if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; }
721 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; }
722 if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; }
723 if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; }
724 if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; }
725 if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; }
726 if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; }
727 if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; }
728 if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) olHideDelay=ar[++i]; continue; }
729 if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; }
730 if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; }
731 if (ar[i]==COMPATMODE) { eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0'); continue; }
732 if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[++i]+'"'); continue; }
733 if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[++i]+'"'); continue; }
734 if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[++i]+'"'); continue; }
735 if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[++i]+'"'); continue; }
736 if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[++i]+'"'); continue; }
737 i = parseCmdLine(pf, i, ar);
738 }
739 }
740
741 if (fnMark && o3_function) o3_text = o3_function();
742
743 if ((pf == 'o3_') && o3_wrap) {
744 o3_width = 0;
745
746 var tReg=/<.*\n*>/ig;
747 if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, '&nbsp;');
748 if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, '&nbsp;');
749 }
750 if ((pf == 'o3_') && o3_sticky) {
751 if (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close;
752 if (o3_mouseoff && (o3_frame == ol_frame)) opt_NOCLOSE(' ');
753 }
754 }
755
756
757 ////////
758 // LAYER FUNCTIONS
759 ////////
760
761 // Writes to a layer
762 function layerWrite(txt) {
763 txt += "\n";
764 if (olNs4) {
765 var lyr = o3_frame.document.layers['overDiv'].document
766 lyr.write(txt)
767 lyr.close()
768 } else if (typeof over.innerHTML != 'undefined') {
769 if (olIe5 && isMac) over.innerHTML = '';
770 over.innerHTML = txt;
771 } else {
772 range = o3_frame.document.createRange();
773 range.setStartAfter(over);
774 domfrag = range.createContextualFragment(txt);
775
776 while (over.hasChildNodes()) {
777 over.removeChild(over.lastChild);
778 }
779
780 over.appendChild(domfrag);
781 }
782 }
783
784 // Make an object visible
785 function showObject(obj) {
786 runHook("showObject", FBEFORE);
787
788 var theObj=(olNs4 ? obj : obj.style);
789 theObj.visibility = 'visible';
790
791 runHook("showObject", FAFTER);
792 }
793
794 // Hides an object
795 function hideObject(obj) {
796 runHook("hideObject", FBEFORE);
797
798 var theObj=(olNs4 ? obj : obj.style);
799 if (olNs6 && olShowId>0) { clearTimeout(olShowId); olShowId=0; }
800 theObj.visibility = 'hidden';
801 theObj.top=theObj.left=-10000 + (!olNs4 ? 'px' : 0);
802
803 if (o3_timerid > 0) clearTimeout(o3_timerid);
804 if (o3_delayid > 0) clearTimeout(o3_delayid);
805
806 o3_timerid = 0;
807 o3_delayid = 0;
808 self.status = "";
809
810 if (obj.onmouseout || obj.onmouseover) {
811 if (olNs4) obj.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER);
812 obj.onmouseout = obj.onmouseover = null;
813 }
814
815 runHook("hideObject", FAFTER);
816 }
817
818 // Move a layer
819 function repositionTo(obj, xL, yL) {
820 var theObj=(olNs4 ? obj : obj.style);
821 theObj.left = xL + (!olNs4 ? 'px' : 0);
822 theObj.top = yL + (!olNs4 ? 'px' : 0);
823 }
824
825 // Check position of cursor relative to overDiv DIVision; mouseOut function
826 function cursorOff() {
827 var left = parseInt(over.style.left);
828 var top = parseInt(over.style.top);
829 var right = left + (over.offsetWidth >= parseInt(o3_width) ? over.offsetWidth : parseInt(o3_width));
830 var bottom = top + (over.offsetHeight >= o3_aboveheight ? over.offsetHeight : o3_aboveheight);
831
832 if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return true;
833
834 return false;
835 }
836
837
838 ////////
839 // COMMAND FUNCTIONS
840 ////////
841
842 // Calls callme or the default function.
843 function opt_FUNCTION(callme) {
844 o3_text = (callme ? (typeof callme=='string' ? (/.+\(.*\)/.test(callme) ? eval(callme) : callme) : callme()) : (o3_function ? o3_function() : 'No Function'));
845
846 return 0;
847 }
848
849 // Handle hovering
850 function opt_NOCLOSE(unused) {
851 if (!unused) o3_close = "";
852
853 if (olNs4) {
854 over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER);
855 over.onmouseover = function () { if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid = 0; } }
856 over.onmouseout = function (e) { if (olHideDelay) hideDelay(olHideDelay); else cClick(e); }
857 } else {
858 over.onmouseover = function () {hoveringSwitch = true; if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } }
859 }
860
861 return 0;
862 }
863
864 // Function to scan command line arguments for multiples
865 function opt_MULTIPLEARGS(i, args, parameter) {
866 var k=i, re, pV, str='';
867
868 for(k=i; k<args.length; k++) {
869 if(typeof args[k] == 'number' && args[k]>pmStart) break;
870 str += args[k] + ',';
871 }
872 if (str) str = str.substring(0,--str.length);
873
874 k--; // reduce by one so the for loop this is in works correctly
875 pV=(olNs4 && /cellpad/i.test(parameter)) ? str.split(',')[0] : str;
876 eval(parameter + '="' + pV + '"');
877
878 return k;
879 }
880
881 // Remove &nbsp; in texts when done.
882 function nbspCleanup() {
883 if (o3_wrap) {
884 o3_text = o3_text.replace(/\&nbsp;/g, ' ');
885 o3_cap = o3_cap.replace(/\&nbsp;/g, ' ');
886 }
887 }
888
889 // Escape embedded single quotes in text strings
890 function escSglQuote(str) {
891 return str.toString().replace(/'/g,"\\'");
892 }
893
894 // Onload handler for window onload event
895 function OLonLoad_handler(e) {
896 var re = /\w+\(.*\)[;\s]+/g, olre = /overlib\(|nd\(|cClick\(/, fn, l, i;
897
898 if(!olLoaded) olLoaded=1;
899
900 // Remove it for Gecko based browsers
901 if(window.removeEventListener && e.eventPhase == 3) window.removeEventListener("load",OLonLoad_handler,false);
902 else if(window.detachEvent) { // and for IE and Opera 4.x but execute calls to overlib, nd, or cClick()
903 window.detachEvent("onload",OLonLoad_handler);
904 var fN = document.body.getAttribute('onload');
905 if (fN) {
906 fN=fN.toString().match(re);
907 if (fN && fN.length) {
908 for (i=0; i<fN.length; i++) {
909 if (/anonymous/.test(fN[i])) continue;
910 while((l=fN[i].search(/\)[;\s]+/)) != -1) {
911 fn=fN[i].substring(0,l+1);
912 fN[i] = fN[i].substring(l+2);
913 if (olre.test(fn)) eval(fn);
914 }
915 }
916 }
917 }
918 }
919 }
920
921 // Wraps strings in Layer Generation Functions with the correct tags
922 // endWrap true(if end tag) or false if start tag
923 // fontSizeStr - font size string such as '1' or '10px'
924 // whichString is being wrapped -- 'text', 'caption', or 'close'
925 function wrapStr(endWrap,fontSizeStr,whichString) {
926 var fontStr, fontColor, isClose=((whichString=='close') ? 1 : 0), hasDims=/[%\-a-z]+$/.test(fontSizeStr);
927 fontSizeStr = (olNs4) ? (!hasDims ? fontSizeStr : '1') : fontSizeStr;
928 if (endWrap) return (hasDims&&!olNs4) ? (isClose ? '</span>' : '</div>') : '</font>';
929 else {
930 fontStr='o3_'+whichString+'font';
931 fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color';
932 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)+'">';
933 }
934 }
935
936 // Quotes Multi word font names; needed for CSS Standards adherence in font-family
937 function quoteMultiNameFonts(theFont) {
938 var v, pM=theFont.split(',');
939 for (var i=0; i<pM.length; i++) {
940 v=pM[i];
941 v=v.replace(/^\s+/,'').replace(/\s+$/,'');
942 if(/\s/.test(v) && !/['"]/.test(v)) {
943 v="\'"+v+"\'";
944 pM[i]=v;
945 }
946 }
947 return pM.join();
948 }
949
950 // dummy function which will be overridden
951 function isExclusive(args) {
952 return false;
953 }
954
955 // function will delay close by time milliseconds
956 function hideDelay(time) {
957 if (time&&!o3_delay) {
958 if (o3_timerid > 0) clearTimeout(o3_timerid);
959
960 o3_timerid=setTimeout("cClick()",(o3_timeout=time));
961 }
962 }
963
964 // Was originally in the placeLayer() routine; separated out for future ease
965 function horizontalPlacement(browserWidth, horizontalScrollAmount, widthFix) {
966 var placeX, iwidth=browserWidth, winoffset=horizontalScrollAmount;
967 var parsedWidth = parseInt(o3_width);
968
969 if (o3_fixx > -1 || o3_relx != null) {
970 // Fixed position
971 placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx);
972 } else {
973 // If HAUTO, decide what to use.
974 if (o3_hauto == 1) {
975 if ((o3_x - winoffset) > (iwidth / 2)) {
976 o3_hpos = LEFT;
977 } else {
978 o3_hpos = RIGHT;
979 }
980 }
981
982 // From mouse
983 if (o3_hpos == CENTER) { // Center
984 placeX = o3_x+o3_offsetx-(parsedWidth/2);
985
986 if (placeX < winoffset) placeX = winoffset;
987 }
988
989 if (o3_hpos == RIGHT) { // Right
990 placeX = o3_x+o3_offsetx;
991
992 if ((placeX+parsedWidth) > (winoffset+iwidth - widthFix)) {
993 placeX = iwidth+winoffset - parsedWidth - widthFix;
994 if (placeX < 0) placeX = 0;
995 }
996 }
997 if (o3_hpos == LEFT) { // Left
998 placeX = o3_x-o3_offsetx-parsedWidth;
999 if (placeX < winoffset) placeX = winoffset;
1000 }
1001
1002 // Snapping!
1003 if (o3_snapx > 1) {
1004 var snapping = placeX % o3_snapx;
1005
1006 if (o3_hpos == LEFT) {
1007 placeX = placeX - (o3_snapx+snapping);
1008 } else {
1009 // CENTER and RIGHT
1010 placeX = placeX+(o3_snapx - snapping);
1011 }
1012
1013 if (placeX < winoffset) placeX = winoffset;
1014 }
1015 }
1016
1017 return placeX;
1018 }
1019
1020 // was originally in the placeLayer() routine; separated out for future ease
1021 function verticalPlacement(browserHeight,verticalScrollAmount) {
1022 var placeY, iheight=browserHeight, scrolloffset=verticalScrollAmount;
1023 var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight));
1024
1025 if (o3_fixy > -1 || o3_rely != null) {
1026 // Fixed position
1027 placeY=(o3_rely != null ? (o3_rely < 0 ? scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy);
1028 } else {
1029 // If VAUTO, decide what to use.
1030 if (o3_vauto == 1) {
1031 if ((o3_y - scrolloffset) > (iheight / 2) && o3_vpos == BELOW && (o3_y + parsedHeight + o3_offsety - (scrolloffset + iheight) > 0)) {
1032 o3_vpos = ABOVE;
1033 } else if (o3_vpos == ABOVE && (o3_y - (parsedHeight + o3_offsety) - scrolloffset < 0)) {
1034 o3_vpos = BELOW;
1035 }
1036 }
1037
1038 // From mouse
1039 if (o3_vpos == ABOVE) {
1040 if (o3_aboveheight == 0) o3_aboveheight = parsedHeight;
1041
1042 placeY = o3_y - (o3_aboveheight+o3_offsety);
1043 if (placeY < scrolloffset) placeY = scrolloffset;
1044 } else {
1045 // BELOW
1046 placeY = o3_y+o3_offsety;
1047 }
1048
1049 // Snapping!
1050 if (o3_snapy > 1) {
1051 var snapping = placeY % o3_snapy;
1052
1053 if (o3_aboveheight > 0 && o3_vpos == ABOVE) {
1054 placeY = placeY - (o3_snapy+snapping);
1055 } else {
1056 placeY = placeY+(o3_snapy - snapping);
1057 }
1058
1059 if (placeY < scrolloffset) placeY = scrolloffset;
1060 }
1061 }
1062
1063 return placeY;
1064 }
1065
1066 // checks positioning flags
1067 function checkPositionFlags() {
1068 if (olHautoFlag) olHautoFlag = o3_hauto=0;
1069 if (olVautoFlag) olVautoFlag = o3_vauto=0;
1070 return true;
1071 }
1072
1073 // get Browser window width
1074 function windowWidth() {
1075 var w;
1076 if (o3_frame.innerWidth) w=o3_frame.innerWidth;
1077 else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientWidth=='number'")&&eval('o3_frame.'+docRoot+'.clientWidth'))
1078 w=eval('o3_frame.'+docRoot+'.clientWidth');
1079 return w;
1080 }
1081
1082 // create the div container for popup content if it doesn't exist
1083 function createDivContainer(id,frm,zValue) {
1084 id = (id || 'overDiv'), frm = (frm || o3_frame), zValue = (zValue || 1000);
1085 var objRef, divContainer = layerReference(id);
1086
1087 if (divContainer == null) {
1088 if (olNs4) {
1089 divContainer = frm.document.layers[id] = new Layer(window.innerWidth, frm);
1090 objRef = divContainer;
1091 } else {
1092 var body = (olIe4 ? frm.document.all.tags('BODY')[0] : frm.document.getElementsByTagName("BODY")[0]);
1093 if (olIe4&&!document.getElementById) {
1094 body.insertAdjacentHTML("beforeEnd",'<div id="'+id+'"></div>');
1095 divContainer=layerReference(id);
1096 } else {
1097 divContainer = frm.document.createElement("DIV");
1098 divContainer.id = id;
1099 body.appendChild(divContainer);
1100 }
1101 objRef = divContainer.style;
1102 }
1103
1104 with (objRef) {
1105 position = 'absolute';
1106 visibility = 'hidden';
1107 zIndex = zValue;
1108 }
1109 }
1110
1111 return divContainer;
1112 }
1113
1114 // get reference to a layer with ID=id
1115 function layerReference(id) {
1116 return (olNs4 ? o3_frame.document.layers[id] : (document.all ? o3_frame.document.all[id] : o3_frame.document.getElementById(id)));
1117 }
1118 ////////
1119 // PLUGIN ACTIVATION FUNCTIONS
1120 ////////
1121
1122 // Runs plugin functions to set runtime variables.
1123 function setRunTimeVariables(){
1124 if (typeof runTime != 'undefined' && runTime.length) {
1125 for (var k = 0; k < runTime.length; k++) {
1126 runTime[k]();
1127 }
1128 }
1129 }
1130
1131 // Runs plugin functions to parse commands.
1132 function parseCmdLine(pf, i, args) {
1133 if (typeof cmdLine != 'undefined' && cmdLine.length) {
1134 for (var k = 0; k < cmdLine.length; k++) {
1135 var j = cmdLine[k](pf, i, args);
1136 if (j >- 1) {
1137 i = j;
1138 break;
1139 }
1140 }
1141 }
1142
1143 return i;
1144 }
1145
1146 // Runs plugin functions to do things after parse.
1147 function postParseChecks(){
1148 if (typeof postParse != 'undefined' && postParse.length) {
1149 for (var k = 0; k < postParse.length; k++) {
1150 if (postParse[k]()) continue;
1151 return false; // end now since have an error
1152 }
1153 }
1154 return true;
1155 }
1156
1157
1158 ////////
1159 // PLUGIN REGISTRATION FUNCTIONS
1160 ////////
1161
1162 // Registers commands and creates constants.
1163 function registerCommands(cmdStr) {
1164 if (typeof cmdStr!='string') return;
1165
1166 var pM = cmdStr.split(',');
1167 pms = pms.concat(pM);
1168
1169 for (var i = 0; i< pM.length; i++) {
1170 eval(pM[i].toUpperCase()+'='+pmCount++);
1171 }
1172 }
1173
1174 // Registers no-parameter commands
1175 function registerNoParameterCommands(cmdStr) {
1176 if (!cmdStr && typeof cmdStr!='string') return;
1177 pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr;
1178 }
1179
1180 // Register a function to hook at a certain point.
1181 function registerHook(fnHookTo, fnRef, hookType, optPm) {
1182 var hookPt, last = typeof optPm;
1183
1184 if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return;
1185 if (typeof hookPts == 'undefined') hookPts = new Array();
1186 if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference();
1187
1188 hookPt = hookPts[fnHookTo];
1189
1190 if (hookType != null) {
1191 if (hookType == FREPLACE) {
1192 hookPt.ovload = fnRef; // replace normal overlib routine
1193 if (fnHookTo.indexOf('ol_content_') > -1) hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef;
1194
1195 } else if (hookType == FBEFORE || hookType == FAFTER) {
1196 var hookPt=(hookType == 1 ? hookPt.before : hookPt.after);
1197
1198 if (typeof fnRef == 'object') {
1199 hookPt = hookPt.concat(fnRef);
1200 } else {
1201 hookPt[hookPt.length++] = fnRef;
1202 }
1203
1204 if (optPm) hookPt = reOrder(hookPt, fnRef, optPm);
1205
1206 } else if (hookType == FALTERNATE) {
1207 if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = fnRef;
1208 } else if (hookType == FCHAIN) {
1209 hookPt = hookPt.chain;
1210 if (typeof fnRef=='object') hookPt=hookPt.concat(fnRef); // add other functions
1211 else hookPt[hookPt.length++]=fnRef;
1212 }
1213
1214 return;
1215 }
1216 }
1217
1218 // Register a function that will set runtime variables.
1219 function registerRunTimeFunction(fn) {
1220 if (isFunction(fn)) {
1221 if (typeof runTime == 'undefined') runTime = new Array();
1222 if (typeof fn == 'object') {
1223 runTime = runTime.concat(fn);
1224 } else {
1225 runTime[runTime.length++] = fn;
1226 }
1227 }
1228 }
1229
1230 // Register a function that will handle command parsing.
1231 function registerCmdLineFunction(fn){
1232 if (isFunction(fn)) {
1233 if (typeof cmdLine == 'undefined') cmdLine = new Array();
1234 if (typeof fn == 'object') {
1235 cmdLine = cmdLine.concat(fn);
1236 } else {
1237 cmdLine[cmdLine.length++] = fn;
1238 }
1239 }
1240 }
1241
1242 // Register a function that does things after command parsing.
1243 function registerPostParseFunction(fn){
1244 if (isFunction(fn)) {
1245 if (typeof postParse == 'undefined') postParse = new Array();
1246 if (typeof fn == 'object') {
1247 postParse = postParse.concat(fn);
1248 } else {
1249 postParse[postParse.length++] = fn;
1250 }
1251 }
1252 }
1253
1254 ////////
1255 // PLUGIN REGISTRATION FUNCTIONS
1256 ////////
1257
1258 // Runs any hooks registered.
1259 function runHook(fnHookTo, hookType) {
1260 var l = hookPts[fnHookTo], k, rtnVal, optPm, arS, ar = runHook.arguments;
1261
1262 if (hookType == FREPLACE) {
1263 arS = argToString(ar, 2);
1264
1265 if (typeof l == 'undefined' || !(l = l.ovload)) return eval(fnHookTo+'('+arS+')');
1266 else return eval('l('+arS+')');
1267
1268 } else if (hookType == FBEFORE || hookType == FAFTER) {
1269 if (typeof l == 'undefined') return;
1270 l=(hookType == 1 ? l.before : l.after);
1271
1272 if (!l.length) return;
1273
1274 arS = argToString(ar, 2);
1275 for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')');
1276
1277 } else if (hookType == FALTERNATE) {
1278 optPm = ar[2];
1279 arS = argToString(ar, 3);
1280
1281 if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') {
1282 return eval(fnHookTo+'('+arS+')');
1283 } else {
1284 return eval('l('+arS+')');
1285 }
1286 } else if (hookType == FCHAIN) {
1287 arS=argToString(ar,2);
1288 l=l.chain;
1289
1290 for (k=l.length; k > 0; k--) if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0)) return rtnVal;
1291 }
1292 }
1293
1294 ////////
1295 // UTILITY FUNCTIONS
1296 ////////
1297
1298 // Checks if something is a function.
1299 function isFunction(fnRef) {
1300 var rtn = true;
1301
1302 if (typeof fnRef == 'object') {
1303 for (var i = 0; i < fnRef.length; i++) {
1304 if (typeof fnRef[i]=='function') continue;
1305 rtn = false;
1306 break;
1307 }
1308 } else if (typeof fnRef != 'function') {
1309 rtn = false;
1310 }
1311
1312 return rtn;
1313 }
1314
1315 // Converts an array into an argument string for use in eval.
1316 function argToString(array, strtInd, argName) {
1317 var jS = strtInd, aS = '', ar = array;
1318 argName=(argName ? argName : 'ar');
1319
1320 if (ar.length > jS) {
1321 for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], ';
1322 aS = aS.substring(0, aS.length-2);
1323 }
1324
1325 return aS;
1326 }
1327
1328 // Places a hook in the correct position in a hook point.
1329 function reOrder(hookPt, fnRef, order) {
1330 if (!order || typeof order == 'undefined' || typeof order == 'number') return;
1331
1332 var newPt = new Array(), match;
1333
1334 if (typeof order=='function') {
1335 if (typeof fnRef=='object') {
1336 newPt = newPt.concat(fnRef);
1337 } else {
1338 newPt[newPt.length++]=fnRef;
1339 }
1340
1341 for (var i = 0; i < hookPt.length; i++) {
1342 match = false;
1343 if (typeof fnRef == 'function' && hookPt[i] == fnRef) {
1344 continue;
1345 } else {
1346 for(var j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {
1347 match = true;
1348 break;
1349 }
1350 }
1351 if (!match) newPt[newPt.length++] = hookPt[i];
1352 }
1353
1354 newPt[newPt.length++] = order;
1355
1356 } else if (typeof order == 'object') {
1357 if (typeof fnRef == 'object') {
1358 newPt = newPt.concat(fnRef);
1359 } else {
1360 newPt[newPt.length++] = fnRef;
1361 }
1362
1363 for (var j = 0; j < hookPt.length; j++) {
1364 match = false;
1365 if (typeof fnRef == 'function' && hookPt[j] == fnRef) {
1366 continue;
1367 } else {
1368 for (var i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {
1369 match = true;
1370 break;
1371 }
1372 }
1373 if (!match) newPt[newPt.length++]=hookPt[j];
1374 }
1375
1376 for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
1377 newPt.length = 0;
1378
1379 for (var j = 0; j < hookPt.length; j++) {
1380 match = false;
1381 for (var i = 0; i < order.length; i++) {
1382 if (hookPt[j] == order[i]) {
1383 match = true;
1384 break;
1385 }
1386 }
1387 if (!match) newPt[newPt.length++] = hookPt[j];
1388 }
1389 newPt = newPt.concat(order);
1390 }
1391
1392 for(i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
1393
1394 return hookPt;
1395 }
1396
1397 ////////
1398 // OBJECT CONSTRUCTORS
1399 ////////
1400
1401 // Object for handling hooks.
1402 function FunctionReference() {
1403 this.ovload = null;
1404 this.before = new Array();
1405 this.after = new Array();
1406 this.alt = new Array();
1407 this.chain = new Array();
1408 }
1409
1410 // Object for simple access to the overLIB version used.
1411 // Examples: simpleversion:351 major:3 minor:5 revision:1
1412 function Info(version, prerelease) {
1413 this.version = version;
1414 this.prerelease = prerelease;
1415
1416 this.simpleversion = Math.round(this.version*100);
1417 this.major = parseInt(this.simpleversion / 100);
1418 this.minor = parseInt(this.simpleversion / 10) - this.major * 10;
1419 this.revision = parseInt(this.simpleversion) - this.major * 100 - this.minor * 10;
1420 this.meets = meets;
1421 }
1422
1423 // checks for Core Version required
1424 function meets(reqdVersion) {
1425 return (!reqdVersion) ? false : this.simpleversion >= Math.round(100*parseFloat(reqdVersion));
1426 }
1427
1428
1429 ////////
1430 // STANDARD REGISTRATIONS
1431 ////////
1432 registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSOFF);
1433 registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSOFF);
1434 registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSOFF);
1435 registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS);
1436 registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS);
1437 registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSCLASS);
1438 registerPostParseFunction(checkPositionFlags);
1439 registerHook("hideObject", nbspCleanup, FAFTER);
1440 registerHook("horizontalPlacement", horizontalPlacement, FCHAIN);
1441 registerHook("verticalPlacement", verticalPlacement, FCHAIN);
1442 if (olNs4||(olIe5&&isMac)||olKq) olLoaded=1;
1443 registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode');
1444 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: