var Ar = new Array(), _pos = 0, scroller = null;

function _scroll(obj){
if(Ar.length <= 0) _count();
//scrollTo(0, Ar[obj.rel]);
if(_pos != Ar[$(obj).attr('rel')]){
_pos = Ar[$(obj).attr('rel')];
if(scroller == null){scroller = setInterval(drive, 20);}
}}

function drive(){
var _top = $("body").get(0).scrollTop, _new = 0;
if(_top > _pos){_new = parseInt(_top - (_top - _pos) / 10);}else{_new = parseInt(_top + (_pos - _top) / 10);}
scrollTo(0, _new);
if(_top == _new){
clearInterval(scroller);
scroller = null;
}}

function _count(){
var step = 0, i = 0;
$("body > table").each(function(){
if(this.className != 'Menu'){
Ar[this.id] = step;
step += this.clientHeight;
i++;
}});
Ar.length = i;}

$(function(){$(document).mousewheel(function(event, delta){
if(delta > 0){
clearInterval(scroller);
scroller = null;
_pos = -1;
}else if(delta < 0){
clearInterval(scroller);
scroller = null;
_pos = -1;
}});});

function _labelHide(){
if(!document.getElementById) return;

var labels, id, field;

labels = document.getElementsByTagName('label');
for(var i=0; i<labels.length; i++){

id = labels[i].htmlFor || labels[i].getAttribute('for');
if(!id || !(field = document.getElementById(id))){continue;}
if(field.type != undefined && (field.type == "text" || field.type == "textarea")){
if(field.value == undefined || field.value == '') field.value = field.title;

field.onfocus = function(){if(this.value == this.title) this.value = '';};
field.onclick = function(){if(this.value == this.title) this.value = '';};
field.onblur = function(){if(this.value == '') this.value = this.title;};
}}
labels = null; id = null; field = null;}

$(document).ready(function(){$(".lightbox").lightbox(); _labelHide();});
