
/*
****************************************************************************
			 
Inserted March 2010 - Enhancements to usability and behavioural layers
       
*****************************************************************************
*/
			
			
			
/*

jQuery Wrapper Functions
Coder: Antony Ellis 

animateElement(obj, speed)

Takes a DOM element and then using jQuery will fade-in the element

@obj - any html element
@speed - the fadein speed measured in milli-seconds
*/

function animateElement(obj, speed) {

    /* Show off a little and now animate via jQuery :-) */
    $(document).ready(function() {

        // dont reference unless it exists, stops errors
        if (element(obj)) {
            obj = "#" + obj;

            $(obj).hide("fast");
            $(obj).fadeIn(speed);
        }
    });   // end ready()

    return true;

}




// This function checks the email address to be sure
// it follows a certain pattern:
// blah@blah.blah
// If so, it assigns class="welldone" to the containing
// div or fieldset

/*

function checkEmail(whatYouTyped) {

    var div = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;

    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(txt)) {
        div.className = "welldone";
    } else {
        div.className = "";
    }
}

function checkPassword(whatYouTyped) {
    var div = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;

    if (txt.length > 3 && txt.length <= 6) {
        div.className = "kindagood";
    } else if (txt.length == 7) {
        div.className = "welldone";
    } else {
        div.className = "";
    }
}


function checkModulation(whatYouTyped) {
    var div = whatYouTyped.parentNode;
    var txt = whatYouTyped.value;

    if (txt.length > 7 && txt.length < 14) {
        div.className = "kindagood";
    } else if (txt.length == 14) {
        div.className = "welldone";
    } else {
        div.className = "";
    }
}



// this part is for the form field hints to display
// only on the condition that the text input has focus.
// otherwise, it stays hidden.

function addLoadEvent(func) {
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
        window.onload = func;
    } else {
        window.onload = function() {
            oldonload();
            func();
        }
    }
}


function prepareInputsForHints() {
    var inputs = document.getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++) {
        inputs[i].onfocus = function() {
            this.parentNode.getElementsByTagName("span")[0].style.display = "inline";

        }

        inputs[i].onblur = function() {
            this.parentNode.getElementsByTagName("span")[0].style.display = "none";
        }

    }
}

addLoadEvent(prepareInputsForHints);


*/
