$.tabs = function(containerId, start) {
    var ON_CLASS = 'on';
    var id = '#' + containerId;
    var i = (typeof start == "number") ? start - 1 : 0;
    $(id + '>div:lt(' + i + ')').add(id + '>div:gt(' + i + ')').hide("slow");
    $(id + '>ul>li:nth-child(' + i + ')').addClass(ON_CLASS);
    $(id + '>ul>li>a').click(function() {
        if (!$(this.parentNode).is('.' + ON_CLASS)) {
            var re = /([_\-\w]+$)/i;
            var target = $('#' + re.exec(this.href)[1]);
            if (target.size() > 0) {
                $(id + '>div:visible').hide("slow");
                target.show("slow");
                $(id + '>ul>li').removeClass(ON_CLASS);
                $(this.parentNode).addClass(ON_CLASS);
            } else {
                alert('There is no such container.');
            }
        }
        return false;
    });
};

$(document).ready(function() {
    $.tabs("logintabcontainer");
});

$(function () { // same as $(document).ready(function () { })
$('LI.drawer H4:not(.open)').next().hide();
$('H4.drawer-handle').click(function () {
	$('H4.open').removeClass('open').next().hide("fast");
	$(this).addClass('open').next().show("fast");
	});
});

$(function () {
$('#nav_drawer_handle').removeClass('open');
$('#nav_drawer_handle').addClass('close');
$('#cntnav_drawer').hide("fast");
$('#nav_drawer_handle').click(function () {
	if($(this).is('.open')) {
		$(this).removeClass('open');
		$(this).addClass('close');
		$('#cntnav_drawer').hide("fast");
	} else {
		$(this).removeClass('close');
		$(this).addClass('open');
		$('#cntnav_drawer').show("fast");
	}
});
});

scrollStep=1
timerUp=""
timerDown=""

function toTop(id){
stopMe();
document.getElementById(id).scrollTop=0
}

function scrollDivDown(id){
clearTimeout(timerDown) 
document.getElementById(id).scrollTop+=scrollStep
timerDown=setTimeout("scrollDivDown('"+id+"')",10)
}

function scrollDivUp(id){
clearTimeout(timerUp)
document.getElementById(id).scrollTop-=scrollStep
timerUp=setTimeout("scrollDivUp('"+id+"')",10)
}

function toBottom(id){
stopMe();
document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
}

function stopMe(){
clearTimeout(timerDown) 
clearTimeout(timerUp)
}