/**
                          "tax the rich"
			            by jason van anden

               found at http://tax.cf.huffingtonpost.com

                               and/or

                  http://www.smileproject.com/tax

		   you can contact jason at jason@smileproject.com
				   or visit www.smileproject.com


        (c) copyright 2006 Jason Van Anden. All rights reserved.
*/

/**
    This module is a bit of a misnomer - I should have named it base_personality.
	It is the container (manager, whatever) for a series of sequences
	(which I should have actually called behaviors - hindsight == 20/20)
*/

    function BaseBehaviors(objArt, index, behavior){
        this.setProperties(objArt, index, behavior);
        return this;
    }

    BaseBehaviors.prototype.setProperties = function(objArt, index, behavior){

        this.objArt  = objArt;
	    this.index   = index;

        this.latitude = new Array(10);

        for (i=0; i<10; i++) this.latitude[i] = LINE_CENTER;

	    // the follwing is from a very useful hint
	    // via http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=14

	    this.obj      = objArt;  // this sets up the object to
        if(objArt) if( objArt.style ) {this.obj = objArt.style;}

	    this.noPx = document.childNodes ? 'px' : 0;

	    // thanks for the hint! j

	    this.visible = true;
	    this.active  = false; // can receive focus

        this.co = new BaseSequence(this, 1000, 100, 2);

        this.timeout_id = setTimeout('super_looper(' + this.index + ')', 100);
        if(this.obj) this.obj.color = "#333333";

	    return this;
    };

    BaseBehaviors.prototype.mp = function(x, y){
	    this.co.mp(x, y);
	    return (this.co);
    };

    BaseBehaviors.prototype.md = function(posX, posY){
	    return (this.co.md(posX, posY));
    };

    BaseBehaviors.prototype.redraw = function(lnnum, newline){

       var span_count = 0;
       var objLine = this.objArt.childNodes[0];

	   for (i=0; i < this.objArt.childNodes.length; i++){ // this accomodates firefox + ie
		   objLine = this.objArt.childNodes[i];
           if (objLine.nodeName == "SPAN") if ((span_count += 1) == lnnum) break;
	   }

       newline = this.convert_spaces(newline);    // consolidate these two lines
       objLine.innerHTML = newline;

       return objLine;
	};

    BaseBehaviors.prototype.convert_spaces = function(newline){
        return(newline.replace(/\s/g, '&nbsp;')); // convert spaces
    };

    BaseBehaviors.prototype.super_looper = function (){
        if (this.co.fini()) this.co = new BaseSequence(this, 1000, 100, 2);
        this.output();
    };

    BaseBehaviors.prototype.output = function (){
        var prog = this.co.actout();

		clearTimeout(this.timeout_id);
		eval("this." + prog);
		this.timeout_id = setTimeout('super_looper(' + this.index + ')', this.co.next_time);
    };

    BaseBehaviors.prototype.start_face = function(){
        this.redraw (1, "");
    };

    BaseBehaviors.prototype.def_face = function(){
        this.redraw (1, "");
    };

    BaseBehaviors.prototype.alt_face = function(){
        this.redraw (1, "");
    };

