I just renamed the script names, the real names are: "sdmenu/sdmenu.js" and "tablecloth/tablecloth.js".
if you want here's the source code, but it will be harder for you to understand.
index.php:
<!--Force IE6 into quirks mode with this comment tag-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PTC Earner - Admin - Earning more from PTC sites</title>
<link href="tablecloth/tablecloth.css" rel="stylesheet" type="text/css" media="screen" />
<link href="style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="sdmenu/sdmenu.css" />
<script type="text/javascript" src="sdmenu/sdmenu.js">
/***********************************************
* Slashdot Menu script- By DimX
* Submitted to Dynamic Drive DHTML code library: http://www.dynamicdrive.com
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
</script>
<script type="text/javascript">
// <![CDATA[
var nav;
window.onload = function() {
nav = new SDMenu('nav');
nav.init();
nav.remember = false; // Store menu states (expanded or collapsed) in cookie and restore later
nav.oneSmOnly = true; // One expanded submenu at a time
};
// ]]>
</script>
<script type="text/javascript" src="tablecloth/tablecloth.js"></script>
</head>
<body>
<div id="framecontent">
<div class="innertube">
<div style="float: left;" id="nav" class="sdmenu">
<div class='' style=''>
<span>PTC sites</span>
<a href="?p=1">Edit Sites</a>
<a href="?p=2">Add Sites</a>
<a href="?p=3">Suggested Sites</a>
</div>
<div>
<span>Pyments</span>
<a href="?p=4">Payments Requests</a>
</div>
<div>
<span>Users</span>
<a href="?p=5">Edit Users</a>
<a href="?p=6">Search Users</a>
<a href="?p=7">List Emails</a>
<a href="?p=8">Mass Email</a>
</div>
<div>
<span>Contact</span>
<a href="?p=9">Messages</a>
</div>
</div>
</div>
</div>
<div id="maincontent">
<div class="innertube">
<b>Edit Sites</b>
<table cellspacing="0" cellpadding="0">
<tr>
<th>Id</th>
<th>Name</th>
<th>Url</th>
<th>Raito</th>
<th>Payed</th>
<th>Use</th>
<th> </th>
<th> </th>
</tr>
<tr>
<td>1</td>
<td>Domain</td>
<td><a href="http://www.domain.com" target="_blank">http://www.domain.com</a></td>
<td>0.01</td>
<td>0</td>
<td>0</td>
<td>
<form method="post" action="index.php?p=1&id=1&do=edit"><input type="submit" value="Edit"></form>
</td>
<td>
<form method="post" action="index.php?p=1&id=1&do=delete"><input onclick="return confirm('Really delete this site?');" type="submit" value="Delete"></form>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td><a href="http://" target="_blank">http://</a></td>
<td>0.01</td>
<td></td>
<td></td>
<td>
<form method="post" action="index.php?p=1&id=&do=edit"><input type="submit" value="Edit"></form>
</td>
<td>
<form method="post" action="index.php?p=1&id=&do=delete"><input onclick="return confirm('Really delete this site?');" type="submit" value="Delete"></form>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td><a href="http://" target="_blank">http://</a></td>
<td>0.01</td>
<td></td>
<td></td>
<td>
<form method="post" action="index.php?p=1&id=&do=edit"><input type="submit" value="Edit"></form>
</td>
<td>
<form method="post" action="index.php?p=1&id=&do=delete"><input onclick="return confirm('Really delete this site?');" type="submit" value="Delete"></form>
</td>
</tr>
<tr>
<td></td>
<td>NeoBux</td>
<td><a href="http://www.neobux.com" target="_blank">http://www.neobux.com</a></td>
<td>0.0</td>
<td></td>
<td></td>
<td>
<form method="post" action="index.php?p=1&id=&do=edit"><input type="submit" value="Edit"></form>
</td>
<td>
<form method="post" action="index.php?p=1&id=&do=delete"><input onclick="return confirm('Really delete this site?');" type="submit" value="Delete"></form>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
tablecloth.js:
/*
Tablecloth
written by Alen Grakalic, provided by Css Globe (cssglobe.com)
please visit http://cssglobe.com/lab/tablecloth/
*/
this.tablecloth = function(){
// CONFIG
// if set to true then mouseover a table cell will highlight entire column (except sibling headings)
var highlightCols = false;
// if set to true then mouseover a table cell will highlight entire row (except sibling headings)
var highlightRows = true;
// if set to true then click on a table sell will select row or column based on config
var selectable = true;
// this function is called when
// add your own code if you want to add action
// function receives object that has been clicked
this.clickAction = function(obj){
//alert(obj.innerHTML);
};
// END CONFIG (do not edit below this line)
var tableover = false;
this.start = function(){
var tables = document.getElementsByTagName("table");
for (var i=0;i<tables.length;i++){
tables[i].onmouseover = function(){tableover = true};
tables[i].onmouseout = function(){tableover = false};
rows(tables[i]);
};
};
this.rows = function(table){
var css = "";
var tr = table.getElementsByTagName("tr");
for (var i=0;i<tr.length;i++){
css = (css == "odd") ? "even" : "odd";
tr[i].className = css;
var arr = new Array();
for(var j=0;j<tr[i].childNodes.length;j++){
if(tr[i].childNodes[j].nodeType == 1) arr.push(tr[i].childNodes[j]);
};
for (var j=0;j<arr.length;j++){
arr[j].row = i;
arr[j].col = j;
if(arr[j].innerHTML == " " || arr[j].innerHTML == "") arr[j].className += " empty";
arr[j].css = arr[j].className;
arr[j].onmouseover = function(){
over(table,this,this.row,this.col);
};
arr[j].onmouseout = function(){
out(table,this,this.row,this.col);
};
arr[j].onmousedown = function(){
down(table,this,this.row,this.col);
};
arr[j].onmouseup = function(){
up(table,this,this.row,this.col);
};
arr[j].onclick = function(){
click(table,this,this.row,this.col);
};
};
};
};
// appyling mouseover state for objects (th or td)
this.over = function(table,obj,row,col){
if (!highlightCols && !highlightRows) obj.className = obj.css + " over";
if(check1(obj,col)){
if(highlightCols) highlightCol(table,obj,col);
if(highlightRows) highlightRow(table,obj,row);
};
};
// appyling mouseout state for objects (th or td)
this.out = function(table,obj,row,col){
if (!highlightCols && !highlightRows) obj.className = obj.css;
unhighlightCol(table,col);
unhighlightRow(table,row);
};
// appyling mousedown state for objects (th or td)
this.down = function(table,obj,row,col){
obj.className = obj.css + " down";
};
// appyling mouseup state for objects (th or td)
this.up = function(table,obj,row,col){
obj.className = obj.css + " over";
};
// onclick event for objects (th or td)
this.click = function(table,obj,row,col){
if(check1){
if(selectable) {
unselect(table);
if(highlightCols) highlightCol(table,obj,col,true);
if(highlightRows) highlightRow(table,obj,row,true);
document.onclick = unselectAll;
}
};
clickAction(obj);
};
this.highlightCol = function(table,active,col,sel){
var css = (typeof(sel) != "undefined") ? "selected" : "over";
var tr = table.getElementsByTagName("tr");
for (var i=0;i<tr.length;i++){
var arr = new Array();
for(j=0;j<tr[i].childNodes.length;j++){
if(tr[i].childNodes[j].nodeType == 1) arr.push(tr[i].childNodes[j]);
};
var obj = arr[col];
if (check2(active,obj) && check3(obj)) obj.className = obj.css + " " + css;
};
};
this.unhighlightCol = function(table,col){
var tr = table.getElementsByTagName("tr");
for (var i=0;i<tr.length;i++){
var arr = new Array();
for(j=0;j<tr[i].childNodes.length;j++){
if(tr[i].childNodes[j].nodeType == 1) arr.push(tr[i].childNodes[j])
};
var obj = arr[col];
if(check3(obj)) obj.className = obj.css;
};
};
this.highlightRow = function(table,active,row,sel){
var css = (typeof(sel) != "undefined") ? "selected" : "over";
var tr = table.getElementsByTagName("tr")[row];
for (var i=0;i<tr.childNodes.length;i++){
var obj = tr.childNodes[i];
if (check2(active,obj) && check3(obj)) obj.className = obj.css + " " + css;
};
};
this.unhighlightRow = function(table,row){
var tr = table.getElementsByTagName("tr")[row];
for (var i=0;i<tr.childNodes.length;i++){
var obj = tr.childNodes[i];
if(check3(obj)) obj.className = obj.css;
};
};
this.unselect = function(table){
tr = table.getElementsByTagName("tr")
for (var i=0;i<tr.length;i++){
for (var j=0;j<tr[i].childNodes.length;j++){
var obj = tr[i].childNodes[j];
if(obj.className) obj.className = obj.className.replace("selected","");
};
};
};
this.unselectAll = function(){
if(!tableover){
tables = document.getElementsByTagName("table");
for (var i=0;i<tables.length;i++){
unselect(tables[i])
};
};
};
this.check1 = function(obj,col){
return (!(col == 0 && obj.className.indexOf("empty") != -1));
}
this.check2 = function(active,obj){
return (!(active.tagName == "TH" && obj.tagName == "TH"));
};
this.check3 = function(obj){
return (obj.className) ? (obj.className.indexOf("selected") == -1) : true;
};
start();
};
/* script initiates on page load. */
window.onload = tablecloth;
sdmenu.js:
function SDMenu(id) {
if (!document.getElementById || !document.getElementsByTagName)
return false;
this.menu = document.getElementById(id);
this.submenus = this.menu.getElementsByTagName("div");
this.remember = true;
this.speed = 3;
this.markCurrent = true;
this.oneSmOnly = false;
}
SDMenu.prototype.init = function() {
var mainInstance = this;
for (var i = 0; i < this.submenus.length; i++)
this.submenus[i].getElementsByTagName("span")[0].onclick = function() {
mainInstance.toggleMenu(this.parentNode);
};
if (this.markCurrent) {
var links = this.menu.getElementsByTagName("a");
for (var i = 0; i < links.length; i++)
if (links[i].href == document.location.href) {
links[i].className = "current";
break;
}
}
if (this.remember) {
var regex = new RegExp("sdmenu_" + encodeURIComponent(this.menu.id) + "=([01]+)");
var match = regex.exec(document.cookie);
if (match) {
var states = match[1].split("");
for (var i = 0; i < states.length; i++)
this.submenus[i].className = (states[i] == 0 ? "collapsed" : "");
}
}
};
SDMenu.prototype.toggleMenu = function(submenu) {
if (submenu.className == "collapsed")
this.expandMenu(submenu);
else
this.collapseMenu(submenu);
};
SDMenu.prototype.expandMenu = function(submenu) {
var fullHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
var links = submenu.getElementsByTagName("a");
for (var i = 0; i < links.length; i++)
fullHeight += links[i].offsetHeight;
var moveBy = Math.round(this.speed * links.length);
var mainInstance = this;
var intId = setInterval(function() {
var curHeight = submenu.offsetHeight;
var newHeight = curHeight + moveBy;
if (newHeight < fullHeight)
submenu.style.height = newHeight + "px";
else {
clearInterval(intId);
submenu.style.height = "";
submenu.className = "";
mainInstance.memorize();
}
}, 30);
this.collapseOthers(submenu);
};
SDMenu.prototype.collapseMenu = function(submenu) {
var minHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
var moveBy = Math.round(this.speed * submenu.getElementsByTagName("a").length);
var mainInstance = this;
var intId = setInterval(function() {
var curHeight = submenu.offsetHeight;
var newHeight = curHeight - moveBy;
if (newHeight > minHeight)
submenu.style.height = newHeight + "px";
else {
clearInterval(intId);
submenu.style.height = "";
submenu.className = "collapsed";
mainInstance.memorize();
}
}, 30);
};
SDMenu.prototype.collapseOthers = function(submenu) {
if (this.oneSmOnly) {
for (var i = 0; i < this.submenus.length; i++)
if (this.submenus[i] != submenu && this.submenus[i].className != "collapsed")
this.collapseMenu(this.submenus[i]);
}
};
SDMenu.prototype.expandAll = function() {
var oldOneSmOnly = this.oneSmOnly;
this.oneSmOnly = false;
for (var i = 0; i < this.submenus.length; i++)
if (this.submenus[i].className == "collapsed")
this.expandMenu(this.submenus[i]);
this.oneSmOnly = oldOneSmOnly;
};
SDMenu.prototype.collapseAll = function() {
for (var i = 0; i < this.submenus.length; i++)
if (this.submenus[i].className != "collapsed")
this.collapseMenu(this.submenus[i]);
};
SDMenu.prototype.memorize = function() {
if (this.remember) {
var states = new Array();
for (var i = 0; i < this.submenus.length; i++)
states.push(this.submenus[i].className == "collapsed" ? 0 : 1);
var d = new Date();
d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000));
document.cookie = "sdmenu_" + encodeURIComponent(this.menu.id) + "=" + states.join("") + "; expires=" + d.toGMTString() + "; path=/";
}
};
is that better?
and everything is in functions so it can't get out.