// possible copy: special character < indicates a line break.
var possibleCopy = [
    'Design that positions, < communicates and enables...',
    'Innovative Design < meets Hardcore Programming...',
    'Beginning with the end in mind...',
    'Smart Processes = Smart Design...',
    'Ashworth delivers targeted < messaging with strategic clout...',
    'Ideas that educate and < stimulate real revenue growth...',
    'Challenging projects < we eat for breakfast...',
    'We nurture brands, encourage < business growth, and plump up the bottom line...',
    'There is invariably something < amazing happening at Ashworth Creative...',
    'Go ahead.... Check us out. < We love the work we do...']

var randomCopy = possibleCopy[Math.floor(Math.random()*possibleCopy.length)];

/**
 * typeString(str): animate the typing of a string
 * 
 * Puts chars into an element with id "data".
 * 50 milliseconds between charcter insertions (to simulate typing).
 */
function typeString(str){
    var currChar = 0;

    // iterate types one char then uses setTimeout to wait 50ms
    function iterate() {
        var charToPut = str.charAt(currChar);
        if(charToPut == "<") {
            charToPut = "<br/>";
        }
        document.getElementById('data').innerHTML += charToPut;
        currChar += 1;
        if(currChar < str.length) {
            setTimeout(iterate, 50);
        }
    }

    iterate();
}

typeString(randomCopy);
