Преглед на файлове

adding the new control panel (3)

pecesama преди 18 години
родител
ревизия
16fdc11cb0
променени са 5 файла, в които са добавени 431 реда и са изтрити 177 реда
  1. 67 70
      admin/admin.php
  2. BIN
      admin/css/images/Thumbs.db
  3. BIN
      admin/css/images/td_back.gif
  4. 36 107
      admin/css/style.css
  5. 328 0
      admin/scripts/sortable.js

+ 67 - 70
admin/admin.php Целия файл

@@ -19,40 +19,40 @@ $conf = new configuration();
19 19
 if ($user->isAdmin()) {
20 20
 	
21 21
 ?>
22
-	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
23
-	<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
22
+	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
23
+	<html xmlns="http://www.w3.org/1999/xhtml">
24 24
 	<head>
25
-		<title>gelato</title>
25
+		<title>gelato :: admin users</title>
26 26
 		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
27 27
 		<link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
28 28
 		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
29
+		<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/sortable.js"></script>
29 30
 		<style type="text/css" media="screen">	
30
-			@import "<?=$conf->urlGelato;?>/admin/css/style-codice.css";
31
+			@import "<?=$conf->urlGelato;?>/admin/css/style.css";
31 32
 		</style>
32 33
 	</head>
34
+	
33 35
 	<body>
34 36
 		<div id="div-process" style="display:none;">Processing request...</div>
35
-		<div id="titulo">
36
-			<img src="<?=$conf->urlGelato;?>/images/logo.jpg" alt="gelato CMS" title="gelato CMS" />	
37
-		</div>
38
-		
39
-		<div id="menuContenedor">
40
-			<ul>
41
-				<li id="active"><a href="#" id="current">Users</a></li>
42
-					<ul>
43
-						<li><a href="user.php">Add</a></li>
44
-						<li id="subactive"><a href="#" id="subcurrent">Manage</a></li>
37
+		<div id="cont">
38
+			<div id="head">
39
+				<h1><a href="<?=$conf->urlGelato;?>/admin/index.php" title="gelato :: home">gelato cms</a></h1>
40
+				<ul id="nav">
41
+					<li><a href="<?=$conf->urlGelato;?>/" title="Take me to the tumblelog">View Tumblelog</a></li>
42
+					<li><a href="close.php" title="Log off" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
43
+			  	</ul>
44
+			</div>
45
+			<div id="main">				
46
+				
47
+				<div class="box">
48
+					<ul class="menu manage">
49
+					<h3>Manage</h3>
50
+					<li><a href="#">Settings</a></li>
51
+					<li><a href="<?=$conf->urlGelato;?>/admin/index.php">Posts</a></li>
52
+					<li><a href="<?=$conf->urlGelato;?>/admin/user.php">Add user</a></li>
53
+					<li class="selected"><a href="#">Users</a></li>
45 54
 					</ul>
46
-				</li>
47
-				<li><a href="index.php">Control Panel</a></li>
48
-			</ul>
49
-		</div>
50
-		
51
-		<div id="contenido">
52
-			<div class="center">
53
-				<div  class="ventana">
54
-					<p class="titulo"><span class="handle">Manage the user information</span></p>
55
-					<div id="formulario">
55
+
56 56
 <?					
57 57
 						if (isset($_GET["added"])) {
58 58
 							if ($_GET["added"]=="true") {
@@ -80,60 +80,57 @@ if ($user->isAdmin()) {
80 80
 							}
81 81
 						}
82 82
 ?>						
83
-						<p>
84
-							<table class="sortable" id="admin-tabla">
85
-								<caption>Authors list.</caption>
86
-								<thead>
87
-									<tr>
88
-										<th scope="col">Login</th>
89
-										<th scope="col">Name</th>
90
-										<th colspan="2" scope="col" class="unsortable">Actions</th>
91
-									</tr>
92
-								</thead>
93
-								<tbody>
83
+						<div class="tabla">
84
+						<table class="sortable" id="admin-table">
85
+							<thead>
86
+								<tr>
87
+									<th scope="col">Login</th>
88
+									<th scope="col">Name</th>
89
+									<th colspan="2" scope="col" class="unsortable">Actions</th>
90
+								</tr>
91
+							</thead>
92
+							<tbody>
94 93
 <?	
95
-						$odd=false;
96
-						$rs = $user->getUsers();
97
-						if ($user->contarRegistros()>0) {
98
-							while($register = mysql_fetch_array($rs)) {
94
+					$odd=false;
95
+					$rs = $user->getUsers();
96
+					if ($user->contarRegistros()>0) {
97
+						while($register = mysql_fetch_array($rs)) {
99 98
 ?>
100
-								<tr <? if ($odd) { echo 'class="odd"'; } $odd=!$odd; ?>>
101
-									<td>
102
-										<? echo $register["login"]."\n"; ?>
103
-									</td>
104
-									<td>
105
-										<? echo $register["name"]."\n"; ?>
106
-									</td>
107
-									<td>
108
-										<a href="user.php?edit=<?=$register["id_user"]; ?>">Edit</a>
109
-									</td>
110
-									<td>
111
-										<a href="user.php?delete=<?=$register["id_user"]; ?>">Delete</a>	
112
-									</td>
113
-								</tr>
99
+							<tr <? if ($odd) { echo 'class="odd"'; } $odd=!$odd; ?>>
100
+								<td>
101
+									<? echo $register["login"]."\n"; ?>
102
+								</td>
103
+								<td>
104
+									<? echo $register["name"]."\n"; ?>
105
+								</td>
106
+								<td>
107
+									<a href="user.php?edit=<?=$register["id_user"]; ?>">Edit</a>
108
+								</td>
109
+								<td>
110
+									<a href="user.php?delete=<?=$register["id_user"]; ?>">Delete</a>	
111
+								</td>
112
+							</tr>
114 113
 <?
115
-							}
116 114
 						}
117
-						else {
115
+					}
116
+					else {
118 117
 ?>
119
-							<tr> 
120
-								<td colspan="4"><div class="exito">No users available.</div></td>
121
-							</tr>
118
+						<tr> 
119
+							<td colspan="4"><div class="exito">No users available.</div></td>
120
+						</tr>
122 121
 <?
123
-						}
122
+					}
124 123
 ?>
125
-								</tbody>
126
-							</table>
127
-						</p>
128
-						<p>&nbsp;</p>
124
+							</tbody>
125
+						</table>
129 126
 					</div>
130
-				</div> 
131
-			</div> 		
132
-			<div id="pie">
133
-				<p>
134
-					<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
135
-				</p>
136
-			</div>				
127
+
128
+					<div class="footer-box">&nbsp;</div>
129
+				</div>
130
+			</div>
131
+			<div id="foot">
132
+				<a href="http://www.gelatocms.com/" title="gelato CMS" target="_blank">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
133
+			</div>
137 134
 		</div>
138 135
 	</body>
139 136
 	</html>

BIN
admin/css/images/Thumbs.db Целия файл


BIN
admin/css/images/td_back.gif Целия файл


+ 36 - 107
admin/css/style.css Целия файл

@@ -66,6 +66,7 @@ form.newpost input.txt{ background: #fff url(images/grad-small.png) top left rep
66 66
 form.newpost input.btn{ }
67 67
 form.newpost textarea{background: #fff url(images/grad-big.png) top left repeat-x; height:190px; border:1px solid #999; width:490px; padding:5px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:0.8em;}
68 68
 
69
+.tabla{ background-color:#FFFBFF; margin:20px 15px; }
69 70
 .entry{ background-color:#efefef; border:1px solid #ccc; margin:20px 15px;}
70 71
 .info{ border-bottom:1px solid #aaa; position:relative; display:block; padding:4px 10px; height:20px; }
71 72
 .info p{font-size:0.8em; color:#297aab; display:inline;}
@@ -88,123 +89,51 @@ form.newpost textarea{background: #fff url(images/grad-big.png) top left repeat-
88 89
 
89 90
 #foot{ background: transparent url(images/foot_bg.png) top center no-repeat; clear: both;}
90 91
 
91
-#foot { text-align:center;
92
-	
93
-		font-size: 10px;
94
-		color: #000;
95
-	}
92
+#foot { text-align:center; font-size: 10px; color: #000; }
96 93
 
97
-	#footer a {
98
-		color: #000;
99
-	}
94
+	#footer a { color: #000; }
100 95
 	
101
-#div-process { 
102
-	top:0px;	
103
-	padding-left: 22px;	
104
-	font: normal 14.5px/17px georgia, "times new roman", serif;
105
-	background: url('../../images/proceso.gif') no-repeat 0% 10%;
106
-	float: right;
107
-	height: 20px;
108
-	width: 150px;
109
-	border: 1px solid #000066;
110
-	background-color:#FFFFCC;
111
-	color:#011940;
112
-}
96
+#div-process { top:0px;	padding-left: 22px;	font: normal 14.5px/17px georgia, "times new roman", serif; background: url('../../images/proceso.gif') no-repeat 0% 10%; float: right; height: 20px; width: 150px; border: 1px solid #000066; background-color:#FFFFCC; color:#011940; }
113 97
 
114 98
 a.linkFrm, a.linkFrm:link, a.linkFrm:visited, a.linkFrm:active{ color:#297aab; text-decoration:none; outline:none;}
115 99
 a.linkFrm:hover{ text-decoration:underline; color:#297aab;  outline:none;}
116 100
 
117 101
 /* User messages */
118 102
 
119
-.error {
120
-	width:80%;
121
-	background: #FFF7F2 url('../../images/error.png') 15px center no-repeat;
122
-	border-top: 2px solid #CC0000;
123
-	border-bottom: 2px solid #CC0000;
124
-	margin: 0 auto;
125
-	padding: 5px 20px 5px 45px;
126
-}
127
-
128
-.exito {
129
-	width:80%;
130
-	background: #F4FBF5 url('../../images/information.png') 15px center no-repeat;
131
-	border-top: 2px solid #006600;
132
-	border-bottom: 2px solid #006600;
133
-	margin: 0 auto;
134
-	padding: 5px 20px 5px 45px;
135
-}
136
-
137
-.information {
138
-	width:80%;
139
-	background: #FFF6BF url('../../images/icon_info.gif') 15px center no-repeat;
140
-	border-top: 2px solid #FFD324;
141
-	border-bottom: 2px solid #FFD324;
142
-	margin: 0 auto;
143
-	padding: 5px 20px 5px 45px;
144
-}
103
+.error { width:80%; background: #FFF7F2 url('../../images/error.png') 15px center no-repeat; border-top: 2px solid #CC0000; border-bottom: 2px solid #CC0000; margin: 0 auto; padding: 5px 20px 5px 45px; }
104
+.exito { width:80%; background: #F4FBF5 url('../../images/information.png') 15px center no-repeat; border-top: 2px solid #006600; border-bottom: 2px solid #006600; margin: 0 auto; padding: 5px 20px 5px 45px; }
105
+.information { width:80%; background: #FFF6BF url('../../images/icon_info.gif') 15px center no-repeat; border-top: 2px solid #FFD324; border-bottom: 2px solid #FFD324; margin: 0 auto;padding: 5px 20px 5px 45px; }
145 106
 
146 107
 /* Pagination */
147 108
 
148
-div.pagination {
149
-	text-align:center;
150
-	padding:3px;
151
-	margin:3px;
152
-}
153
-
154
-div.pagination a {
155
-	padding: 2px 5px 2px 5px;
156
-	margin-right: 2px;
157
-	border: 1px solid #ddd;
158
-	
159
-	text-decoration: none;
160
-	color: #aaa;
161
-}
162
-
163
-div.pagination a:hover, div.pagination a:active {
164
-	padding: 2px 5px 2px 5px;
165
-	margin-right: 2px;
166
-	border: 1px solid #a0a0a0;
167
-}
168
-
169
-div.pagination span.current {
170
-	padding: 2px 5px 2px 5px;
171
-	margin-right: 2px;
172
-	border: 1px solid #e0e0e0;
173
-	font-weight: bold;
174
-	background-color: #f0f0f0;
175
-	color: #aaa;
176
-}
177
-
178
-div.pagination span.disabled {
179
-	padding: 2px 5px 2px 5px;
180
-	margin-right: 2px;
181
-	border: 1px solid #f3f3f3;
182
-	color: #ccc;
183
-}
109
+div.pagination { text-align:center; padding:3px; margin:3px; }
110
+div.pagination a { padding: 2px 5px 2px 5px; margin-right: 2px; border: 1px solid #ddd; text-decoration: none; color: #aaa; }
111
+div.pagination a:hover, div.pagination a:active { padding: 2px 5px 2px 5px; margin-right: 2px; border: 1px solid #a0a0a0; }
112
+div.pagination span.current { padding: 2px 5px 2px 5px; margin-right: 2px; border: 1px solid #e0e0e0; font-weight: bold; background-color: #f0f0f0; color: #aaa; }
113
+div.pagination span.disabled { padding: 2px 5px 2px 5px; margin-right: 2px; border: 1px solid #f3f3f3; color: #ccc; }
184 114
 
185 115
 /* Conversation Post */
186
-div.conversation ul {
187
-	list-style-type: none;
188
-	margin: 0px;
189
-	padding: 0px 0px 0px 1px;
190
-	border-left: solid 5px #555;
191
-}
192
-
193
-	div.conversation ul li {
194
-		font-size: 12px;
195
-		padding: 4px 0px 4px 8px;
196
-		color: #000;
197
-		margin-bottom: 1px;
198
-	}
199
-
200
-		div.conversation ul li span.label {
201
-			font-weight: bold;
202
-		}
203
-
204
-		div.conversation ul li.odd {
205
-			background-color: #f4f4f4;
206
-		}
207
-
208
-		div.conversation ul li.even {
209
-			background-color: #e8e8e8;
210
-		}
116
+
117
+div.conversation ul { list-style-type: none; margin: 0px; padding: 0px 0px 0px 1px; border-left: solid 5px #555; }
118
+	div.conversation ul li { font-size: 12px; padding: 4px 0px 4px 8px; color: #000; margin-bottom: 1px; }
119
+		div.conversation ul li span.label { font-weight: bold; }
120
+		div.conversation ul li.odd { background-color: #f4f4f4; }
121
+		div.conversation ul li.even { background-color: #e8e8e8; }
122
+
123
+/* Tables design */
124
+
125
+#admin-table { width:535px; margin:0 auto; padding:0;}
126
+table { padding: 0; width:70%; margin: 0 auto; border-collapse: collapse; color: #333; background: #F3F5F7; }
127
+table a {color: #3A4856; text-decoration: none; border-bottom: 1px solid #C6C8CB; }
128
+table img { border:0px; }
129
+table a:visited {color: #777; text-decoration: none; }
130
+table a:hover {color: #000; text-decoration: none; }
131
+table caption {text-align: left; text-transform: uppercase;  padding-bottom: 10px; }
132
+table thead th {background: #BDD3E7; padding: 15px 10px; color: #fff; text-align: left; font-weight: normal; }
133
+table tbody, table thead {border-left: 1px solid #EAECEE; border-right: 1px solid #EAECEE; }
134
+table tbody {border-bottom: 1px solid #EAECEE; }                      
135
+table tbody td, table tbody th {padding: 10px; background: url('images/td_back.gif') repeat-x; text-align: left; }
136
+table tbody tr {background: #F3F5F7; }
137
+table tbody tr.odd {background: #F0F2F4; }
138
+table tbody  tr:hover {background: #EAECEE; color: #111; }
139
+table tfoot td, table tfoot th, table tfoot tr {text-align: left; background: #fff; padding: 10px; }

+ 328 - 0
admin/scripts/sortable.js Целия файл

@@ -0,0 +1,328 @@
1
+/*
2
+Table sorting script  by Joost de Valk, check it out at http://www.joostdevalk.nl/code/sortable-table/.
3
+Based on a script from http://www.kryogenix.org/code/browser/sorttable/.
4
+Distributed under the MIT license: http://www.kryogenix.org/code/browser/licence.html .
5
+
6
+Copyright (c) 1997-2006 Stuart Langridge, Joost de Valk.
7
+
8
+Version 1.5.6
9
+*/
10
+
11
+/* You can change these values */
12
+var image_path = "http://www.joostdevalk.nl/code/sortable-table/";
13
+var image_up = "arrow-up.gif";
14
+var image_down = "arrow-down.gif";
15
+var image_none = "arrow-none.gif";
16
+var europeandate = true;
17
+var alternate_row_colors = true;
18
+
19
+/* Don't change anything below this unless you know what you're doing */
20
+addEvent(window, "load", sortables_init);
21
+
22
+var SORT_COLUMN_INDEX;
23
+var thead = false;
24
+
25
+function sortables_init() {
26
+	// Find all tables with class sortable and make them sortable
27
+	if (!document.getElementsByTagName) return;
28
+	tbls = document.getElementsByTagName("table");
29
+	for (ti=0;ti<tbls.length;ti++) {
30
+		thisTbl = tbls[ti];
31
+		if (((' '+thisTbl.className+' ').indexOf("sortable") != -1) && (thisTbl.id)) {
32
+			ts_makeSortable(thisTbl);
33
+		}
34
+	}
35
+}
36
+
37
+function ts_makeSortable(t) {
38
+	if (t.rows && t.rows.length > 0) {
39
+		if (t.tHead && t.tHead.rows.length > 0) {
40
+			var firstRow = t.tHead.rows[t.tHead.rows.length-1];
41
+			thead = true;
42
+		} else {
43
+			var firstRow = t.rows[0];
44
+		}
45
+	}
46
+	if (!firstRow) return;
47
+	
48
+	// We have a first row: assume it's the header, and make its contents clickable links
49
+	for (var i=0;i<firstRow.cells.length;i++) {
50
+		var cell = firstRow.cells[i];
51
+		var txt = ts_getInnerText(cell);
52
+		if (cell.className != "unsortable" && cell.className.indexOf("unsortable") == -1) {
53
+			cell.innerHTML = '<a href="#" class="sortheader" onclick="ts_resortTable(this, '+i+');return false;">'+txt+'<span class="sortarrow">&nbsp;&nbsp;<img src="'+ image_path + image_none + '" alt="&darr;"/></span></a>';
54
+		}
55
+	}
56
+	if (alternate_row_colors) {
57
+		alternate(t);
58
+	}
59
+}
60
+
61
+function ts_getInnerText(el) {
62
+	if (typeof el == "string") return el;
63
+	if (typeof el == "undefined") { return el };
64
+	if (el.innerText) return el.innerText;	//Not needed but it is faster
65
+	var str = "";
66
+	
67
+	var cs = el.childNodes;
68
+	var l = cs.length;
69
+	for (var i = 0; i < l; i++) {
70
+		switch (cs[i].nodeType) {
71
+			case 1: //ELEMENT_NODE
72
+				str += ts_getInnerText(cs[i]);
73
+				break;
74
+			case 3:	//TEXT_NODE
75
+				str += cs[i].nodeValue;
76
+				break;
77
+		}
78
+	}
79
+	return str;
80
+}
81
+
82
+function ts_resortTable(lnk, clid) {
83
+	var span;
84
+	for (var ci=0;ci<lnk.childNodes.length;ci++) {
85
+		if (lnk.childNodes[ci].tagName && lnk.childNodes[ci].tagName.toLowerCase() == 'span') span = lnk.childNodes[ci];
86
+	}
87
+	var spantext = ts_getInnerText(span);
88
+	var td = lnk.parentNode;
89
+	var column = clid || td.cellIndex;
90
+	var t = getParent(td,'TABLE');
91
+	// Work out a type for the column
92
+	if (t.rows.length <= 1) return;
93
+	var itm = "";
94
+	var i = 1;
95
+	while (itm == "") {
96
+		var itm = ts_getInnerText(t.tBodies[0].rows[i].cells[column]);
97
+		itm = trim(itm);
98
+		if (itm.substr(0,4) == "<!--" || itm.length == 0) {
99
+			itm = "";
100
+		}
101
+		i++;
102
+	}
103
+	sortfn = ts_sort_caseinsensitive;
104
+	if (itm.match(/^\d\d[\/\.-][a-zA-z][a-zA-Z][a-zA-Z][\/\.-]\d\d\d\d$/)) sortfn = ts_sort_date;
105
+	if (itm.match(/^\d\d[\/\.-]\d\d[\/\.-]\d\d\d{2}?$/)) sortfn = ts_sort_date;
106
+	if (itm.match(/^-?[£$€Û¢´]\d/)) sortfn = ts_sort_numeric;
107
+	if (itm.match(/^-?(\d+[,\.]?)+(E[-+][\d]+)?%?$/)) sortfn = ts_sort_numeric;
108
+	SORT_COLUMN_INDEX = column;
109
+	var firstRow = new Array();
110
+	var newRows = new Array();
111
+	for (k=0;k<t.tBodies.length;k++) {
112
+		for (i=0;i<t.tBodies[k].rows[0].length;i++) { 
113
+			firstRow[i] = t.tBodies[k].rows[0][i]; 
114
+		}
115
+	}
116
+	for (k=0;k<t.tBodies.length;k++) {
117
+		if (!thead) {
118
+			// Skip the first row
119
+			for (j=1;j<t.tBodies[k].rows.length;j++) { 
120
+				newRows[j-1] = t.tBodies[k].rows[j];
121
+			}
122
+		} else {
123
+			// Do NOT skip the first row
124
+			for (j=0;j<t.tBodies[k].rows.length;j++) { 
125
+				newRows[j] = t.tBodies[k].rows[j];
126
+			}
127
+		}
128
+	}
129
+	newRows.sort(sortfn);
130
+	if (span.getAttribute("sortdir") == 'down') {
131
+			ARROW = '&nbsp;&nbsp;<img src="'+ image_path + image_down + '" alt="&darr;"/>';
132
+			newRows.reverse();
133
+			span.setAttribute('sortdir','up');
134
+	} else {
135
+			ARROW = '&nbsp;&nbsp;<img src="'+ image_path + image_up + '" alt="&uarr;"/>';
136
+			span.setAttribute('sortdir','down');
137
+	} 
138
+    // We appendChild rows that already exist to the tbody, so it moves them rather than creating new ones
139
+    // don't do sortbottom rows
140
+    for (i=0; i<newRows.length; i++) { 
141
+		if (!newRows[i].className || (newRows[i].className && (newRows[i].className.indexOf('sortbottom') == -1))) {
142
+			t.tBodies[0].appendChild(newRows[i]);
143
+		}
144
+	}
145
+    // do sortbottom rows only
146
+    for (i=0; i<newRows.length; i++) {
147
+		if (newRows[i].className && (newRows[i].className.indexOf('sortbottom') != -1)) 
148
+			t.tBodies[0].appendChild(newRows[i]);
149
+	}
150
+	// Delete any other arrows there may be showing
151
+	var allspans = document.getElementsByTagName("span");
152
+	for (var ci=0;ci<allspans.length;ci++) {
153
+		if (allspans[ci].className == 'sortarrow') {
154
+			if (getParent(allspans[ci],"table") == getParent(lnk,"table")) { // in the same table as us?
155
+				allspans[ci].innerHTML = '&nbsp;&nbsp;<img src="'+ image_path + image_none + '" alt="&darr;"/>';
156
+			}
157
+		}
158
+	}		
159
+	span.innerHTML = ARROW;
160
+	alternate(t);
161
+}
162
+
163
+function getParent(el, pTagName) {
164
+	if (el == null) {
165
+		return null;
166
+	} else if (el.nodeType == 1 && el.tagName.toLowerCase() == pTagName.toLowerCase()) {
167
+		return el;
168
+	} else {
169
+		return getParent(el.parentNode, pTagName);
170
+	}
171
+}
172
+
173
+function sort_date(date) {	
174
+	// y2k notes: two digit years less than 50 are treated as 20XX, greater than 50 are treated as 19XX
175
+	dt = "00000000";
176
+	if (date.length == 11) {
177
+		mtstr = date.substr(3,3);
178
+		mtstr = mtstr.toLowerCase();
179
+		switch(mtstr) {
180
+			case "jan": var mt = "01"; break;
181
+			case "feb": var mt = "02"; break;
182
+			case "mar": var mt = "03"; break;
183
+			case "apr": var mt = "04"; break;
184
+			case "may": var mt = "05"; break;
185
+			case "jun": var mt = "06"; break;
186
+			case "jul": var mt = "07"; break;
187
+			case "aug": var mt = "08"; break;
188
+			case "sep": var mt = "09"; break;
189
+			case "oct": var mt = "10"; break;
190
+			case "nov": var mt = "11"; break;
191
+			case "dec": var mt = "12"; break;
192
+			// default: var mt = "00";
193
+		}
194
+		dt = date.substr(7,4)+mt+date.substr(0,2);
195
+		return dt;
196
+	} else if (date.length == 10) {
197
+		if (europeandate == false) {
198
+			dt = date.substr(6,4)+date.substr(0,2)+date.substr(3,2);
199
+			return dt;
200
+		} else {
201
+			dt = date.substr(6,4)+date.substr(3,2)+date.substr(0,2);
202
+			return dt;
203
+		}
204
+	} else if (date.length == 8) {
205
+		yr = date.substr(6,2);
206
+		if (parseInt(yr) < 50) { 
207
+			yr = '20'+yr; 
208
+		} else { 
209
+			yr = '19'+yr; 
210
+		}
211
+		if (europeandate == true) {
212
+			dt = yr+date.substr(3,2)+date.substr(0,2);
213
+			return dt;
214
+		} else {
215
+			dt = yr+date.substr(0,2)+date.substr(3,2);
216
+			return dt;
217
+		}
218
+	}
219
+	return dt;
220
+}
221
+
222
+function ts_sort_date(a,b) {
223
+	dt1 = sort_date(ts_getInnerText(a.cells[SORT_COLUMN_INDEX]));
224
+	dt2 = sort_date(ts_getInnerText(b.cells[SORT_COLUMN_INDEX]));
225
+	
226
+	if (dt1==dt2) {
227
+		return 0;
228
+	}
229
+	if (dt1<dt2) { 
230
+		return -1;
231
+	}
232
+	return 1;
233
+}
234
+function ts_sort_numeric(a,b) {
235
+	var aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
236
+	aa = clean_num(aa);
237
+	var bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
238
+	bb = clean_num(bb);
239
+	return compare_numeric(aa,bb);
240
+}
241
+function compare_numeric(a,b) {
242
+	var a = parseFloat(a);
243
+	a = (isNaN(a) ? 0 : a);
244
+	var b = parseFloat(b);
245
+	b = (isNaN(b) ? 0 : b);
246
+	return a - b;
247
+}
248
+function ts_sort_caseinsensitive(a,b) {
249
+	aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]).toLowerCase();
250
+	bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]).toLowerCase();
251
+	if (aa==bb) {
252
+		return 0;
253
+	}
254
+	if (aa<bb) {
255
+		return -1;
256
+	}
257
+	return 1;
258
+}
259
+function ts_sort_default(a,b) {
260
+	aa = ts_getInnerText(a.cells[SORT_COLUMN_INDEX]);
261
+	bb = ts_getInnerText(b.cells[SORT_COLUMN_INDEX]);
262
+	if (aa==bb) {
263
+		return 0;
264
+	}
265
+	if (aa<bb) {
266
+		return -1;
267
+	}
268
+	return 1;
269
+}
270
+function addEvent(elm, evType, fn, useCapture)
271
+// addEvent and removeEvent
272
+// cross-browser event handling for IE5+,	NS6 and Mozilla
273
+// By Scott Andrew
274
+{
275
+	if (elm.addEventListener){
276
+		elm.addEventListener(evType, fn, useCapture);
277
+		return true;
278
+	} else if (elm.attachEvent){
279
+		var r = elm.attachEvent("on"+evType, fn);
280
+		return r;
281
+	} else {
282
+		alert("Handler could not be removed");
283
+	}
284
+}
285
+function clean_num(str) {
286
+	str = str.replace(new RegExp(/[^-?0-9.]/g),"");
287
+	return str;
288
+}
289
+function trim(s) {
290
+	while (s.substring(0,1) == ' ') {
291
+		s = s.substring(1,s.length);
292
+	}
293
+	while (s.substring(s.length-1,s.length) == ' ') {
294
+		s = s.substring(0,s.length-1);
295
+	}
296
+	return s;
297
+}
298
+function alternate(table) {
299
+	// Take object table and get all it's tbodies.
300
+	var tableBodies = table.getElementsByTagName("tbody");
301
+	// Loop through these tbodies
302
+	for (var i = 0; i < tableBodies.length; i++) {
303
+		// Take the tbody, and get all it's rows
304
+		var tableRows = tableBodies[i].getElementsByTagName("tr");
305
+		// Loop through these rows
306
+		// Start at 1 because we want to leave the heading row untouched
307
+		for (var j = 0; j < tableRows.length; j++) {
308
+			// Check if j is even, and apply classes for both possible results
309
+			if ( (j % 2) == 0  ) {
310
+				if ( !(tableRows[j].className.indexOf('odd') == -1) ) {
311
+					tableRows[j].className = tableRows[j].className.replace('odd', 'even');
312
+				} else {
313
+					if ( tableRows[j].className.indexOf('even') == -1 ) {
314
+						tableRows[j].className += " even";
315
+					}
316
+				}
317
+			} else {
318
+				if ( !(tableRows[j].className.indexOf('even') == -1) ) {
319
+					tableRows[j].className = tableRows[j].className.replace('even', 'odd');
320
+				} else {
321
+					if ( tableRows[j].className.indexOf('odd') == -1 ) {
322
+						tableRows[j].className += " odd";
323
+					}
324
+				}
325
+			} 
326
+		}
327
+	}
328
+}