// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

// trim prototype - this is important... remove whitespace on eitherside of a string
if (typeof String.prototype.trim == "undefined") {
    String.prototype.trim = function () {
        var s = this.replace(/^\s*/, "");
        return s.replace(/\s*$/, "");
        };
}


function noenter() {
	return !(window.event && window.event.keyCode == 13);
	}


//----
// if enter, call func... - cross-browser
function handleenter(e, func, prefix) {
	var pK = document.all? window.event.keyCode:e.which;
	if(pK == 13) {
		func(prefix);
		}
	return pK != 13;
	}

//----
// keyboard handler function - absorbs enter key across whole document - cross browser
function kH(e) {
	var pK = document.all? window.event.keyCode:e.which;
	return pK != 13;
	}

//document.onkeypress = kH;
if (document.layers) document.captureEvents(Event.KEYPRESS);


function start_acced_form() {
	
	}
	
function check_login_fields() {
	if (document.getElementById("login_ID").value.trim == "") return !(window.event && window.event.keyCode == 13);
	if (document.getElementById("login_PASSWORD").value.trim == "") return !(window.event && window.event.keyCode == 13);
	else document.login.submit();
	}



var FadeInterval = 600;
var StartFadeAt = 7;


var FadeSteps = new Array();
	FadeSteps[1] = "ff";
	FadeSteps[2] = "ee";
	FadeSteps[3] = "dd";
	FadeSteps[4] = "cc";
	FadeSteps[5] = "bb";
	FadeSteps[6] = "aa";
	FadeSteps[7] = "99";
	FadeSteps[8] = "88";
	FadeSteps[9] = "77";
	FadeSteps[10] = "66";

	FadeSteps[10]

// this is recursive... hmm - probably stupid...
function DoFade(colorId, targetId) {
    if (colorId >= 1) {
		document.getElementById(targetId).style.background = "#ffff" + FadeSteps[colorId];
		--colorId;	
        // Wait a little bit and fade another shade
        setTimeout("DoFade("+colorId+",'"+targetId+"')", 100);
	}
}
	