function checkVal(res) {
  if (res.textContent) return res.textContent;
  else if (res.text) return res.text;
  else if (res.nodeValue) return res.nodeValue
  else if (res.firstChild) return res.firstChild.nodeValue;
  else return "";
}

var set = {
	'scrSize' : function() {
	  var sWid,sHe;
	  if( typeof(window.innerWidth) === 'number' ) {
       sWid = window.innerWidth;
       sHe = window.innerHeight;
      } else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight )) {
       sWid  = document.documentElement.clientWidth;
       sHe = document.documentElement.clientHeight;
     } else if(document.body && (document.body.clientWidth || document.body.clientHeight )) {
      sWid  = document.body.clientWidth;
      sHe = document.body.clientHeight;
     }
     return[sWid,sHe];
	},
	'stopBub' : function(e) {
	   if (!e) var e = window.event; e.cancelBubble=true;if(e.stopPropagation)e.stopPropagation();return e;
	},
	'offset' : function(el, lessPar) {
	  if (!el) return false;
		var wid = el.offsetWidth;
		var height=el.offsetHeight;
		var top=left=ptop=pleft=x=0;
		do {
		  if (x > 0) {
			ptop+=el.offsetTop;
			pleft+=el.offsetLeft;
		  }
		  x++
		  left += el.offsetLeft;
		  top += el.offsetTop;
		} while (el=el.offsetParent);
	  if (lessPar) {
		left= left - pleft;
		top = top - ptop;
	  }
	  pleft=ptop=null;
 	  return [top, left, wid, height];
	},
	'shDiv' : function(id, type) {
	  var el=(typeof id == "string") ? document.getElementById(id) : id;
	  if (el) {
		if (type) {
			el.style.visibility="visible";
			el.style.display="block";
		} else {
			el.style.visibility="hidden";
			el.style.display="none";
		}
	  }	
		el=null;
	}
}

String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); };



function Ajax() {
  this.req = null;
  this.url = null;
  this.method = 'GET';
  this.async = true;
  this.status = null;
  this.statusText = '';
  this.postData = null;
  this.readyState = null;
  this.responseText = null;
  this.responseXML = null;
  this.handleResp = null;
  this.responseFormat = 'text', // 'text', 'xml' or object
  this.innerID = null;
  this.logout = null;
  this.tries=0;
  this.maxtries=2;
}

Ajax.prototype.init = function() {
    if (!this.req) {
       try {
         //Try to create object for firefox / safari etc
         this.req = new XMLHttpRequest();
        }
        catch (e) {
         try {
           //try to create object for later versions of IE
           this.req = new ActiveXObject("MSXML2.XMLHTTP");
         }
         catch(e) {
            try {
             //try to create object for earlier versions of IE
             this.req = new ActiveObject('Microsoft.XMLHTTP');
          } catch (e) {
            //could not create the object so return false
            return false;
         }
       }
    }
  }
  return this.req;
}

Ajax.prototype.doReq = function() {
  if (!this.init()) {
    alert("Could not create XMLHttp Object");
    return;
  }
 this.req.open(this.method, this.url, this.async);
  if (this.method == "POST") {
    this.req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    this.req.setRequestHeader("Content-length", this.postData.length);
    this.req.setRequestHeader("Connection", "close");
  }
  var self = this;
  this.req.onreadystatechange = function() {
    var resp;
    if (self.req.readyState == 4) {
        switch(self.responseFormat) {
            case 'text':
                resp = self.req.responseText;
                break;
            case 'xml':
                resp = self.req.responseXML;
                break;
            case 'object':
                resp = req;
                break;
       }
        if (self.req.status >= 200 && self.req.status <= 299) {
            //find out what status resp is
            if (self.logout) {
               if (self.responseFormat=="xml") {
				var tgs = resp.getElementsByTagName("_logout_");
				 if (tgs.length > 1) {
					tgs=null;
					href.location = self.logout;
				 } 
			   } else if (resp.indexOf("_logout_=true ") > -1) {
				href.location=self.logout;
			   }
			  return false;  
	      }	   
	  if (self.innerID) {
	    document.getElementById(self.innerID).innerHTML = resp;
	  } 
	  if (typeof self.handleResp === 'function') self.handleResp(resp);
	  else if (self.handleResp==="alert") alert(resp);
     } else self.handleErr(resp);
    }
    resp=null;
  };
  try {
    this.req.send(this.postData);
    } catch (e) {
    }
    resp=null;
}

Ajax.prototype.handleErr = function(str) {
  if (this.tries < this.maxtries) {
	this.tries++;
	this.abort();
	this.doReq();
 } else {
    alert ('An error has occured, Status code: ' + this.req.status + '\n Status description: ' + this.req.statusText + ' URL: ' + this.url);
  }
}

Ajax.prototype.abort = function() {
  if (this.req) {
    this.req.onreadystatechange = function () {};
    this.req.abort();
    this.req = null;
  }
}

Ajax.prototype.doGet = function(url, hand, format, innerID, logout) {
  this.url=url;
  this.handleResp=hand;
  this.innerID=innerID;
  this.logout=logout;
  this.responseFormat = format || 'text';
  this.doReq();
}

var sts = {
	'clicks' : [],
	'stT' : new Date(),
	'load' : new Date(),
	'setXY' : function(e) {
		if (!e) var e = window.event;
		var orig = (e.srcElement) ? e.srcElement : e.target;  
		while (orig) {
		  if (orig.id || orig.nodeType !== 1) break;
		  orig=orig.parentNode;
		}
		var id=(orig)?orig.id:0;
		sts.clicks[sts.clicks.length] = {'x' : e.clientX, 'y' : e.clientY, 'srcId' : id};
		id=orig=null;
	},
	'endPage' : function() {
		var clstr='', endtime, sttime;
		for (var i=0; i<sts.clicks.length; i++) {
		 clstr += "&link_" + i + "_x=" + sts.clicks[i].x;
		 clstr += "&link_" + i + "_y=" + sts.clicks[i].y;
		 clstr += "&link_" + i + "_srcid=" + encodeURI(sts.clicks[i].srcId);
	    }
	    endtime = new Date().getTime() - sts.load.getTime();
	    sttime = sts.load.getTime() - sts.stT.getTime();
	 var arr=set.scrSize();
	 clstr = "starttime=" + sttime + "&endtime=" + endtime + "&wid=" + arr[0] + "&he=" + arr[1]  + clstr;
	 var ajax = new Ajax();
	 ajax.async=false;
	 ajax.doGet("/function/setstats.php?" + clstr);
	 ajax=endtime=clstr=arr=sttime=ajax=null;
	}
}

var hands = {
	'st' : {},
	'setHd' : function(el, ob, set) {
	  for ( var i in ob) {
	    try {
		el[i] = (set)?ob[i]:null;
		if (i==="onclick") el.style.cursor="pointer";
		} catch(e){}
	  }
	  el=ob=set=null;
	},
	'set' : function(set) {
	  var iob, el, y;
		for (var i in hands.st) {
		   iob=hands.st[i];
		   if (iob.loop) {
		    y=0;
		    do {
		     el=document.getElementById(i + y);
		     if (el) hands.setHd(el, iob, set);
		     y++;
		    } while (el);
		  } else hands.setHd(document.getElementById(i), iob, set);
		}
		scrl.loadOb();
	  iob=el=y=null;	
	},
	'reg' : function(id, type, func) {
	   if (!hands.st[id]) hands.st[id] = {};
	   hands.st[id][type] = func;
	} 
}

var win = {
   'wins' : {},
	'open' : function() {
	  var ob=win.wins[this.id];
		window.open(ob.src, "view_photo", "toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,copyhistory=no,scrollbars=yes,width=" + b.width + ",height=" + ob.height + ",top=100,left=50");
		ob=null;
    return false;
	},
	'reg' : function(id, src, width, height) {
		win.wins[id] = {'src':src,'width':width,'height':height};
	},
	'popOver' : function(id) {
	  var id = (typeof id === "string") ? id : this.id;
      var ob=win.wins[id];
	  win.closePopOver();
	  var dv = document.createElement("div");
	 dv.setAttribute("id", "popover");
	 dv.style.cssText="width:100%;height:100%;position:fixed;margin:0px;padding:0px;top:0px;left:0px;background-image:url(/img/grey_popup_fade.png);background-repeat:repeat;z-index:6000;";
    var href= (ob.src.indexOf("?") > -1) ? ob.src + "&popover=true" : ob.src + "?popover=true";
	dv.innerHTML="<iframe id='popovercontent' src='" + href + "' FRAMEBORDER=0 style='position:absolute;margin:0px;padding:0px;top:10px;left:0px;border:0px;visibility:hidden;'></iframe></div>";
	document.body.appendChild(dv);
	dv=null;
	return false;
  },
  'resizePop' : function() {
    var arr=set.scrSize();
    var wid,he;
    var ob=document.getElementById("popovercontent");
  	if (!ob) return false;
  	var sWid=arr[0],sHe=arr[1];
	var bd=(ob.contentWindow) ?ob.contentWindow.document.body : ob.contentDocument.body;
	for (var i=0,n=bd.childNodes.length;i<n;i++) {
		if (bd.childNodes[i].nodeName.toLowerCase() === "div") {
			wid = bd.childNodes[i].offsetWidth;
			he=bd.childNodes[i].offsetHeight;
		   break;
		}
	}
	var sc=false;
  	if (he > arr[1] * 0.9) {
	    he = arr[1] * 0.9;
	    sc=true;
	}
	if(sc) {
  	  bd.style.overflow="hidden";
  	  var bdwid=bd.clientWidth;
  	  bd.style.overflow="scroll";
  	  bdwid -= bd.clientWidth;
  	  if (!bdwid) bdwid = bd.offsetWidth - bd.clientWidth;
  	  bd.style.overflow='auto';
  	  if (bdwid + wid < sWid * 0.8) wid += bdwid;
  	}  
  	bd=null;
  	ob.style.left=((sWid / 2) - (wid / 2)) + "px";
    ob.style.top=((sHe / 2) - (he / 2)) + "px";
    ob.style.width=(wid + 3) + "px";
    ob.style.height=(he + 3) +  "px";
    ob.style.visibility="visible";
    sHe=sWid=ob=wid=he=null;
  },
  'closePopOver' : function() {
     var ob=document.getElementById("popover");
     if (ob) document.body.removeChild(ob);
     ob=null;
   }
}

function popOver(ob) {
 	win.reg(ob.id, ob.href);
	win.popOver(ob.id);
	ob=null;
	return false;
}

function closePopOver() {
	win.closePopOver();
}

var drop = {
  'drops' : {},
  'msO' : {},
  'sty' : {},
  'oM' : [],
  'curLevel' : 0,
  'scrollOut' : function(id,x, y) {
    ob=drop.cob;
    var cob=drop.drops[id];
    if (x > parseInt(cob.width)) x=parseInt(cob.width);
    if (y > parseInt(cob.height)) y = parseInt(cob.height);
	ob.style.overflow="hidden";
	ob.style.width = x + "px";
	ob.style.minHeight= y + "px";
	x+=10;
	y+=10;
	if (x < parseInt(cob.width) || y < parseInt(cob.height)) {
		window.setTimeout("drop.scrollOut('" + id + "', " + x + ", " + y + ");", 10);
	}
	ob=cob=null;
  },
  'startDrop' : function(id) {
    //if curmenu is not false then clear it out
    var cob=drop.drops[id];
    drop.curLevel = (isNaN(parseInt(cob.level)))? 0:  cob.level;
    if (!cob.status) {
      drop.checkTime();
      drop.oM[drop.oM.length] = id;
      set.shDiv(cob._dropMenu, true);
      if (cob.align) {
           //get the offset of the parent and then the child node
           var dropel=document.getElementById(cob._dropMenu);
           var el=set.offset(document.getElementById(id));
           dropel.style.left = (el[1] + cob.align[0]) + "px";
           dropel.style.top = (el[0] + cob.align[1]) + "px";
           dropel=el=null;
      }
      drop.cob=document.getElementById(cob._dropMenu);
      if (cob.type == "scrollin") drop.scrollOut(id, 0, 0);
    } 
	cob.status=1;
	cob=null;
    //finally start timer
  },
  'unSet' : function(id) {
	drop.drops[id].status=2;
	drop.drops[id].offsetTime = new Date();
	setTimeout("drop.checkTime();",200);
  },
  'checkTime' : function() {
    var recheck=false;
    var cob,now,dif;
    var i = drop.oM.length;
    while (i--) {
		cob=drop.drops[drop.oM[i]];
		if (cob.status==2 && cob.level >= drop.curLevel) {
		   now = new Date();
    	   dif = now.getTime() - cob.offsetTime.getTime();
    	if (dif > cob.delay) {
		   set.shDiv(cob._dropMenu, false);
		   cob.status=null;
		   drop.oM.splice(i, 1);
    	} else recheck=true;
		}
	}
    if (recheck) setTimeout("drop.checkTime()", 100);
    recheck=cob=now=dif=null;
 },
 'mouseO' : function(){
   var cob=drop.msO[this.id];
   if (cob) this.src=cob.mouseO;
   id=this.id.replace(/_dropdown/g, "");
   cob = drop.drops[id];
   if (cob) drop.startDrop(id);
   cob=drop.sty[this.id];
   if (cob){
    var or;
	 for (var i in cob) {
		or=this.style[i];
		this.style[i]=cob[i];
		cob[i]=or?or:i==="backgroundColor"?"transparent":"none";  
	 }
	or=null;
  }
   cob=null;
  },
  'mouseOt' : function() {
    var cob=drop.msO[this.id];
    if (cob) this.src=cob.src;
    id=this.id.replace(/_dropdown/g, "");
    cob = drop.drops[id];
	if (cob) drop.unSet(id);
	cob=this.sty;
	cob=drop.sty[this.id];
   if (cob){
    var or;
	 for (var i in cob) {
		or=this.style[i];
     	 this.style[i]=cob[i];
		 cob[i]=or;
	 }
	or=null;
  }
	cob=null;
  },
  'regDrop' : function(id, level, delay, align) {
   if (!delay) delay=0;
	drop.drops[id] = {'_dropMenu': id + "_dropdown", 'level':level, 'delay':delay, 'align':align};
	hands.reg(id, 'onmouseover', drop.mouseO);
	hands.reg(id, 'onmouseout', drop.mouseOt);
	hands.reg(id + "_dropdown", 'onmouseover', drop.mouseO);
	hands.reg(id + "_dropdown", 'onmouseout', drop.mouseOt);
  },
  'regM' : function(id, src, msO) {
	drop.msO[id] = {'src':src,'mouseO':msO};
	hands.reg(id, 'onmouseover', drop.mouseO);
	hands.reg(id, 'onmouseout', drop.mouseOt);
	var img = new Image();
    img.src = msO;
  },
  'regSt' : function(id, col, img, rep) {
	 drop.sty[id] = {'backgroundColor':col,'backgroundImage':img,'backgroundRepeat':rep};
	 hands.reg(id, 'onmouseover', drop.mouseO);
	hands.reg(id, 'onmouseout', drop.mouseOt);
  }
}

var fms = {
  'vals' : {},  
  'reg' : function(id, def,err) {
	 fms.vals[id] = {'def':def,'error':err};
  },
  '_clickBlur' : function() {
	if (this.value=="") this.value =fms.vals[this.id].clickRemove;
  },
  '_clickFocus' : function() {
	if (this.value==fms.vals[this.id].clickRemove) this.value = "";
   },
    'shBD' : function(fm) {
     var tgs=fm.elements;
     var cob;
     var i=tgs.length;
     while (i--) {
		if (fms.vals[tgs[i].id]) {
			cob=fms.vals[tgs[i].id];
			if (cob.okay) {
				if (cob.border && tgs[i].type != "radio" ) tgs[i].style.border=cob.border;
			} else {
			if (tgs[i].type != "radio") {
				if (tgs[i].style.border != "2px solid red") cob.border=tgs[i].style.border;
				tgs[i].style.border="2px solid red";
			}
		   }	
		}
	 }
	tgs=cob=i=null;
    }, 
    '_chkForm' : function(fmName, del) {
       if (del==="1") {
		var ok=confirm("Are you sure you want to delete this?\nClicking ok will permanently delete this from the database. If you do not want to delete this, click cancel");
		return ok;
	  } else {
  		var ob, cob, fm = document.getElementById(fmName), typ;
  		var okay=true;
  		var tgs=fm.getElementsByTagName("*");
  		var i=tgs.length;
  		var rads={};
  		var err="The following action is required: ";
  		while (i--) {
  		  ob=tgs[i];
			if (fms.vals[ob.id]) {
				typ=ob.type;
				cob=fms.vals[ob.id];
				cob.okay=true;
				if (typ == "radio") {
					if (ob.checked) rads[ob.name] = true;
					else if (!rads[ob.name]) rads[ob.name] = false;
				} else if ((typ=="checkbox" && !ob.checked) || (typ !== "checkbox" && ob.value.trim() == cob.def)) {
				 if (cob.error) err += "<br>" + cob.error;
				 else err += "<br>" + ob.name;
				  okay=cob.okay=false;
				}  
			} 
		}
		for (var i in rads) {
		  if (!rads[i]) {
		    fms.vals[i].okay = okay = false;
		    err += (err.error) ? "<br>" + err.error : "<br>" + i;
		   }  
		}
		rads=typ=cob=ob=null;
		fms.shBD(fm);
  		if (!okay) {
	      var el=document.getElementById(fm.id + "_error");
	      if (el) {
		    el.firstChild.innerHTML = err;
		    set.shDiv(el);
		    el=null;
		  }  else alert(err.replace(/<br>/g, "\n"));
	      el=null;
  		} else if (mAjax.obs[fmName]) {
  		  var data = "";
			//make an ajax object of the data
	        var i=fm.elements.length;
	        var ob;
	        while (i--) {
	         ob=fm.elements[i];
	         if (data !== "") data += "&";
	         if (ob.type==="radio") {
	           var x=ob.length;
	           while (x--) {
				if (ob[x].checked) {
				   data += ob[x].name + "=" + escape(ob[x].value);
					break;
				} 
			   }	
			 } else if ((ob.type!=="checkbox" || ob.checked) && typeof ob.value === "string" ) data += ob.name + "=" + escape(ob.value);
		   }
		  mAjax.run(fmName, data);
		  tg=tgs=data=null;
		  return false;
		}
 		return okay;
 	 }	
   }
}
var cal = {
	'date' : null,
	'day' : ((1000 * 60) * 60) * 24,
	'curmonth' : null,
	'month' : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
	'setDateId' : null,
	'origFunc' : false,
	'runCal' : function(e) {
		//get offset left and top
	  set.stopBub(e);
	  cal.close();
	  cal.setDateId = this.id;
	  cal.date = new Date();
	  var off=set.offset(this);
      var dv = document.createElement("div");
      dv.style.position="absolute";
      dv.style.top=off[0] + "px";
      dv.style.left=(off[1] + off[2] + 15 ) + "px";
      dv.setAttribute("id", "calendar");
      dv.onclick=set.stopBub;
      dv.style.backgroundColor="#ffffff";
      dv.style.border="1px solid #000000";
      dv.style.zIndex="400";
      document.body.appendChild(dv);
      cal.setCal();
      cal.origFunc = document.body.onclick;
      dv=off=null;
	},
	'setCal' : function() {
	  var el = document.getElementById("calendar");
	  if (el==null) return false;
	    var mon, htm, st, day, dt;
	    this.curmonth = this.date.getMonth()
	    mon = this.month[this.curmonth];
	    htm = "<table style='font-size:12px;font-family:Arial;'><tr><td colspan='7' style='text-align:right;cursor:pointer;' onclick='cal.close();'>close</td></tr>";
		htm += "<tr><td colspan='7' style='text-align:center;'><span style='position:relative;float:left;'><a id='backyear' style='cursor:pointer;'>&lt;&lt;</a>&nbsp;|&nbsp;<a id='back' style='cursor:pointer;'>&lt;</a></span>&nbsp;|&nbsp;<span>" + mon + " - " + cal.date.getFullYear() + "</span>&nbsp;|&nbsp;<span id='nextmonth' style='position:relative;float:right;'><a id='next' style='cursor:pointer;'>&gt;</a>&nbsp;|&nbsp;<a id='nextyear' style='cursor:pointer;'>&gt;&gt;</a></span></td></tr>";
		htm += "<tr><td id='sun'>Sun</td><td id='mon'>Mon</td><td id='tue'>Tue</td><td id='wed'>Wed</td><td id='thu'>Thu</td><td id='fri'>Fri</td><td id='sat'>Sat</td></tr>";
		var dto = new Date();
		dto.setDate(1);
		dto.setFullYear(this.date.getFullYear());
		dto.setMonth(this.date.getMonth());
		day = dto.getDay();
		st=0;
		while (dto.getMonth() == this.curmonth) {
		  for (var i=0; i<7; i++) {
		    if (i==0) htm += "<tr>";
		    if (i==day && st==0) st=1;
		    if (st==1) {
		     dt = dto.getDate();
		     htm += "<td id='date/" + dt + "' style='text-align:center;cursor:pointer;'>" + dt + "</td>";
		      dto.setTime(dto.getTime() + this.day);
			} else {
			 htm += "<td>&nbsp;</td>";
			}
		    if (i==6) htm += "<tr>";
		    if (dto.getMonth() != this.curmonth) st=2;
		  }
		}	 
	   el.innerHTML = htm;
	   var tgs =el.getElementsByTagName("td");
       for (var i=0; i<tgs.length; i++) {
		if (tgs[i].id!=null && tgs[i].id!="") {
		    tgs[i].onclick=cal.postDate;
		}
	  } 
	  document.getElementById("back").onclick=cal.prevMonth;
	  document.getElementById("next").onclick=cal.nextMonth;
	  document.getElementById("backyear").onclick=cal.prevYear;
	  document.getElementById("nextyear").onclick=cal.nextYear;
	  mon=htm=st=day=dt=dto=tgs=el=null;
	},	
	'setDate' : function(time) {
		this.date.setTime(time);
	},
   'postDate' : function(e) {
       set.stopBub(e);
		var day = this.id.split("/");
		var mon = cal.date.getMonth() + 1;
		if (mon < 10) mon = "0" + mon;
		if (day[1] < 10) day[1] = "0" + day[1];
		document.getElementById(cal.setDateId).value = day[1] + "/" + mon + "/" + cal.date.getFullYear();
		day=mon=null;
		cal.close();
	},	
	'nextMonth' : function() {
		var mon = cal.date.getMonth() + 1;
		if (mon>=12) {
			cal.date.setFullYear(cal.date.getFullYear() + 1);
			cal.date.setMonth(0);
		} else {
		    cal.date.setMonth(mon);
	    }
	  cal.setCal();
	},
	'nextYear' : function() {
		cal.date.setFullYear(cal.date.getFullYear() + 1);
		cal.setCal();
	},	
	'prevMonth' : function() {
		var mon = cal.date.getMonth() - 1;
		if (mon==-1) {
		   cal.date.setFullYear(cal.date.getFullYear() - 1);
		   cal.date.setMonth(11);
		} else {
		   cal.date.setMonth(mon);
	    }
	  cal.setCal();
	},
	'prevYear' : function() {
		cal.date.setFullYear(cal.date.getFullYear() - 1);
		cal.setCal();
	},
	'close' : function() {
	   var el = document.getElementById("calendar");
	   if (el!=null) document.body.removeChild(el);
	   el=null;
	   if (cal.origFunc != false) {
	       document.body.onclick=cal.origFunc;
	   	   cal.origFunc=null;
	   }
	} 
}

var mAjax = {
	'obs' : {},
	'addOb' : function(id, name, src, srcid, method, func, data, logout, time) {
		mAjax.obs[id] = {'src':src,'srcid':srcid,'name':name,'method':method,'func':func,'data':data,'logout':logout,'time':time};
	},
	'run' : function(id, data) {
		var id=(typeof id === "string") ? id : this.id;
		var cob=mAjax.obs[id];
		if (!cob) return false;
	    var ob=document.getElementById(cob.srcid);
		if (ob) ob.innerHTML = "loading... ";
		ob=null;
		var ajax = new Ajax();
		var src=cob.src;
		if (cob.method==="POST") ajax.postData = cob.data;
		else src += "?" + cob.name + "=true&" + data;
		ajax.doGet(src, cob.func, "text", cob.srcid, cob.logout);
		if (!isNaN(parseInt(cob.time))) window.setTimeout("mAjax('" + id + "');");
	    id=cob=src=ajax=null;
	}

}

var scrl = {
	'obs':{},
	'scr' : function(id) {
	  var obs=scrl.obs[id];
	    if(!obs.pause) {
			obs.vl=obs.vl <= 0 - obs.size? obs.st : obs.vl - 2;
			obs.ob.firstChild.style[obs.style] = obs.vl + "px";
		}	
		window.setTimeout("scrl.scr('" + id + "')", obs.speed / 10);
	  obs=null;
	},
	'stpscr' : function() {
		scrl.obs[this.id].pause=true;
	},
	'setscr' : function() {
		scrl.obs[this.id].pause=false;
	},
	'regOb' : function(id, speed, style) {
		scrl.obs[id] = {'speed' : speed, 'id' :id, 'style' : style};
	},
	'loadOb' : function() {
	  var style,ob,dv;
		for (var id in scrl.obs) {
		ob=document.getElementById(id);
		scrl.obs[id].ob = ob;
		style=scrl.obs[id].style;
		dv=document.createElement("div");
		dv.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;";
		if (ob.style.paddingLeft) dv.style.paddingLeft=ob.style.paddingLeft;
		if (ob.style.paddingRight) dv.style.paddingRight=ob.style.paddingRight;
		if (ob.style.paddingTop) dv.style.paddingTop=ob.style.paddingTop;
		if (ob.style.paddingBottom) dv.style.paddingBottom=ob.style.paddingBottom;
		ob.style.padding=0;
		ob.style.overflow="hidden";
		dv.innerHTML=ob.innerHTML;
		ob.innerHTML="";
		ob.appendChild(dv);
		if (style==="left") {
			scrl.obs[id].size=ob.firstChild.offsetWidth;
			scrl.obs[id].vl = ob.offsetWidth;
		} else {
			scrl.obs[id].size=ob.firstChild.offsetHeight;
			scrl.obs[id].vl = ob.offsetHeight;
		}
		scrl.obs[id].st=scrl.obs[id].vl;
		dv.style[style] = scrl.obs[id].vl + "px";
		window.setTimeout("scrl.scr('" + id + "')", scrl.obs[id].speed / 10);
		}
      dv=ob=style=null;	
	}
}

document.onclick = sts.setXY;
window.onbeforeunload = function() {
     sts.endPage();
     hands.set(false);
}