function numberFormat(e) {
	var key;
	var keychar;
	var reg;
	
	if(window.event)  //IE
		key = e.keyCode;
	else if(e.which) 	{//Netscape
			key = e.which;
	}
	else
		return true;
	if(key > 46 && key < 58 || key == 8) return true;
	else return false;
}

function decrementCounter(id) {
	oldValue = parseInt($(id).innerHTML);
	if (oldValue == 1) 
		$('records_info').update("There aren't records waiting for approval");
	else
		$(id).update(oldValue - 1);
}


function updateLoading(event) {
	if (document.getElementById('loading').style.display != 'none') {
		var scrollposY=0;
		if (window.pageYOffset){scrollposY=window.pageYOffset;}
		else if(document.documentElement&&document.documentElement.scrollTop){scrollposY=document.documentElement.scrollTop;}
		else if(document.getElementById("body").scrollTop){scrollposY=document.getElementById("body").scrollTop;}
		document.getElementById('loading').style.top=(scrollposY+event.clientY-8)+"px";
		document.getElementById('loading').style.left=event.clientX+10+"px";
		document.getElementById('loading').style.zIndex=1500;
	}
}

//Event.observe(window,"load",function(e){Event.observe(document,"mousemove",function(e){updateLoading(e);});});

jQuery.fn.dock = function() {
    $('#more_maids_container').show();
    $(this).Fisheye(
        {
        maxWidth: 90,
        items: 'a',
        itemsText: 'span',
        container: '.dock-container2',
        itemWidth: 55,
        proximity: 50,
        alignment: 'left',
        valign: 'bottom',
        halign: 'center'
        }
    );
}

jQuery(document).ready(function() { 
	
	jQuery(document).mousemove(function(event) { 
		updateLoading(event);
	});

	//BEGIN LOGIN FUNCTIONS
	jQuery('#open_login_window').click(function() {
		    jQuery('#overlay').show();
		    jQuery('#container_login').show();
		    jQuery('#redir').html('');
		    jQuery('#MemberEmail').focus();
		}
	);        

	jQuery('.close_login').click(function() {
		    jQuery("#container_login").hide();
		    jQuery("#overlay").hide();
		}
	);    
	//END LOGIN FUNCTIONS


	//BEGIN RETURN CALENDAR
	// jQuery('#return_calendar').click(function() {	
	// 		jQuery('#slot_times').hide();
	// 		jQuery('#calendar_box').show();
	// 	});
	//END RETURN CALENDAR
});

function refreshLinkTime(id) {
	if (Element.hasClassName(id, 'work')) {
		Element.removeClassName(id, 'work');
		Element.addClassName(id, 'off');
		Element.update(id, 'OFF');
	} 
	else {
		Element.removeClassName(id, 'off');
		Element.addClassName(id, 'work');
		Element.update(id, 'WORK');
	} 
}
