-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollapsible_faq.js
More file actions
76 lines (73 loc) · 1.78 KB
/
collapsible_faq.js
File metadata and controls
76 lines (73 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*************************************************************
* DHTML Collapsible FAQ MOD v1.0.0
*
* Copyright (C) 2004, Markus (http://www.phpmix.com)
* This script is released under GPL License.
* Feel free to use this script (or part of it) wherever you need
* it ...but please, give credit to original author. Thank you. :-)
* We will also appreciate any links you could give us.
*
* Enjoy! ;-)
*************************************************************/
function _CFAQ()
{
this.lastOpened = '';
return this;
}
_CFAQ.prototype.IsDisplaySupported = function()
{
if( window.opera && !document.childNodes ) return false;
if( document.getElementById || document.all ) return true;
return false;
}
_CFAQ.prototype.getQueryVar = function(varName)
{
var q = window.location.search.substring(1);
var v = q.split('&');
for( var i=0; i < v.length; i++ )
{
var p = v[i].split('=');
if( p[0] == varName ) return p[1];
}
return null;
}
_CFAQ.prototype.getObj = function(obj)
{
return ( document.getElementById ? document.getElementById(obj) : ( document.all ? document.all[obj] : null ) );
}
_CFAQ.prototype.displayObj = function(obj, status)
{
var x = this.getObj(obj);
if( x && x.style ) x.style.display = status;
}
_CFAQ.prototype.display = function(faq_id, isLink)
{
if( this.IsDisplaySupported() )
{
if( !isLink )
{
if( this.lastOpened != '' )
{
this.displayObj(this.lastOpened, 'none');
}
if( this.lastOpened != faq_id )
{
this.displayObj(faq_id, '');
this.lastOpened = faq_id;
}
else
{
this.lastOpened = '';
}
}
return false;
}
return true;
}
var CFAQ = new _CFAQ();
if( !CFAQ.IsDisplaySupported() )
{
var u_faq = window.location.href;
u_faq += ( u_faq.indexOf('?') > 0 ? '&' : '?' ) + 'dhtml=no';
window.location.replace(u_faq);
}