/* file generated at Tue, 07 Sep 2010 05:39:21 +0000 on stickkweb01.pacifica.ca content hash 6dd4d612f0d8c9f04c8034a93114d162 */
/* file /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.us.StaticTextField.js size 5597 */
/* file /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.DateOfBirthField.js size 6485 */
/* file /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.MoneyField.js size 7551 */
/* file /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.PasswordField.js size 7551 */
/* file /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.Summit.js size 4231 */
/* file /home/websites/stickk.com/web/js/ajaxwrapper.js size 6238 */
/* file /home/websites/stickk.com/web/js/counters.js size 609 */
/* file /home/websites/stickk.com/web/js/dates.js size 388 */
/* file /home/websites/stickk.com/web/js/dropDownHack.js size 6425 */
/* file /home/websites/stickk.com/web/js/dyn-misc.js size 375 */
/* file /home/websites/stickk.com/web/js/graph.js size 6548 */
/* file /home/websites/stickk.com/web/js/home.js size 1042 */
/* file /home/websites/stickk.com/web/js/json2.js size 16927 */
/* file /home/websites/stickk.com/web/js/keyDetect.js size 2112 */
/* file /home/websites/stickk.com/web/js/language.js size 208 */
/* file /home/websites/stickk.com/web/js/legend.js size 4640 */
/* file /home/websites/stickk.com/web/js/line.js size 7230 */
/* file /home/websites/stickk.com/web/js/members.js size 1696 */
/* file /home/websites/stickk.com/web/js/misc.js size 30358 */
/* file /home/websites/stickk.com/web/js/overlay.js size 5827 */
/* file /home/websites/stickk.com/web/js/pie.js size 6340 */
/* file /home/websites/stickk.com/web/js/spinningwheel-min.js size 12503 */
/* file /home/websites/stickk.com/web/js/spinningwheel.js size 15326 */
/* file /home/websites/stickk.com/web/js/stickk.js size 6904 */
/* file /home/websites/stickk.com/web/js/swfobject.js size 9759 */
/* file /home/websites/stickk.com/web/js/timezone.js size 971 */
/* file /home/websites/stickk.com/web/js/user.js size 894 */
/* file /home/websites/stickk.com/web/js/userbox.js size 857 */
/* file /home/websites/stickk.com/web/js/wall.js size 603 */
/* file /home/websites/stickk.com/web/js/wz_jsgraphics2.js size 25379 */
/* file /home/websites/stickk.com/web/js/forms/basics.js size 7564 */
/* file /home/websites/stickk.com/web/js/forms/contract.js size 20286 */
/* file /home/websites/stickk.com/web/js/forms/user-forms.js size 312 */
/* file /home/websites/stickk.com/web/js/forms/journal.js size 6192 */
/* file /home/websites/stickk.com/web/js/forms/transfer-delivery.js size 1978 */

/* begin /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.us.StaticTextField.js size 5597 */
/**
 * @class Ext.ux.form.StaticTextField
 * @extends Ext.BoxComponent
 * Base class to easily display static text in a form layout.
 * @constructor
 * Creates a new StaticTextField Field
 * @param {Object} config Configuration options
 * @author Based on MiscField by Nullity with modifications by Aparajita Fishman
 */
Ext.namespace('Ext.ux.form');

Ext.ux.form.StaticTextField = function(config){
    this.name = config.name || config.id;
    Ext.ux.form.StaticTextField.superclass.constructor.call(this, config);
};

Ext.extend(Ext.ux.form.StaticTextField, Ext.BoxComponent,  {
    /**
     * @cfg {String/Object} autoCreate A DomHelper element spec, or true for a default element spec (defaults to
     * {tag: "div"})
     */
    defaultAutoCreate : {tag: "div"},

    /**
     * @cfg {String} fieldClass The default CSS class for the field (defaults to "x-form-field")
     */
    fieldClass : "x-form-text",

    // private
    isFormField : true,

    /**
     * @cfg {Boolean} postValue True to create a hidden field that will post the field's value during a submit
     */
    submitValue : false,

    /**
     * @cfg {Mixed} value A value to initialize this field with.
     */
    value : undefined,

    /**
     * @cfg {Boolean} disableReset True to prevent this field from being reset when calling Ext.form.Form.reset()
     */
    disableReset: false,

    // private
    field: null,
    
    /**
     * Returns the name attribute of the field if available
     * @return {String} name The field name
     */
    getName: function(){
         return this.name;
    },

    // private
    onRender : function(ct, position){
        Ext.ux.form.StaticTextField.superclass.onRender.call(this, ct, position);
        if(!this.el){
            var cfg = this.getAutoCreate();
            this.el = ct.createChild(cfg, position);
        
            if (this.submitValue) {
                this.field = ct.createChild({tag:'input', type:'hidden', name: this.getName(), id: ''}, position);
            }
        }

        this.el.addClass([this.fieldClass, this.cls, 'ux-form-statictextfield']);
        this.initValue();
    },

    // private
    afterRender : function(ct, position){
        Ext.ux.form.StaticTextField.superclass.afterRender.call(this);
        this.initEvents();
    },

    // private
    initValue : function(){
        if(this.value !== undefined){
            this.setValue(this.value);
        }else if(this.el.dom.innerHTML.length > 0){
            this.setValue(this.el.dom.innerHTML);
        }
    },

    /**
     * Returns true if this field has been changed since it was originally loaded.
     */
    isDirty : function() {
        return false;
    },

    /**
     * Resets the current field value to the originally-loaded value
     * @param {Boolean} force Force a reset even if the option disableReset is true
     */
    reset : function(force){
        if(!this.disableReset || force === true){
            this.setValue(this.originalValue);
        }
    },

    // private
    initEvents : function(){
        // reference to original value for reset
        this.originalValue = this.getRawValue();
    },

    /**
     * Returns whether or not the field value is currently valid
     * Always returns true, not used in StaticTextField.
     * @return {Boolean} True
     */
    isValid : function(){
        return true;
    },

    /**
     * Validates the field value
     * Always returns true, not used in StaticTextField.  Required for Ext.form.Form.isValid()
     * @return {Boolean} True
     */
    validate : function(){
        return true;
    },

    processValue : function(value){
        return value;
    },

    // private
    // Subclasses should provide the validation implementation by overriding this
    validateValue : function(value){
        return true;
    },

    /**
     * Mark this field as invalid
     * Not used in StaticTextField.   Required for Ext.form.Form.markInvalid()
     */
    markInvalid : function(){
        return;
    },

    /**
     * Clear any invalid styles/messages for this field
     * Not used in StaticTextField.   Required for Ext.form.Form.clearInvalid()
     */
    clearInvalid : function(){
        return;
    },

    /**
     * Returns the raw field value.
     * @return {Mixed} value The field value
     */
    getRawValue : function(){
       return (this.rendered) ? this.value : null;
    },

    /**
     * Returns the clean field value.
     * @return {String} value The field value
     */
    getValue : function(){
        return this.getRawValue();
    },

    /**
     * Sets the raw field value. The display text is <strong>not</strong> HTML encoded.
     * @param {Mixed} value The value to set
     */
    setRawValue : function(v){
        this.value = v;
        if(this.rendered){
            this.el.dom.innerHTML = v;
            if(this.field){
                this.field.dom.value = v;
            }
        }
    },

    /**
     * Sets the field value. The display text is HTML encoded.
     * @param {Mixed} value The value to set
     */
    setValue : function(v){
        this.value = v;
        if(this.rendered){
            this.el.dom.innerHTML = Ext.util.Format.htmlEncode(v);
            if(this.field){
                this.field.dom.value = v;
            }
        }
    }
});

Ext.reg('statictextfield', Ext.ux.form.StaticTextField);
/* end /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.us.StaticTextField.js size 5597 */
/* begin /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.DateOfBirthField.js size 6485 */
// Create user extensions namespace (Ext.ux)
Ext.namespace('Ext.ux');

/**
 * @class Ext.ux.DateOfBirthField
 * @extends Ext.form.Field
 * Basic custom content field
 * @constructor
 * Creates a new custom content field
 * @param {Object} config Configuration options
 * @author Bart Wegrzyn <bart.wegrzyn@gmail.com>
 */
Ext.ux.DateOfBirthField = Ext.extend(Ext.form.Field, {

    /**
     * @cfg {String} format
     * The default date format string which can be overriden for localization support.  The format must be
     * valid according to {@link Date#parseDate} (defaults to 'm/d/y').
     */
    format : "m/d/Y",
    /**
     * @cfg {String} altFormats
     * Multiple date formats separated by "|" to try when parsing a user input value and it doesn't match the defined
     * format (defaults to 'm/d/Y|m-d-y|m-d-Y|m/d|m-d|d').
     */
    altFormats : "m/d/Y|m/d/y|m-d-y|m-d-Y|m/d|m-d|md|mdy|mdY|d|Y-m-d|Y/m/d",

	// private
	defaultAutoCreate: {
		tag: 'input',
		type: 'hidden'
	},

	// private
	initComponent: function() {
		Ext.ux.DateOfBirthField.superclass.initComponent.call(this);
		this.addEvents(
			/**
			 * @event load
			 * Fires when the content is loaded into the field
			 * @param {Ext.ux.DateOfBirthField} this
			 * @param {Object} file
			 */
			'load'
		);
	},

	// private
	initValue: Ext.emptyFn,

	// private
	onRender: function(ct, position)
	{
        Ext.ux.DateOfBirthField.superclass.onRender.call(this, ct, position);
		this.divContainer = Ext.DomHelper.insertFirst(ct, {cls:'x-form-field-wrap', style:'text-align: left'});
		this.yearSelect = Ext.DomHelper.insertFirst(this.divContainer, {tag:'input', style:'width:50px'}, true);
		this.daySelect = Ext.DomHelper.insertFirst(this.divContainer, {tag:'input', style:'width:35px'}, true);
		this.monthSelect = Ext.DomHelper.insertFirst(this.divContainer, {tag:'input', style:'width:90px'}, true);

		this.dayStoreArray = new Array();
		for (var i=1; i<=31; i++) this.dayStoreArray.push([i,i]);
		this.dayStoreArray.push(['', '--']);
		this.dayStore = new Ext.data.SimpleStore( {fields:['K','V'], data:this.dayStoreArray} );

		this.monthStoreArray = new Array();
		for (var i=0; i<Date.monthNames.length; i++) this.monthStoreArray.push([i+1, Date.monthNames[i]]);
		this.monthStoreArray.push(['', '--']);
		this.monthStore = new Ext.data.SimpleStore( {fields:['K', 'V'], data:this.monthStoreArray} );
		
		this.yearStoreArray = new Array();
		var fullYear = (new Date()).getFullYear();
		for (var i=fullYear; i>fullYear-100; i--) this.yearStoreArray.push([i,i]);
		this.yearStoreArray.push(['', '----']);
		this.yearStore = new Ext.data.SimpleStore( {fields:['K','V'], data:this.yearStoreArray} );
		
		
		var d;
		if (this.value)
			d = this.parseDate(this.value);
		
		if (!d)
		{
			dd = '';
			mm = '';
			yy = '';
		}
		else
		{
			dd = d.getDate();
			mm = d.getMonth()+1;
			yy = d.getFullYear();
		}
				
		this.yearSelectObj = new Ext.form.ComboBox(
							{	applyTo:this.yearSelect, displayField:'V', valueField:'K', editable:false, value:yy,
			        			mode:'local', store: this.yearStore, triggerAction: 'all' });
		this.daySelectObj = new Ext.form.ComboBox(
							{	applyTo:this.daySelect, displayField:'V', valueField:'K', editable:false, value:dd,
			        			mode:'local', store: this.dayStore, triggerAction: 'all' });
		this.monthSelectObj = new Ext.form.ComboBox(
							{	applyTo:this.monthSelect, displayField:'V', valueField:'K', editable:false, value:mm,
			        			mode:'local', store: this.monthStore, triggerAction: 'all' });

		//this.yearSelectObj.el.up('div').wrap().dom;.dom.style.width='70px';
		//this.monthSelectObj.el.up('div').wrap({tag:'span'}).dom.style.width='110px';
		//this.daySelectObj.el.up('div').wrap({tag:'span'}).dom.style.width='55px';


		var o =	this.monthSelectObj.el.up('div');
		o.dom.style.width = '110px';
		o.dom.className+=' floatLeft ';

		var o =	this.daySelectObj.el.up('div');
		o.dom.style.width = '55px';
		o.dom.className+=' floatLeft ';

		var o =	this.yearSelectObj.el.up('div');
		o.dom.style.width = '55px';
		o.dom.className+=' floatLeft ';

	},

    adjustSize : function(w, h){
    	this.divContainer.style.width = w + 'px';
    	/*try {
    		this.monthSelectObj.el.dom.style.width = (w-150)+'px';
	    	this.monthSelectObj.el.up('span').dom.style.width=(w-130)+'px';
    	} catch(ex) {
    		;
    	}*/
    	
        var s = Ext.form.Field.superclass.adjustSize.call(this, w, h);
        //s.width = this.adjustWidth(this.el.dom.tagName, s.width);
        return s;
    },

	/**
	 * Returns the field element (ie. 'this')
	 */
	getValue: function() {
		var d = new Date();
		if (!this.daySelectObj.getValue() ||
			!this.monthSelectObj.getValue() ||
			!this.yearSelectObj.getValue())
				return '';
		d.setDate(this.daySelectObj.getValue());
		d.setMonth(this.monthSelectObj.getValue()-1);
		d.setFullYear(this.yearSelectObj.getValue());
		return this.formatDate(d);
	},
	
	getRawValue : function(){
		Ext.form.DateField.superclass.setRawValue.call(this, this.getValue());
		return Ext.form.DateField.superclass.getRawValue.call(this);
	},
	
	setRawValue : function(date) {
		this.setValue(date);
	},
	
    setValue : function(date){
    	var curValue = this.parseDate(date);
    	this.monthSelectObj.setValue(curValue.getMonth()+1);
    	this.daySelectObj.setValue(curValue.getDate());
    	this.yearSelectObj.setValue(curValue.getFullYear());
        Ext.form.DateField.superclass.setValue.call(this, this.formatDate(this.parseDate(date)));
    },	
	
    formatDate : function(date){
        return (!date || !(date instanceof Date)) ?
               date : date.dateFormat(this.format);
    },
	
    parseDate : function(value){
        if(!value || value instanceof Date)
        {
            return value;
        }
        var v = Date.parseDate(value, this.format);
        if(!v && this.altFormats)
        {
            if(!this.altFormatsArray)
            {
                this.altFormatsArray = this.altFormats.split("|");
            }
            for(var i = 0, len = this.altFormatsArray.length; i < len && !v; i++)
            {
                v = Date.parseDate(value, this.altFormatsArray[i]);
            }
        }
        return v;
    }
	
});
Ext.reg('dateofbirth', Ext.ux.DateOfBirthField);
/* end /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.DateOfBirthField.js size 6485 */
/* begin /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.MoneyField.js size 7551 */
// Create user extensions namespace (Ext.ux)
Ext.namespace('Ext.ux');
 
/**
  * Ext.ux.PasswordField Extension Class
  *
  * @author Benjamin Horan (benh@b2bwebsolutions.com.au)
  * @version 0.1
  *
  * @license MIT License: http://www.opensource.org/licenses/mit-license.php  
  *  
  * Combines the existing work of:
  *     CAPS detection code by James Asher
  *     (http://17thdegree.com/archives/2007/12/06/capturing-caps-lock-with-the-ext-js-framework/)
  *  and
  *     Password Strength UX code by Eelco Wiersma
  *     (http://testcases.pagebakers.com/PasswordMeter/)
  *        - Algorithm based on code of Tane
  *            http://digitalspaghetti.me.uk/index.php?q=jquery-pstrength
  *      and 
  *        - Steve Moitozo
  *            http://www.geekwisdom.com/dyn/passwdmeter  
  * --------------------------------------------------------
  *
  * @class Ext.ux.PasswordField
  * @extends Ext.form.Textfield
  * @constructor
  * @param {Object} config Configuration options
  *
  * EXT Version: 2.0
  *
  * Refer to config options for Ext.form.TextField
  *
  * showCapsWarning (boolean) - 
  *    If 'true', will show  warning message beside password
  *    field if CAPS LOCK is detected.
  *
  * showStrengthMeter (boolean) -
  *    If 'true', will show password strength meter immediately
  *    below password field.
  */

Ext.ux.PasswordField = function(config) {
	if (!config) config = {};
	// call parent constructor
	Ext.ux.PasswordField.superclass.constructor.call(this, config);
	
	this.showCapsWarning = config.showCapsWarning || true;
	this.showStrengthMeter = config.showStrengthMeter || false;

};

Ext.extend(Ext.ux.PasswordField, Ext.form.TextField, {
	    /**
	     * @cfg {String} inputType The type attribute for input fields -- e.g. text, password (defaults to "password").
	     */
		inputType: 'password',
		// private
				
		onRender: function(ct, position) {
			Ext.ux.PasswordField.superclass.onRender.call(this, ct, position);

			// create caps lock warning box
			if (this.showCapsWarning) {
				var id = Ext.id();
				this.alertBox = Ext.DomHelper.append(document.body,{
					tag: 'div',
					style: 'width: 10em',
					children: [{
						tag: 'div',
						style: 'text-align: center; color: red;',
						html: 'Caps Lock is on.',
						id: id
					}]
				}, true);
				Ext.fly(id).boxWrap();
				this.alertBox.hide();	
			}
			// create password strength meter
			if (this.showStrengthMeter) {
				this.objMeter = ct.createChild({tag: "div", 'class': "x-form-password-strengthMeter"});
				this.objMeter.setWidth(ct.first('INPUT').getWidth(false));
				this.scoreBar = this.objMeter.createChild({tag: "div", 'class': "x-form-password-scoreBar"});				
				if(Ext.isIE && !Ext.isIE7) { // Fix style for IE6
					this.objMeter.setStyle('margin-left', '3px');
				}					
			}
		},
		
		/*adjustSize : function(w, h)
		{
			Ext.ux.PasswordField.superclass.adjustSize.call(this, w, h);
			//if (this.showStrengthMeter) {
			//	this.objMeter.setWidth(w);
			//}
		},*/
		
    afterRender : function(){
        Ext.ux.PasswordField.superclass.afterRender.call(this);
        //alert('afterRender()');
        //this.initEvents();
        alert(this.el.dom.getWidth(false));
        alert(this.el.getWidth(false));
    },

		initEvents: function() {
			Ext.ux.PasswordField.superclass.initEvents.call(this);	
			
			this.el.on('keypress', this.handleKeypress, this);
			this.el.on('blur', this.handleBlur, this);
			this.el.on('focus', this.handleFocus, this);
			this.el.on('keyup', this.handleKeyUp, this);			
		},
		handleFocus: function(e) {
        	if(!Ext.isOpera) { // don't touch in Opera
            	this.objMeter.addClass('x-form-password-strengthMeter-focus');
       		}
		},
		handleBlur: function(e) {
        	if(!Ext.isOpera) { // don't touch in Opera
            	this.objMeter.removeClass('x-form-password-strengthMeter-focus');
       		}
			if (this.showCapsWarning) {
				this.hideCapsWarning();	
			}
		},		
		handleKeypress: function(e) {
			var charCode = e.getCharCode();
			// blank field if ESC pressed
			if (charCode == e.ESC) {
				this.setRawValue('');					
			}
			// detect if CAPS LOCK is on and show warning if appropriate
			if (this.showCapsWarning) {
				if(
					(e.shiftKey && charCode >= 97 && charCode <= 122) ||
					(!e.shiftKey && charCode >= 65 && charCode <= 90)
				){
					this.showCapsMessage(e.target); 
				} else {
					this.hideCapsMessage();
				}
			}
		},
		handleKeyUp: function(e) {
			if (this.showStrengthMeter) {
				this.updateMeter(e);	
			}	
		},
		showCapsMessage: function(el) {
			var position = this.showStrengthMeter ? 'tl-tr': 'l-r';
			
			this.alertBox.alignTo(el, position, [5, 0]);
			this.alertBox.show();			
		},
		hideCapsMessage: function() {
			this.alertBox.hide();			
		},
		/**
		 * Sets the width of the meter, based on the score
		 * @param {Object} e 
		 * Private function
		 */
		updateMeter: function(e) {			
			var score = 0 
		    var p = e.target.value;
			
			var maxWidth = this.objMeter.getWidth() - 2;
			
			var nScore = this.calcStrength(p);
			
    		// Set new width
    		var nRound = Math.round(nScore * 2);

			if (nRound > 100) {
				nRound = 100;
			}

			var scoreWidth = (maxWidth / 100) * nRound;
			this.scoreBar.setWidth(scoreWidth, true);
		},
		/**
		 * Calculates the strength of a password
		 * @param {Object} p The password that needs to be calculated
		 * @return {int} intScore The strength score of the password
		 */
		calcStrength: function(p) {
			var intScore = 0;

			// PASSWORD LENGTH
			intScore += p.length;
			
			if(p.length > 0 && p.length <= 4) {                    // length 4 or less
				intScore += p.length;
			}
			else if (p.length >= 5 && p.length <= 7) {	// length between 5 and 7
				intScore += 6;
			}
			else if (p.length >= 8 && p.length <= 15) {	// length between 8 and 15
				intScore += 12;
				//alert(intScore);
			}
			else if (p.length >= 16) {               // length 16 or more
				intScore += 18;
				//alert(intScore);
			}
			
			// LETTERS (Not exactly implemented as dictacted above because of my limited understanding of Regex)
			if (p.match(/[a-z]/)) {              // [verified] at least one lower case letter
				intScore += 1;
			}
			if (p.match(/[A-Z]/)) {              // [verified] at least one upper case letter
				intScore += 5;
			}
			// NUMBERS
			if (p.match(/\d/)) {             	// [verified] at least one number
				intScore += 5;
			}
			if (p.match(/.*\d.*\d.*\d/)) {            // [verified] at least three numbers
				intScore += 5;
			}
			
			// SPECIAL CHAR
			if (p.match(/[!,@,#,$,%,^,&,*,?,_,~]/)) {           // [verified] at least one special character
				intScore += 5;
			}
			// [verified] at least two special characters
			if (p.match(/.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~]/)) {
				intScore += 5;
			}
			
			// COMBOS
			if (p.match(/(?=.*[a-z])(?=.*[A-Z])/)) {        // [verified] both upper and lower case
				intScore += 2;
			}
			if (p.match(/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/)) { // [verified] both letters and numbers
				intScore += 2;
			}
	 		// [verified] letters, numbers, and special characters
			if (p.match(/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!,@,#,$,%,^,&,*,?,_,~])/)) {
				intScore += 2;
			}

			return intScore;
		}		
	}
);
		   
/* end /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.MoneyField.js size 7551 */
/* begin /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.PasswordField.js size 7551 */
// Create user extensions namespace (Ext.ux)
Ext.namespace('Ext.ux');
 
/**
  * Ext.ux.PasswordField Extension Class
  *
  * @author Benjamin Horan (benh@b2bwebsolutions.com.au)
  * @version 0.1
  *
  * @license MIT License: http://www.opensource.org/licenses/mit-license.php  
  *  
  * Combines the existing work of:
  *     CAPS detection code by James Asher
  *     (http://17thdegree.com/archives/2007/12/06/capturing-caps-lock-with-the-ext-js-framework/)
  *  and
  *     Password Strength UX code by Eelco Wiersma
  *     (http://testcases.pagebakers.com/PasswordMeter/)
  *        - Algorithm based on code of Tane
  *            http://digitalspaghetti.me.uk/index.php?q=jquery-pstrength
  *      and 
  *        - Steve Moitozo
  *            http://www.geekwisdom.com/dyn/passwdmeter  
  * --------------------------------------------------------
  *
  * @class Ext.ux.PasswordField
  * @extends Ext.form.Textfield
  * @constructor
  * @param {Object} config Configuration options
  *
  * EXT Version: 2.0
  *
  * Refer to config options for Ext.form.TextField
  *
  * showCapsWarning (boolean) - 
  *    If 'true', will show  warning message beside password
  *    field if CAPS LOCK is detected.
  *
  * showStrengthMeter (boolean) -
  *    If 'true', will show password strength meter immediately
  *    below password field.
  */

Ext.ux.PasswordField = function(config) {
	if (!config) config = {};
	// call parent constructor
	Ext.ux.PasswordField.superclass.constructor.call(this, config);
	
	this.showCapsWarning = config.showCapsWarning || true;
	this.showStrengthMeter = config.showStrengthMeter || false;

};

Ext.extend(Ext.ux.PasswordField, Ext.form.TextField, {
	    /**
	     * @cfg {String} inputType The type attribute for input fields -- e.g. text, password (defaults to "password").
	     */
		inputType: 'password',
		// private
				
		onRender: function(ct, position) {
			Ext.ux.PasswordField.superclass.onRender.call(this, ct, position);

			// create caps lock warning box
			if (this.showCapsWarning) {
				var id = Ext.id();
				this.alertBox = Ext.DomHelper.append(document.body,{
					tag: 'div',
					style: 'width: 10em',
					children: [{
						tag: 'div',
						style: 'text-align: center; color: red;',
						html: 'Caps Lock is on.',
						id: id
					}]
				}, true);
				Ext.fly(id).boxWrap();
				this.alertBox.hide();	
			}
			// create password strength meter
			if (this.showStrengthMeter) {
				this.objMeter = ct.createChild({tag: "div", 'class': "x-form-password-strengthMeter"});
				this.objMeter.setWidth(ct.first('INPUT').getWidth(false));
				this.scoreBar = this.objMeter.createChild({tag: "div", 'class': "x-form-password-scoreBar"});				
				if(Ext.isIE && !Ext.isIE7) { // Fix style for IE6
					this.objMeter.setStyle('margin-left', '3px');
				}					
			}
		},
		
		/*adjustSize : function(w, h)
		{
			Ext.ux.PasswordField.superclass.adjustSize.call(this, w, h);
			//if (this.showStrengthMeter) {
			//	this.objMeter.setWidth(w);
			//}
		},*/
		
    afterRender : function(){
        Ext.ux.PasswordField.superclass.afterRender.call(this);
        //alert('afterRender()');
        //this.initEvents();
        alert(this.el.dom.getWidth(false));
        alert(this.el.getWidth(false));
    },

		initEvents: function() {
			Ext.ux.PasswordField.superclass.initEvents.call(this);	
			
			this.el.on('keypress', this.handleKeypress, this);
			this.el.on('blur', this.handleBlur, this);
			this.el.on('focus', this.handleFocus, this);
			this.el.on('keyup', this.handleKeyUp, this);			
		},
		handleFocus: function(e) {
        	if(!Ext.isOpera) { // don't touch in Opera
            	this.objMeter.addClass('x-form-password-strengthMeter-focus');
       		}
		},
		handleBlur: function(e) {
        	if(!Ext.isOpera) { // don't touch in Opera
            	this.objMeter.removeClass('x-form-password-strengthMeter-focus');
       		}
			if (this.showCapsWarning) {
				this.hideCapsWarning();	
			}
		},		
		handleKeypress: function(e) {
			var charCode = e.getCharCode();
			// blank field if ESC pressed
			if (charCode == e.ESC) {
				this.setRawValue('');					
			}
			// detect if CAPS LOCK is on and show warning if appropriate
			if (this.showCapsWarning) {
				if(
					(e.shiftKey && charCode >= 97 && charCode <= 122) ||
					(!e.shiftKey && charCode >= 65 && charCode <= 90)
				){
					this.showCapsMessage(e.target); 
				} else {
					this.hideCapsMessage();
				}
			}
		},
		handleKeyUp: function(e) {
			if (this.showStrengthMeter) {
				this.updateMeter(e);	
			}	
		},
		showCapsMessage: function(el) {
			var position = this.showStrengthMeter ? 'tl-tr': 'l-r';
			
			this.alertBox.alignTo(el, position, [5, 0]);
			this.alertBox.show();			
		},
		hideCapsMessage: function() {
			this.alertBox.hide();			
		},
		/**
		 * Sets the width of the meter, based on the score
		 * @param {Object} e 
		 * Private function
		 */
		updateMeter: function(e) {			
			var score = 0 
		    var p = e.target.value;
			
			var maxWidth = this.objMeter.getWidth() - 2;
			
			var nScore = this.calcStrength(p);
			
    		// Set new width
    		var nRound = Math.round(nScore * 2);

			if (nRound > 100) {
				nRound = 100;
			}

			var scoreWidth = (maxWidth / 100) * nRound;
			this.scoreBar.setWidth(scoreWidth, true);
		},
		/**
		 * Calculates the strength of a password
		 * @param {Object} p The password that needs to be calculated
		 * @return {int} intScore The strength score of the password
		 */
		calcStrength: function(p) {
			var intScore = 0;

			// PASSWORD LENGTH
			intScore += p.length;
			
			if(p.length > 0 && p.length <= 4) {                    // length 4 or less
				intScore += p.length;
			}
			else if (p.length >= 5 && p.length <= 7) {	// length between 5 and 7
				intScore += 6;
			}
			else if (p.length >= 8 && p.length <= 15) {	// length between 8 and 15
				intScore += 12;
				//alert(intScore);
			}
			else if (p.length >= 16) {               // length 16 or more
				intScore += 18;
				//alert(intScore);
			}
			
			// LETTERS (Not exactly implemented as dictacted above because of my limited understanding of Regex)
			if (p.match(/[a-z]/)) {              // [verified] at least one lower case letter
				intScore += 1;
			}
			if (p.match(/[A-Z]/)) {              // [verified] at least one upper case letter
				intScore += 5;
			}
			// NUMBERS
			if (p.match(/\d/)) {             	// [verified] at least one number
				intScore += 5;
			}
			if (p.match(/.*\d.*\d.*\d/)) {            // [verified] at least three numbers
				intScore += 5;
			}
			
			// SPECIAL CHAR
			if (p.match(/[!,@,#,$,%,^,&,*,?,_,~]/)) {           // [verified] at least one special character
				intScore += 5;
			}
			// [verified] at least two special characters
			if (p.match(/.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~]/)) {
				intScore += 5;
			}
			
			// COMBOS
			if (p.match(/(?=.*[a-z])(?=.*[A-Z])/)) {        // [verified] both upper and lower case
				intScore += 2;
			}
			if (p.match(/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/)) { // [verified] both letters and numbers
				intScore += 2;
			}
	 		// [verified] letters, numbers, and special characters
			if (p.match(/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!,@,#,$,%,^,&,*,?,_,~])/)) {
				intScore += 2;
			}

			return intScore;
		}		
	}
);
		   
/* end /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.PasswordField.js size 7551 */
/* begin /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.Summit.js size 4231 */

Ext.namespace('Ext.ux.Summit');

Ext.ux.Summit.Replace = function(id, cfg)
{
	if (typeof(cfg)=='undefined')
		cfg = {};
	var oldEl = Ext.get(id);
	var o = oldEl.dom;
	if (o.tagName.toUpperCase()=='TEXTAREA')
	{
		new Ext.form.TextArea({applyTo:o});
	}
	if (o.tagName.toUpperCase()=='INPUT')
	{
		if (o.type.toUpperCase()=='SUBMIT')
		{
			var newEl = Ext.DomHelper.insertBefore(oldEl,{});
			var f = Ext.get(oldEl.up('form').id).dom;
			var btn = new Ext.Button( {text:o.value, name:o.name, id:o.id, handler:function(){if (!f.onsubmit || f.onsubmit()) f.submit();}});
			oldEl.remove();
			btn.applyToMarkup(newEl);
		}
	}

};

//Ext.Button.buttonTemplate = 
Ext.ux.Summit.StickkButtonTemplate = new Ext.Template(
                    '<table border="0" cellpadding="0" cellspacing="0" class="x-stickk-btn-wrap"><tbody><tr>',
                    '<td class="x-stickk-btn-left"><i>&#160;</i></td><td class="x-stickk-btn-center"><em unselectable="on"><button class="x-stickk-btn-text" type="{1}">{0}</button></em></td><td class="x-stickk-btn-right"><i>&#160;</i></td>',
                    "</tr></tbody></table>");
	                    
Ext.ux.Summit.NumberField = Ext.extend(Ext.form.TextField,  {
	fieldClass: "x-form-field x-form-num-field",
	allowDecimals : true,
	decimalSeparator : ".",
	decimalPrecision : 2,
	allowNegative : true,
	minValue : Number.NEGATIVE_INFINITY,
	maxValue : Number.MAX_VALUE,
	minText : "The minimum value for this field is {0}",
	maxText : "The maximum value for this field is {0}",
	nanText : "{0} is not a valid number",
	baseChars : "0123456789",

        initEvents : function(){
        Ext.ux.Summit.NumberField.superclass.initEvents.call(this);
        var allowed = this.baseChars+'';
        if(this.allowDecimals){
            allowed += this.decimalSeparator;
        }
        if(this.allowNegative){
            allowed += "-";
        }
        this.stripCharsRe = new RegExp('[^'+allowed+']', 'gi');
        var keyPress = function(e){
            var k = e.getKey();
            if(/*!Ext.isIE && */(e.isSpecialKey() || k == e.BACKSPACE || k == e.DELETE)){
                return;
            }
            var c = e.getCharCode();
            if(allowed.indexOf(String.fromCharCode(c)) === -1){
                e.stopEvent();
            }
        };
        this.el.on("keypress", keyPress, this);
    },

        validateValue : function(value){
        if(!Ext.ux.Summit.NumberField.superclass.validateValue.call(this, value)){
            return false;
        }
        if(value.length < 1){              return true;
        }
        value = String(value).replace(this.decimalSeparator, ".");
        if(isNaN(value)){
            this.markInvalid(String.format(this.nanText, value));
            return false;
        }
        var num = this.parseValue(value);
        if(num < this.minValue){
            this.markInvalid(String.format(this.minText, this.minValue));
            return false;
        }
        if(num > this.maxValue){
            this.markInvalid(String.format(this.maxText, this.maxValue));
            return false;
        }
        return true;
    },

    getValue : function(){
        return this.fixPrecision(this.parseValue(Ext.ux.Summit.NumberField.superclass.getValue.call(this)));
    },

    setValue : function(v){
        Ext.ux.Summit.NumberField.superclass.setValue.call(this, String(parseFloat(v)).replace(".", this.decimalSeparator));
    },

        parseValue : function(value){
        value = parseFloat(String(value).replace(this.decimalSeparator, "."));
        return isNaN(value) ? '' : value;
    },

        fixPrecision : function(value){
        var nan = isNaN(value);
        if(!this.allowDecimals || this.decimalPrecision == -1 || nan || !value){
           return nan ? '' : value;
        }
        return parseFloat(parseFloat(value).toFixed(this.decimalPrecision));
    },

    beforeBlur : function(){
        var v = this.parseValue(this.getRawValue());
        if(v){
            this.setValue(this.fixPrecision(v));
        }
    }
});
Ext.reg('summitnumberfield', Ext.ux.Summit.NumberField);
/* end /home/websites/stickk.com/web/js/ext-2.0-stickk/ux/js/Ext.ux.Summit.js size 4231 */
/* begin /home/websites/stickk.com/web/js/ajaxwrapper.js size 6238 */
//var requestType="";
//var placeholder=null;

/**
*	sends an ajax request
*
* @param txtURL: url to request
* @param txtParams: parameters to send, in par1=val1&par2=val2 format
* @param rtype: what to do when the request is done. possible values:
*		load_in_placeholder: loads the content of the response into the given placeholder.
*			anything inside <script> tags inside the content of the response is evaluated as javascript.
*		overlay: loads the content of the response in an overlay box
*			anything inside <script> tags inside the content of the response is evaluated as javascript.
*		execute: content of the response is evaluated as javascript
*		run_code: given javascript code is run
*		run_function: given javascript function is run, with the content of the response as parameter
*		dev: content of the response is displayed in an alert box
*		load_in_wall: content of the response is loaded into commitment/user wall. not exactly sure why this is a special case.
*		parse: anything inside <script> tags inside the content of the response is evaluated as javascript.
*		return: returns the response. in this case, the request is synchronous
* @param rph: 
*		if rtype is 'load_in_placeholder', this is the id of the placeholder
*		if rtype is 'run_code', this is the code to run
*		if rtype is 'run_function', this is the name of the function to run
*		if rtype is 'overlay', this is a collection of options for the overlay
*	@param notLoginRedirect: if type is 'execute' and the user is not logged in, browser is redirected to this URL
*
**/
function send(txtURL, txtParams, rtype, rph, notLoginRedirect)
{
	var retVal = null;
  //alert("function send()\n\ntxtURL:" + txtURL + "\ntxtParams:" + txtParams + "\nrtype:" + rtype + "\nrph:" + rph + "\nnotLoginRedirect:" + notLoginRedirect)
  
  //excute doesn't run javascript so another send needs to be done to check if login is required
  if(rtype == 'execute')
  {
	  if(txtURL == "/register.php" || txtURL.search("/faq/") > -1 || txtURL == "/elements/people-list.inc.php" || txtURL == "/elements/goals-list.inc.php" 
	  	|| txtURL == "/elements/password.php" 
	    )
	    loggedInRequired=0;
	  else
	    loggedInRequired=1;
	  
	  if(loggedInRequired==1)
	  {   
	    var url = "";
  		
  		if(notLoginRedirect != null)
  		{
				url = notLoginRedirect;
  		}
  		
			userOfflineRedirect(url); // force page refresh if user not logged in
		}
		
		// for 'execute', don't add the 'wait' cursor
		var onCreate = function() 
			{
				document.body.style.cursor = "wait";
			}
  }

	var async = (rtype != 'return');
	
	new Ajax.Request(txtURL, {
		method: 'get', 
		parameters: txtParams, 
		asynchronous: async,
		onCreate: onCreate,
		onSuccess: 
			function(transport) { 
		  	retVal = receive(transport, rtype, rph);
		}
//    ,on302: function(transport) {
//      receive(transport, rtype, rph);
//    }
	
	});
	return retVal;
}


function sendPost(txtURL, txtParams, rtype, rph)
{
	//alert("function sendPost()\n\ntxtURL:" + txtURL + "\ntxtParams:" + txtParams + "\nrtype:" + rtype + "\nrph:" + rph)

	new Ajax.Request(txtURL, {
		method: 'post', 
		parameters: txtParams, 
		onComplete: function(transport) {
		  receive(transport, rtype, rph);
		}
	
	});
}

function receive(originalRequest, rtype, rph)
{
	var retVal = null;
  //alert("function receive()\n\noriginalRequest:" + originalRequest + "\nrtype:" + rtype + "\nrph:" + rph)
  
  switch (rtype)
  {
		case 'load_in_wall':
			//alert("lw:" + lastWall);
			window.setTimeout("recallTxt('"+lastWall+"',0);",500);
    
    // Yes there's a break; missing here, it's intended, leave it like that!
		case 'load_in_placeholder':
			//alert(originalRequest.responseText);
			if (rph!="")
			{
				var txt = originalRequest.responseText;

				$(rph).innerHTML = txt;
				
				parseScript(txt);
			}
		break;
    
		case 'overlay':
			var txt = originalRequest.responseText + ' ';
			
			displayOverlay(txt, 0, 0, rph);
			parseScript(txt); 
		break;
    
    case 'alert':
        var txt = originalRequest.responseText + ' ';
        
        displayAlert(txt);
        
        parseScript(txt); 
        
        eval(rph);
        
    break;
		
    case 'parse':
			var txt = originalRequest.responseText + ' ';
			
			parseScript(txt);
		break;
		
    case 'execute':
			eval(originalRequest.responseText); 
		break;
		
    case '':
		break;
    
		case 'dev':
			alert(originalRequest.responseText);
		break;
		
    case 'run_code':
			eval(rph);
		break;
		
    case 'run_function':
			eval(rph + '(' + originalRequest.responseText + ')');
		break;
		
		case 'return':
			retVal = originalRequest.responseText;
			break;
	}
	
	return retVal;
}

// why is this here?
function keepAlive(sid)
{
	if ((typeof(sid)=='string') && (sid.length))
		send('/members/ajax/user-session-update.php?sid=' + sid, '', '', '');
	else
		send('/members/ajax/user-session-update.php', '', '', '');
	window.setTimeout("send('/members/ajax/user-session-update.php', '', '', '');",30000);
	window.setTimeout("keepAlive('"+sid+"');",60000);
}      

//parse and execute script in the txt variable
function parseScript(txt)
{
	var myRE = /<[s]cript.*?>([\s\S]*?)<\/[s]cript.*?>/im;

	var scripts = []; // extract script tags
	while (1)
	{
		var res = myRE.exec(txt);
		if (res)
		{
			scripts[scripts.length] = res[1]
			var n = txt.indexOf(res[0]);
			txt = txt.substr(0, n) + txt.substr(n + res[0].length);
		}
		else
			break;
	}
	
	// run script tags
	for (var i=0; i<scripts.length; i++)
	{
		var o = document.createElement('SCRIPT');
		o = document.body.appendChild(o);
		o.text = scripts[i];
	}
	
	if (chkObject('execute'))
	{
		//alert("Will run:" + $('execute').value);
		eval($('execute').value);
	}
	else
	{
		//alert("No run");
	}			
}

// registers responders for all ajax requests, so that when a request starts, 
// the cursor is set to "wait" and when the request ends, it goes back to normal
function registerAjaxResponders()
{
	// show "wait" mouse pointer while processing ajax request
	Ajax.Responders.register(
		{
			onCreate: function() 
			{
				document.body.style.cursor = "progress";
			},   
			onComplete: function() 
			{
				document.body.style.cursor = "auto";
			} 
		}); 
}

registerAjaxResponders();
/* end /home/websites/stickk.com/web/js/ajaxwrapper.js size 6238 */
/* begin /home/websites/stickk.com/web/js/counters.js size 609 */
function ctr_scroll(dir)
{
	var myLeft = $('counters-master').style.left;
	myLeft=myLeft.replace('px','');
	if (myLeft==''){myLeft=0;}
	myLeft = Math.round(myLeft);
	if (dir==1)
	{
		myLeft=myLeft+5;
	}
	else
	{
		myLeft=myLeft-5;
	}
	if (myLeft<-400)
	{
		myLeft=-400;
	}
	if (myLeft>0)
	{
		myLeft=0;
	}
	//alert("Go:"+myLeft);
	$('counters-master').style.left=myLeft + "px";

}

var scrollIntervalId = 0;
function ctr_startscroll(dir)
{
	scrollIntervalId = setInterval("ctr_scroll(" + dir + ")", 30);
}

function ctr_stopscroll(dir)
{
	clearInterval(scrollIntervalId);
}
/* end /home/websites/stickk.com/web/js/counters.js size 609 */
/* begin /home/websites/stickk.com/web/js/dates.js size 388 */
function getDateDiff(d1,d2){
	var sm=d1[1];
	var tm=d2[1];
	var lower_end =new Date(d1[0], sm-1, d1[2]) //Month is 0-11 in JavaScript
	var higher_end =new Date(d2[0], tm-1, d2[2]) 

	//Get 1 day in milliseconds
	var one_day=1000*60*60*24

	//Calculate difference btw the two dates, and convert to days
	return Math.ceil((higher_end.getTime()-lower_end.getTime())/(one_day)) ;
}
/* end /home/websites/stickk.com/web/js/dates.js size 388 */
/* begin /home/websites/stickk.com/web/js/dropDownHack.js size 6425 */
function foo(px,py,pw,ph,baseElement,fid)
{
  var win = document.getElementById(this.fid);
}

function dropdown_menu_hack(el)
{
  if(el.runtimeStyle.behavior.toLowerCase()=="none"){return;}
  el.runtimeStyle.behavior="none";

  var ie5 = (document.namespaces==null);
  el.ondblclick = function(e)
  {
    window.event.returnValue=false;
    return false;
  }

  if(window.createPopup==null)
  {
    var fid = "dropdown_menu_hack_" + Date.parse(new Date());

    window.createPopup = function()
    {
      if(window.createPopup.frameWindow==null)
      {
        el.insertAdjacentHTML("AfterEnd","<iframe id='"+fid+"' name='"+fid+"' src='about:blank' frameborder='1' scrolling='no'></></iframe>");
        var f = document.frames[fid];
        f.document.open();
        f.document.write("<html><body></body></html>");
        f.document.close();
        f.fid = fid;

        var fwin = document.getElementById(fid);
        fwin.style.cssText="position:absolute;top:0;left:0;display:none;z-index:99999;";

        f.show = function(px,py,pw,ph,baseElement)
        {
          py = py + baseElement.getBoundingClientRect().top + Math.max( document.body.scrollTop, document.documentElement.scrollTop) ;
          px = px + baseElement.getBoundingClientRect().left + Math.max( document.body.scrollLeft, document.documentElement.scrollLeft) ;
          fwin.style.width = pw + "px";
          fwin.style.height = ph + "px";
          fwin.style.posLeft =px ;
          fwin.style.posTop = py ;
          fwin.style.display="block";
        }

        f_hide = function(e)
        {
          if(window.event && window.event.srcElement && window.event.srcElement.tagName && window.event.srcElement.tagName.toLowerCase()=="select"){return true;}
          fwin.style.display="none";
        }
        f.hide = f_hide;
        document.attachEvent("onclick",f_hide);
        document.attachEvent("onkeydown",f_hide);

      }
      return f;
    }
  }

  function showMenu()
  {

    function selectMenu(obj)
    {
      var o = document.createElement("option");
      o.value = obj.value;
      o.innerHTML = obj.innerHTML;
      
      while(el.options.length>0){el.options[0].removeNode(true);}
      
      el.appendChild(o);
      el.title = o.innerHTML;
      el.contentIndex = obj.selectedIndex ;
      el.menu.hide();
    }

    el.menu.show(0 , el.offsetHeight , 10, 10, el);
    var mb = el.menu.document.body;
    
    mb.style.cssText ="border:solid 1px black; margin:0px 0px 0px 0px; padding:0px 0px 0px 0px; overflow-y:auto; overflow-x:auto; background:white; font-size: 12px; font-family: Arial; font-weight: bold;";
    var t = el.contentHTML;
    t = t.replace(/<select/gi,'<ul');
    t = t.replace(/<option/gi,'<li');
    t = t.replace(/<\/option/gi,'</li');
    t = t.replace(/<\/select/gi,'</ul');
    mb.innerHTML = t;

    el.select = mb.all.tags("ul")[0];
    el.select.style.cssText="list-style:none;margin:0;padding:0;";
    mb.options = el.select.getElementsByTagName("li");

    for(var i=0;i<mb.options.length;i++)
    {
      mb.options[i].selectedIndex = i;
      mb.options[i].style.cssText = "list-style:none; margin:0; padding:1px 2px;width:100%; cursor:hand; cursor:pointer; white-space:nowrap;"
      mb.options[i].title =mb.options[i].innerHTML;
      mb.options[i].innerHTML ="<nobr>" + mb.options[i].innerHTML + "</nobr>";
      
      mb.options[i].onmouseover = function()
      {
        if( mb.options.selected ){mb.options.selected.style.background="white";mb.options.selected.style.color="black";}
        mb.options.selected = this;
        this.style.background="#333366";this.style.color="white";
      }

      mb.options[i].onmouseout = function(){this.style.background="white";this.style.color="black";}
      mb.options[i].onmousedown = function(){selectMenu(this); }
      mb.options[i].onkeydown = function(){selectMenu(this); }

      if(i == el.contentIndex)
      {
        mb.options[i].style.background="#333366";
        mb.options[i].style.color="white";
        mb.options.selected = mb.options[i];
      }
    }

    var mw = Math.max( ( el.select.offsetWidth + 22 ), el.offsetWidth + 22 );
    mw = Math.max( mw, ( mb.scrollWidth+22) );
    var mh = mb.options.length * 15 + 8 ;

    var mx = (ie5)?-3:0;
    var my = el.offsetHeight -2;
    var docH = document.documentElement.offsetHeight ;
    var bottomH = docH - el.getBoundingClientRect().bottom ;

    mh = Math.min(mh, Math.max(( docH - el.getBoundingClientRect().top - 50),100) );

    if( ( bottomH < mh) )
    {
      mh = Math.max( (bottomH - 12),10);
      if( mh <100 )
      {
        my = -100 ;
      }
      mh = Math.max(mh,100);
    }

    self.focus();

    el.menu.show( mx , my , mw, mh , el);
    sync=null;
    
    if(mb.options.selected)
    {
      mb.scrollTop = mb.options.selected.offsetTop;
    }

    window.onresize = function(){el.menu.hide()};
  }

  function switchMenu()
  {
    if(event.keyCode)
    {
      if(event.keyCode==40){ el.contentIndex++ ;}
      else if(event.keyCode==38){ el.contentIndex--; }
    }
    else if(event.wheelDelta )
    {
      if (event.wheelDelta >= 120)
      el.contentIndex++ ;
      else if (event.wheelDelta <= -120)
      el.contentIndex-- ;
    }
    else
    {
      return true;
    }

    if( el.contentIndex > (el.contentOptions.length-1) )
    { 
      el.contentIndex =0;
    }
    else if (el.contentIndex<0)
    {
      el.contentIndex = el.contentOptions.length-1 ;
    }

    var o = document.createElement("option");
    o.value = el.contentOptions[el.contentIndex].value;
    o.innerHTML = el.contentOptions[el.contentIndex].text;
    
    while(el.options.length>0)
    {
      el.options[0].removeNode(true);
    }
    el.appendChild(o);
    el.title = o.innerHTML;
  }

  if(dropdown_menu_hack.menu ==null)
  {
    dropdown_menu_hack.menu = window.createPopup();
    document.attachEvent("onkeydown",dropdown_menu_hack.menu.hide);
  }
  
  el.menu = dropdown_menu_hack.menu ;
  el.contentOptions = new Array();
  el.contentIndex = el.selectedIndex;
  el.contentHTML = el.outerHTML;

  for(var i=0;i<el.options.length;i++)
  {
    el.contentOptions [el.contentOptions.length] =
    {
      "value": el.options[i].value,
      "text": el.options[i].innerHTML
    }

    if(!el.options[i].selected){el.options[i].removeNode(true);i--;};
  }

  el.onkeydown = switchMenu;
  el.onclick = showMenu;
  el.onmousewheel= switchMenu;
}
/* end /home/websites/stickk.com/web/js/dropDownHack.js size 6425 */
/* begin /home/websites/stickk.com/web/js/dyn-misc.js size 375 */
function confirmOverlay(ctext,cyes,cno)
{
  Ext.apply(Ext.MessageBox.buttonText, {no: JS_NO_BUTTON, yes: JS_YES_BUTTON});
	Ext.MessageBox.confirm('stickK.com', ctext, function(btn){
   if (btn=='yes') { 
     try { if (typeof(cyes)=='function') cyes(); else eval(cyes); } 
     catch (xx) { ;} 
   } 
   else { 
     try { eval(cno); } 
     catch(xx){ ; } 
   } 
  }
  );
}

/* end /home/websites/stickk.com/web/js/dyn-misc.js size 375 */
/* begin /home/websites/stickk.com/web/js/graph.js size 6548 */
/* This notice must remain at all times.

graph.js
Copyright (c) Balamurugan S, 2005. sbalamurugan @ hotmail.com
Development support by Jexp, Inc http://www.jexp.com 

This package is free software. It is distributed under GPL - legalese removed, it means that you can use this for any purpose, but cannot charge for this software. Any enhancements you make to this piece of code, should be made available free to the general public! 

Latest version can be downloaded from http://www.sbmkpm.com

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

graph.js provides a simple mechanism to draw bar graphs. It  uses 
wz_jsgraphics.js  which is copyright of its author. 

Usage:
var g = new graph();
g.add("title1",value);
g.add("title2",value2);

g.render("canvas_name", "graph title");

//where canvas_name is a div defined INSIDE body tag 
<body>
<div id="canvas_name" style="overflow: auto; position:relative;height:300px;width:400px;"></div>


*/

hD="0123456789ABCDEF";

function d2h(d) 
{
 var h = hD.substr(d&15,1);
 while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;}
 return h;
}

function h2d(h) 
{
 return parseInt(h,16);
}

function graph()
{
 this.ct = 0;
 
 this.data      = new Array();
 this.x_name    = new Array();
 this.scale     = 1;
 this.max       = 10; //MAX INT

 this.c_array = new Array();
 this.c_array[0] = new Array(255, 192, 95);
 this.c_array[1] = new Array(80, 127, 175);
 this.c_array[2] = new Array(159, 87, 112);
 this.c_array[3] = new Array(111, 120, 96);
 this.c_array[4] = new Array(224, 119, 96);
 this.c_array[5] = new Array(80, 159, 144);
 this.c_array[6] = new Array(207, 88, 95);
 this.c_array[7] = new Array(64, 135, 96);
 this.c_array[8] = new Array(239, 160, 95);
 this.c_array[9] = new Array(144, 151, 80);
 this.c_array[10] = new Array(255, 136, 80);

 this.getColor = function()
  {
   if(this.ct >= (this.c_array.length-1))
      this.ct = 0;
   else
      this.ct++;

   return "#" + d2h(this.c_array[this.ct][0]) + d2h(this.c_array[this.ct][1]) + d2h(this.c_array[this.ct][2]);
  }

this.setMax = function(value)
{
	this.max = value;
}
  
this.setScale = function(scale)
{
	this.scale  = scale;
}

 this.add = function(x_name, value)
  {
   value = parseFloat(value,10)*this.scale;

   this.x_name.push(x_name);  
   this.data.push(parseFloat(value,10));

   if(value > this.max)
      this.max = parseFloat(value,10);
  }

 this.render = function(canvas, title, xName, yName, height, legend)
 {
 	 	var legendGraphic;
    var jg = new jsGraphics(canvas);

		if(legend != null)
		{
			legendGraphic = new jsGraphics(legend);
		}
		   
		var h  = 250;
		var yOffset = 75;
		var xOffset = 25;
		var graphPrecision=10;
		var barSpacing=40;

		if (typeof(height) == "number")
			 h = height;

		var sx = 40;
		var dw = 25;
		var shadow = 3;
		var fnt    = 10;

		var rtmax = sx + 10 + (dw+Math.round((dw/2))+shadow)*(this.data.length) + barSpacing*(this.data.length);

		// Draw markers
		/*
		var i;
		for(i = 1 ; i <= 5 ; i++)
		 {
			jg.drawLine(0,Math.round((h/5*i)),rtmax+20,Math.round((h/5*i)));
			var ff = Math.round(this.max - (this.max / 5 * i))/this.scale;
			jg.drawString(ff+"",4,Math.round((h/5*i)-2));
		 }
		*/

		jg.setFont("verdana, arial, sans-serif", "14px",Font.BOLD);
		jg.drawStringRect(title, 0, 0,  rtmax+20+xOffset, 'center');
		jg.setColor("black");

		jg.setFont("Verdana", fnt,  Font.BOLD);

		if(yName != null)
		{  
		  //draw y-axis markers
		 for(i = 0 ; i <= graphPrecision; i++)
		 {
		   if(i%2 == 0)
		   {
   			jg.setColor('#FBFBFB');
			 }
			 else
			 {
   			jg.setColor('white');
			 }
		   
		   if(i!=graphPrecision)
		   {
				jg.fillRect(20+xOffset,Math.round((h/graphPrecision*i)+yOffset),rtmax-10,Math.round((h/graphPrecision*(i+1))+yOffset) - Math.round((h/graphPrecision*i)+yOffset));
			 }
			
				jg.setColor('black');
			
				if(i==graphPrecision)
				{
					jg.drawLine(15+xOffset,Math.round((h/graphPrecision*i)+yOffset),rtmax+10+xOffset,Math.round((h/graphPrecision*i)+yOffset)); 
					//jg.drawString(xName, rtmax+15+xOffset+5, h+yOffset-7); 
				}
				
				else
				{
					jg.drawLine(15+xOffset,Math.round((h/graphPrecision*i)+yOffset),20+xOffset,Math.round((h/graphPrecision*i)+yOffset));
				}
			
				var ff = Math.round((this.max - (this.max / graphPrecision * i))/this.scale);
			  
				var valueString = new String(ff);
				
				jg.drawString(valueString, xOffset-((valueString.length-1)*8),Math.round((h/graphPrecision*i)-7+yOffset));
		 }

		//draw horizontal line
		jg.drawLine(20+xOffset, -5+yOffset, 20+xOffset, h+5+yOffset);
		jg.drawString(yName, 0, -25+yOffset);
		}


		// Draw the bar graph
		for(i = 0; i < this.data.length; i++)
		{
 			currentColor = this.getColor(); 

			if(legend != null)
			{ 
				var boxWidth = 10;
				var boxHeight = 10;
				var fontSize = "8pt";

				legendGraphic.setColor(currentColor);                
				legendGraphic.fillRect(10, 10+(i*5)+(i*boxHeight), boxWidth, boxHeight, "1");
				
				legendGraphic.setColor("#000000");
				legendGraphic.setFont("monospace, arial, sans-serif", fontSize,Font.PLAIN);
				
				legendGraphic.drawStringRect2(this.x_name[i], 10+boxWidth+5, 9+(i*5)+(i*boxHeight), 300, 'left');				   
			}

			 var ht1 = Math.round(this.data[i]*h/this.max);

			 //alert('Max'+this.max+'/Pixels' + ht1);
			 
			 // fix for wierd IE bug that doesn't display h=0
			 var ht2 = (ht1 > 0 ? ht1 : (ht1 == 0 ? 0 : ht1*-1));
			 if (ht1 < 0)
			 {
			     ht1 = 0;
			 }

			 if(ht1 != 0 && ht2 != 0)
			 {			 
				 // shadow  
				 jg.setColor("gray");
				 
				 if(ht2-shadow > 1)
				 {
						jg.fillRect(sx+shadow+xOffset,h-ht1+shadow+yOffset,dw,ht2-shadow);
				 }
				 
				 jg.setColor(currentColor);
				 jg.fillRect(sx+xOffset,h-ht1+yOffset,dw,ht2);

				 jg.setColor("black");
				 jg.drawRect(sx+xOffset,h-ht1+yOffset,dw,ht2);
			 }
			 
			 jg.drawString(this.x_name[i], sx+xOffset+(dw/2)-((this.x_name[i].length-1)*4), h+yOffset);

			 sx = sx+dw+Math.round(dw/2)+shadow+barSpacing;
			}


		jg.setFont("Verdana", fnt,  Font.BOLD);
		jg.drawStringRect2(xName, 0, h+fnt+15+yOffset, rtmax+20+xOffset, "center");

		jg.paint();
 
	  if(legend != null)
		{
			legendGraphic.paint();
		}	
  }

}

/* end /home/websites/stickk.com/web/js/graph.js size 6548 */
/* begin /home/websites/stickk.com/web/js/home.js size 1042 */

function homeTopBarSearch()
{
	$('qstr').value = $('qstr').value.replace(/[\,=\]\[\(\)]/g, '');
  
	if (($('qstr').value!=0)&&($('qstr').value!=' Friend\'s name'))
	{
		if ($('qstr').value.length<3)
		{
			displayAlert(get_constant("JS_SEARCH_ALERT2"));
		}
		else
		{
			location.href='/people.php/search/Action/search-3/string/' + escape($('qstr').value);
		}
	}
	else
	{
    //displayAlert('Please enter some search terms!');
		displayAlert(get_constant("JS_SEARCH_ALERT"));
	}
}

function mb_homeTopBarSearch()
{              
  $('qstr').value = $('qstr').value.replace(/[\,=\]\[\(\)]/g, '');
  
  if (($('qstr').value!=0)&&($('qstr').value!=' Friend\'s name'))
  {          
    if ($('qstr').value.length<3)
    {  
      displayAlert(get_constant("JS_SEARCH_ALERT2"));
    }
    else
    {
      location.href = '/mobile/_iphone/people.php/search/Action/search-3/string/' + escape($('qstr').value);
    }
  }
  else
  {  
    //displayAlert('Please enter some search terms!');
    displayAlert(get_constant("JS_SEARCH_ALERT"));
  }
}
/* end /home/websites/stickk.com/web/js/home.js size 1042 */
/* begin /home/websites/stickk.com/web/js/json2.js size 16927 */
/*
    http://www.JSON.org/json2.js
    2008-03-24

    Public Domain.

    NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.

    See http://www.JSON.org/js.html

    This file creates a global JSON object containing three methods: stringify,
    parse, and quote.


        JSON.stringify(value, replacer, space)
            value       any JavaScript value, usually an object or array.

            replacer    an optional parameter that determines how object
                        values are stringified for objects without a toJSON
                        method. It can be a function or an array.

            space       an optional parameter that specifies the indentation
                        of nested structures. If it is omitted, the text will
                        be packed without extra whitespace. If it is a number,
                        it will specify the number of spaces to indent at each
                        level. If it is a string (such as '\t'), it contains the
                        characters used to indent at each level.

            This method produces a JSON text from a JavaScript value.

            When an object value is found, if the object contains a toJSON
            method, its toJSON method will be called and the result will be
            stringified. A toJSON method does not serialize: it returns the
            value represented by the name/value pair that should be serialized,
            or undefined if nothing should be serialized. The toJSON method will
            be passed the key associated with the value, and this will be bound
            to the object holding the key.

            This is the toJSON method added to Dates:

                function toJSON(key) {
                    return this.getUTCFullYear()   + '-' +
                         f(this.getUTCMonth() + 1) + '-' +
                         f(this.getUTCDate())      + 'T' +
                         f(this.getUTCHours())     + ':' +
                         f(this.getUTCMinutes())   + ':' +
                         f(this.getUTCSeconds())   + 'Z';
                }

            You can provide an optional replacer method. It will be passed the
            key and value of each member, with this bound to the containing
            object. The value that is returned from your method will be
            serialized. If your method returns undefined, then the member will
            be excluded from the serialization.

            If no replacer parameter is provided, then a default replacer
            will be used:

                function replacer(key, value) {
                    return Object.hasOwnProperty.call(this, key) ?
                        value : undefined;
                }

            The default replacer is passed the key and value for each item in
            the structure. It excludes inherited members.

            If the replacer parameter is an array, then it will be used to
            select the members to be serialized. It filters the results such
            that only members with keys listed in the replacer array are
            stringified.

            Values that do not have JSON representaions, such as undefined or
            functions, will not be serialized. Such values in objects will be
            dropped; in arrays they will be replaced with null. You can use
            a replacer function to replace those with JSON values.
            JSON.stringify(undefined) returns undefined.

            The optional space parameter produces a stringification of the value
            that is filled with line breaks and indentation to make it easier to
            read.

            If the space parameter is a non-empty string, then that string will
            be used for indentation. If the space parameter is a number, then
            then indentation will be that many spaces.

            Example:

            text = JSON.stringify(['e', {pluribus: 'unum'}]);
            // text is '["e",{"pluribus":"unum"}]'


            text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
            // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'


        JSON.parse(text, reviver)
            This method parses a JSON text to produce an object or array.
            It can throw a SyntaxError exception.

            The optional reviver parameter is a function that can filter and
            transform the results. It receives each of the keys and values,
            and its return value is used instead of the original value.
            If it returns what it received, then the structure is not modified.
            If it returns undefined then the member is deleted.

            Example:

            // Parse the text. Values that look like ISO date strings will
            // be converted to Date objects.

            myData = JSON.parse(text, function (key, value) {
                var a;
                if (typeof value === 'string') {
                    a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
                    if (a) {
                        return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
                            +a[5], +a[6]));
                    }
                }
                return value;
            });


        JSON.quote(text)
            This method wraps a string in quotes, escaping some characters
            as needed.


    This is a reference implementation. You are free to copy, modify, or
    redistribute.

    USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD THIRD PARTY
    CODE INTO YOUR PAGES.
*/

/*jslint regexp: true, forin: true, evil: true */

/*global JSON */

/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
    call, charCodeAt, floor, getUTCDate, getUTCFullYear, getUTCHours,
    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, length,
    parse, propertyIsEnumerable, prototype, push, quote, replace, stringify,
    test, toJSON, toString
*/

if (!this.JSON) {

// Create a JSON object only if one does not already exist. We create the
// object in a closure to avoid global variables.

    JSON = function () {

        function f(n) {    // Format integers to have at least two digits.
            return n < 10 ? '0' + n : n;
        }

        Date.prototype.toJSON = function () {

// Eventually, this method will be based on the date.toISOString method.

            return this.getUTCFullYear()   + '-' +
                 f(this.getUTCMonth() + 1) + '-' +
                 f(this.getUTCDate())      + 'T' +
                 f(this.getUTCHours())     + ':' +
                 f(this.getUTCMinutes())   + ':' +
                 f(this.getUTCSeconds())   + 'Z';
        };


        var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g,
            gap,
            indent,
            meta = {    // table of character substitutions
                '\b': '\\b',
                '\t': '\\t',
                '\n': '\\n',
                '\f': '\\f',
                '\r': '\\r',
                '"' : '\\"',
                '\\': '\\\\'
            },
            rep;


        function quote(string) {

// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.

            return escapeable.test(string) ?
                '"' + string.replace(escapeable, function (a) {
                    var c = meta[a];
                    if (typeof c === 'string') {
                        return c;
                    }
                    c = a.charCodeAt();
                    return '\\u00' + Math.floor(c / 16).toString(16) +
                                               (c % 16).toString(16);
                }) + '"' :
                '"' + string + '"';
        }


        function str(key, holder) {

// Produce a string from holder[key].

            var i,          // The loop counter.
                k,          // The member key.
                v,          // The member value.
                length,
                mind = gap,
                partial,
                value = holder[key];

// If the value has a toJSON method, call it to obtain a replacement value.

            if (value && typeof value === 'object' &&
                    typeof value.toJSON === 'function') {
                value = value.toJSON(key);
            }

// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.

            if (typeof rep === 'function') {
                value = rep.call(holder, key, value);
            }

// What happens next depends on the value's type.

            switch (typeof value) {
            case 'string':
                return quote(value);

            case 'number':

// JSON numbers must be finite. Encode non-finite numbers as null.

                return isFinite(value) ? String(value) : 'null';

            case 'boolean':
            case 'null':

// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce 'null'. The case is included here in
// the remote chance that this gets fixed someday.

                return String(value);

// If the type is 'object', we might be dealing with an object or an array or
// null.

            case 'object':

// Due to a specification blunder in ECMAScript, typeof null is 'object',
// so watch out for that case.

                if (!value) {
                    return 'null';
                }

// Make an array to hold the partial results of stringifying this object value.

                gap += indent;
                partial = [];

// If the object has a dontEnum length property, we'll treat it as an array.

                if (typeof value.length === 'number' &&
                        !(value.propertyIsEnumerable('length'))) {

// The object is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.

                    length = value.length;
                    for (i = 0; i < length; i += 1) {
                        partial[i] = str(i, value) || 'null';
                    }

// Join all of the elements together, separated with commas, and wrap them in
// brackets.

                    v = partial.length === 0 ? '[]' :
                        gap ? '[\n' + gap + partial.join(',\n' + gap) +
                                  '\n' + mind + ']' :
                              '[' + partial.join(',') + ']';
                    gap = mind;
                    return v;
                }

// If the replacer is an array, use it to select the members to be stringified.

                if (typeof rep === 'object') {
                    length = rep.length;
                    for (i = 0; i < length; i += 1) {
                        k = rep[i];
                        if (typeof k === 'string') {
                            v = str(k, value, rep);
                            if (v) {
                                partial.push(quote(k) + (gap ? ': ' : ':') + v);
                            }
                        }
                    }
                } else {

// Otherwise, iterate through all of the keys in the object.

                    for (k in value) {
                        v = str(k, value, rep);
                        if (v) {
                            partial.push(quote(k) + (gap ? ': ' : ':') + v);
                        }
                    }
                }

// Join all of the member texts together, separated with commas,
// and wrap them in braces.

                v = partial.length === 0 ? '{}' :
                    gap ? '{\n' + gap + partial.join(',\n' + gap) +
                              '\n' + mind + '}' :
                          '{' + partial.join(',') + '}';
                gap = mind;
                return v;
            }
        }


// Return the JSON object containing the stringify, parse, and quote methods.

        return {
            stringify: function (value, replacer, space) {

// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.

                var i;
                gap = '';
                indent = '';
                if (space) {

// If the space parameter is a number, make an indent string containing that
// many spaces.

                    if (typeof space === 'number') {
                        for (i = 0; i < space; i += 1) {
                            indent += ' ';
                        }

// If the space parameter is a string, it will be used as the indent string.

                    } else if (typeof space === 'string') {
                        indent = space;
                    }
                }

// If there is no replacer parameter, use the default replacer.

                if (!replacer) {
                    rep = function (key, value) {
                        if (!Object.hasOwnProperty.call(this, key)) {
                            return undefined;
                        }
                        return value;
                    };

// The replacer can be a function or an array. Otherwise, throw an error.

                } else if (typeof replacer === 'function' ||
                        (typeof replacer === 'object' &&
                         typeof replacer.length === 'number')) {
                    rep = replacer;
                } else {
                    throw new Error('JSON.stringify');
                }

// Make a fake root object containing our value under the key of ''.
// Return the result of stringifying the value.

                return str('', {'': value});
            },


            parse: function (text, reviver) {

// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.

                var j;

                function walk(holder, key) {

// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.

                    var k, v, value = holder[key];
                    if (value && typeof value === 'object') {
                        for (k in value) {
                            if (Object.hasOwnProperty.call(value, k)) {
                                v = walk(value, k);
                                if (v !== undefined) {
                                    value[k] = v;
                                } else {
                                    delete value[k];
                                }
                            }
                        }
                    }
                    return reviver.call(holder, key, value);
                }


// Parsing happens in three stages. In the first stage, we run the text against
// regular expressions that look for non-JSON patterns. We are especially
// concerned with '()' and 'new' because they can cause invocation, and '='
// because it can cause mutation. But just to be safe, we want to reject all
// unexpected forms.

// We split the first stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace all backslash pairs with '@' (a non-JSON character). Second, we
// replace all simple value tokens with ']' characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or ']' or
// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval.

                if (/^[\],:{}\s]*$/.test(text.replace(/\\["\\\/bfnrtu]/g, '@').
replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {

// In the second stage we use the eval function to compile the text into a
// JavaScript structure. The '{' operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.

                    j = eval('(' + text + ')');

// In the optional third stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.

                    return typeof reviver === 'function' ?
                        walk({'': j}, '') : j;
                }

// If the text is not JSON parseable, then a SyntaxError is thrown.

                throw new SyntaxError('JSON.parse');
            },

            quote: quote
        };
    }();
}

/* end /home/websites/stickk.com/web/js/json2.js size 16927 */
/* begin /home/websites/stickk.com/web/js/keyDetect.js size 2112 */
    document.onkeydown = KeyDownHandler;
    document.onkeyup = KeyUpHandler;

    var CTRL = false;      
    var SHIFT = false;     
    var ALT = false;
    var CHAR_CODE = -1;

    function KeyDownHandler(e)
    {
        var x = '';

        if (document.all)
        {
            var evnt = window.event;
            x = evnt.keyCode;
        }
        else
        {
            x = e.keyCode;
        }

        DetectKeys(x, true);
        //ShowReport();
    }

    function KeyUpHandler(e)
    {
        var x = '';

        if (document.all)
        {
            var evnt = window.event;
            x = evnt.keyCode;
        }
        else
        {
            x = e.keyCode;
        }

        DetectKeys(x, false);
        //ShowReport();
    }

    function DetectKeys(KeyCode, IsKeyDown)
    {           
        if (KeyCode == '16')
        {
            SHIFT = IsKeyDown;
        }
        else if (KeyCode == '17')
        {
            CTRL = IsKeyDown;
        }
        else if (KeyCode == '18')
        {
            ALT = IsKeyDown;
        }
        else
        {
            if(IsKeyDown)
                CHAR_CODE = KeyCode;
            else
                CHAR_CODE = -1;
        }
    }

     function ShowReport()
     {
        var TBReport = document.getElementById("tbReport");
        var DIVCtrl = document.getElementById("IsCtrl");
        var DIVShift = document.getElementById("IsShift");
        var DIVAlt = document.getElementById("IsAlt");
        var DIVChar = document.getElementById("IsChar");

        document.title = 'SHIFT: ' + SHIFT + ', CTRL: ' + CTRL + ', ALT: ' + ALT + ', Char code is: ' + CHAR_CODE;

        TBReport.value = document.title;            

        if(SHIFT)
            DIVShift.style.visibility = "visible";
        else
            DIVShift.style.visibility = "hidden";

        if(ALT)
            DIVAlt.style.visibility = "visible";
        else
            DIVAlt.style.visibility = "hidden";

        if(CTRL)
            DIVCtrl.style.visibility = "visible";
        else
            DIVCtrl.style.visibility = "hidden";
     }
/* end /home/websites/stickk.com/web/js/keyDetect.js size 2112 */
/* begin /home/websites/stickk.com/web/js/language.js size 208 */
  function get_constant(constant)
  {
    var text = window[constant];
    
    if(text != "")
      return text;
    else
      return window[constant + '_EN_BACKUP'];
    
    //return window[constant];
  }
/* end /home/websites/stickk.com/web/js/language.js size 208 */
/* begin /home/websites/stickk.com/web/js/legend.js size 4640 */
/* This notice must remain at all times.

pie.js
Copyright (c) Balamurugan S, 2005. sbalamurugan @ hotmail.com
Development support by Jexp, Inc http://www.jexp.com 

This package is free software. It is distributed under GPL - legalese removed, 
it means that you can use this for any purpose, but cannot charge for this software. 
Any enhancements you make to this piece of code, should be made available free to 
the general public!

Latest version can be downloaded from http://www.sbmkpm.com

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

pie.js provides a simple mechanism to draw pie charts. It  uses 
wz_jsgraphics.js  which is copyright of its author.

Usage:
var p = new pie();
p.add("title1",value1);
p.add("title2",value2);

p.render("canvas_name", "graph_title", imageSize);

  canvas_name is a div defined INSIDE body tag
  graph_title is the text that is displayed over the graph itself
  imageSize is the desired size of the pie chart (in pixels)
  
<body>
<div id="canvas_name" style="overflow: auto; position:relative;height:400px;width:400px;"></div>
*/

var boxWidth = 10;
var boxHeight = 10;
var fontSize = "8pt";
hD="0123456789ABCDEF";
function d2h(d) 
{
	var h = hD.substr(d&15,1);
	while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;}
	return h;
}

function h2d(h) 
{
	return parseInt(h,16);
}

function legend()
{
	this.ct = 0;

	this.data      	= new Array();
	this.divOnclick = new Array();
	this.x_name    	= new Array();
	this.div_id		= new Array();
	this.max       	= 0;

	this.c_array = new Array();
 /*
	this.c_array[0] = new Array(255, 192, 95);
	this.c_array[1] = new Array(80, 127, 175);
	this.c_array[2] = new Array(159, 87, 112);
	this.c_array[3] = new Array(111, 120, 96);
	this.c_array[4] = new Array(224, 119, 96);
	this.c_array[5] = new Array(80, 159, 144);
	this.c_array[6] = new Array(207, 88, 95);
	this.c_array[7] = new Array(64, 135, 96);
	this.c_array[8] = new Array(239, 160, 95);
	this.c_array[9] = new Array(144, 151, 80);
	this.c_array[10] = new Array(255, 136, 80);
 */
 	this.c_array[0] = new Array(32, 255, 255);
	this.c_array[1] = new Array(255, 0, 0);
	this.c_array[2] = new Array(0, 255, 0);
	this.c_array[3] = new Array(0, 0, 255);
	this.c_array[4] = new Array(235, 235, 30);
	this.c_array[5] = new Array(255, 0, 255);
	this.c_array[6] = new Array(0, 255, 255);
	this.c_array[7] = new Array(255, 122, 0);
	this.c_array[8] = new Array(122, 0, 255);
	this.c_array[9] = new Array(0, 122, 255);
	this.c_array[10] = new Array(255, 122, 122);
	this.c_array[11] = new Array(122, 255, 122);
	this.c_array[12] = new Array(122, 122, 255);
	this.c_array[13] = new Array(64, 122,122);
	this.c_array[14] = new Array(122, 64, 122);
	this.c_array[15] = new Array(122, 122, 64);	
 	this.c_array[16] = new Array(64,64, 122);
	this.c_array[17] = new Array(122, 64, 64);
	this.c_array[18] = new Array(64, 122, 64);	
	this.c_array[19] = new Array(64, 64, 64);	
	this.c_array[20] = new Array(122, 122, 122);	 
			
	this.getColor = function()
	{
   if(this.ct >= (this.c_array.length-1))
      this.ct = 0;
   else
      this.ct++;
      
   var red = "";
   var green = "";
   var blue = "";
   
   if(this.c_array[this.ct][0] < 16)
   {
	 		red += "0";
   }
   
   red += d2h(this.c_array[this.ct][0]);
   
   if(this.c_array[this.ct][1] < 16)
   {
	 		green += "0";
   }
   
   green += d2h(this.c_array[this.ct][1]);
   
   if(this.c_array[this.ct][2] < 16)
   {
	 		blue += "0";
   }
   
   blue += d2h(this.c_array[this.ct][2]);   
      
   return "#" + red + green + blue;
	}


	this.add = function(x_name, onclick, divId)
	{
		this.x_name.push(x_name);  
		this.divOnclick.push(onclick);
		divId?this.div_id.push(divId):null;
	}

	this.render = function(legend)
	{
		var legendGraphic;

		legendGraphic = new jsGraphics(legend);
		
		legendGraphic.setFontSize(fontSize);
		   
		for(i = 0; i<this.x_name.length; i++)
		{
			currentColor = this.getColor(); 

			legendGraphic.setColor(currentColor);                
			legendGraphic.fillRect(10, 10+(i*5)+(i*boxHeight), boxWidth, boxHeight, "1", this.divOnclick[i]);
			
			legendGraphic.setColor("#000000");
			legendGraphic.setFont("monospace, arial, sans-serif", fontSize,Font.PLAIN);
			

			legendGraphic.drawStringRect2(this.x_name[i], 10+boxWidth+5, 9+(i*5)+(i*boxHeight), 300, 'left', this.divOnclick[i]);      
		}

		legendGraphic.paint();	
	}
}

/* end /home/websites/stickk.com/web/js/legend.js size 4640 */
/* begin /home/websites/stickk.com/web/js/line.js size 7230 */
/* This notice must remain at all times.

graph.js v2.0.1 20/07/2007
Copyright (c) Balamurugan S, 2007. sbalamurugan @ hotmail.com
Development support by Jexp, Inc http://www.jexp.com 

This package is free software. It is distributed under GPL - legalese removed, it means that you can use this for any purpose, but cannot charge for this software. Any enhancements you make to this piece of code, should be made available free to the general public! 

Latest version can be downloaded from http://www.sbmkpm.com

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

line.js provides a simple mechanism to draw line graphs. It  uses 
wz_jsgraphics.js  which is copyright of its author. 

Usage:
var g = new line_graph();
g.add("title1",value);
g.add("title2",value2);

g.render("canvas_name", "graph title");

//where canvas_name is a div defined INSIDE body tag 
<body>
<div id="canvas_name" style="overflow: auto; position:relative;height:300px;width:400px;"></div>


*/

hD="0123456789ABCDEF";

function d2h(d) 
{
 var h = hD.substr(d&15,1);
 while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;}
 return h;
}

function h2d(h) 
{
 return parseInt(h,16);
}

function line_graph()
{
 this.ct = 0;
 
 this.data      = new Array();
 this.x_name    = new Array();
 this.scale     = 1;
 this.max       = -64000; //MAX INT
 this.user_min  = 64000; 
 this.min	= 0;

 this.c_array = new Array();
  /*
	this.c_array[0] = new Array(255, 192, 95);
	this.c_array[1] = new Array(80, 127, 175);
	this.c_array[2] = new Array(159, 87, 112);
	this.c_array[3] = new Array(111, 120, 96);
	this.c_array[4] = new Array(224, 119, 96);
	this.c_array[5] = new Array(80, 159, 144);
	this.c_array[6] = new Array(207, 88, 95);
	this.c_array[7] = new Array(64, 135, 96);
	this.c_array[8] = new Array(239, 160, 95);
	this.c_array[9] = new Array(144, 151, 80);
	this.c_array[10] = new Array(255, 136, 80);
 */
 	this.c_array[0] = new Array(32, 255, 255);
	this.c_array[1] = new Array(255, 0, 0);
	this.c_array[2] = new Array(0, 255, 0);
	this.c_array[3] = new Array(0, 0, 255);
	this.c_array[4] = new Array(235, 235, 30);
	this.c_array[5] = new Array(255, 0, 255);
	this.c_array[6] = new Array(0, 255, 255);
	this.c_array[7] = new Array(255, 122, 0);
	this.c_array[8] = new Array(122, 0, 255);
	this.c_array[9] = new Array(0, 122, 255);
	this.c_array[10] = new Array(255, 122, 122);
	this.c_array[11] = new Array(122, 255, 122);
	this.c_array[12] = new Array(122, 122, 255);
	this.c_array[13] = new Array(64, 122,122);
	this.c_array[14] = new Array(122, 64, 122);
	this.c_array[15] = new Array(122, 122, 64);	
 	this.c_array[16] = new Array(64,64, 122);
	this.c_array[17] = new Array(122, 64, 64);
	this.c_array[18] = new Array(64, 122, 64);	
	this.c_array[19] = new Array(64, 64, 64);	
	this.c_array[20] = new Array(122, 122, 122);	
 
	
 
 this.getColor = function()
 {
   if(this.ct >= (this.c_array.length-1))
      this.ct = 0;
   else
      this.ct++;
      
   var red = "";
   var green = "";
   var blue = "";
   
   if(this.c_array[this.ct][0] < 16)
   {
	 		red += "0";
   }
   
   red += d2h(this.c_array[this.ct][0]);
   
   if(this.c_array[this.ct][1] < 16)
   {
	 		green += "0";
   }
   
   green += d2h(this.c_array[this.ct][1]);
   
   if(this.c_array[this.ct][2] < 16)
   {
	 		blue += "0";
   }
   
   blue += d2h(this.c_array[this.ct][2]);   
      
   return "#" + red + green + blue;
  }


 this.setScale = function(scale)
  {
   this.scale  = scale;
  }

 this.setColor = function(value)
  {
   this.ct = value;
  }

 this.setMax = function(value)
  {
   this.max = value;
  }

 this.setMin = function(value)
  {
   this.user_min = (this.user_min < value ? this.user_min : value);
   this.min = this.user_min;
  }

 this.add = function(x_name, value)
  {
   value = parseFloat(value,10);

   this.x_name.push(x_name);  
   this.data.push(parseFloat(value,10));

   if(value > this.max)
      this.max = parseFloat(value,10);

   if(value < this.user_min)
      this.user_min = parseFloat(value,10);
  }

 this.render = function(canvas, title, xName, yName, height)
  {
   var jg = new jsGraphics(canvas);

   var w = 800;
   var h  = 240;
   var yOffset = 25;
   var xOffset = 25;
   var graphPrecision=10;
   
   if (typeof(height) == "number")
       h = height;

   h = h*this.scale;    
   
   //x-offset    
   var sx = 40;
   //space between points on x  
   var dw = 15;
   var shadow = 0;
   var fnt    = 10;

   var rtmax = sx + 10 + (dw+Math.round((dw/2))+shadow)*(this.data.length);

   var i;
   jg.setColor("black");
   
   if(this.max < graphPrecision)
   {
		 this.max = graphPrecision;
   }

   if(yName != null)
   {  
   
	   jg.setFont("Verdana", fnt,  Font.BOLD);
	   jg.drawStringRect(title, 0, 4, w, "center");
	   
  		//draw y-axis markers
	   for(i = 0 ; i <= graphPrecision; i++)
	   {
   		 if(i%2 == 0)
   		 {
   	 		jg.setColor('#EEEEEE');
			 }
			 else
			 {
   	 		jg.setColor('white');
			 }
   		 
   		 if(i!=graphPrecision)
   		 {
		 		jg.fillRect(20+xOffset,Math.round((h/graphPrecision*i)+yOffset),rtmax+10+xOffset,Math.round((h/graphPrecision*(i+1))+yOffset) - Math.round((h/graphPrecision*i)+yOffset));
			 }
			
				jg.setColor('black');
			
				if(i==graphPrecision)
				{
					jg.drawLine(15+xOffset,Math.round((h/graphPrecision*i)+yOffset),rtmax+10+xOffset,Math.round((h/graphPrecision*i)+yOffset)); 
					//jg.drawString(xName, rtmax+15+xOffset+5, h+yOffset-7);
					jg.drawStringRect2(xName, 0, h+fnt+15+yOffset, rtmax+20+xOffset, "center"); 
				}
				
				else
				{
					jg.drawLine(15+xOffset,Math.round((h/graphPrecision*i)+yOffset),20+xOffset,Math.round((h/graphPrecision*i)+yOffset));
				}
			
				var ff = Math.round((this.max - (this.max / graphPrecision * i))+this.min);

				var valueString = new String(ff);

				jg.drawString(valueString,xOffset-((valueString.length-1)*8),Math.round((h/graphPrecision*i)-7+yOffset));
	   }
 
    //draw horizontal line
	  jg.drawLine(20+xOffset, -5+yOffset, 20+xOffset, h+5+yOffset);
   	jg.drawString(yName, 0, -25+yOffset);
	 }
	   
   // Draw the bar graph
   var color = this.getColor();
   var oldx, oldy;
   jg.setStroke(1);

   //draw line graph
   for(i = 0; i < this.data.length; i++)
   {
       var ht1 = Math.round(this.data[i]*h/this.max) - (this.min*h/this.max);

       if(i >= 1)
       {
          jg.setColor(color);
          jg.drawLine(oldx+xOffset, h-oldy+yOffset, sx+xOffset, h-ht1+yOffset);
	 		 }

       jg.setColor(color);
       jg.fillEllipse(sx-2+xOffset, h-ht1-2+yOffset, 5, 5);

       if(yName != null)
   		 {  
       	jg.setColor("black");
       	jg.drawString(this.x_name[i], sx-5+xOffset, h+7+yOffset);
			  jg.drawLine(sx+xOffset, h+yOffset, sx+xOffset, h+5+yOffset);  
       }
       
       oldx = sx;
       oldy = ht1;

       sx = sx+dw+Math.round(dw/2)+shadow;
   }
   
   jg.paint();
  }
}

/* end /home/websites/stickk.com/web/js/line.js size 7230 */
/* begin /home/websites/stickk.com/web/js/members.js size 1696 */

function filterMemberCommitments(filter, uid)
{
	var ct = $('commitments-list');
	if (ct)
	{
		ct = Element.select(ct, ".boxext-body");
		if (ct.length)
		{
			ct = ct[0];
			if (!ct.id)
			{
				ct.setAttribute("id", 'commimtents-list-body');
			}
			send('/members/elements/user-info-contracts.inc.php', 't=&uid=' + uid + '&filter=' + filter, 'load_in_placeholder', ct.id);
		}
	}
	return false;
}


EditCard = {};

EditCard.initCreditCardForm = function(frm) {
	$$('input[name=userAddressID]').each(function (el) { el.observe('click', EditCard.userAddressClick) });
	if (parseInt($F('numOfAddresses')) > 0) {
		if (!$RF(frm, 'userAddressID')) {
			$('choose_address').down('input[name=userAddressID]').checked = true;
		}
		$(frm).down('.new_address').hide();
		EditCard.disableNewAddress();
	}
	else {
		$('userAddress_new').hide();
	}
};

EditCard.disableNewAddress = function() {
	$$('.new_address .address_container input').each(function (el) { el.disable() });
	$$('.new_address .address_container select').each(function (el) { el.disable() });
};

EditCard.enableNewAddress = function() {
	$$('.new_address .address_container input').each(function (el) { el.enable() });
	$$('.new_address .address_container select').each(function (el) { el.enable() });
};

EditCard.userAddressClick = function(ev) {
	var userAddress = ev.element();
	if (userAddress.id == 'userAddress_new') {
		EditCard.enableNewAddress();
	}
	else {
		EditCard.disableNewAddress();
	}
};

EditCard.newAddressClick = function() {
	$$('.new_address').each(function(el) { el.show() });
	EditCard.enableNewAddress();
	$('userAddress_new').checked = true;
};

/* end /home/websites/stickk.com/web/js/members.js size 1696 */
/* begin /home/websites/stickk.com/web/js/misc.js size 30358 */
var tempX = 0
var tempY = 0

// Temporary variables to hold mouse x-y pos.s
var IE = document.all?true:false

//!IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove
document.onmousemove = getMouseXY;

// Main function to retrieve mouse x-y pos.s
function getMouseXY(e)
{
  if (IE)
  { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.documentElement.scrollLeft;
    tempY = event.clientY + document.documentElement.scrollTop;
  }
  
  else
  {  // grab the x-y pos.s if browser is not IE
    tempX = e.pageX;
    tempY = e.pageY ;
  } 
   
  // catch possible negative values
  if (tempX < 0){tempX = 0;}
  if (tempY < 0){tempY = 0;}  

  return true;
}


function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

var cms=null;
var major_to_bug=0;
var olost=10;
var olosl=15;


//posType: 	if 1 or null, the position of the menu is based on the sender object position.
//					if anything else the position of the context menu is based on mouse position 
function showContextMenu(itmArray,lnkArray,itmObj,soqtip, posType){
	window.clearTimeout(cms);
	
	//used to determine how fast the menu dissapears
	var contextMenuTimout = 0;
	
	major_to_bug=1;
	if (soqtip==1){
		Ext.QuickTips.getQuickTip().hide();
	}

	var ohtml = '';

	ohtml = ohtml + "<table class='context' cellspacing=0 cellpadding=0 class='txt12' onMouseOver=\"window.clearTimeout(cms);major_to_bug=1;\" onMouseMove=\"window.clearTimeout(cms);major_to_bug=1;\" onMouseOut=\"window.setTimeout('hideContextMenu()',500);major_to_bug=0;\">";

	for (l=0;l<itmArray.length;l++){
		if (l>0){
			ohtml = ohtml + '<tr>';		
			ohtml = ohtml + "<td nowrap onClick=\""+lnkArray[l]+"\" class='context_c' onMouseOver=\"this.className='context_c_hover';\" onMouseOut=\"this.className='context_c';\" style=\"border-top:1px solid #999999;\">"+itmArray[l]+"</td>";		
			ohtml = ohtml + '</tr>';		
		}else{
			ohtml = ohtml + '<tr>';		
			ohtml = ohtml + "<td nowrap onClick=\""+lnkArray[l]+"\" class='context_c' onMouseOver=\"this.className='context_c_hover';\" onMouseOut=\"this.className='context_c';\">"+itmArray[l]+"</td>";		
			ohtml = ohtml + '</tr>';		

		}
	}

	ohtml = ohtml + '</table>';

	$('overlay_context').style.display='';

	if(posType == null || posType == 1)
	{
		posarr = findPos(itmObj); 
		posarr[1]=posarr[1]+olost;
		$('overlay_context').style.top = posarr[1] + "px" ;   
		posarr[0]=posarr[0]+olosl;
		$('overlay_context').style.left = posarr[0] + "px" ;
		
		contextMenuTimout = 0;
	}
	
	else
	{
		$('overlay_context').style.top = tempY + "px" ;   
		$('overlay_context').style.left = tempX + "px" ;
		
		contextMenuTimout = 2000;		
	}


	$('overlay_context').innerHTML = ohtml;

	if (soqtip==1){
		window.setTimeout("Ext.QuickTips.getQuickTip().hide();",500);
	}

	cms = window.setTimeout("hideContextMenu()",contextMenuTimout);

	olost=10;
	olosl=15;


	return false;


}

function hideContextMenu(){
	window.clearTimeout(cms);
	if (major_to_bug==0){
		$('overlay_context').style.display='none';
	}
}
function friendContextMenu(fid,fn,obj){
  return showContextMenu(Array('<img src=\'http://static.stickk.com/images/icons/user_16.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_VIEW_PROFILE").replace(/##fn##/i, fn),'<img src=\'http://static.stickk.com/images/icons/chat3.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_WRITE_MESSAGE").replace(/##fn##/i, fn)),Array('location.href=\'/members/index.php/uid/' + fid + '\'','location.href=\'/members/mail.php/mail/comp/1/u/' + fid + '\''),obj,1, 2);
}
function friendWallContextMenu(fid,fn,obj){
	return showContextMenu(Array('<img src=\'http://static.stickk.com/images/icons/chat.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_GOTO_STICKKER_NOTES").replace(/##fn##/i, fn),'<img src=\'http://static.stickk.com/images/icons/user_16.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_VIEW_PROFILE").replace(/##fn##/i, fn),'<img src=\'http://static.stickk.com/images/icons/chat3.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_WRITE_INBOX").replace(/##fn##/i, fn)),Array('location.href=\'/members/index.php/uid/' + fid + '#wall\'','location.href=\'/members/index.php/uid/' + fid + '\'','location.href=\'/members/mail.php/mail/comp/1/u/' + fid + '\''),obj,1, 2);
}

function inboxContextMenu(mid,mtid,iur,obj){
	switch (iur){
		case 1:
		return showContextMenu(Array('<img src=\'http://static.stickk.com/images/icons/chat5.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_MARK_AS_READ"),'<img src=\'http://static.stickk.com/images/icons/chat5.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_READ_MESSAGE"),'<img src=\'http://static.stickk.com/images/icons/chat3.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_REPLY_TO_MESSAGE")),Array('location.href=\'mail.php?Action=read&mid='+mid+'\'','location.href=\'mail.php?m=&t='+mtid+'#m'+mid+'\'','location.href=\'mail.php?m=&t='+mtid+'#comp\''),obj,1);
		break;
		case 0:
		return showContextMenu(Array('<img src=\'http://static.stickk.com/images/icons/chat4.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_MARK_AS_UNREAD"),'<img src=\'http://static.stickk.com/images/icons/chat5.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_READ_MESSAGE"),'<img src=\'http://static.stickk.com/images/icons/chat3.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_REPLY_TO_MESSAGE")),Array('location.href=\'mail.php?Action=unread&mid='+mid+'\'','location.href=\'mail.php?m=&t='+mtid+'#m'+mid+'\'','location.href=\'mail.php?m=&t='+mtid+'#comp\''),obj,1);
		break;
		case -1:
		return showContextMenu(Array('<img src=\'http://static.stickk.com/images/icons/chat5.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_REVIEW_MESSAGE"),'<img src=\'http://static.stickk.com/images/icons/chat3.gif\' style=\'position:relative;top:2px;\'>&nbsp;&nbsp;&nbsp;' + get_constant("JS_CONTEXTMENU_FOLLOW_UP_ON_MESSAGE")),Array('location.href=\'mail.php?m=sent&t='+mtid+'#m'+mid+'\'','location.href=\'mail.php?m=sent&t='+mtid+'#comp\''),obj,1);
		break;

	}
}



var myt=null;
var mya=null;
function showRefTT(t,o,hd,vd){
	var op = findPos(o);
	var fpt = op[0];
	$('overlay_tooltip').style.display='';
	$('overlay_tooltip').style.top = op[1] + vd;
	$('overlay_tooltip').style.left = op[0];
	$('overlay_tooltip_content').innerHTML = t;

	if (myt!=null){window.clearTimeout(myt);}
	if (mya!=null){window.clearTimeout(mya);}

	slideRefTT(fpt,hd,0);

	var extTimeout=0;
	if (t.length>35){
		var unitExtend = t.length;
		unitExtend=unitExtend-35;
		extTimeout = unitExtend * 10;
	}

	myt=window.setTimeout("hideRefTT()",3000 + extTimeout);
}
function slideRefTT(shd,lhd,cd){
	cd=cd+15;
	$('overlay_tooltip').style.left = shd + cd;
	//alert("RND:"+cd+"<"+lhd);
	if (cd<(lhd-15)){
		mya = window.setTimeout("slideRefTT("+shd+","+lhd+","+cd+");",50);
	}

}
function hideRefTT(){
	if (mya!=null){window.clearTimeout(mya);}
	$('overlay_tooltip').style.display='none';
}

function chkObject(theVal) {
	if (document.getElementById(theVal) != null) {
		return true;
	} else {
		return false;
	}
}

function show_help_approval(){
	displayAlert('This contract is awaiting for the referee and/or the recipient of stakes to approve their role in the contract.');
}

function show_help_confirmation(){
	displayAlert('This contract is ready to begin and will start when the committed user confirms.');
}

var cnh=new Array;
function smoothExpand(objName,mnh){
	if (cnh[objName]==null){cnh[objName]=0;}
	if (cnh[objName]<mnh){
		cnh[objName]=cnh[objName]+5;
		$(objName).style.height = cnh[objName] + 'px';
		window.setTimeout("smoothExpand('"+objName+"',"+mnh+")",50);
	}
}

function formatMoney(amount, currency_sign_before,
	currency_sign_after, thousands_separator, decimal_point,
	significant_after_decimal_pt, display_after_decimal_pt)
{
	// Only display a minus if the final displayed value is going to be <= -0.01 (or equivalent)
	var str_minus = (amount * significant_multiplier <= -0.5 ? "-" : "");
	
	if (typeof(currency_sign_before)=='undefined')
		currency_sign_before = '$';
	if (typeof(currency_sign_after)=='undefined')
		currency_sign_after = '';
	if (typeof(thousands_separator)=='undefined')
		thousands_separator = ',';
	if (typeof(decimal_point)=='undefined')
		decimal_point = '.';
	if (typeof(significant_after_decimal_pt)=='undefined')
		significant_after_decimal_pt = 2;
	if (typeof(display_after_decimal_pt)=='undefined')
		display_after_decimal_pt = 2;
		

	// Sanity check on the incoming amount value
	amount = parseFloat(amount);
	if( isNaN(amount) || Math.LOG10E * Math.log(Math.abs(amount)) +
			Math.max(display_after_decimal_pt, significant_after_decimal_pt) >= 21 )
	{
		return str_minus + currency_sign_before +
			(isNaN(amount)? "#" : "####################".substring(0, Math.LOG10E * Math.log(Math.abs(amount)))) +
			(display_after_decimal_pt >= 1?
				(decimal_point + "##################".substring(0, display_after_decimal_pt)) : "") +
			currency_sign_after;
	}
	
	var significant_multiplier = Math.pow(10, significant_after_decimal_pt);

	// Make +ve and ensure we round up/down properly later by adding half a penny now.
	amount = Math.abs(amount) + (0.5 / significant_multiplier);

	amount *= significant_multiplier;
	
	var str_display = parseInt(
		parseInt(amount) * Math.pow(10, display_after_decimal_pt - significant_after_decimal_pt) ).toString();
			
	// Prefix as many zeroes as is necessary and strip the leading 1
	if( str_display.length <= display_after_decimal_pt )
		str_display = (Math.pow(10, display_after_decimal_pt - str_display.length + 1).toString() +
			str_display).substring(1);
			
	var comma_sep_pounds = str_display.substring(0, str_display.length - display_after_decimal_pt);
	var str_pence = str_display.substring(str_display.length - display_after_decimal_pt);
	
	if( thousands_separator.length > 0 && comma_sep_pounds.length > 3 )
	{
		comma_sep_pounds += ",";

		// We need to do this twice because the first time only inserts half the commas.  The reason is
		// the part of the lookahead ([0-9]{3})+ also consumes characters; embedding one lookahead (?=...)
		// within another doesn't seem to work, so (?=[0-9](?=[0-9]{3})+,)(.)(...) fails to match anything.
		if( comma_sep_pounds.length > 7 )
			comma_sep_pounds = comma_sep_pounds.replace(/(?=[0-9]([0-9]{3})+,)(.)(...)/g, "$2,$3");

		comma_sep_pounds = comma_sep_pounds.replace(/(?=[0-9]([0-9]{3})+,)(.)(...)/g, "$2,$3");

		// Remove the fake separator at the end, then replace all commas with the actual separator
		comma_sep_pounds = comma_sep_pounds.substring(0, comma_sep_pounds.length - 1).replace(/,/g, thousands_separator);
	}

	return str_minus + currency_sign_before +
		comma_sep_pounds + (display_after_decimal_pt >= 1? (decimal_point + str_pence) : "") +
		currency_sign_after;
}

//function imposeMaxLength(Object, MaxLen)
//{   
//    Object.value = Object.value.substr(0,MaxLen-1);
//}

function imposeMaxLength(Object, MaxLen)
{
  if (Object.value.length>MaxLen)
  {
    Object.value = Object.value.substr(0,MaxLen-1);
  }
}

/**
* Returns the value of the selected radio button in the radio group, null if
* none are selected, and false if the button group doesn't exist
*
* @param {radio Object} or {radio id} el
* OR
* @param {form Object} or {form id} el
* @param {radio group name} radioGroup
*/
function $RF(el, radioGroup) {
    if($(el).readAttribute("type") && $(el).readAttribute("type").toLowerCase() == 'radio') {
        var radioGroup = $(el).name;
        var el = $(el).form;
    } else if ($(el).tagName.toLowerCase() != 'form') {
        return false;
    }

    var checked = $(el).getInputs('radio', radioGroup).find(
        function(re) {return re.checked;}
    );
    return (checked) ? $F(checked) : null;
}

/**
* Delay for a number of milliseconds
*/
function sleep(delay)
{
	var start = new Date().getTime();
	while (new Date().getTime() < start + delay);
}

function removeSpaces(string)
{
    return string.split(' ').join('');
}

/**
*
* Validate email
*
*/
function validateEmail(str) 
{
    var regEmail = /^([A-Za-z0-9]+[-_.]?[A-Za-z0-9]+)+@[A-Za-z0-9-]+\.[A-Za-z]{2,4}$/;

    if(regEmail.exec(removeSpaces(str)) == null)
    {
        return false;
    } 
    
    return true;
}

function emailCheck (emailStr) // This is the function that MGB uses, that Eric found and Ron swears by
{
  /* The following variable tells the rest of the function whether or not
  to verify that the address ends in a two-letter country or well-known
  TLD.  1 means check it, 0 means don't. */

  var checkTLD=1;

  /* The following is the list of known TLDs that an e-mail address must end
  with. */

  var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/i;

  /* The following pattern is used to check if the entered e-mail address
  fits the user@domain format.  It also is used to separate the username
  from the domain. */

  var emailPat=/^(.+)@(.+)$/;

  /* The following string represents the pattern for matching all special
  characters.  We don't want to allow special characters in the address.
  These characters include ( ) < > @ , ; : \ " . [ ] */

  var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

  /* The following string represents the range of characters allowed in a
  username or domainname.  It really states which chars aren't allowed.*/

  var validChars="\[^\\s" + specialChars + "\]";

  /* The following pattern applies if the "user" is a quoted string (in
  which case, there are no rules about which characters are allowed
  and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
  is a legal e-mail address. */

  var quotedUser="(\"[^\"]*\")";

  /* The following pattern applies for domains that are IP addresses,
  rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
  e-mail address. NOTE: The square brackets are required. */

  var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

  /* The following string represents an atom (basically a series of
  non-special characters.) */

  var atom=validChars + '+';

  /* The following string represents one word in the typical username.
  For example, in john.doe@somewhere.com, john and doe are words.
  Basically, a word is either an atom or quoted string. */

  var word="(" + atom + "|" + quotedUser + ")";

  // The following pattern describes the structure of the user

  var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

  /* The following pattern describes the structure of a normal symbolic
  domain, as opposed to ipDomainPat, shown above. */

  var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

  /* Finally, let's start trying to figure out if the supplied address is
  valid. */

  /* Begin with the coarse pattern to simply break up user@domain into
  different pieces that are easy to analyze. */

  var matchArray=emailStr.match(emailPat);

  if (matchArray==null)
  {
    /* Too many/few @'s or something; basically, this address doesn't
    even fit the general mould of a valid e-mail address. */

    //alert("Email address seems incorrect (check @ and .'s)");
    return false;
  }
  
  var user=matchArray[1];
  var domain=matchArray[2];

  // Start by checking that only basic ASCII characters are in the strings (0-127).

  for (i=0; i<user.length; i++)
  {
    if (user.charCodeAt(i)>127)
    {
      //alert("Ths username contains invalid characters.");
      return false;
    }
  }
  
  for (i=0; i<domain.length; i++)
  {
    if (domain.charCodeAt(i)>127)
    {
      //alert("Ths domain name contains invalid characters.");
      return false;
    }
  }

  // See if "user" is valid
  if(user.match(userPat)==null)
  {
    // user is not valid
    //alert("The username doesn't seem to be valid.");
    return false;
  }

  /* if the e-mail address is at an IP address (as opposed to a symbolic
  host name) make sure the IP address is valid. */

  var IPArray=domain.match(ipDomainPat);
  
  if (IPArray!=null)
  {
    // this is an IP address

    for (var i=1;i<=4;i++)
    {
      if (IPArray[i]>255)
      {
        //alert("Destination IP address is invalid!");
        return false;
      }
    }
    return true;
  }

  // Domain is symbolic name.  Check if it's valid.
  var atomPat=new RegExp("^" + atom + "$");
  var domArr=domain.split(".");
  var len=domArr.length;
  
  for (i=0;i<len;i++)
  {
    if (domArr[i].search(atomPat)==-1)
    {
      //alert("The domain name does not seem to be valid.");
      return false;
    }
  }

  /* domain name seems valid, but now make sure that it ends in a
  known top-level domain (like com, edu, gov) or a two-letter word,
  representing country (uk, nl), and that there's a hostname preceding
  the domain or country. */

  if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1)
  {
    //alert("The e-mail address must end in a well-known domain or two letter " + "country.");
    return false;
  }

  // Make sure there's a host name preceding the domain.
  if (len<2)
  {
    //alert("This address is missing a hostname!");
    return false;
  }

  // If we've gotten this far, everything's valid!
  return true;
}

function hasSpecialCharacters(val)
{

  //var iChars = "?!@#$%&*-+='.,:;\""; // allowed
  //var iChars = "<>[]{}^/|\\";
  var iChars = "<>[]{}^";
  
  var invalidCharacterersFound = "";
  
  for (var i = 0; i < val.length; i++) 
  {
    if (iChars.indexOf(val.charAt(i)) != -1)
      invalidCharacterersFound += val.charAt(i);
  }
  
  return invalidCharacterersFound;
}

function stripSpecialCharacters(val)
{

  //var iChars = "?!@#$%&*-+='.,:;\""; // allowed
  var iChars = "<>[]{}^/|\\";
  
  var invalidCharacterersFound = "";
  
  for (var i = 0; i < val.length; i++) 
  {
    if (iChars.indexOf(val.charAt(i)) != -1)
    {
      val = val.replace(val.charAt(i), "");
    }
  }
  
  return val;
}

function getTimezoneName() 
{
  tmSummer = new Date(Date.UTC(2009, 6, 30, 0, 0, 0, 0));
  so = -1 * tmSummer.getTimezoneOffset();
  
  tmWinter = new Date(Date.UTC(2009, 12, 30, 0, 0, 0, 0));
  wo = -1 * tmWinter.getTimezoneOffset();

  if (-660 == so && -660 == wo) 
    return 'Pacific/Midway';
  else if (-600 == so && -600 == wo) 
    return 'Pacific/Tahiti';
  else if (-570 == so && -570 == wo) 
    return 'Pacific/Marquesas';
  else if (-540 == so && -600 == wo) 
    return 'America/Adak';
  else if (-540 == so && -540 == wo) 
    return 'Pacific/Gambier';
  else if (-480 == so && -540 == wo) 
    return 'US/Alaska';
  else if (-480 == so && -480 == wo) 
    return 'Pacific/Pitcairn';
  else if (-420 == so && -480 == wo) 
    return 'US/Pacific';
  else if (-420 == so && -420 == wo) 
    return 'US/Arizona';
  else if (-360 == so && -420 == wo) 
    return 'US/Mountain';
  else if (-360 == so && -360 == wo) 
    return 'America/Guatemala';
  else if (-360 == so && -300 == wo) 
    return 'Pacific/Easter';
  else if (-300 == so && -360 == wo) 
    return 'US/Central';
  else if (-300 == so && -300 == wo) 
    return 'America/Bogota';
  else if (-240 == so && -300 == wo) 
    return 'US/Eastern';
  else if (-240 == so && -240 == wo) 
    return 'America/Caracas';
  else if (-240 == so && -180 == wo) 
    return 'America/Santiago';
  else if (-180 == so && -240 == wo) 
    return 'Canada/Atlantic';
  else if (-180 == so && -180 == wo) 
    return 'America/Montevideo';
  else if (-180 == so && -120 == wo) 
    return 'America/Sao_Paulo';
  else if (-150 == so && -210 == wo) 
    return 'America/St_Johns';
  else if (-120 == so && -180 == wo) 
    return 'America/Godthab';
  else if (-120 == so && -120 == wo) 
    return 'America/Noronha';
  else if (-60 == so && -60 == wo) 
    return 'Atlantic/Cape_Verde';
  else if (0 == so && -60 == wo) 
    return 'Atlantic/Azores';
  else if (0 == so && 0 == wo) 
    return 'Africa/Casablanca';
  else if (60 == so && 0 == wo) 
    return 'Europe/London';
  else if (60 == so && 60 == wo) 
    return 'Africa/Algiers';
  else if (60 == so && 120 == wo) 
    return 'Africa/Windhoek';
  else if (120 == so && 60 == wo) 
    return 'Europe/Amsterdam';
  else if (120 == so && 120 == wo) 
    return 'Africa/Harare';
  else if (180 == so && 120 == wo) 
    return 'Europe/Athens';
  else if (180 == so && 180 == wo) 
    return 'Africa/Nairobi';
  else if (240 == so && 180 == wo) 
    return 'Europe/Moscow';
  else if (240 == so && 240 == wo) 
    return 'Asia/Dubai';
  else if (270 == so && 210 == wo) 
    return 'Asia/Tehran';
  else if (270 == so && 270 == wo) 
    return 'Asia/Kabul';
  else if (300 == so && 240 == wo) 
    return 'Asia/Baku';
  else if (300 == so && 300 == wo) 
    return 'Asia/Karachi';
  else if (330 == so && 330 == wo) 
    return 'Asia/Calcutta';
  else if (345 == so && 345 == wo) 
    return 'Asia/Katmandu';
  else if (360 == so && 300 == wo) 
    return 'Asia/Yekaterinburg';
  else if (360 == so && 360 == wo) 
    return 'Asia/Colombo';
  else if (390 == so && 390 == wo) 
    return 'Asia/Rangoon';
  else if (420 == so && 360 == wo) 
    return 'Asia/Almaty';
  else if (420 == so && 420 == wo) 
    return 'Asia/Bangkok';
  else if (480 == so && 420 == wo) 
    return 'Asia/Krasnoyarsk';
  else if (480 == so && 480 == wo) 
    return 'Australia/Perth';
  else if (540 == so && 480 == wo) 
    return 'Asia/Irkutsk';
  else if (540 == so && 540 == wo) 
    return 'Asia/Tokyo';
  else if (570 == so && 570 == wo) 
    return 'Australia/Darwin';
  else if (570 == so && 630 == wo) 
    return 'Australia/Adelaide';
  else if (600 == so && 540 == wo) 
    return 'Asia/Yakutsk';
  else if (600 == so && 600 == wo) 
    return 'Australia/Brisbane';
  else if (600 == so && 660 == wo) 
    return 'Australia/Sydney';
  else if (630 == so && 660 == wo) 
    return 'Australia/Lord_Howe';
  else if (660 == so && 600 == wo) 
    return 'Asia/Vladivostok';
  else if (660 == so && 660 == wo) 
    return 'Pacific/Guadalcanal';
  else if (690 == so && 690 == wo) 
    return 'Pacific/Norfolk';
  else if (720 == so && 660 == wo) 
    return 'Asia/Magadan';
  else if (720 == so && 720 == wo) 
    return 'Pacific/Fiji';
  else if (720 == so && 780 == wo) 
    return 'Pacific/Auckland';
  else if (765 == so && 825 == wo) 
    return 'Pacific/Chatham';
  else if (780 == so && 780 == wo) 
    return 'Pacific/Enderbury'
  else if (840 == so && 840 == wo) 
    return 'Pacific/Kiritimati';
  else
    return 'US/Pacific';
}

function validatePhone(phoneValue)
{
    var error = "";
    var stripped = phoneValue.replace(/[\(\)\.\-\ ]/g, '');    

    if (phoneValue == "")
    {
      //error = "Phone number: cannot be empty!";
      return error; // We only validate if the user actually puts something in, the field is optional
    }
    else if (isNaN(parseInt(stripped)))
    {
        error = "Phone number: contains illegal characters!";
    }
    else if (stripped.length < 10)
    {
      error = "Phone number: wrong length. Make sure you included an area code!";
    }
    return error;
}

function addslashes(str)
{
    str=str.replace(/\\/g,'\\\\');
    str=str.replace(/\'/g,'\\\'');
    str=str.replace(/\"/g,'\\"');
    str=str.replace(/\0/g,'\\0');

    return str;
}

function stripslashes(str)
{
    str=str.replace(/\\'/g,'\'');
    str=str.replace(/\\"/g,'"');
    str=str.replace(/\\0/g,'\0');
    str=str.replace(/\\\\/g,'\\');

    return str;
}

function stripAlpha(str) // strips all alpha characters
{
  return str.replace( /\D/g, "");
}

function printR(myObj)
{
  var objData = "";
  for (myKey in myObj)
  {
    objData += "myObj["+myKey +"] = "+myObj[myKey]+"\n";
  }
  
  alert(objData);
}


//Returns the browser’s left position on the screen
function getBrowserLeft()
{
	//screenX is Firefox and the other is IE
	return (window.screenLeft == null ? window.screenX : window.screenLeft);
}

//Returns the browser’s  top position on the screen. IE gives the top coordinate of the webpage viewport.
function getBrowserTop()
{
	//screenY is Firefox and the other is IE
	return (window.screenTop == null ? window.screenY : window.screenTop);
}

//Returns the browser’s width
function getBrowserWidth()
{
	var x = 0;
	if (self.innerHeight)
	{
		x = self.innerWidth;
	}

	else if (document.documentElement && document.documentElement.clientHeight)
	{
		x = document.documentElement.clientWidth;
	}

	else if (document.body)
	{
		x = document.body.clientWidth;
	}

	return x;
}

//Returns the browser’s height
function getBrowserHeight()
{
	var y = 0;

	if (self.innerHeight)
	{
		y = self.innerHeight;
	}

	else if (document.documentElement && document.documentElement.clientHeight)
	{
		y = document.documentElement.clientHeight;
	}

	else if (document.body)
	{
		y = document.body.clientHeight;
	}
	return y;
}

/*
 * displays pageName in a new window with the given dimesions, location, and properties.
 * If no x or y is specified then the window will be centered according to the browser width, height, and location.
 */
function displayPopup(pageName, windowProperties, width, height, x, y)
{
	var browserWidth = getBrowserWidth();
	var browserHeight = getBrowserHeight();

	var leftPos = 0;
	var topPos = 0;

	if(x == null)
	{
		leftPos = ((browserWidth - width) / 2) + getBrowserLeft();
	}

	else
	{
		leftPos = x;
	}

	if(y == null)
	{
		topPos = ((browserHeight - height) / 2) + getBrowserTop();
	}

	else
	{
		topPos = y;
	}


	<!-- Idea by:  Nic Wolfe -->
	<!-- This script and many more are available free online at -->
	<!-- The JavaScript Source!! http://javascript.internet.com -->
	var day = new Date();
	var id = day.getTime();

	eval("page" + id + " = window.open('" + pageName + "', '" + id + "', '" + (windowProperties != null ? windowProperties + "," : "") + "width=" + width + ",height=" + height + ",left = " + leftPos + ",top = " + topPos + "');");
}

//mimic php empty function
function empty(obj)
{
	//check if the object is null, undefined, empty string, empty array or 0
	if(null==obj || "undefined"==obj || ""==obj || (obj.constructor.toString().indexOf("Array")!=-1 && 0==obj.length) || 0==obj)
	{
		return true;
	}

	return false;
}

function promptRegister(link)
{
  location.href='/registerP.php?oriLink=' + link;
}

function zeroPad(num, count)
{
	var numZeropad = num + '';
	while(numZeropad.length < count) {
		numZeropad = "0" + numZeropad;
	}
	return numZeropad;
}

String.prototype.trim = function() 
{
 return this.replace(/^\s+|\s+$/g, "");
}


// disables a graphical button created by makeButton
function disableButton(btnID) {
	var btn = $(btnID);
	
	if (btn) {
		btn.setAttribute('dis_disabled', 1);
		btn.addClassName('disabled');
		
		btn.setAttribute('dis_href', btn.getAttribute('href'));
		btn.setAttribute('dis_onclick', btn.getAttribute('onclick'));
		
		// had to change this
		//btn.removeAttribute('href');
		//btn.removeAttribute('onclick');
		// to the following hack, because removing the attributes wouldn't work on IE7
		btn.setAttribute('href', 'javascript:void(return false)');
		btn.setAttribute('onclick', 'return false');
	}	
}

// enables a graphical button created by makeButton (which was previously disabled with disableButton)
function enableButton(btnID) {
	var btn = $(btnID);
	
	if (btn && btn.getAttribute('dis_disabled') == 1) {
		btn.setAttribute('dis_disabled', 0);
		btn.removeClassName('disabled');
		
		btn.setAttribute('href', btn.getAttribute('dis_href'));
		btn.setAttribute('onclick', btn.getAttribute('dis_onclick'));
		btn.removeAttribute('dis_href');
		btn.removeAttribute('dis_onclick');
	}	
}
function submitForm(frmID) {
	var valid = true;
	var frm = $(frmID);
	if (frm) {
		if (frm.onsubmit != null) {
			valid = frm.onsubmit();
		}
		
		if (valid) {
			frm.submit();
		}
	}
}

  function checkUsernameAvailability(username, userID)
  {
    checkIfExists = checkAjax("checkPortalUserScreenName", username.toLowerCase(), userID);
    
    if(checkIfExists == 1)
    {
      $('usernameInfo').innerHTML = username + " is not available";
      $('usernameInfo').style.color = "#FF0000";
      $('usernameInfo').style.display = "";
    }
    else
    {
      $('usernameInfo').innerHTML = username + " is available";
      $('usernameInfo').style.color = "#008000";
      $('usernameInfo').style.display = "";
    }
  }
  
  function checkAjax(type, param1, param2)
  {
    if(type=="checkPortalUserScreenName")
      var params = 'action=checkCorporatePortal_UserScreenName&param1=' + param1 + '&param2=' + param2;
      
    new Ajax.Request("/members/ajax/checks.php", {
      method: 'post',
      parameters: params, asynchronous:false, 
      onComplete: function(transport) {
        response=parseInt(transport.responseText);
        }
    });
    
    return response;    
  } 
/* end /home/websites/stickk.com/web/js/misc.js size 30358 */
/* begin /home/websites/stickk.com/web/js/overlay.js size 5827 */
var extOverlay = null;

function displayAlert(msg, maxWidth, callback)
{
  //alert(maxWidth);    
  msg = msg.replace(/<p>/g,"");
  msg = msg.replace(/<\/p>/g,"<br \/>");
  if ( MOBILE ) {
    var vrbl = {
      title:  'StickK REPORTER',
      message: 'This is the message',
      owidth : 250 ,
      oheight: 250 ,
      listnerid: 'mButtonField' ,
      contentid: 'lipsum'
   }

    mbOverlay( vrbl, msg )
    //return true
  }
  else 
  {    
    hideOverlay();

    if(MOBILE)
      maxWidth = 300;
    
    if(Ext)
    {  
      if(callback == "promptMissingDetails" || callback == "promptForSurvey")
      {    
        Ext.MessageBox.alert("stickK.com", msg, function()
        {
          location.reload(true);
        });
      }
      else
      {
        if(maxWidth > 0)
          Ext.MessageBox.maxWidth = maxWidth;

        Ext.MessageBox.alert("stickK.com", msg);
      }
    }
    else
    {  
      if(maxWidth > 0)
        displayOverlay(msg, 1, maxWidth);
      else
        displayOverlay(msg, 1);
    }
  }
}

function incOpacity(objName,j)
{
  if (j<100)
  {

    if (navigator.appName!="Netscape")
    {
      $(objName).style.filter="alpha(opacity="+j+")";
    }
    else
    {
      $(objName).style.opacity=j/100;
    }

    j=j+100;

    if (navigator.appName!="Netscape")
    {
      window.setTimeout('incOpacity("'+objName+'",'+j+');',5);
    }
    else
    {
      window.setTimeout('incOpacity("'+objName+'",'+j+');',1);
    }
  }
  else
  {
    if (navigator.appName!="Netscape")
    {
      $(objName).style.filter="";
    }
    else
    {
      $(objName).style.opacity=1;
    }
  }
}

function displayLoading()
{
  var wh = $('theBody').scrollHeight;
  var ww = $('theBody').scrollWidth;

  $('overlay_general').style.height = wh;
  $('overlay_general').style.width = ww;
  $('overlay_general').style.display="";  
  $('overlay_general_bg').style.height = wh;
  $('overlay_general_bg').style.width = ww;
  $('overlay_general_bg').style.display="";  

}

function bodyScrolled()
{
  var scrollTop = 0;
  var wh = 0;
  try {
    scrollTop = document.documentElement.scrollTop;
  }
  catch (ex)
  {
    scrollTop = $('theBody').clientHeight;
  }  
  var toppos = scrollTop + 150;
  $('overlay01').style.top = toppos + 'px';
}

function displayOverlay(content,cclose,myWidth,options)
{
  //alert(content);
  if(!myWidth)
    myWidth = 400;
    
  if (options)
    if(options['width'] > 0)
      myWidth = options['width'];
      
  if(MOBILE)
    myWidth = 300;
    
  if (Ext && Ext.Window)
  {
    try {
      if (extOverlay)
      {
        extOverlay.mask.remove();
        extOverlay.close();
        delete extOverlay;
      }
      var defaultOptions = {
            autoCreate : true, title:"",
            resizable: false, constrain: true, constrainHeader: true,
            minimizable : false, maximizable : false, stateful: false,
            modal: true, shim:true, buttonAlign: "center",
            width:myWidth, height:100, minHeight: 80, plain:true, footer:true, closable:false
        };
      
      if (options) {
      	options = Object.extend(options, defaultOptions);
			}
			else {
				options = defaultOptions;
			}
      extOverlay = new Ext.Window(options);
        extOverlay.render(document.body);
        extOverlay.getEl().addClass('x-window-dlg');
        var bodyEl = extOverlay.body.createChild({
            html:'<div class="ext-mb-content"><span class="ext-mb-text">' + content + '</span></div>'
        });
        extOverlay.setSize(myWidth, 'auto').center();
        if(!extOverlay.isVisible())
        {
            extOverlay.show();
        }
        return;
    } catch (ex) {
      delete extOverlay;
      // something went wrong... use the normal dialog
    }
  }
  
  seeKDivs(true);

  var scrollTop = 0;
  var wh = 0;
  try
  {
    scrollTop = document.documentElement.scrollTop;
    Event.observe(window, 'scroll', bodyScrolled);
  }
  catch (ex)
  {
    scrollTop = $('theBody').clientHeight;
    Event.observe($('theBody'), 'scroll', bodyScrolled);
  }
  var wh = scrollTop + $('theBody').clientHeight;
  var ww = $('theBody').scrollWidth;
  wh = wh - 500;
  ww = ww - 300;
  //var toppos = Math.round(wh/3);
  //toppos = toppos*2; //lower 2/3rd
  var toppos = scrollTop + 150;
  var leftpos = Math.round(ww/2);


  $('overlay01_close').style.display="none";
  $('overlay01').style.top = toppos + 'px';
  $('overlay01').style.left = leftpos + 'px';
  $('overlay01_content').innerHTML = content;
  incOpacity('overlay01',1);
  $('overlay01').style.display="";  
  if (cclose==1)
  {
    $('overlay01_close').style.display="";  
  }

  var wh = $('theBody').scrollHeight;
  var ww = $('theBody').scrollWidth;
  //alert(wh + "-" + ww)
  $('overlay_general_bg').style.height = wh + 'px';
  $('overlay_general_bg').style.width = ww + 'px';
  $('overlay_general_bg').style.display="";  
}

function hideOverlay()
{
  if (Ext)
  {
    if (extOverlay)
    {
        extOverlay.mask.remove();
        extOverlay.close();
        delete extOverlay;
    }
    return;
  }
  
  try
  {
    Event.stopObserving(window, 'scroll', bodyScrolled);
  }
  catch (ex)
  {
    Event.stopObserving($('theBody'), 'scroll', bodyScrolled);
  }
  seeKDivs(false);
  $('overlay01').style.display="none";
  $('overlay_general_bg').style.display="none";  
  //unhideSelect();
}

function seeKDivs(hide)
{

  for (j=0;j<document.forms.length;j++)
  {
    for (y=0;y<document.forms[j].elements.length;y++)
    {
      if ((document.forms[j].elements[y].type=="select-one")||(document.forms[j].elements[y].type=="select-multiple"))
      {
        if (hide)
        {
          document.forms[j].elements[y].style.visibility="hidden";
        }
        else
        {
          document.forms[j].elements[y].style.visibility="visible";
        }
      }
    }
  }
}


/* end /home/websites/stickk.com/web/js/overlay.js size 5827 */
/* begin /home/websites/stickk.com/web/js/pie.js size 6340 */
/* This notice must remain at all times.

pie.js
Copyright (c) Balamurugan S, 2005. sbalamurugan @ hotmail.com
Development support by Jexp, Inc http://www.jexp.com 

This package is free software. It is distributed under GPL - legalese removed, 
it means that you can use this for any purpose, but cannot charge for this software. 
Any enhancements you make to this piece of code, should be made available free to 
the general public!

Latest version can be downloaded from http://www.sbmkpm.com

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 

pie.js provides a simple mechanism to draw pie charts. It  uses 
wz_jsgraphics.js  which is copyright of its author.

Usage:
var p = new pie();
p.add("title1",value1);
p.add("title2",value2);

p.render("canvas_name", "graph_title", imageSize);

  canvas_name is a div defined INSIDE body tag
  graph_title is the text that is displayed over the graph itself
  imageSize is the desired size of the pie chart (in pixels)
  
<body>
<div id="canvas_name" style="overflow: auto; position:relative;height:400px;width:400px;"></div>
*/

hD="0123456789ABCDEF";
function d2h(d) 
{
	var h = hD.substr(d&15,1);
	while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;}
	return h;
}

function h2d(h) 
{
	return parseInt(h,16);
}

function pie()
{
	this.ct = 0;

	this.data      	= new Array();
	this.x_name    	= new Array();
	this.div_id		= new Array();
	this.max       	= 0;

	this.c_array = new Array();

	this.c_array[0] = new Array(255, 192, 95);
	this.c_array[1] = new Array(80, 127, 175);
	this.c_array[2] = new Array(159, 87, 112);
	this.c_array[3] = new Array(111, 120, 96);
	this.c_array[4] = new Array(224, 119, 96);
	this.c_array[5] = new Array(80, 159, 144);
	this.c_array[6] = new Array(207, 88, 95);
	this.c_array[7] = new Array(64, 135, 96);
	this.c_array[8] = new Array(239, 160, 95);
	this.c_array[9] = new Array(144, 151, 80);
	this.c_array[10] = new Array(255, 136, 80);
 /*  
 	this.c_array[0] = new Array(255, 0, 0);
	this.c_array[1] = new Array(255, 0, 0);
	this.c_array[2] = new Array(0, 255, 0);
	this.c_array[3] = new Array(0, 0, 255);
	this.c_array[4] = new Array(235, 235, 30);
	this.c_array[5] = new Array(255, 0, 255);
	this.c_array[6] = new Array(0, 255, 255);
	this.c_array[7] = new Array(255, 122, 0);
	this.c_array[8] = new Array(122, 0, 255);
	this.c_array[9] = new Array(0, 122, 255);
	this.c_array[10] = new Array(255, 122, 122);
	this.c_array[11] = new Array(122, 255, 122);
	this.c_array[12] = new Array(122, 122, 255);
 */ 
		
	this.getColor = function()
	{
   if(this.ct >= (this.c_array.length-1))
      this.ct = 0;
   else
      this.ct++;
      
   var red = "";
   var green = "";
   var blue = "";
   
   if(this.c_array[this.ct][0] < 16)
   {
	 		red += "0";
   }
   
   red += d2h(this.c_array[this.ct][0]);
   
   if(this.c_array[this.ct][1] < 16)
   {
	 		green += "0";
   }
   
   green += d2h(this.c_array[this.ct][1]);
   
   if(this.c_array[this.ct][2] < 16)
   {
	 		blue += "0";
   }
   
   blue += d2h(this.c_array[this.ct][2]);   
      
   return "#" + red + green + blue;
	}


	this.add = function(x_name, value, divId)
	{
		if(value != 0)
		{
			this.x_name.push(x_name);  
			this.data.push(parseInt(value,10));
			divId?this.div_id.push(divId):null;
			this.max += parseInt(value,10);
		}
		
		else
		{
			this.x_name.push(x_name);  
			this.data.push(parseInt(0,10));
			divId?this.div_id.push(divId):null;
		}
	}

	this.render = function(canvas, title, size, legend)
	{
		var jg,cnv,r,sW,cH,sx,xy,st_angle,hyp,lblFnt,graphFnt,legendGraphic;
		jg = new jsGraphics(canvas);
		
		if(legend != null)
		{
			legendGraphic = new jsGraphics(legend);
		}
		
		cnv = document.getElementById(canvas);	//location of Graph
		cW = (cnv.style.width).substring(0,(cnv.style.width).lastIndexOf('px'));	//width of chart canvas
		cH = (cnv.style.height).substring(0,(cnv.style.height).lastIndexOf('px'));	//height of chart canvas
		size?size=size:size=cW*.5; //if no size is provided, default to 50% of the canvas width.
		r = size/2;
		sx = cW/2 - r;	//start X
		sy = cH/2 - r;	//start Y
		st_angle = 0;	//starting position for piechart graph
		hyp = r*1.1;	//the length of the ray used to position the text (125% of the radius)
		lblFnt = 10;
		graphFnt = 14;
		
		// pie shadow
		jg.setColor("gray");
		jg.fillEllipse(sx+3,sy+3,2*r,2*r);
		   
		for(i = 0; i<this.data.length; i++)
		{
			currentColor = this.getColor(); 

			if(legend != null)
			{ 
				legendGraphic.setColor(currentColor);                
				legendGraphic.fillRect(10, 10+(i*10)+(i*15), 30, 15, "1");
				
				legendGraphic.setColor("#000000");
				legendGraphic.setFont("verdana, arial, sans-serif","12px",Font.PLAIN);
				 
				legendGraphic.drawStringRect2(this.x_name[i], 50, 10+(i*10)+(i*15), 300, 'left');      
			}
			
			if(this.data[i] != 0)
			{
				var angle = this.data[i]/this.max*360;
				var pc    = this.data[i]/this.max*100;
				pc = pc.toFixed(2);
				
				jg.setColor(currentColor);
				
				jg.fillArc(sx,sy,2*r,2*r,st_angle,st_angle+angle);
				var ang_rads = (st_angle+(angle/2)) * (Math.PI/180);
				var my  = Math.sin(ang_rads) * hyp;
				var mx  = Math.cos(ang_rads) * hyp;
				st_angle += angle;
				
				if(legend != null)
				{
					//my = my/2.2;
					//mx = mx/2.5;
					//mxa = (mx < 0 ? 30 : 15);
					mxa = (mx < 0 ? 50 : 0);
				}
				
				else
				{
					mxa = (mx < 0 ? 50 : 0);
				}
				
				jg.setColor("black");
				jg.setFont("verdana, arial, sans-serif",lblFnt+"px",Font.PLAIN);
				
				var tempLabel = "";
				
				if(legend != null)
				{
					tempLabel = pc+"%";
				} 
				
				else
				{
					tempLabel = this.x_name[i]+"("+pc+"%"+")";
				}
				
				jg.drawString(tempLabel,cW/2+mx-mxa,cH/2-my, this.div_id[i]);
			}
		}
		jg.setFont("verdana, arial, sans-serif", graphFnt+"px",Font.BOLD);
		jg.drawStringRect(title, 0, 0, cW, 'center');
		jg.setColor("black");
		jg.drawEllipse(sx, sy, 2*r, 2*r);
		jg.paint();
		
		if(legend != null)
		{
			legendGraphic.paint();
		}		
	}
}

/* end /home/websites/stickk.com/web/js/pie.js size 6340 */
/* begin /home/websites/stickk.com/web/js/spinningwheel-min.js size 12503 */
   

var SpinningWheel = {
    cellHeight:44,
    friction:0.003,
    slotData:[],
    handleEvent:function(e){

      if(e.type=="touchstart"){
        this.lockScreen(e);
        if(e.currentTarget.id=="sw-cancel"||e.currentTarget.id=="sw-done"){
          this.tapDown(e)
        }
        else{
          if(e.currentTarget.id=="sw-frame"){
            this.scrollStart(e)
          }
        }
      }
      else{
        if(e.type=="touchmove"){
          
          this.lockScreen(e);
          if(e.currentTarget.id=="sw-cancel"||e.currentTarget.id=="sw-done"){
            this.tapCancel(e)
          }
          else{
            if(e.currentTarget.id=="sw-frame"){
              this.scrollMove(e)
            }
          }
        }
        else{
          if(e.type=="touchend"){
            if(e.currentTarget.id=="sw-cancel"||e.currentTarget.id=="sw-done"){
              this.tapUp(e)
            }
            else{
              if(e.currentTarget.id=="sw-frame"){this.scrollEnd(e)}
            }
          }
          else{
            if(e.type=="webkitTransitionEnd"){
              if(e.target.id=="sw-wrapper"){
                this.destroy()
              }
              else{
                this.backWithinBoundaries(e)
              }
            }
            else{
              if(e.type=="orientationchange"){
                this.onOrientationChange(e)
              }
              else{
                if(e.type=="scroll"){
                  this.onScroll(e)
                }
              }
            }
          }
        }
      }
    },
    onOrientationChange:function(e){
      window.scrollTo(0,0);
      this.swWrapper.style.top=window.innerHeight+window.pageYOffset+"px";
      this.calculateSlotsWidth()
    },
    onScroll:function(e){
      this.swWrapper.style.top=window.innerHeight+window.pageYOffset+"px"
    },
    lockScreen:function(e){
      e.preventDefault();
      e.stopPropagation()
    },
    reset:function(){
      this.slotEl=[];
      this.activeSlot=null;
      this.swWrapper=undefined;
      this.swSlotWrapper=undefined;
      this.swSlots=undefined;
      this.swFrame=undefined
    },
    calculateSlotsWidth:function(){
      var div=this.swSlots.getElementsByTagName("div");
      for(var i=0;i<div.length;i+=1){
        this.slotEl[i].slotWidth=div[i].offsetWidth
      }
    },
    create:function(){
      var i,l,out,ul,div;
      this.reset();
      div=document.createElement("div");div.id="sw-wrapper";
      div.style.top=window.innerHeight+window.pageYOffset+"px"; 
      div.style.webkitTransitionProperty="-webkit-transform";
      div.innerHTML='<div id="sw-header"><div id="sw-cancel">Cancel</div><div id="sw-done">Done</div></div><div id="sw-slots-wrapper"><div id="sw-slots"></div></div><div id="sw-frame"></div>';
      document.body.appendChild(div);
      this.swWrapper=div;
      this.swSlotWrapper=document.getElementById("sw-slots-wrapper");
      this.swSlots=document.getElementById("sw-slots");
      this.swFrame=document.getElementById("sw-frame");
      for(l=0;l<this.slotData.length;l+=1){
        ul=document.createElement("ul");
        out="";
        for(i in this.slotData[l].values){
          out+="<li>"+this.slotData[l].values[i]+"</li>"}ul.innerHTML=out;
          div=document.createElement("div");
          div.className=this.slotData[l].style;
          div.appendChild(ul);
          this.swSlots.appendChild(div);
          ul.slotPosition=l;
          ul.slotYPosition=0;
          ul.slotWidth=0;
          ul.slotMaxScroll=this.swSlotWrapper.clientHeight-ul.clientHeight-86;
          ul.style.webkitTransitionTimingFunction="cubic-bezier(0, 0, 0.2, 1)";
          this.slotEl.push(ul);
          if(this.slotData[l].defaultValue){
            this.scrollToValue(l,this.slotData[l].defaultValue)
          }
      }
      this.calculateSlotsWidth();
      document.addEventListener("touchstart",this,false);
      document.addEventListener("touchmove",this,false);
      window.addEventListener("orientationchange",this,true);
      window.addEventListener("scroll",this,true);
      document.getElementById("sw-cancel").addEventListener("touchstart",this,false);
      document.getElementById("sw-done").addEventListener("touchstart",this,false);
      this.swFrame.addEventListener("touchstart",this,false)
    },
    open:function(){
        this.create();
        this.swWrapper.style.webkitTransitionTimingFunction="ease-out";
        this.swWrapper.style.webkitTransitionDuration="400ms";
        this.swWrapper.style.webkitTransform="translate3d(0, -260px, 0)"
      },
      destroy:function(){
        this.swWrapper.removeEventListener("webkitTransitionEnd",this,false);
        this.swFrame.removeEventListener("touchstart",this,false);
        document.getElementById("sw-cancel").removeEventListener("touchstart",this,false);
        document.getElementById("sw-done").removeEventListener("touchstart",this,false);
        document.removeEventListener("touchstart",this,false);
        document.removeEventListener("touchmove",this,false);
        window.removeEventListener("orientationchange",this,true);
        window.removeEventListener("scroll",this,true);
        this.slotData=[];
        this.cancelAction=function(){
          return false
        };
        this.cancelDone=function(){return true};
        this.reset();
        document.body.removeChild(document.getElementById("sw-wrapper"))
      },
      close:function(){
        this.swWrapper.style.webkitTransitionTimingFunction="ease-in";
        this.swWrapper.style.webkitTransitionDuration="400ms";
        this.swWrapper.style.webkitTransform="translate3d(0, 0, 0)";
        this.swWrapper.addEventListener("webkitTransitionEnd",this,false)
      },
      addSlot:function(values,style,defaultValue){
        if(!style){style=""}style=style.split(" ");
        for(var i=0;i<style.length;i+=1){style[i]="sw-"+style[i]}style=style.join(" ");
        var obj={
          values:values,
          style:style,
          defaultValue:defaultValue
        };
        this.slotData.push(obj)
      },
      getSelectedValues:function(){
        var index,count,i,l,keys=[],values=[];
      for(i in this.slotEl){this.slotEl[i].removeEventListener("webkitTransitionEnd",this,false);
      this.slotEl[i].style.webkitTransitionDuration="0";
      if(this.slotEl[i].slotYPosition>0){this.setPosition(i,0)}else{if(this.slotEl[i].slotYPosition<this.slotEl[i].slotMaxScroll){this.setPosition(i,this.slotEl[i].slotMaxScroll)}}index=-Math.round(this.slotEl[i].slotYPosition/this.cellHeight);
      count=0;
      for(l in this.slotData[i].values){if(count==index){keys.push(l);
      values.push(this.slotData[i].values[l]);
      break}count+=1}}return{keys:keys,values:values}
      },
      setPosition:function(slot,pos){
        this.slotEl[slot].slotYPosition=pos;
        this.slotEl[slot].style.webkitTransform="translate3d(0, "+pos+"px, 0)"
      },
      scrollStart:function(e){
        var xPos=e.targetTouches[0].clientX-this.swSlots.offsetLeft;
        var slot=0;
        for(var i=0;i<this.slotEl.length;i+=1){slot+=this.slotEl[i].slotWidth;
        if(xPos<slot){this.activeSlot=i;
        break}}if(this.slotData[this.activeSlot].style.match("readonly")){this.swFrame.removeEventListener("touchmove",this,false);
        this.swFrame.removeEventListener("touchend",this,false);
        return false}this.slotEl[this.activeSlot].removeEventListener("webkitTransitionEnd",this,false);
        this.slotEl[this.activeSlot].style.webkitTransitionDuration="0";
        var theTransform=window.getComputedStyle(this.slotEl[this.activeSlot]).webkitTransform;
        theTransform=new WebKitCSSMatrix(theTransform).m42;
        if(theTransform!=this.slotEl[this.activeSlot].slotYPosition){this.setPosition(this.activeSlot,theTransform)}this.startY=e.targetTouches[0].clientY;
        this.scrollStartY=this.slotEl[this.activeSlot].slotYPosition;
        this.scrollStartTime=e.timeStamp;
        this.swFrame.addEventListener("touchmove",this,false);
        this.swFrame.addEventListener("touchend",this,false);
        return true
      },
      scrollMove:function(e){
        var topDelta=e.targetTouches[0].clientY-this.startY;
        if(this.slotEl[this.activeSlot].slotYPosition>0||this.slotEl[this.activeSlot].slotYPosition<this.slotEl[this.activeSlot].slotMaxScroll){topDelta/=2}this.setPosition(this.activeSlot,this.slotEl[this.activeSlot].slotYPosition+topDelta);
        this.startY=e.targetTouches[0].clientY;
        if(e.timeStamp-this.scrollStartTime>80){this.scrollStartY=this.slotEl[this.activeSlot].slotYPosition;
        this.scrollStartTime=e.timeStamp}
      },
      scrollEnd:function(e){
        this.swFrame.removeEventListener("touchmove",this,false);
        this.swFrame.removeEventListener("touchend",this,false);
        if(this.slotEl[this.activeSlot].slotYPosition>0||this.slotEl[this.activeSlot].slotYPosition<this.slotEl[this.activeSlot].slotMaxScroll){this.scrollTo(this.activeSlot,this.slotEl[this.activeSlot].slotYPosition>0?0:this.slotEl[this.activeSlot].slotMaxScroll);
        return false}var scrollDistance=this.slotEl[this.activeSlot].slotYPosition-this.scrollStartY;
        if(scrollDistance<this.cellHeight/1.5&&scrollDistance>-this.cellHeight/1.5){if(this.slotEl[this.activeSlot].slotYPosition%this.cellHeight){this.scrollTo(this.activeSlot,Math.round(this.slotEl[this.activeSlot].slotYPosition/this.cellHeight)*this.cellHeight,"100ms")}
        return false}var scrollDuration=e.timeStamp-this.scrollStartTime;
        var newDuration=(2*scrollDistance/scrollDuration)/this.friction;
        var newScrollDistance=(this.friction/2)*(newDuration*newDuration);
        if(newDuration<0){newDuration=-newDuration;
        newScrollDistance=-newScrollDistance}var newPosition=this.slotEl[this.activeSlot].slotYPosition+newScrollDistance;
        if(newPosition>0){newPosition/=2;
        newDuration/=3;
        if(newPosition>this.swSlotWrapper.clientHeight/4){newPosition=this.swSlotWrapper.clientHeight/4}}else{if(newPosition<this.slotEl[this.activeSlot].slotMaxScroll){newPosition=(newPosition-this.slotEl[this.activeSlot].slotMaxScroll)/2+this.slotEl[this.activeSlot].slotMaxScroll;
        newDuration/=3;
        if(newPosition<this.slotEl[this.activeSlot].slotMaxScroll-this.swSlotWrapper.clientHeight/4){newPosition=this.slotEl[this.activeSlot].slotMaxScroll-this.swSlotWrapper.clientHeight/4}}else{newPosition=Math.round(newPosition/this.cellHeight)*this.cellHeight}}this.scrollTo(this.activeSlot,Math.round(newPosition),Math.round(newDuration)+"ms");
        return true
      },
      scrollTo:function(slotNum,dest,runtime){
        this.slotEl[slotNum].style.webkitTransitionDuration=runtime?runtime:"100ms";
      this.setPosition(slotNum,dest?dest:0);
      if(this.slotEl[slotNum].slotYPosition>0||this.slotEl[slotNum].slotYPosition<this.slotEl[slotNum].slotMaxScroll){this.slotEl[slotNum].addEventListener("webkitTransitionEnd",this,false)}
      },
      scrollToValue:function(slot,value){
        var yPos,count,i;
      this.slotEl[slot].removeEventListener("webkitTransitionEnd",this,false);
      this.slotEl[slot].style.webkitTransitionDuration="0";
      count=0;
      for(i in this.slotData[slot].values){if(i==value){yPos=count*this.cellHeight;
      this.setPosition(slot,yPos);
      break}count-=1}
      },
      backWithinBoundaries:function(e){
        e.target.removeEventListener("webkitTransitionEnd",this,false);
      this.scrollTo(e.target.slotPosition,e.target.slotYPosition>0?0:e.target.slotMaxScroll,"150ms");
      return false
      },
      tapDown:function(e){
        e.currentTarget.addEventListener("touchmove",this,false);
        e.currentTarget.addEventListener("touchend",this,false);
        e.currentTarget.className="sw-pressed"
      },
      tapCancel:function(e){
        e.currentTarget.removeEventListener("touchmove",this,false);
      e.currentTarget.removeEventListener("touchend",this,false);
      e.currentTarget.className=""
      },
      tapUp:function(e){
        this.tapCancel(e);
      if(e.currentTarget.id=="sw-cancel"){this.cancelAction()}else{this.doneAction()}this.close()
      },
      setCancelAction:function(action){
        this.cancelAction=action
      },
      setDoneAction:function(action){
        this.doneAction=action
      },
      cancelAction:function(){
        return false
      },
      cancelDone:function(){
        return true
      }
    };
/* end /home/websites/stickk.com/web/js/spinningwheel-min.js size 12503 */
/* begin /home/websites/stickk.com/web/js/spinningwheel.js size 15326 */
/**
 * 
 * Find more about the Spinning Wheel function at
 * http://cubiq.org/spinning-wheel-on-webkit-for-iphone-ipod-touch/11
 *
 * Copyright (c) 2009 Matteo Spinelli, http://cubiq.org/
 * Released under MIT license
 * http://cubiq.org/dropbox/mit-license.txt
 * 
 * Version 1.4 - Last updated: 2009.07.09
 * 
 */

var SpinningWheel = {
	cellHeight: 44,
	friction: 0.003,
	slotData: [],


	/**
	 *
	 * Event handler
	 *
	 */

	handleEvent: function (e) {
		if (e.type == 'touchstart') {
			this.lockScreen(e);
			if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
				this.tapDown(e);
			} else if (e.currentTarget.id == 'sw-frame') {
				this.scrollStart(e);
			}
		} else if (e.type == 'touchmove') {
			this.lockScreen(e);
			
			if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
				this.tapCancel(e);
			} else if (e.currentTarget.id == 'sw-frame') {
				this.scrollMove(e);
			}
		} else if (e.type == 'touchend') {
			if (e.currentTarget.id == 'sw-cancel' || e.currentTarget.id == 'sw-done') {
				this.tapUp(e);
			} else if (e.currentTarget.id == 'sw-frame') {
				this.scrollEnd(e);
			}
		} else if (e.type == 'webkitTransitionEnd') {
			if (e.target.id == 'sw-wrapper') {
				this.destroy();
			} else {
				this.backWithinBoundaries(e);
			}
		} else if (e.type == 'orientationchange') {
			this.onOrientationChange(e);
		} else if (e.type == 'scroll') {
			this.onScroll(e);
		}
	},


	/**
	 *
	 * Global events
	 *
	 */

	onOrientationChange: function (e) {
		window.scrollTo(0, 0);
		this.swWrapper.style.top = window.innerHeight + window.pageYOffset + 'px';
		this.calculateSlotsWidth();
	},
	
	onScroll: function (e) {
		this.swWrapper.style.top = window.innerHeight + window.pageYOffset + 'px';
	},

	lockScreen: function (e) {
		e.preventDefault();
		e.stopPropagation();
	},


	/**
	 *
	 * Initialization
	 *
	 */

	reset: function () {
		this.slotEl = [];

		this.activeSlot = null;
		
		this.swWrapper = undefined;
		this.swSlotWrapper = undefined;
		this.swSlots = undefined;
		this.swFrame = undefined;
	},

	calculateSlotsWidth: function () {
		var div = this.swSlots.getElementsByTagName('div');
		for (var i = 0; i < div.length; i += 1) {
			this.slotEl[i].slotWidth = div[i].offsetWidth;
		}
	},

	create: function () {
		var i, l, out, ul, div;

		this.reset();	// Initialize object variables

		// Create the Spinning Wheel main wrapper
		div = document.createElement('div');
		div.id = 'sw-wrapper';
		div.style.top = window.innerHeight + window.pageYOffset + 'px';		// Place the SW down the actual viewing screen
		div.style.webkitTransitionProperty = '-webkit-transform';
		div.innerHTML = '<div id="sw-header"><div id="sw-cancel">Cancel</' + 'div><div id="sw-done">Done</' + 'div></' + 'div><div id="sw-slots-wrapper"><div id="sw-slots"></' + 'div></' + 'div><div id="sw-frame"></' + 'div>';

		document.body.appendChild(div);

		this.swWrapper = div;													// The SW wrapper
		this.swSlotWrapper = document.getElementById('sw-slots-wrapper');		// Slots visible area
		this.swSlots = document.getElementById('sw-slots');						// Pseudo table element (inner wrapper)
		this.swFrame = document.getElementById('sw-frame');						// The scrolling controller

		// Create HTML slot elements
		for (l = 0; l < this.slotData.length; l += 1) {
			// Create the slot
			ul = document.createElement('ul');
			out = '';
			for (i in this.slotData[l].values) {
				out += '<li>' + this.slotData[l].values[i] + '<' + '/li>';
			}
			ul.innerHTML = out;

			div = document.createElement('div');		// Create slot container
			div.className = this.slotData[l].style;		// Add styles to the container
			div.appendChild(ul);
	
			// Append the slot to the wrapper
			this.swSlots.appendChild(div);
			
			ul.slotPosition = l;			// Save the slot position inside the wrapper
			ul.slotYPosition = 0;
			ul.slotWidth = 0;
			ul.slotMaxScroll = this.swSlotWrapper.clientHeight - ul.clientHeight - 86;
			ul.style.webkitTransitionTimingFunction = 'cubic-bezier(0, 0, 0.2, 1)';		// Add default transition
			
			this.slotEl.push(ul);			// Save the slot for later use
			
			// Place the slot to its default position (if other than 0)
			if (this.slotData[l].defaultValue) {
				this.scrollToValue(l, this.slotData[l].defaultValue);	
			}
		}
		
		this.calculateSlotsWidth();
		
		// Global events
		document.addEventListener('touchstart', this, false);			// Prevent page scrolling
		document.addEventListener('touchmove', this, false);			// Prevent page scrolling
		window.addEventListener('orientationchange', this, true);		// Optimize SW on orientation change
		window.addEventListener('scroll', this, true);				// Reposition SW on page scroll

		// Cancel/Done buttons events
		document.getElementById('sw-cancel').addEventListener('touchstart', this, false);
		document.getElementById('sw-done').addEventListener('touchstart', this, false);

		// Add scrolling to the slots
		this.swFrame.addEventListener('touchstart', this, false);
	},

	open: function () {
		this.create();

		this.swWrapper.style.webkitTransitionTimingFunction = 'ease-out';
		this.swWrapper.style.webkitTransitionDuration = '400ms';
		this.swWrapper.style.webkitTransform = 'translate3d(0, -260px, 0)';
	},
	
	
	/**
	 *
	 * Unload
	 *
	 */

	destroy: function () {
		this.swWrapper.removeEventListener('webkitTransitionEnd', this, false);

		this.swFrame.removeEventListener('touchstart', this, false);

		document.getElementById('sw-cancel').removeEventListener('touchstart', this, false);
		document.getElementById('sw-done').removeEventListener('touchstart', this, false);

		document.removeEventListener('touchstart', this, false);
		document.removeEventListener('touchmove', this, false);
		window.removeEventListener('orientationchange', this, true);
		window.removeEventListener('scroll', this, true);
		
		this.slotData = [];
		this.cancelAction = function () {
			return false;
		};
		
		this.cancelDone = function () {
			return true;
		};
		
		this.reset();
		
		document.body.removeChild(document.getElementById('sw-wrapper'));
	},
	
	close: function () {
		this.swWrapper.style.webkitTransitionTimingFunction = 'ease-in';
		this.swWrapper.style.webkitTransitionDuration = '400ms';
		this.swWrapper.style.webkitTransform = 'translate3d(0, 0, 0)';
		
		this.swWrapper.addEventListener('webkitTransitionEnd', this, false);
	},


	/**
	 *
	 * Generic methods
	 *
	 */

	addSlot: function (values, style, defaultValue) {
		if (!style) {
			style = '';
		}
		
		style = style.split(' ');

		for (var i = 0; i < style.length; i += 1) {
			style[i] = 'sw-' + style[i];
		}
		
		style = style.join(' ');

		var obj = { 'values': values, 'style': style, 'defaultValue': defaultValue };
		this.slotData.push(obj);
	},

	getSelectedValues: function () {
		var index, count,
		    i, l,
			keys = [], values = [];
      str_date = '' ;
      var month=new Array(12) ;
      month['Gen'] = '01' ;
      month['Fev'] = '02' ;
      month['Mar'] = '03' ;
      month['Apr'] = '04' ;
      month['May'] = '05' ;
      month['Jun'] = '06' ;
      month['Jul'] = '07' ;
      month['Aug'] = '08' ;
      month['Sep'] = '09' ;
      month['Oct'] = '10' ;
      month['Nov'] = '11' ;
      month['Dec'] = '12' ;
      
      
		for (i in this.slotEl) {
      
      //alert(i);
      
			// Remove any residual animation
			this.slotEl[i].removeEventListener('webkitTransitionEnd', this, false);
			this.slotEl[i].style.webkitTransitionDuration = '0';

			if (this.slotEl[i].slotYPosition > 0) {
				this.setPosition(i, 0);
			} else if (this.slotEl[i].slotYPosition < this.slotEl[i].slotMaxScroll) {
				this.setPosition(i, this.slotEl[i].slotMaxScroll);
			}

			index = -Math.round(this.slotEl[i].slotYPosition / this.cellHeight);

			count = 0;
			for (l in this.slotData[i].values) {
				if (count == index) {
					keys.push(l);
					values.push(this.slotData[i].values[l]);
					break;
				}
				
				count += 1;
			}
      
      if ( i == 0 )  str_y = values[i] ; 
      if ( i == 1 )  str_m = values[i] ;
      if ( i == 2 )  str_d = values[i] ;
      
      
      
      //if ( str_date ) str_date = values[i] +'-'+str_date
      if(i == 2) // small hack to make sure it gets out after having set the 3 date fields // do not remove!!!
        break;
      
		}
    
    str_date = month[str_m] + '-' + str_d + '-' + str_y ;
    
    setSelectBoxValue(month[str_m], document.newContract01.cEndDate_m);
    setSelectBoxValue(str_d,        document.newContract01.cEndDate_d);
    setSelectBoxValue(str_y,        document.newContract01.cEndDate_y);
    
    document.newContract01.commitmentEndsOn_calendar.value = str_date ;
    //alert( str_date ) ;
		return { 'keys': keys, 'values': values };
	},


	/**
	 *
	 * Rolling slots
	 *
	 */

	setPosition: function (slot, pos) {
		this.slotEl[slot].slotYPosition = pos;
		this.slotEl[slot].style.webkitTransform = 'translate3d(0, ' + pos + 'px, 0)';
	},
	
	scrollStart: function (e) {
		// Find the clicked slot
		var xPos = e.targetTouches[0].clientX - this.swSlots.offsetLeft;	// Clicked position minus left offset (should be 11px)

		// Find tapped slot
		var slot = 0;
		for (var i = 0; i < this.slotEl.length; i += 1) {
			slot += this.slotEl[i].slotWidth;
			
			if (xPos < slot) {
				this.activeSlot = i;
				break;
			}
		}

		// If slot is readonly do nothing
		if (this.slotData[this.activeSlot].style.match('readonly')) {
			this.swFrame.removeEventListener('touchmove', this, false);
			this.swFrame.removeEventListener('touchend', this, false);
			return false;
		}

		this.slotEl[this.activeSlot].removeEventListener('webkitTransitionEnd', this, false);	// Remove transition event (if any)
		this.slotEl[this.activeSlot].style.webkitTransitionDuration = '0';		// Remove any residual transition
		
		// Stop and hold slot position
		var theTransform = window.getComputedStyle(this.slotEl[this.activeSlot]).webkitTransform;
		theTransform = new WebKitCSSMatrix(theTransform).m42;
		if (theTransform != this.slotEl[this.activeSlot].slotYPosition) {
			this.setPosition(this.activeSlot, theTransform);
		}
		
		this.startY = e.targetTouches[0].clientY;
		this.scrollStartY = this.slotEl[this.activeSlot].slotYPosition;
		this.scrollStartTime = e.timeStamp;

		this.swFrame.addEventListener('touchmove', this, false);
		this.swFrame.addEventListener('touchend', this, false);
		
		return true;
	},

	scrollMove: function (e) {
		var topDelta = e.targetTouches[0].clientY - this.startY;

		if (this.slotEl[this.activeSlot].slotYPosition > 0 || this.slotEl[this.activeSlot].slotYPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
			topDelta /= 2;
		}
		
		this.setPosition(this.activeSlot, this.slotEl[this.activeSlot].slotYPosition + topDelta);
		this.startY = e.targetTouches[0].clientY;

		// Prevent slingshot effect
		if (e.timeStamp - this.scrollStartTime > 80) {
			this.scrollStartY = this.slotEl[this.activeSlot].slotYPosition;
			this.scrollStartTime = e.timeStamp;
		}
	},
	
	scrollEnd: function (e) {
		this.swFrame.removeEventListener('touchmove', this, false);
		this.swFrame.removeEventListener('touchend', this, false);

		// If we are outside of the boundaries, let's go back to the sheepfold
		if (this.slotEl[this.activeSlot].slotYPosition > 0 || this.slotEl[this.activeSlot].slotYPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
			this.scrollTo(this.activeSlot, this.slotEl[this.activeSlot].slotYPosition > 0 ? 0 : this.slotEl[this.activeSlot].slotMaxScroll);
			return false;
		}

		// Lame formula to calculate a fake deceleration
		var scrollDistance = this.slotEl[this.activeSlot].slotYPosition - this.scrollStartY;

		// The drag session was too short
		if (scrollDistance < this.cellHeight / 1.5 && scrollDistance > -this.cellHeight / 1.5) {
			if (this.slotEl[this.activeSlot].slotYPosition % this.cellHeight) {
				this.scrollTo(this.activeSlot, Math.round(this.slotEl[this.activeSlot].slotYPosition / this.cellHeight) * this.cellHeight, '100ms');
			}

			return false;
		}

		var scrollDuration = e.timeStamp - this.scrollStartTime;

		var newDuration = (2 * scrollDistance / scrollDuration) / this.friction;
		var newScrollDistance = (this.friction / 2) * (newDuration * newDuration);
		
		if (newDuration < 0) {
			newDuration = -newDuration;
			newScrollDistance = -newScrollDistance;
		}

		var newPosition = this.slotEl[this.activeSlot].slotYPosition + newScrollDistance;

		if (newPosition > 0) {
			// Prevent the slot to be dragged outside the visible area (top margin)
			newPosition /= 2;
			newDuration /= 3;

			if (newPosition > this.swSlotWrapper.clientHeight / 4) {
				newPosition = this.swSlotWrapper.clientHeight / 4;
			}
		} else if (newPosition < this.slotEl[this.activeSlot].slotMaxScroll) {
			// Prevent the slot to be dragged outside the visible area (bottom margin)
			newPosition = (newPosition - this.slotEl[this.activeSlot].slotMaxScroll) / 2 + this.slotEl[this.activeSlot].slotMaxScroll;
			newDuration /= 3;
			
			if (newPosition < this.slotEl[this.activeSlot].slotMaxScroll - this.swSlotWrapper.clientHeight / 4) {
				newPosition = this.slotEl[this.activeSlot].slotMaxScroll - this.swSlotWrapper.clientHeight / 4;
			}
		} else {
			newPosition = Math.round(newPosition / this.cellHeight) * this.cellHeight;
		}

		this.scrollTo(this.activeSlot, Math.round(newPosition), Math.round(newDuration) + 'ms');
 
		return true;
	},

	scrollTo: function (slotNum, dest, runtime) {
		this.slotEl[slotNum].style.webkitTransitionDuration = runtime ? runtime : '100ms';
		this.setPosition(slotNum, dest ? dest : 0);

		// If we are outside of the boundaries go back to the sheepfold
		if (this.slotEl[slotNum].slotYPosition > 0 || this.slotEl[slotNum].slotYPosition < this.slotEl[slotNum].slotMaxScroll) {
			this.slotEl[slotNum].addEventListener('webkitTransitionEnd', this, false);
		}
	},
	
	scrollToValue: function (slot, value) {
		var yPos, count, i;

		this.slotEl[slot].removeEventListener('webkitTransitionEnd', this, false);
		this.slotEl[slot].style.webkitTransitionDuration = '0';
		
		count = 0;
		for (i in this.slotData[slot].values) {
			if (i == value) {
				yPos = count * this.cellHeight;
				this.setPosition(slot, yPos);
				break;
			}
			
			count -= 1;
		}
	},
	
	backWithinBoundaries: function (e) {
		e.target.removeEventListener('webkitTransitionEnd', this, false);

		this.scrollTo(e.target.slotPosition, e.target.slotYPosition > 0 ? 0 : e.target.slotMaxScroll, '150ms');
		return false;
	},


	/**
	 *
	 * Buttons
	 *
	 */

	tapDown: function (e) {
		e.currentTarget.addEventListener('touchmove', this, false);
		e.currentTarget.addEventListener('touchend', this, false);
		e.currentTarget.className = 'sw-pressed';
	},

	tapCancel: function (e) {
		e.currentTarget.removeEventListener('touchmove', this, false);
		e.currentTarget.removeEventListener('touchend', this, false);
		e.currentTarget.className = '';
	},
	
	tapUp: function (e) {
		this.tapCancel(e);

		if (e.currentTarget.id == 'sw-cancel') {
			this.cancelAction();
		} else {
			this.doneAction();
		}
		
		this.close();
	},

	setCancelAction: function (action) {
		this.cancelAction = action;
	},

	setDoneAction: function (action) {
		this.doneAction = action;
	},
	
	cancelAction: function () {
		return false;
	},

	cancelDone: function () {
		return true;
	}
};
/* end /home/websites/stickk.com/web/js/spinningwheel.js size 15326 */
/* begin /home/websites/stickk.com/web/js/stickk.js size 6904 */

/**
* Returns the value of the selected radio button in the radio group, null if
* none are selected, and false if the button group doesn't exist
*
* @param {radio Object} or {radio id} el
* OR
* @param {form Object} or {form id} el
* @param {radio group name} radioGroup
*/
/*function $RF(el, radioGroup) {
    if($(el).type && $(el).type.toLowerCase() == 'radio') {
        var radioGroup = $(el).name;
        var el = $(el).form;
    } else if ($(el).tagName.toLowerCase() != 'form') {
        return false;
    }

    var checked = $(el).getInputs('radio', radioGroup).find(
        function(re) {return re.checked;}
    );
    return (checked) ? $F(checked) : null;
}*/

function isValidCreditCardNum(newCCNO)
{
  var errs="";
  var sum = 0;
  var digit = 0;
  var addend = 0;
  var timesTwo = false;

  for (var i = newCCNO.length-1; i >= 0; i--)
  {
    digit =parseInt(newCCNO.substring (i, i + 1));
    
    if (timesTwo)
    {
      addend = digit * 2;
      if (addend > 9)
      {
        addend -= 9;
      }
    }
    else
    {
      addend = digit;
    }
    addend = parseInt(addend);
    sum += addend;
   
    timesTwo = !timesTwo;
  }
  
  var modulus = 0;
  
  if(sum !=0)
  {
    modulus = sum % 10;
    return modulus == 0;
  }
  else
  {
    return false;
  }
}

function addFriend(userid, username)
{
	confirmOverlay(get_constant("JS_STICKK_ADD_FRIEND_CONFIRM_MESSAGE_PART1") + " " + username + " " + get_constant("JS_STICKK_ADD_FRIEND_CONFIRM_MESSAGE_PART2"),
		"send('/members/elements/friends.inc.php','uid=" + userid + "&Action=friend&response=y','execute','');",
		"hideOverlay()");
}

function removeFriend(userid, username)
{
	confirmOverlay(get_constant("JS_STICKK_REMOVE_FRIEND_CONFIRM_MESSAGE_PART1") + " " + username + " " + get_constant("JS_STICKK_ADD_FRIEND_CONFIRM_MESSAGE_PART2"),
		"send('/members/elements/friends.inc.php','uid=" + userid + "&Action=friend&response=y','execute','');",
		"hideOverlay()");
}
  
function profilePassword(f){
	var errs='';

  if (f.Password.value.length < 6)
	{
    errs=errs+'<p><b>'+get_constant("JS_STICKK_NEW_PASSWORD_MUST_BE_AT_LEAST_6_CHARS")+'</b></p>';
  }
	else if (f.Password.value!=f.Password2.value)
	{
		errs=errs+'<p><b>'+get_constant("JS_STICKK_NEW_PASSWORD_NOT_CONFIRMED")+'</b></p>';
	}
	return errs;
}

/**
*	does an ajax request to shorten the given url using bit.ly
*/
function bitly_shorten(longURL) {
	return send('/members/ajax/bit.ly.php', 'action=shorten&url=' + escape(longURL), 'return').trim();
}



function showflash(fileName, w, h, container, objname)
{
	if (objname==undefined)
		objname = 'myFlash';
	var html = '	<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"   '+
	'codebase="https://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" '+
	'width="'+w+'" height="'+h+'" id="'+objname+'"  align="middle"> ' +
	'<param name="allowScriptAccess" value="sameDomain" />' +
	'<param name="movie" value="'+fileName+'" />' +
	'<param name="quality" value="high" />' +
	'<embed   src="' + fileName + '" quality="high"   width="'+w+'" height="'+h+'" ' +
	'name="'+objname+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" '+
	'pluginspage="https://www.macromedia.com/go/getflashplayer" />' +
	'</object>';
	if (container==undefined)
		document.body.innerHTML = html;
	else
		document.getElementById(container).innerHTML = html;
}
var FlashDetect = new function(){
	var self = this;
	self.installed = false;
	self.major = -1;
	self.minor = -1;
	self.revision = -1;
	self.revisionStr = "";
	self.activeXVersion = "";
	var activeXDetectRules = [
		{
			"name":"ShockwaveFlash.ShockwaveFlash.7",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash.6",
			"version":function(obj){
				var version = "6,0,21";
				try{
					obj.AllowScriptAccess = "always";
					version = getActiveXVersion(obj);
				}catch(err){}
				return version;
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		}
	];
	var getActiveXVersion = function(activeXObj){
		var version = -1;
		try{
			version = activeXObj.GetVariable("$version");
		}catch(err){}
		return version;
	};
	var getActiveXObject = function(name){
		var obj = -1;
		try{
			obj = new ActiveXObject(name);
		}catch(err){}
		return obj;
	};
	var parseActiveXVersion = function(str){
		var versionArray = str.split(",");//replace with regex
		return {
			"major":parseInt(versionArray[0].split(" ")[1], 10),
			"minor":parseInt(versionArray[1], 10),
			"revision":parseInt(versionArray[2], 10),
			"revisionStr":versionArray[2]
		};
	};
	var parseRevisionStrToInt = function(str){
		return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
	};
	self.majorAtLeast = function(version){
		return self.major >= version;
	};
	self.FlashDetect = function(){
		if(navigator.plugins && navigator.plugins.length>0){
			var type = 'application/x-shockwave-flash';
			var mimeTypes = navigator.mimeTypes;
			if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
				var desc = mimeTypes[type].enabledPlugin.description;
				var descParts = desc.split(' ');//replace with regex
				var majorMinor = descParts[2].split('.');
				self.major = parseInt(majorMinor[0], 10);
				self.minor = parseInt(majorMinor[1], 10); 
				self.revisionStr = descParts[3];
				self.revision = parseRevisionStrToInt(self.revisionStr);
				self.installed = true;
			}
		}else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
			var version = -1;
			for(var i=0; i<activeXDetectRules.length && version==-1; i++){
				var obj = getActiveXObject(activeXDetectRules[i].name);
				if(typeof obj == "object"){
					self.installed = true;
					version = activeXDetectRules[i].version(obj);
					if(version!=-1){
						var versionObj = parseActiveXVersion(version);
						self.major = versionObj.major;
						self.minor = versionObj.minor; 
						self.revision = versionObj.revision;
						self.revisionStr = versionObj.revisionStr;
						self.activeXVersion = version;
					}
				}
			}
		}
	}();
};
FlashDetect.release = "1.0.2";


		var newsAt=0;
		var sdir=0;
		var freeze=0;
		function scrollNews(){
			var scrat = $('news_roll').offsetHeight;
			if (scrat>120){
			  if (sdir==0){
				if (newsAt<(scrat-120)){
					if (freeze==0){
					newsAt=newsAt+1;
					$('news_roll').style.top = "-" + newsAt + 'px';}
					window.setTimeout("scrollNews()",30);

				}else{
					sdir=1;window.setTimeout("scrollNews()",1500);
				}
			  }else{
				if (newsAt>0){
					if (freeze==0){
					newsAt=newsAt-1;
					if (newsAt>0){$('news_roll').style.top = "-" + newsAt + 'px';}}
					window.setTimeout("scrollNews()",30);
				}else{
					sdir=0;window.setTimeout("scrollNews()",1500);
				}
			  }
			  
			}

		}

/* end /home/websites/stickk.com/web/js/stickk.js size 6904 */
/* begin /home/websites/stickk.com/web/js/swfobject.js size 9759 */
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
/* end /home/websites/stickk.com/web/js/swfobject.js size 9759 */
/* begin /home/websites/stickk.com/web/js/timezone.js size 971 */
function tz_calculate(timestamp)
{
	var d=new Date();
	var raw_offset=d.getTimezoneOffset()/30;
	var time_sec=d.getTime()/1000;
	var time_diff=Math.round((timestamp-time_sec)/1800);
	var rounded_offset=Math.round(raw_offset+time_diff)%48;
	if(rounded_offset==0){
		return 0;
	}else if(rounded_offset>24){
		rounded_offset-=Math.ceil(rounded_offset/48)*48;
	}else if(rounded_offset<-28){
		rounded_offset+=Math.ceil(rounded_offset/-48)*48;
	}
	return rounded_offset*30;
}

function tz_set(ts,sid,ct,co)
{
	tz_calculate_2(sid,ct,co);
}

function tz_calculate_2(sid,ct,co)
{
	var today=new Date();

	var h=today.getHours();
	var m=today.getMinutes();
	var s=today.getSeconds();
	
	var d=today.getDate();
	var n=today.getMonth()+1;
	var y=today.getYear();

	var qs = 'h='+h+'&m='+m+'&s='+s+'&d='+d+'&n='+n+'&y='+y+'';

	send('/members/ajax/user-precise-timezone-load.php', 'co='+escape(co)+'&ct='+escape(ct)+'&sid='+sid+'&' + qs  , '');
}
/* end /home/websites/stickk.com/web/js/timezone.js size 971 */
/* begin /home/websites/stickk.com/web/js/user.js size 894 */
  //used to check is the callback function has completed
	//var userID = -1;
	var redirectUrl = '';
 
 	//redirects browser to url if user offline 
	function userOfflineRedirect(url)
	{
		if(url == null)
		{
			redirectUrl = '';
		}
		else
		{
			redirectUrl = url;
		}
		
		send('/members/ajax/user-get-status.php', '', 'parse', ''); // this is not really an load_in_placeholder but we do need to parse the script tags in the response
		
		return 1;
	}

	function callbackGetUserStatus(response)
	{
		  /*
			userID = response.responseText;
			
			if(isNaN(userID) || userID == 0)
			{		
						if (redirectUrl == '')
						{
							//setTimeOut('document.location', 2000);
							//document.location;
						}
						else
						{
							//setTimeOut('document.location = redirectUrl', 2000)
							//document.location = redirectURL;
						}
			}
		  */
	}
/* end /home/websites/stickk.com/web/js/user.js size 894 */
/* begin /home/websites/stickk.com/web/js/userbox.js size 857 */
function overrideLink(overlink,overtext){
	$(overlink).innerHTML = overtext;
}
function checkAv(io,m){
	//alert(io.height);
	
	var mh = io.height;

	if (m=="1"){
	  if (mh>40){
		switch (true){
			case (mh<40):
			var os = Math.round((mh - 35) / 2);
			break;
			case ((mh>40)&&(mh<50)):
			var os = Math.round((mh - 40) / 2);
			break;
			case (mh>=50):
			var os = Math.round((mh - 50) / 2);
			break;

		}
		io.style.position="relative";
		io.style.top="-" + os + "px";
	  }
	}else{
	  if (mh>180){
		switch (true){
			case (mh<200):
			var os = Math.round((mh - 180) / 2);
			break;
			case ((mh>200)&&(mh<230)):
			var os = Math.round((mh - 200) / 2);
			break;
			case (mh>=260):
			var os = Math.round((mh - 230) / 2);
			break;

		}
		io.style.position="relative";
		io.style.top="-" + os + "px";
	  }
	}
}
/* end /home/websites/stickk.com/web/js/userbox.js size 857 */
/* begin /home/websites/stickk.com/web/js/wall.js size 603 */
var lastWall="";

function postNotice(objBaseName)
{
	//alert(objBaseName);   

	$(objBaseName + '-txt').innerHTML = 'Posting...<br /><br />';
	
	lastWall=objBaseName;
	
}

function recallTxt(objBaseName,s)
{
	//alert(objBaseName)
	//alert(s)
  
	if (s==0)
	{
	  $(objBaseName + '-txt').innerHTML = 'Your message has been posted!<br /><br />';
		window.setTimeout("recallTxt('"+objBaseName+"',1);",3000);
	}
	else
	{
		if(objBaseName == "wall-post-form")
    {
			$(objBaseName + '-txt').innerHTML = '';
    }
		else
		{
		  $(objBaseName + '-txt').innerHTML = '<table style="width:400;"><tr>';
		}
	}
}
/* end /home/websites/stickk.com/web/js/wall.js size 603 */
/* begin /home/websites/stickk.com/web/js/wz_jsgraphics2.js size 25379 */
/* This notice must be untouched at all times.

wz_jsgraphics.js    v. 3.03
The latest version is available at
http://www.walterzorn.com
or http://www.devira.com
or http://www.walterzorn.de

Copyright (c) 2002-2004 Walter Zorn. All rights reserved.
Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com )
Last modified: 28. 1. 2008

Performance optimizations for Internet Explorer
by Thomas Frank and John Holdsworth.
fillPolygon method implemented by Matthieu Haller.

High Performance JavaScript Graphics Library.
Provides methods
- to draw lines, rectangles, ellipses, polygons
	with specifiable line thickness,
- to fill rectangles, polygons, ellipses and arcs
- to draw text.
NOTE: Operations, functions and branching have rather been optimized
to efficiency and speed than to shortness of source code.

LICENSE: LGPL

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License (LGPL) as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA,
or see http://www.gnu.org/copyleft/lesser.html
*/


var jg_ok, jg_ie, jg_fast, jg_dom, jg_moz;


function _chkDHTM(x, i)
{
	x = document.body || null;
	jg_ie = x && typeof x.insertAdjacentHTML != "undefined" && document.createElement;
	jg_dom = (x && !jg_ie &&
		typeof x.appendChild != "undefined" &&
		typeof document.createRange != "undefined" &&
		typeof (i = document.createRange()).setStartBefore != "undefined" &&
		typeof i.createContextualFragment != "undefined");
	jg_fast = jg_ie && document.all && !window.opera;
	jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined";
	jg_ok = !!(jg_ie || jg_dom);
}

function _pntCnvDom()
{
	var x = this.wnd.document.createRange();
	x.setStartBefore(this.cnv);
	x = x.createContextualFragment(jg_fast? this._htmRpc() : this.htm);
	if(this.cnv) this.cnv.appendChild(x);
	this.htm = "";
}

function _pntCnvIe()
{
	if(this.cnv) this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this._htmRpc() : this.htm);
	this.htm = "";
}

function _pntDoc()
{
	this.wnd.document.write(jg_fast? this._htmRpc() : this.htm);
	this.htm = '';
}

function _pntN()
{
	;
}

//modified by Alexander Marcoux to include border width
function _mkDiv(x, y, w, h, borderWidth, onclick)
{
	var borderWidthStyle = "";
	
	if(borderWidth != null)
	{
		borderWidthStyle += "border-style: solid; border-width:" + borderWidth + "px;";
	}
	
	this.htm += '<div style="position:absolute;'+
		'left:' + x + 'px;'+
		'top:' + y + 'px;'+
		'width:' + w + 'px;'+
		'height:' + h + 'px;';
		
		if(borderWidth != null)
		{
			w += borderWidth*2;
			h += borderWidth*2;
		}
		
		this.htm +='clip:rect(0,'+w+'px,'+h+'px,0);'+
		borderWidthStyle +
		'background-color:' + this.color +
		(onclick? '; cursor: pointer;' : '') +
		(!jg_moz? ';overflow:hidden' : '')+
		';" ' + (onclick? (' onclick="' + onclick + '"') : '') + '><\/div>';
}

function _mkDivIe(x, y, w, h)
{
	this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';';
}

function _mkDivPrt(x, y, w, h)
{
	this.htm += '<div style="position:absolute;'+
		'border-left:' + w + 'px solid ' + this.color + ';'+
		'left:' + x + 'px;'+
		'top:' + y + 'px;'+
		'width:0px;'+
		'height:' + h + 'px;'+
		'clip:rect(0,'+w+'px,'+h+'px,0);'+
		'background-color:' + this.color +
		(!jg_moz? ';overflow:hidden' : '')+
		';"><\/div>';
}

var _regex =  /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;
function _htmRpc()
{
	return this.htm.replace(
		_regex,
		'<div style="overflow:hidden;position:absolute;background-color:'+
		'$1;left:$2;top:$3;width:$4;height:$5"></div>\n');
}

function _htmPrtRpc()
{
	return this.htm.replace(
		_regex,
		'<div style="overflow:hidden;position:absolute;background-color:'+
		'$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n');
}

function _mkLin(x1, y1, x2, y2)
{
	if(x1 > x2)
	{
		var _x2 = x2;
		var _y2 = y2;
		x2 = x1;
		y2 = y1;
		x1 = _x2;
		y1 = _y2;
	}
	var dx = x2-x1, dy = Math.abs(y2-y1),
	x = x1, y = y1,
	yIncr = (y1 > y2)? -1 : 1;

	if(dx >= dy)
	{
		var pr = dy<<1,
		pru = pr - (dx<<1),
		p = pr-dx,
		ox = x;
		while(dx > 0)
		{--dx;
			++x;
			if(p > 0)
			{
				this._mkDiv(ox, y, x-ox, 1);
				y += yIncr;
				p += pru;
				ox = x;
			}
			else p += pr;
		}
		this._mkDiv(ox, y, x2-ox+1, 1);
	}

	else
	{
		var pr = dx<<1,
		pru = pr - (dy<<1),
		p = pr-dy,
		oy = y;
		if(y2 <= y1)
		{
			while(dy > 0)
			{--dy;
				if(p > 0)
				{
					this._mkDiv(x++, y, 1, oy-y+1);
					y += yIncr;
					p += pru;
					oy = y;
				}
				else
				{
					y += yIncr;
					p += pr;
				}
			}
			this._mkDiv(x2, y2, 1, oy-y2+1);
		}
		else
		{
			while(dy > 0)
			{--dy;
				y += yIncr;
				if(p > 0)
				{
					this._mkDiv(x++, oy, 1, y-oy);
					p += pru;
					oy = y;
				}
				else p += pr;
			}
			this._mkDiv(x2, oy, 1, y2-oy+1);
		}
	}
}

function _mkLin2D(x1, y1, x2, y2)
{
	if(x1 > x2)
	{
		var _x2 = x2;
		var _y2 = y2;
		x2 = x1;
		y2 = y1;
		x1 = _x2;
		y1 = _y2;
	}
	var dx = x2-x1, dy = Math.abs(y2-y1),
	x = x1, y = y1,
	yIncr = (y1 > y2)? -1 : 1;

	var s = this.stroke;
	if(dx >= dy)
	{
		if(dx > 0 && s-3 > 0)
		{
			var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx;
			_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;
		}
		else var _s = s;
		var ad = Math.ceil(s/2);

		var pr = dy<<1,
		pru = pr - (dx<<1),
		p = pr-dx,
		ox = x;
		while(dx > 0)
		{--dx;
			++x;
			if(p > 0)
			{
				this._mkDiv(ox, y, x-ox+ad, _s);
				y += yIncr;
				p += pru;
				ox = x;
			}
			else p += pr;
		}
		this._mkDiv(ox, y, x2-ox+ad+1, _s);
	}

	else
	{
		if(s-3 > 0)
		{
			var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy;
			_s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1;
		}
		else var _s = s;
		var ad = Math.round(s/2);

		var pr = dx<<1,
		pru = pr - (dy<<1),
		p = pr-dy,
		oy = y;
		if(y2 <= y1)
		{
			++ad;
			while(dy > 0)
			{--dy;
				if(p > 0)
				{
					this._mkDiv(x++, y, _s, oy-y+ad);
					y += yIncr;
					p += pru;
					oy = y;
				}
				else
				{
					y += yIncr;
					p += pr;
				}
			}
			this._mkDiv(x2, y2, _s, oy-y2+ad);
		}
		else
		{
			while(dy > 0)
			{--dy;
				y += yIncr;
				if(p > 0)
				{
					this._mkDiv(x++, oy, _s, y-oy+ad);
					p += pru;
					oy = y;
				}
				else p += pr;
			}
			this._mkDiv(x2, oy, _s, y2-oy+ad+1);
		}
	}
}

function _mkLinDott(x1, y1, x2, y2)
{
	if(x1 > x2)
	{
		var _x2 = x2;
		var _y2 = y2;
		x2 = x1;
		y2 = y1;
		x1 = _x2;
		y1 = _y2;
	}
	var dx = x2-x1, dy = Math.abs(y2-y1),
	x = x1, y = y1,
	yIncr = (y1 > y2)? -1 : 1,
	drw = true;
	if(dx >= dy)
	{
		var pr = dy<<1,
		pru = pr - (dx<<1),
		p = pr-dx;
		while(dx > 0)
		{--dx;
			if(drw) this._mkDiv(x, y, 1, 1);
			drw = !drw;
			if(p > 0)
			{
				y += yIncr;
				p += pru;
			}
			else p += pr;
			++x;
		}
	}
	else
	{
		var pr = dx<<1,
		pru = pr - (dy<<1),
		p = pr-dy;
		while(dy > 0)
		{--dy;
			if(drw) this._mkDiv(x, y, 1, 1);
			drw = !drw;
			y += yIncr;
			if(p > 0)
			{
				++x;
				p += pru;
			}
			else p += pr;
		}
	}
	if(drw) this._mkDiv(x, y, 1, 1);
}

function _mkOv(left, top, width, height)
{
	var a = (++width)>>1, b = (++height)>>1,
	wod = width&1, hod = height&1,
	cx = left+a, cy = top+b,
	x = 0, y = b,
	ox = 0, oy = b,
	aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
	st = (aa2>>1)*(1-(b<<1)) + bb2,
	tt = (bb2>>1) - aa2*((b<<1)-1),
	w, h;
	while(y > 0)
	{
		if(st < 0)
		{
			st += bb2*((x<<1)+3);
			tt += bb4*(++x);
		}
		else if(tt < 0)
		{
			st += bb2*((x<<1)+3) - aa4*(y-1);
			tt += bb4*(++x) - aa2*(((y--)<<1)-3);
			w = x-ox;
			h = oy-y;
			if((w&2) && (h&2))
			{
				this._mkOvQds(cx, cy, x-2, y+2, 1, 1, wod, hod);
				this._mkOvQds(cx, cy, x-1, y+1, 1, 1, wod, hod);
			}
			else this._mkOvQds(cx, cy, x-1, oy, w, h, wod, hod);
			ox = x;
			oy = y;
		}
		else
		{
			tt -= aa2*((y<<1)-3);
			st -= aa4*(--y);
		}
	}
	w = a-ox+1;
	h = (oy<<1)+hod;
	y = cy-oy;
	this._mkDiv(cx-a, y, w, h);
	this._mkDiv(cx+ox+wod-1, y, w, h);
}

function _mkOv2D(left, top, width, height)
{
	var s = this.stroke;
	width += s+1;
	height += s+1;
	var a = width>>1, b = height>>1,
	wod = width&1, hod = height&1,
	cx = left+a, cy = top+b,
	x = 0, y = b,
	aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
	st = (aa2>>1)*(1-(b<<1)) + bb2,
	tt = (bb2>>1) - aa2*((b<<1)-1);

	if(s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0))
	{
		var ox = 0, oy = b,
		w, h,
		pxw;
		while(y > 0)
		{
			if(st < 0)
			{
				st += bb2*((x<<1)+3);
				tt += bb4*(++x);
			}
			else if(tt < 0)
			{
				st += bb2*((x<<1)+3) - aa4*(y-1);
				tt += bb4*(++x) - aa2*(((y--)<<1)-3);
				w = x-ox;
				h = oy-y;

				if(w-1)
				{
					pxw = w+1+(s&1);
					h = s;
				}
				else if(h-1)
				{
					pxw = s;
					h += 1+(s&1);
				}
				else pxw = h = s;
				this._mkOvQds(cx, cy, x-1, oy, pxw, h, wod, hod);
				ox = x;
				oy = y;
			}
			else
			{
				tt -= aa2*((y<<1)-3);
				st -= aa4*(--y);
			}
		}
		this._mkDiv(cx-a, cy-oy, s, (oy<<1)+hod);
		this._mkDiv(cx+a+wod-s, cy-oy, s, (oy<<1)+hod);
	}

	else
	{
		var _a = (width-(s<<1))>>1,
		_b = (height-(s<<1))>>1,
		_x = 0, _y = _b,
		_aa2 = (_a*_a)<<1, _aa4 = _aa2<<1, _bb2 = (_b*_b)<<1, _bb4 = _bb2<<1,
		_st = (_aa2>>1)*(1-(_b<<1)) + _bb2,
		_tt = (_bb2>>1) - _aa2*((_b<<1)-1),

		pxl = new Array(),
		pxt = new Array(),
		_pxb = new Array();
		pxl[0] = 0;
		pxt[0] = b;
		_pxb[0] = _b-1;
		while(y > 0)
		{
			if(st < 0)
			{
				pxl[pxl.length] = x;
				pxt[pxt.length] = y;
				st += bb2*((x<<1)+3);
				tt += bb4*(++x);
			}
			else if(tt < 0)
			{
				pxl[pxl.length] = x;
				st += bb2*((x<<1)+3) - aa4*(y-1);
				tt += bb4*(++x) - aa2*(((y--)<<1)-3);
				pxt[pxt.length] = y;
			}
			else
			{
				tt -= aa2*((y<<1)-3);
				st -= aa4*(--y);
			}

			if(_y > 0)
			{
				if(_st < 0)
				{
					_st += _bb2*((_x<<1)+3);
					_tt += _bb4*(++_x);
					_pxb[_pxb.length] = _y-1;
				}
				else if(_tt < 0)
				{
					_st += _bb2*((_x<<1)+3) - _aa4*(_y-1);
					_tt += _bb4*(++_x) - _aa2*(((_y--)<<1)-3);
					_pxb[_pxb.length] = _y-1;
				}
				else
				{
					_tt -= _aa2*((_y<<1)-3);
					_st -= _aa4*(--_y);
					_pxb[_pxb.length-1]--;
				}
			}
		}

		var ox = -wod, oy = b,
		_oy = _pxb[0],
		l = pxl.length,
		w, h;
		for(var i = 0; i < l; i++)
		{
			if(typeof _pxb[i] != "undefined")
			{
				if(_pxb[i] < _oy || pxt[i] < oy)
				{
					x = pxl[i];
					this._mkOvQds(cx, cy, x, oy, x-ox, oy-_oy, wod, hod);
					ox = x;
					oy = pxt[i];
					_oy = _pxb[i];
				}
			}
			else
			{
				x = pxl[i];
				this._mkDiv(cx-x, cy-oy, 1, (oy<<1)+hod);
				this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
				ox = x;
				oy = pxt[i];
			}
		}
		this._mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod);
		this._mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod);
	}
}

function _mkOvDott(left, top, width, height)
{
	var a = (++width)>>1, b = (++height)>>1,
	wod = width&1, hod = height&1, hodu = hod^1,
	cx = left+a, cy = top+b,
	x = 0, y = b,
	aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
	st = (aa2>>1)*(1-(b<<1)) + bb2,
	tt = (bb2>>1) - aa2*((b<<1)-1),
	drw = true;
	while(y > 0)
	{
		if(st < 0)
		{
			st += bb2*((x<<1)+3);
			tt += bb4*(++x);
		}
		else if(tt < 0)
		{
			st += bb2*((x<<1)+3) - aa4*(y-1);
			tt += bb4*(++x) - aa2*(((y--)<<1)-3);
		}
		else
		{
			tt -= aa2*((y<<1)-3);
			st -= aa4*(--y);
		}
		if(drw && y >= hodu) this._mkOvQds(cx, cy, x, y, 1, 1, wod, hod);
		drw = !drw;
	}
}

function _mkRect(x, y, w, h)
{
	var s = this.stroke;
	this._mkDiv(x, y, w, s);
	this._mkDiv(x+w, y, s, h);
	this._mkDiv(x, y+h, w+s, s);
	this._mkDiv(x, y+s, s, h-s);
}

function _mkRectDott(x, y, w, h)
{
	this.drawLine(x, y, x+w, y);
	this.drawLine(x+w, y, x+w, y+h);
	this.drawLine(x, y+h, x+w, y+h);
	this.drawLine(x, y, x, y+h);
}

function jsgFont()
{
	this.PLAIN = 'font-weight:normal;';
	this.BOLD = 'font-weight:bold;';
	this.ITALIC = 'font-style:italic;';
	this.ITALIC_BOLD = this.ITALIC + this.BOLD;
	this.BOLD_ITALIC = this.ITALIC_BOLD;
}
var Font = new jsgFont();

function jsgStroke()
{
	this.DOTTED = -1;
}
var Stroke = new jsgStroke();

function jsGraphics(cnv, wnd)
{
	this.setColor = function(x)
	{
		this.color = x.toLowerCase();
	};

	this.setStroke = function(x)
	{
		this.stroke = x;
		if(!(x+1))
		{
			this.drawLine = _mkLinDott;
			this._mkOv = _mkOvDott;
			this.drawRect = _mkRectDott;
		}
		else if(x-1 > 0)
		{
			this.drawLine = _mkLin2D;
			this._mkOv = _mkOv2D;
			this.drawRect = _mkRect;
		}
		else
		{
			this.drawLine = _mkLin;
			this._mkOv = _mkOv;
			this.drawRect = _mkRect;
		}
	};

	this.setPrintable = function(arg)
	{
		this.printable = arg;
		if(jg_fast)
		{
			this._mkDiv = _mkDivIe;
			this._htmRpc = arg? _htmPrtRpc : _htmRpc;
		}
		else this._mkDiv = arg? _mkDivPrt : _mkDiv;
	};

	this.setFont = function(fam, sz, sty)
	{
		this.ftFam = fam;
		this.ftSz = sz;
		this.ftSty = sty || Font.PLAIN;
	};
	
	this.setFontSize = function(size)
	{
		this.ftSz = size;
	}

	this.drawPolyline = this.drawPolyLine = function(x, y)
	{
		for (var i=x.length - 1; i;)
		{--i;
			this.drawLine(x[i], y[i], x[i+1], y[i+1]);
		}
	};

	//modified by Alexander Marcoux to include border width 
	this.fillRect = function(x, y, w, h, borderWidth, onclick)
	{
		this._mkDiv(x, y, w, h, borderWidth, onclick);
	};

	this.drawPolygon = function(x, y)
	{
		this.drawPolyline(x, y);
		this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]);
	};

	this.drawEllipse = this.drawOval = function(x, y, w, h)
	{
		this._mkOv(x, y, w, h);
	};

	this.fillEllipse = this.fillOval = function(left, top, w, h)
	{
		var a = w>>1, b = h>>1,
		wod = w&1, hod = h&1,
		cx = left+a, cy = top+b,
		x = 0, y = b, oy = b,
		aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
		st = (aa2>>1)*(1-(b<<1)) + bb2,
		tt = (bb2>>1) - aa2*((b<<1)-1),
		xl, dw, dh;
		if(w) while(y > 0)
		{
			if(st < 0)
			{
				st += bb2*((x<<1)+3);
				tt += bb4*(++x);
			}
			else if(tt < 0)
			{
				st += bb2*((x<<1)+3) - aa4*(y-1);
				xl = cx-x;
				dw = (x<<1)+wod;
				tt += bb4*(++x) - aa2*(((y--)<<1)-3);
				dh = oy-y;
				this._mkDiv(xl, cy-oy, dw, dh);
				this._mkDiv(xl, cy+y+hod, dw, dh);
				oy = y;
			}
			else
			{
				tt -= aa2*((y<<1)-3);
				st -= aa4*(--y);
			}
		}
		this._mkDiv(cx-a, cy-oy, w, (oy<<1)+hod);
	};

	this.fillArc = function(iL, iT, iW, iH, fAngA, fAngZ)
	{
		var a = iW>>1, b = iH>>1,
		iOdds = (iW&1) | ((iH&1) << 16),
		cx = iL+a, cy = iT+b,
		x = 0, y = b, ox = x, oy = y,
		aa2 = (a*a)<<1, aa4 = aa2<<1, bb2 = (b*b)<<1, bb4 = bb2<<1,
		st = (aa2>>1)*(1-(b<<1)) + bb2,
		tt = (bb2>>1) - aa2*((b<<1)-1),
		// Vars for radial boundary lines
		xEndA, yEndA, xEndZ, yEndZ,
		iSects = (1 << (Math.floor((fAngA %= 360.0)/180.0) << 3))
				| (2 << (Math.floor((fAngZ %= 360.0)/180.0) << 3))
				| ((fAngA >= fAngZ) << 16),
		aBndA = new Array(b+1), aBndZ = new Array(b+1);
		
		// Set up radial boundary lines
		fAngA *= Math.PI/180.0;
		fAngZ *= Math.PI/180.0;
		xEndA = cx+Math.round(a*Math.cos(fAngA));
		yEndA = cy+Math.round(-b*Math.sin(fAngA));
		_mkLinVirt(aBndA, cx, cy, xEndA, yEndA);
		xEndZ = cx+Math.round(a*Math.cos(fAngZ));
		yEndZ = cy+Math.round(-b*Math.sin(fAngZ));
		_mkLinVirt(aBndZ, cx, cy, xEndZ, yEndZ);

		while(y > 0)
		{
			if(st < 0) // Advance x
			{
				st += bb2*((x<<1)+3);
				tt += bb4*(++x);
			}
			else if(tt < 0) // Advance x and y
			{
				st += bb2*((x<<1)+3) - aa4*(y-1);
				ox = x;
				tt += bb4*(++x) - aa2*(((y--)<<1)-3);
				this._mkArcDiv(ox, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
				oy = y;
			}
			else // Advance y
			{
				tt -= aa2*((y<<1)-3);
				st -= aa4*(--y);
				if(y && (aBndA[y] != aBndA[y-1] || aBndZ[y] != aBndZ[y-1]))
				{
					this._mkArcDiv(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
					ox = x;
					oy = y;
				}
			}
		}
		this._mkArcDiv(x, 0, oy, cx, cy, iOdds, aBndA, aBndZ, iSects);
		if(iOdds >> 16) // Odd height
		{
			if(iSects >> 16) // Start-angle > end-angle
			{
				var xl = (yEndA <= cy || yEndZ > cy)? (cx - x) : cx;
				this._mkDiv(xl, cy, x + cx - xl + (iOdds & 0xffff), 1);
			}
			else if((iSects & 0x01) && yEndZ > cy)
				this._mkDiv(cx - x, cy, x, 1);
		}
	};

/* fillPolygon method, implemented by Matthieu Haller.
This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib.
C source of GD 1.8.4 found at http://www.boutell.com/gd/

THANKS to Kirsten Schulz for the polygon fixes!

The intersection finding technique of this code could be improved
by remembering the previous intertersection, and by using the slope.
That could help to adjust intersections to produce a nice
interior_extrema. */
	this.fillPolygon = function(array_x, array_y)
	{
		var i;
		var y;
		var miny, maxy;
		var x1, y1;
		var x2, y2;
		var ind1, ind2;
		var ints;

		var n = array_x.length;
		if(!n) return;

		miny = array_y[0];
		maxy = array_y[0];
		for(i = 1; i < n; i++)
		{
			if(array_y[i] < miny)
				miny = array_y[i];

			if(array_y[i] > maxy)
				maxy = array_y[i];
		}
		for(y = miny; y <= maxy; y++)
		{
			var polyInts = new Array();
			ints = 0;
			for(i = 0; i < n; i++)
			{
				if(!i)
				{
					ind1 = n-1;
					ind2 = 0;
				}
				else
				{
					ind1 = i-1;
					ind2 = i;
				}
				y1 = array_y[ind1];
				y2 = array_y[ind2];
				if(y1 < y2)
				{
					x1 = array_x[ind1];
					x2 = array_x[ind2];
				}
				else if(y1 > y2)
				{
					y2 = array_y[ind1];
					y1 = array_y[ind2];
					x2 = array_x[ind1];
					x1 = array_x[ind2];
				}
				else continue;

				 //  Modified 11. 2. 2004 Walter Zorn
				if((y >= y1) && (y < y2))
					polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);

				else if((y == maxy) && (y > y1) && (y <= y2))
					polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1);
			}
			polyInts.sort(_CompInt);
			for(i = 0; i < ints; i+=2)
				this._mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1);
		}
	};

	this.drawString = function(txt, x, y, id, position)
	{
		if(position==null)
		{
			position="absolute";			
		}
		
		this.htm += '<div style="position:' + position + ';white-space:nowrap;'+
			'left:' + x + 'px;'+
			'top:' + y + 'px;'+
			'font-family:' +  this.ftFam + ';'+
			'font-size:' + this.ftSz + ';'+
			'color:' + this.color + ';' + this.ftSty + '"' +
			(id? (' id="' +  id + '"') : null) + '>'+
			txt +
			'<\/div>';
	};
	
/* drawStringRect() added by Rick Blommers.
   Allows to specify the size of the text rectangle and to align the
   text both horizontally (e.g. right) and vertically within that rectangle */
	this.drawStringRect = function(txt, x, y, w, halign, id, position)
	{
		if(position==null)
		{
			position="absolute";
			
		}
		
		this.htm += '<div style="position:' + position + ';overflow:hidden;'+
			'left:' + x + 'px;'+
			'top:' + y + 'px;'+
			'width:' + w + 'px;'+
			'text-align:'+halign+';'+
			'font-family:' +  this.ftFam + ';'+
			'font-size:' + this.ftSz + ';'+
			'text-decoration: underline;'+
			'color:' + this.color + ';' + this.ftSty + '"' +
			(id? (' id="' +  id + '"') : '') + '>'+
			txt +
			'<\/div>';
	};

	this.drawStringRect2 = function(txt, x, y, w, halign, onclick, id, position)
	{
		if(position==null)
		{
			position="absolute";
			
		}
		
		this.htm += '<div style="position:' + position + ';overflow:hidden;'+
			'left:' + x + 'px;'+
			'top:' + y + 'px;'+
			'width:' + w + 'px;'+
			'text-align:'+halign+';'+
			'font-family:' +  this.ftFam + ';'+
			'font-size:' + this.ftSz + ';'+
			(onclick? ' cursor: pointer;' : '') +
			'color:' + this.color + ';' + this.ftSty + '"' +
			(id? (' id="' +  id + '"') : '') +
			(onclick? (' onclick="' + onclick + '"') : '') + '>' + txt +
			'<\/div>';
	};
	

	this.drawImage = function(imgSrc, x, y, w, h, a)
	{
		this.htm += '<div style="position:absolute;'+
			'left:' + x + 'px;'+
			'top:' + y + 'px;'+
			// w (width) and h (height) arguments are now optional.
			// Added by Mahmut Keygubatli, 14.1.2008
			(w? ('width:' +  w + 'px;') : '') +
			(h? ('height:' + h + 'px;'):'')+'">'+
			'<img src="' + imgSrc +'"'+ (w ? (' width="' + w + '"'):'')+ (h ? (' height="' + h + '"'):'') + (a? (' '+a) : '') + '>'+
			'<\/div>';
	};

	this.clear = function()
	{
		this.htm = "";
		if(this.cnv) this.cnv.innerHTML = "";
	};

	this._mkOvQds = function(cx, cy, x, y, w, h, wod, hod)
	{
		var xl = cx - x, xr = cx + x + wod - w, yt = cy - y, yb = cy + y + hod - h;
		if(xr > xl+w)
		{
			this._mkDiv(xr, yt, w, h);
			this._mkDiv(xr, yb, w, h);
		}
		else
			w = xr - xl + w;
		this._mkDiv(xl, yt, w, h);
		this._mkDiv(xl, yb, w, h);
	};
	
	this._mkArcDiv = function(x, y, oy, cx, cy, iOdds, aBndA, aBndZ, iSects)
	{
		var xrDef = cx + x + (iOdds & 0xffff), y2, h = oy - y, xl, xr, w;

		if(!h) h = 1;
		x = cx - x;

		if(iSects & 0xff0000) // Start-angle > end-angle
		{
			y2 = cy - y - h;
			if(iSects & 0x00ff)
			{
				if(iSects & 0x02)
				{
					xl = Math.max(x, aBndZ[y]);
					w = xrDef - xl;
					if(w > 0) this._mkDiv(xl, y2, w, h);
				}
				if(iSects & 0x01)
				{
					xr = Math.min(xrDef, aBndA[y]);
					w = xr - x;
					if(w > 0) this._mkDiv(x, y2, w, h);
				}
			}
			else
				this._mkDiv(x, y2, xrDef - x, h);
			y2 = cy + y + (iOdds >> 16);
			if(iSects & 0xff00)
			{
				if(iSects & 0x0100)
				{
					xl = Math.max(x, aBndA[y]);
					w = xrDef - xl;
					if(w > 0) this._mkDiv(xl, y2, w, h);
				}
				if(iSects & 0x0200)
				{
					xr = Math.min(xrDef, aBndZ[y]);
					w = xr - x;
					if(w > 0) this._mkDiv(x, y2, w, h);
				}
			}
			else
				this._mkDiv(x, y2, xrDef - x, h);
		}
		else
		{
			if(iSects & 0x00ff)
			{
				if(iSects & 0x02)
					xl = Math.max(x, aBndZ[y]);
				else
					xl = x;
				if(iSects & 0x01)
					xr = Math.min(xrDef, aBndA[y]);
				else
					xr = xrDef;
				y2 = cy - y - h;
				w = xr - xl;
				if(w > 0) this._mkDiv(xl, y2, w, h);
			}
			if(iSects & 0xff00)
			{
				if(iSects & 0x0100)
					xl = Math.max(x, aBndA[y]);
				else
					xl = x;
				if(iSects & 0x0200)
					xr = Math.min(xrDef, aBndZ[y]);
				else
					xr = xrDef;
				y2 = cy + y + (iOdds >> 16);
				w = xr - xl;
				if(w > 0) this._mkDiv(xl, y2, w, h);
			}
		}
	};

	this.setStroke(1);
	this.setFont("verdana,geneva,helvetica,sans-serif", "12px", Font.PLAIN);
	this.color = "#000000";
	this.htm = "";
	this.wnd = wnd || window;

	if(!jg_ok) _chkDHTM();
	if(jg_ok)
	{
		if(cnv)
		{
			if(typeof(cnv) == "string")
				this.cont = document.all? (this.wnd.document.all[cnv] || null)
					: document.getElementById? (this.wnd.document.getElementById(cnv) || null)
					: null;
			else if(cnv == window.document)
				this.cont = document.getElementsByTagName("body")[0];
			// If cnv is a direct reference to a canvas DOM node
			// (option suggested by Andreas Luleich)
			else this.cont = cnv;
			// Create new canvas inside container DIV. Thus the drawing and clearing
			// methods won't interfere with the container's inner html.
			// Solution suggested by Vladimir.
			this.cnv = this.wnd.document.createElement("div");
			this.cnv.style.fontSize=0;
			this.cont.appendChild(this.cnv);
			this.paint = jg_dom? _pntCnvDom : _pntCnvIe;
		}
		else
			this.paint = _pntDoc;
	}
	else
		this.paint = _pntN;

	this.setPrintable(false);
}

function _mkLinVirt(aLin, x1, y1, x2, y2)
{
	var dx = Math.abs(x2-x1), dy = Math.abs(y2-y1),
	x = x1, y = y1,
	xIncr = (x1 > x2)? -1 : 1,
	yIncr = (y1 > y2)? -1 : 1,
	p,
	i = 0;
	if(dx >= dy)
	{
		var pr = dy<<1,
		pru = pr - (dx<<1);
		p = pr-dx;
		while(dx > 0)
		{--dx;
			if(p > 0)    //  Increment y
			{
				aLin[i++] = x;
				y += yIncr;
				p += pru;
			}
			else p += pr;
			x += xIncr;
		}
	}
	else
	{
		var pr = dx<<1,
		pru = pr - (dy<<1);
		p = pr-dy;
		while(dy > 0)
		{--dy;
			y += yIncr;
			aLin[i++] = x;
			if(p > 0)    //  Increment x
			{
				x += xIncr;
				p += pru;
			}
			else p += pr;
		}
	}
	for(var len = aLin.length, i = len-i; i;)
		aLin[len-(i--)] = x;
};

function _CompInt(x, y)
{
	return(x - y);
}


/* end /home/websites/stickk.com/web/js/wz_jsgraphics2.js size 25379 */
/* begin /home/websites/stickk.com/web/js/forms/basics.js size 7564 */
var orClasses= new Array();

function setFieldType(el, t, bFocus)
{
	if (el.getAttribute('type').toLowerCase()==t.toLowerCase())
		return true;
	
  var newEl = el.cloneNode(true);
	
  try
	{
		newEl.setAttribute("type", t);
	}
	catch (xx)
	{
		try
		{
			newEl.type = ("type", t);
		}
		catch (xx2)
		{
			return false;
		}
	}
	el.parentNode.replaceChild(newEl, el);
	
	var obj = new Object();
	obj.ref = newEl;
	obj.focus = function() { obj.ref.focus(); }
	
	if ((typeof(bFocus)!='undefined') && bFocus)
		window.setTimeout( obj.focus, 5 );
	return false;
}

function checkNumber(theValue,isDec)
{
		if (isDec==1)
    {
			theValue=theValue.replace(".","");
			if (theValue==""){return false;}
			lc="1234567890";
		}
    else
    {
			lc="1234567890";
		}
		var tonum=1;  
		for (var k=0; k < theValue.length; k++)
    {
			var subs=theValue.substring(k, tonum);
			if (lc.indexOf(subs)==-1)
      {
				return false;
				break;
			}
      else
      {
				tonum+=1;
			}
		}
		return true;
}

function checkAlpha(theValue)
{
		lc="1234567890";
		lc= lc + "abcdefghijklmnopqrstuvwxyz";
		lc= lc + "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
		lc= lc + "_-";
		var tonum=1;
		for (var k=0; k < theValue.length; k++)
    {
			var subs=theValue.substring(k, tonum);
			if (lc.indexOf(subs)==-1)
      {
				return false;
				break;
			}
      else
      {
				tonum+=1;
			}
		}
		return true;
}

function checkAlpha2(theValue) // same as above but allows spaces
{
    lc="1234567890";
    lc= lc + "abcdefghijklmnopqrstuvwxyz";
    lc= lc + "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    lc= lc + "_- ";
    var tonum=1;
    for (var k=0; k < theValue.length; k++)
    {
      var subs=theValue.substring(k, tonum);
      if (lc.indexOf(subs)==-1)
      {
        return false;
        break;
      }
      else
      {
        tonum+=1;
      }
    }
    return true;
}


function checkHasSpecial(theValue)
{
		lc="";
		lc= lc + "abcdefghijklmnopqrstuvwxyz";
		lc= lc + "ABCDEFJHIJKLMNOPQRSTUVWXYZ";
		var tonum=1;
		var fc=0;
		for (var k=0; k < theValue.length; k++)
    {
			var subs=theValue.substring(k, tonum);
			if (lc.indexOf(subs)==-1)
      {
				fc++;
			}
			tonum+=1;
		}
		return fc;
}

function checkRegister(f)
{
	var errs='';
  
  var firstName = f.FName.value.toLowerCase();
  var lastName = f.LName.value.toLowerCase();
  var userName = f.Username.value.toLowerCase();
  
  if ((firstName.indexOf("stickk") > -1 || firstName.indexOf("stick") > -1))
  {
    errs=errs+'<p>Your <u>First Name</u> contains a reserved word, please choose another.</p>';
  }
  if ((lastName.indexOf("stickk") > -1 || lastName.indexOf("stick") > -1))
  {
    errs=errs+'<p>Your <u>Last Name</u> contains a reserved word, please choose another.</p>';
  }
  if ((userName.indexOf("stickk") > -1 || userName.indexOf("stick") > -1))
  {
    errs=errs+'<p>Your <u>Screen Name</u> contains a reserved word, please choose another.</p>';
  }
  

	if ((f.TermsConditions.type == "checkbox") && !f.TermsConditions.checked)
  {
    errs=errs+'<p>"I have read and accept the Terms of Use." is <b>NOT</b> checked.</p>';
  }

	if ((f.Birth_m.value==0)||(f.Birth_d.value==0)||(f.Birth_y.value==0))
  {
		errs=errs+'<p>Birth date is required</p>';
	}

	return errs;
}

function checkRegisterP(f)
{
  var errs='';
  
  if ((f.TermsConditions.type == "checkbox") && !f.TermsConditions.checked)
  {
    errs=errs+'<p>"I have read and accept the Terms of Use." is <b>NOT</b> checked.</p>';
  }

  return errs;
}

function checkPreRegister(f)
{
	var errs='';
	if ((f.TermsConditions.type == "checkbox") && !f.TermsConditions.checked)
  {
    errs=errs+'<p>"I agree to the Privacy Policy." is <b>NOT</b> checked.</p>';
  }
	return errs;
}

function checkAttach(form, file)
{
	allowSubmit = false;
	if (!file)
  {
		return false;
	}
  else
  {
		return true;
	}
}

function checkPostRegister(f)
{
	var errs='';
	if (checkAttach(f,f.Picture.value))
  {
		if ((f.TermsConditions.type == "checkbox") && !f.TermsConditions.checked)
    {
      errs=errs+'<p>"I certify that I have the right to redistribute this picture and that it is not pornography" is <b>NOT</b> checked.</p>';
    }
	}
	return errs;
}

function syncSelectFromValue(value, selectBox)
{
  for(var i=0; i<selectBox.length; i++)
    if(selectBox.options[i].value == value)
      selectBox.selectedIndex = i;
}

function syncSelectFromText(textValue, selectBox)
{
  for(var i=0; i<selectBox.length; i++)
    if(selectBox.options[i].text == textValue)
      selectBox.selectedIndex = i;
}

function setSelectBoxValue(textValue, selectBox)
{
  selectBox.options[0]=new Option(textValue, textValue, true, false)
}

function changeStartDate(newStartDate)
{
  //alert(newStartDate);
  
  startDate_ar = newStartDate.split(",");
  
  syncSelectFromValue(newStartDate, document.newContract01.startDay);
  
  clearSelectBox(document.newContract01.cStartDate_m);
  clearSelectBox(document.newContract01.cStartDate_d);
  clearSelectBox(document.newContract01.cStartDate_y);
  
  setSelectBoxValue(startDate_ar[0], document.newContract01.cStartDate_m);
  setSelectBoxValue(startDate_ar[1], document.newContract01.cStartDate_d);
  setSelectBoxValue(startDate_ar[2], document.newContract01.cStartDate_y);
  
  //alert("" + startDate_ar[2] + "/" + startDate_ar[0] + "/" + startDate_ar[1] + "")
  //calendar.parseDate("" + startDate_ar[2] + "/" + startDate_ar[0] + "/" + startDate_ar[1] + "");

  changeReportingDay(startDate_ar[3])
}

function changeCommitmentEndsOnDate(cal)
{
  if(cal.dateClicked)
  {
    var date = cal.date;
    var time = date.getTime()

    clearSelectBox(document.newContract01.cEndDate_m);
    clearSelectBox(document.newContract01.cEndDate_d);
    clearSelectBox(document.newContract01.cEndDate_y);
    
    setSelectBoxValue(date.print("%m"), document.newContract01.cEndDate_m);
    setSelectBoxValue(date.print("%d"), document.newContract01.cEndDate_d);
    setSelectBoxValue(date.print("%Y"), document.newContract01.cEndDate_y);
    
    //document.newContract01.commitmentEndsOn_calendar.value = date.print("%Y-%m-%d");
    document.newContract01.commitmentEndsOn_calendar.value = date.print("%m-%d-%Y");
  }
}

function changeCommitmentEndsOnDate_marathon(cal)
{
  //alert(1);
  if(cal.dateClicked)
  {
    var date = cal.date;
    var time = date.getTime()

    clearSelectBox(document.newContract01.cMarathonDate_m);
    clearSelectBox(document.newContract01.cMarathonDate_d);
    clearSelectBox(document.newContract01.cMarathonDate_y);
    
    setSelectBoxValue(date.print("%m"), document.newContract01.cMarathonDate_m);
    setSelectBoxValue(date.print("%d"), document.newContract01.cMarathonDate_d);
    setSelectBoxValue(date.print("%Y"), document.newContract01.cMarathonDate_y);
    
    //document.newContract01.commitmentEndsOn_calendar.value = date.print("%Y-%m-%d");
    document.newContract01.commitmentEndsOn_calendar.value = date.print("%m-%d-%Y");
  }
}


function resetStartDate()
{
  syncSelectFromText("Today", document.newContract01.startDay);
  setTimeout('changeStartDate(document.newContract01.startDay.value)', 100);
}

function changeReportingDay(day)
{
  try
  {
    var dayStr;
    
    if(day.charAt(day.length-1) == "s")
      dayStr = day;
    else
      dayStr = day + "s";
      
    if(currentLanguage == "es")
    {
      dayStr = "los " + dayStr.toLowerCase();
    }
    
    document.newContract01.reportingDays.value=dayStr
    
  }
  catch (err) {}
}

function clearSelectBox(selectBox)
{
  for(var i=selectBox.options.length-1; i>=0; i--) 
  {
    selectBox.removeChild(selectBox.options[i]);
  }
}
/* end /home/websites/stickk.com/web/js/forms/basics.js size 7564 */
/* begin /home/websites/stickk.com/web/js/forms/contract.js size 20286 */
var curStep=1;

function fRange(ft)
{
	//$('column0_4').innerHTML='';
	$('comm-type-0').style.display='none';
	$('comm-type-1').style.display='none';
	$('comm-type-2').style.display='none';
	$('journal-type-1').style.display='none';
  $('journal-type-2').style.display='none';
	$('journal-type-3').style.display='none';
  $('cigarettes').style.display='none';
	$('reportingDays_row').style.display='none';

  //alert(ft)
  
	switch (ft)
  {
	  case "-1": // one-shot
		  //$('column0_4').innerHTML='I commit to quit smoking by:';
		  $('comm-type-2').style.display='';
      $('journal-type-2').style.display='';
		  //$('journal-type-3').style.display='';
		  $('cigarettes').style.display='';
      //$('reportingDays_row').style.display='';
      
      resetStartDate();
      
    break;

    case "":
		  $('comm-type-0').style.display='';
		break;

    default: // ongoing
		  //$('column0_4').innerHTML='I commit not to smoke for:';
		  $('comm-type-1').style.display='';
      $('journal-type-1').style.display='';
		  $('journal-type-3').style.display='';
      $('reportingDays_row').style.display='';
		break;
	}
}

function cfRange(ft)
{

	$('journal-type-1').style.display='none';
  $('journal-type-2').style.display='none';
	$('journal-type-3').style.display='none';
  $('comm-type-0').style.display='none';
	$('comm-type-1').style.display='none';
	$('comm-type-2').style.display='none';

  try { $('reportingDays_row').style.display='none'; } catch(err){};
	try { $('custom-goal1').style.display='none'; } catch(err){};
	try { $('custom-goal2').style.display='none'; } catch(err){};
  try { $('custom-goal3').style.display='none'; } catch(err){};
  try { $('custom-goal4').style.display='none'; } catch(err){};
  try { $('custom-goal5').style.display='none'; } catch(err){};
  try { $('custom-goal6').style.display='none'; } catch(err){};
	try { $('custom-goal7').style.display='none'; } catch(err){};
	try { $('et01').style.display='none'; } catch(err){};
	try { $('et02').style.display='none'; } catch(err){};
	try { $('ec01').style.display='none'; } catch(err){};
	try { $('ec02').style.display='none'; } catch(err){};

	switch(ft+"")
  {
	  case "-1": // one-shot
      $('journal-type-2').style.display='';
		  $('comm-type-2').style.display='';
      
		  try { $('custom-goal1').style.display=''; } catch(err){};
		  try { $('custom-goal2').style.display=''; } catch(err){};
      try { $('custom-goal3').style.display=''; } catch(err){};
      try { $('custom-goal4').style.display=''; } catch(err){};
      try { $('custom-goal5').style.display='none'; } catch(err){};
      try { $('custom-goal6').style.display=''; } catch(err){};
		  try { $('custom-goal7').style.display=''; } catch(err){};
      try { $('et01').style.display=''; } catch(err){};
      try { $('et02').style.display=''; } catch(err){};
      try { $('ec01').style.display=''; } catch(err){};
      try { $('ec02').style.display=''; } catch(err){};
      
      resetStartDate();
      
		break;
      
	  case "":
		  $('comm-type-0').style.display='';
		break;

	  default: // ongoing
      $('journal-type-1').style.display='';
		  $('journal-type-3').style.display='';
		  $('comm-type-1').style.display='';
      
      try { $('reportingDays_row').style.display=''; } catch(err){};
		  try { $('custom-goal1').style.display=''; } catch(err){};
		  try { $('custom-goal2').style.display=''; } catch(err){};
		  try { $('custom-goal3').style.display=''; } catch(err){};
      try { $('custom-goal4').style.display=''; } catch(err){};
      try { $('custom-goal5').style.display=''; } catch(err){};
      try { $('custom-goal6').style.display=''; } catch(err){};
      try { $('custom-goal7').style.display=''; } catch(err){};
      try { $('et01').style.display=''; } catch(err){};
      try { $('et02').style.display=''; } catch(err){};
      try { $('ec01').style.display=''; } catch(err){};
      try { $('ec02').style.display=''; } catch(err){};
		break;
	}
}

function vst(vType)
{
		$('row_vfType01Header').style.display="none";
		$('row_vfType02Header').style.display="none";
    $('row_vfType05Header').style.display="none";
		$('row_vVerifier').style.display="none";

		switch (vType)
    {
			case "1":
				$('row_vfType01Header').style.display="";
			break;

			case "2":
				$('row_vVerifier').style.display="";
				$('row_vfType02Header').style.display="";
			break;

			case "4":
				$('row_vfType04Header').style.display="";
			break;

			case "5":
				$('row_vfType05Header').style.display="";
			break;

      case "9":
        $('row_vfType02Header').style.display="";
      break;
    }
}

function vstVoting(vType){
		$('row_vfType01Header').style.display="none";
		$('row_vfType02Header').style.display="none";
    $('row_vfType05Header').style.display="none";
		$('row_vVerifier').style.display="none";

		$('row_vVerifierZIP').style.display="none";
		$('row_vVerifierDOB').style.display="none";

		switch (vType)
    {
			case "1":
				$('row_vfType01Header').style.display="";
			break;

			case "2":
				$('row_vVerifier').style.display="";
				$('row_vfType02Header').style.display="";
			break;

			case "4":
				$('row_vfType04Header').style.display="";
			break;

			case "5":
				$('row_vfType05Header').style.display="";
				$('row_vVerifierZIP').style.display="";
				$('row_vVerifierDOB').style.display="";
			break;

      case "9":
        $('row_vfType02Header').style.display="";
      break;
		}
}

var frln=0;
var frmt=0;

function vRange(f)
{
	var nwmt=0;
	var nwln=0;

	frln=Math.round(f.cLength.value);
	nwmt = Math.round(f.cMultiplier.value);

	if (nwmt!=frmt)
  {
		nwln = frln * frmt;
		nwln = Math.round(nwln / nwmt);
		f.cLength.value = nwln;
	}
}

//function changeStep(f,s)
//{
//	if (s==curStep){return;}
//	if (s>curStep)
//  {
//		if (s==2)
//    {
//			var cType = f.cType.value;
//			switch (cType)
//      {
//				case "1": var vType = f.cType01vType.value; 
//        break;
//				
//        case "2": var vType = "9"; 
//        break;
//				
//        case "3": var vType = f.cType03vType.value; 
//        break;
//				
//        case "4": var vType = f.cType04vType.value; 
//        break;
//			}
//		}

//		$('step01').style.display='none';
//		$('step02').style.display='none';
//		$('step0'+s).style.display='';

//		$('row_vfNothingHeader').style.display='none';
//		$('row_cType03fType').style.display='none';
//		$('row_cType04fType').style.display='none';

//		$('row_fType01Header').style.display='none';
//		$('row_fType02Header').style.display='none';
//		$('row_fType03Header').style.display='none';
//		$('row_fType04Header').style.display='none';
//		$('row_fType05Header').style.display='none';

//		$('row_vfType01Header').style.display="none";
//		$('row_vfType02Header').style.display="none";
//		$('row_vfType04Header').style.display="none";
//		$('row_vfType05Header').style.display="none";
//		$('row_vfType03').style.display="none";

//		$('row_rTypefType01').style.display="none";
//		$('row_rTypefType05').style.display="none";
//		$('row_rType01Desc').style.display="none";
//		$('row_rType02Desc').style.display="none";
//		$('row_rAmount').style.display="none";

//		$('row_vfSupporterHeader').style.display="none";
//		$('row_vfFriendInvite').style.display="none";

//		if (s==2)
//    {
//		  switch (cType)
//      {
//			  case "1": $('row_vfNothingHeader').style.display='';
//        break;
//			  
//        case "2": $('row_vfNothingHeader').style.display='';
//        break;
//			  
//        case "3":
//        case "4":
//				  $('row_cType0' + cType + 'fType').style.display='';
//				  fst($('i_cType0' + cType + 'fType').value);
//		  }
//		  
//      switch (vType)
//      {
//			  case "1":
//				  $('row_vfType01Header').style.display="";
//			  break;
//			  
//        case "2":
//				  $('row_vfType03').style.display="";
//			  break;
//			  
//        case "3":
//				  $('row_vfType04Header').style.display="";
//			  break;
//			  
//        case "4":
//				  $('row_vfType05Header').style.display="";
//			  break;

//        case "9":
//          $('row_vfType02Header').style.display="";
//        break;
//		  }
//		}
//	}
//  else
//  {
//		$('step01').style.display='none';
//		$('step02').style.display='none';
//		$('step0'+s).style.display='';
//	}
//	curStep=s;
//}

//function rst(v)
//{
//	$('row_rType01Desc').style.display="none";
//	$('row_rType02Desc').style.display="none";
//	
//  if (v!="")
//  {
//		$('row_rType0'+v+'Desc').style.display="";
//	}
//}

function changeAntiCharityCountry(country)
{
  //$('charity-type').style.display='none';
  $('charity-type_US').style.display='none';
  $('charity-type_UK').style.display='none';

  switch(country)
  {
    case "US":
      //$('charity-type').style.display='';
      $('charity-type_US').style.display='';
      $('charity-type_UK').style.display='none';
      document.forms['newContract02'].charityType.value = 0
      document.forms['newContract02'].charityType_US.selectedIndex = 0;
      document.forms['newContract02'].charityType_UK.selectedIndex = 0;
    break;
    
    case "UK":
      //$('charity-type').style.display='none';
      $('charity-type_US').style.display='none';
      $('charity-type_UK').style.display='';
      document.forms['newContract02'].charityType.value = 0
      document.forms['newContract02'].charityType_US.selectedIndex = 0;
      document.forms['newContract02'].charityType_UK.selectedIndex = 0;
    break;
  }
}

function affectAntiCharity(v)
{
  document.forms['newContract02'].charityType.value=v;
}

function fst(v)
{
  
 	// if there are no stakes, unselect payment options
  if (v == 0) {
  	$$('input[name=selectPayment]').each(function (el) {
  			el.checked = false;
		});
	}
	
  
	try { $('row_rAmount').style.display="none"; } catch(err){};
	try { $('row_NumPeriods').style.display="none"; } catch(err){};
	try { $('row_rAmountTot').style.display="none"; } catch(err){};

	try { $('row_chFriendInvite').style.display="none"; } catch(err){};
	try { $('row_chGroupInvite').style.display="none"; } catch(err){};

  try { $('row_AmountHeaderDesc').style.display="none"; } catch(err){};
  
  try { $('row_keepMeMotivatedBar').style.display="none"; } catch(err){};
  try { $('row_keepMeMotivated_spacer_1').style.display="none"; } catch(err){};
  try { $('row_keepMeMotivatedContent').style.display="none"; } catch(err){};
  try { $('row_keepMeMotivated_spacer_2').style.display="none"; } catch(err){};

  try { $('row_amountAtStakeBar').style.display="none"; } catch(err){};
  try { $('row_amountAtStake').style.display="none"; } catch(err){};
  try { $('row_paymentMethodBar').style.display="none"; } catch(err){};
  try { $('row_paymentMethod').style.display="none"; } catch(err){};
  try { $('row_creditCardForm').style.display="none"; } catch(err){};

  try { $('row_AmountHeaderDesc_2').style.display="none"; } catch(err){};

	try { $('row_fType00Header').style.display='none'; } catch(err){};
	try { $('row_fType02Header').style.display='none'; } catch(err){};
	try { $('row_fType03Header').style.display='none'; } catch(err){};
	try { $('row_fType04Header').style.display='none'; } catch(err){};
	try { $('row_fType04aHeader').style.display='none'; } catch(err){};
	try { $('row_fType06Header').style.display='none'; } catch(err){};
	try { $('row_AmountHeaderDesc').style.display="none"; } catch(err){};
  try { $('country-charity-type').style.display='none'; } catch(err){};
  try { $('charity-type').style.display='none'; } catch(err){};
  try { $('charity-type_US').style.display='none'; } catch(err){};
  try { $('charity-type_UK').style.display='none'; } catch(err){};

  if(parseInt(v) == -1)
  {
    try { $('row_fType04aHeader').style.display=''; } catch(err){};
  }
	
  switch(parseInt(v))
  {
//		case 1:
//			$('row_rTypefType01').style.display="";
//			rst($('i_rTypefType01').value);
//			$('row_chFriendInvite').style.display="";
//		break;
		
    case 2:
			try { $('row_rAmount').style.display=""; } catch(err){};
			try { $('row_NumPeriods').style.display=""; } catch(err){};
			try { $('row_rAmountTot').style.display=""; } catch(err){};
			try { $('row_chFriendInvite').style.display=""; } catch(err){};
			try { $('row_AmountHeaderDesc').style.display=""; } catch(err){};
      
      try { $('row_keepMeMotivatedBar').style.display=""; } catch(err){};
      try { $('row_keepMeMotivated_spacer_1').style.display=""; } catch(err){};
      try { $('row_keepMeMotivatedContent').style.display=""; } catch(err){};
      try { $('row_keepMeMotivated_spacer_2').style.display=""; } catch(err){};

      try { $('row_amountAtStakeBar').style.display=""; } catch(err){};
      try { $('row_amountAtStake').style.display=""; } catch(err){};
      try { $('row_paymentMethodBar').style.display=""; } catch(err){};
      try { $('row_paymentMethod').style.display=""; } catch(err){};
      try { $('row_creditCardForm').style.display=""; } catch(err){};
		break;
		
//    case 3:
//			$('row_rAmount').style.display="";
//			$('row_NumPeriods').style.display="";
//			$('row_rAmountTot').style.display="";
//			$('row_AmountHeaderDesc').style.display="";
//      $('row_amountAtStakeBar').style.display="";
//      $('row_amountAtStake').style.display="";
//      $('row_paymentMethodBar').style.display="";
//      $('row_paymentMethod').style.display="";
//      $('row_creditCardForm').style.display="";
//		break;
		
    case -1: // anti-charity
		case 4: // charity
			try { $('row_rAmount').style.display=""; } catch(err){};
			try { $('row_NumPeriods').style.display=""; } catch(err){};
			try { $('row_rAmountTot').style.display=""; } catch(err){};
			try { $('row_AmountHeaderDesc').style.display=""; } catch(err){};

      try { $('row_keepMeMotivatedBar').style.display=""; } catch(err){};
      try { $('row_keepMeMotivated_spacer_1').style.display=""; } catch(err){};
      try { $('row_keepMeMotivatedContent').style.display=""; } catch(err){};
      try { $('row_keepMeMotivated_spacer_2').style.display=""; } catch(err){};

      try { $('row_amountAtStakeBar').style.display=""; } catch(err){};
      try { $('row_amountAtStake').style.display=""; } catch(err){};
      try { $('row_paymentMethodBar').style.display=""; } catch(err){};
      try { $('row_paymentMethod').style.display=""; } catch(err){};
      try { $('row_creditCardForm').style.display=""; } catch(err){};

			if (parseInt(v)==-1) // anti-charity
      {
        try { $('country-charity-type').style.display=''; } catch(err){};
        changeAntiCharityCountry("US");
			}
      else // charity
      {
				try { document.forms['newContract02'].charityType.value=0; } catch(err){};
			}
		break;
		
//    case 5:
//			$('row_rAmount').style.display="";
//			$('row_NumPeriods').style.display="";
//			$('row_rAmountTot').style.display="";
//      
//      $('row_amountAtStakeBar').style.display="";
//      $('row_amountAtStake').style.display="";
//      $('row_paymentMethodBar').style.display="";
//      $('row_paymentMethod').style.display="";
//      $('row_creditCardForm').style.display="";
//		break;

	}

}

function st(v)
{
	$('row_cFriendList').style.display="none";
	$('row_cFriendInvite').style.display="none";

	$('row_cType01vType').style.display="none";
	$('row_cType02vType').style.display="none";
	$('row_cType03vType').style.display="none";
	$('row_cType04vType').style.display="none";
	$('row_cHeader02').style.display="none";
	$('row_cChallengeInvite').style.display="none";

	if (v==""){return;}
	$('row_cType0'+v+'vType').style.display="";

	switch (v)
  {
		case "3":
			$('row_cChallengeInvite').style.display="";
			$('row_cFriendList').style.display="";
			$('row_cFriendInvite').style.display="";
			$('row_cHeader02').style.display="";

		break;
		
    case "1":
		case "4": //for charity define those in next step
			$('row_cFriendList').style.display="";
			$('row_cFriendInvite').style.display="";
			$('row_cHeader02').style.display="";
		break;
	}
}

function validateChoices(f)
{
	var errs="";	
	
	switch (f.cType.value)
  {
		case "1":
			if (f.cFriendInvite.value==0){errs=errs+get_constant("JS_CONTRACT_INVITE_FRIENDS_CANT_BE_EMPTY")+'\n';}
			if (f.cType01vType.value==0){errs=errs+get_constant("JS_CONTRACT_VERIFICATION_CANT_BE_EMPTY")+'\n';}
		break;
		case "3":
			if (f.cType03vType.value==0){errs=errs+get_constant("JS_CONTRACT_VERIFICATION_CANT_BE_EMPTY")+'\n';}
		break;
		case "4":
			//if (f.cFriendInvite.value==0){errs=errs+'Invite friends: Cannot be empty!\n';}
			if (f.cType04vType.value==0){errs=errs+get_constant("JS_CONTRACT_VERIFICATION_CANT_BE_EMPTY")+'\n';}
		break;
	}
  
	errs=errs+validateChoicesExt(f);
	return errs;
}


function checkStakes(f)
{
	var errs="";	
	
  //alert(f.fType.value);
	
  var minimumStake = f.minimumStake.value;
  
  //alert(minimumStake);
  
  switch (f.fType.value)
  {
		case "2":	
			if (f.rAmount.value==0)
			{
				errs=errs+get_constant("JS_CONTRACT_AMOUNT_AT_STAKE_CANT_BE_EMPTY")+'<br />';
			}
			else
			{
				if (!checkNumber(f.rAmount.value,1))
				{
					errs=errs+get_constant("JS_CONTRACT_STAKE_MUST_BE_DOLLAR_VALUE")+'<br />';
				}
				else
				{
					if (f.rAmount.value<parseInt(minimumStake))
					{
						errs=errs+get_constant("JS_CONTRACT_STAKE_MUST_BE_AT_LEAST_FIVE_DOLLARS").replace(/MIN_STAKE/i, minimumStake)+'<br />';
					}
				}
			}
			if (f.chFriendInvite.value==0)
			{
				errs=errs+get_constant("JS_CONTRACT_RECIPIENT_CANT_BE_EMPTY")+'<br />';
			}

			if (!(total_amount_normal<10000)){
				errs=errs+get_constant("JS_CONTRACT_STAKE_CANT_BE_10000_OR_MORE")+'<br />';
			}
		break;
    
		case "3":	
			if (f.rAmount.value==0)
			{
				errs=errs+get_constant("JS_CONTRACT_AMOUNT_AT_STAKE_CANT_BE_EMPTY")+'<br />';
			}
			else
			{
				if (!checkNumber(f.rAmount.value,1))
				{
					errs=errs+get_constant("JS_CONTRACT_STAKE_MUST_BE_DOLLAR_VALUE")+'<br />';
				}
				else
				{
					if (f.rAmount.value<parseInt(minimumStake))
					{
						errs=errs+get_constant("JS_CONTRACT_STAKE_MUST_BE_AT_LEAST_FIVE_DOLLARS").replace(/MIN_STAKE/i, minimumStake)+'<br />';
					}
				}
			}

			if (!(total_amount_normal<10000))
      {
				errs=errs+get_constant("JS_CONTRACT_STAKE_CANT_BE_10000_OR_MORE")+'<br />';
			}
		break;
    
		case "-1":
		case "4":
			if (f.rAmount.value==0)
			{
				errs=errs+get_constant("JS_CONTRACT_AMOUNT_AT_STAKE_CANT_BE_EMPTY")+'<br />';
			}
			else
			{
				if (!checkNumber(f.rAmount.value,1))
				{
					errs=errs+get_constant("JS_CONTRACT_STAKE_MUST_BE_DOLLAR_VALUE")+'<br />';
				}
				else
				{
					if (f.rAmount.value<parseInt(minimumStake))
					{
						errs=errs+get_constant("JS_CONTRACT_STAKE_MUST_BE_AT_LEAST_FIVE_DOLLARS").replace(/MIN_STAKE/i, minimumStake)+'<br />';
					}

				}
			}

			if (f.fType.value=="-1"){
				if (f.charityType.value=="0"){
					errs=errs+get_constant("JS_CONTRACT_MUST_SELECT_ANTI_CHARITY_PREFERENCE")+'<br />';
				}
			}

			if (!(total_amount_normal<10000)){
				errs=errs+get_constant("JS_CONTRACT_STAKE_CANT_BE_10000_OR_MORE")+'<br />';
			}
		break;
    
		case "6":
			errs=errs+get_constant("JS_CONTRACT_GROUP_CONTRACT_SELECTION_SOON")+'<br />';
		break;
	}
	return errs;
}

function checkVerifier(f)
{
	var errs="";	
	
  switch (f.vType.value)
	{
		case "2":	
			if (f.vVerifier.value==0)
			{
				errs=errs+get_constant("JS_CONTRACT_INDIVIDUAL_REFEREE_CANT_BE_EMPTY")+'<br />';
			}
		break;
	}
	return errs;
}

function checkVerifierVoting(f)
{
	var errs="";	
	
  switch (f.vType.value)	
	{
		case "2":	
			if (f.vVerifier.value==0)
			{
				errs=errs+get_constant("JS_CONTRACT_INDIVIDUAL_REFEREE_CANT_BE_EMPTY")+'<br />';
			}

		break;
    
		case "5":	
			if (f.cVotingZIP.value==0)
			{
				errs=errs+get_constant("JS_CONTRACT_MUST_ENTER_ZIP_CODE")+'<br />';
			}
			if ((f.cVotingDOB_y.value==0)||(f.cVotingDOB_m.value==0)||(f.cVotingDOB_d.value==0))
			{
				errs=errs+get_constant("JS_CONTRACT_MUST_ENTER_BIRTH_DATE")+'<br />';
			}
		break;
	}
	return errs;
}

function confirmCancel(sid, cid, redirectURL)
{
	var msgText = get_constant("JS_CANCEL_CONFIRM");
	var yesEval = "";
	
	if(redirectURL==null)
	{	
		yesEval = "location.href='/members/index.php/sid/" + sid + "/action/kc/cid/" + cid + "'";
	}
	else
	{
		yesEval = "location.href='" + redirectURL + "'";
	}
	
	var noEval = "";
  
	confirmOverlay(msgText, yesEval, noEval);
}

/* end /home/websites/stickk.com/web/js/forms/contract.js size 20286 */
/* begin /home/websites/stickk.com/web/js/forms/user-forms.js size 312 */
function user_form_avatar(uid){
	setTimeout("$('user-box-"+uid+"-loader').style.display='';",150);
	//setTimeout("$('user-box-"+uid+"-cancel').disabled=true;",150);
	setTimeout("$('user-box-"+uid+"-submit').disabled=true;",150);
	setTimeout("$('user-box-"+uid+"-file').disabled=true;",150);
	return true;
}
/* end /home/websites/stickk.com/web/js/forms/user-forms.js size 312 */
/* begin /home/websites/stickk.com/web/js/forms/journal.js size 6192 */
function postType(st,pid)
{
	/*if (st==99){
		$('post-message-' + pid).style.display="none";
		$('post-report-info-' + pid).style.display="";
		$('post-report-data-' + pid).style.display="";
	}else{
		$('post-message-' + pid).style.display="";
		$('post-report-info-' + pid).style.display="none";
		$('post-report-data-' + pid).style.display="none";

	}*/
}

function checkJournalPost(f)
{        
  try
  {
    updateDailyModule()
  }
  catch(err){}
  
  
	var asdf = f.pid.value;
	
  //alert( !MOBILE ) ;
	//var overlayOptions = { shadow: false, width: 300 };
  if ( !MOBILE ) {
    var overlayOptions = { shadow: false } ;
    mb_alert_width = 0 ;
  }
  else {
    var overlayOptions = { shadow: false, width: 250 };
    mb_alert_width = 250 ; 
  }
	
	if (f.Status.value!=99)
	{ //treat as normal post

		var qs=Form.serialize(f);

		//send('elements/commitments/commitment-journal-form.inc.php', Form.serialize(f) ,  'execute', '');
		//$('journal-post-form-' + f.pid.value).innerHTML='Posting...';
		//window.setTimeout("$('journal-post-form-" +asdf+ "').innerHTML='Your entry has been posted!';",3000);    
		send('/members/elements/commitments/journal-referee-confirm.php', qs, 'overlay', overlayOptions);
    

	}
	else
	{
     
		//var md = Math.round(f.MessageData.value);
		var ct = Math.round(f.ctarget.value);

		var qs="";
		qs = qs + "Action=" + escape(f.Action.value) + "&" ;
		qs = qs + "sid=" + escape(f.sid.value) + "&" ;
		qs = qs + "cb=" + escape(f.cb.value) + "&" ;
		//qs = qs + "uid=" + escape(f.uid.value) + "&";
		qs = qs + "cid=" + escape(f.cid.value) + "&" ;
		qs = qs + "pid=" + escape(f.pid.value) + "&" ;
		qs = qs + "ctype=" + escape(f.ctypeid.value) + "&" ;
		qs = qs + "ct=" + escape(f.ctarget.value) + "&" ;
		qs = qs + "md=" + escape(f.MessageData.value) + "&" ;
		qs = qs + "Status=" + escape(f.Status.value) + "&" ;
    qs = qs + "cmu=" + escape(f.cmu.value) + "&" ;
    qs = qs + "customContractTypeID=" + escape(f.customContractTypeID.value) + "&" ;
    if(f.customContractTypeID.value>0)
    {
      if(f.customContractResponse_1)
        qs = qs + "customContractResponse_1=" + escape(f.customContractResponse_1.value) + "&" ;
      if(f.customContractResponse_2)
        qs = qs + "customContractResponse_2=" + escape(f.customContractResponse_2.value) + "&" ;
    }
    qs = qs + "cCustomReportingFrequency=" + escape(f.cCustomReportingFrequency.value) + "" ;
     
		switch (f.ctypeid.value)
		{
      case "17": //custom contract (contract engine)
        
        var errs = "";
        var dailyFormCheckOK = true;
        
        if(f.customContractResponse_1 && f.customContractResponse_2)
        {
          if ( ( (f.customContractResponse_1.value.length==0) && (f.customContractResponse_1.value!="spoof") ) || (f.customContractResponse_2.value.length==0 && (f.customContractResponse_2.value!="spoof")) )
          {
            errs += get_constant("  JS_REPORT_CUSTOM_MUST_ANSWER_MULTIPLE") + '<br />';
          }
        }
        else if(f.customContractResponse_1)
        {
          if ( ( (f.customContractResponse_1.value.length==0) && (f.customContractResponse_1.value!="spoof") ) )
          {
            errs += get_constant("  JS_REPORT_CUSTOM_MUST_ANSWER_SINGLE") + '<br />';
          }
        }
        
        if ( (f.variable_1_type.value=="number") && (f.customContractResponse_1.value!="spoof") && (!checkNumber(f.customContractResponse_1.value,1) ) )
        {
          if(errs.length == 0)
            errs += get_constant("JS_REPORT_CUSTOM_FIRST_ANSWER_NUMBER") + '<br />';
        }
        else if ( (f.variable_2_type.value=="number") && (f.customContractResponse_2.value!="spoof") && (!checkNumber(f.customContractResponse_2.value,1) ) )
        {
          if(errs.length == 0)
            errs += get_constant("JS_REPORT_CUSTOM_SECOND_ANSWER_NUMBER") + '<br />';
        }
        else
        {
          try
          {
            dailyFormCheckOK = checkDailyModule();
          }
          catch (err) {}
        }

        if(!dailyFormCheckOK)
          errs += get_constant("JS_REPORT_CUSTOM_FILL_DAILY_GRID");
        
        if(errs.length > 0)
          displayAlert(errs);
        else
          send('/members/elements/commitments/journal-customContract-confirm.php', qs, 'overlay', overlayOptions);
        
      break;
			case "1": //weight
				if ( (!checkNumber(f.MessageData.value,1)) || (f.MessageData.value==0) )
				{                                                                 
          displayAlert(get_constant("JS_REPORT_WEIGHT_BLANK_NUMBER"), mb_alert_width);
				}
				else
				{
					send('/members/elements/commitments/journal-weight-confirm.php', qs, 'overlay', overlayOptions);
				}
	
			break;
			case "14": //weightm
				if ( (!checkNumber(f.MessageData.value,1)) || (f.MessageData.value==0) )
				{   
          displayAlert(get_constant("JS_REPORT_WEIGHT_BLANK_NUMBER"), mb_alert_width);
				}
				else
				{
					send('/members/elements/commitments/journal-weightm-confirm.php', qs, 'overlay', overlayOptions);
				}
	
			break;

			case "2": //smoking
				send('/members/elements/commitments/journal-smoking-confirm.php', qs, 'overlay', overlayOptions);
				
			break;
			case "4": //gym
        
				if ( (!checkNumber(f.MessageData.value,0)) || (f.MessageData.value=="") )
				{         
          displayAlert(get_constant("JS_REPORT_EXERCISE_BLANK_WHOLE_ALERT"), mb_alert_width );
				}
				else
				{
					if (f.MessageData.value<=7)
					{
						send('/' + MOBILE_FOLDER + 'members/elements/commitments/journal-gym-confirm.php', qs, 'overlay', overlayOptions);
					}
					else
					{
						displayAlert(get_constant("JS_REPORT_EXERCISE_GREATER_THAN_SEVEN"), mb_alert_width);
					}
				}
			break;
      
			case "13": //custom      
				send('/'+ MOBILE_FOLDER +'members/elements/commitments/journal-custom-confirm.php', qs, 'overlay', overlayOptions);
			break;
      
			case "15": //voting
				send('/members/elements/commitments/journal-voting-confirm.php', qs, 'overlay', overlayOptions);
			break;
			case "16": //marathon
				send('/members/elements/commitments/journal-marathon-confirm.php', qs, 'overlay', overlayOptions);
			break;
		}
	}
}


/* end /home/websites/stickk.com/web/js/forms/journal.js size 6192 */
/* begin /home/websites/stickk.com/web/js/forms/transfer-delivery.js size 1978 */
function cdt(v){
	$('rest-address1').style.display='none';
	$('rest-address2').style.display='none';
	$('rest-city').style.display='none';
	$('rest-state').style.display='none';
	$('rest-country').style.display='none';
	$('rest-zip').style.display='none';

	$('header-paypal-div').style.display='none';
	$('header-paypal').style.display='none';


	switch (parseInt(v)){ //parseInt = wow, asp style types.
		case 0:
			$('rest-address1').style.display='';
			$('rest-address2').style.display='';
			$('rest-city').style.display='';
			$('rest-state').style.display='';
			$('rest-country').style.display='';
			$('rest-zip').style.display='';
			$('column0_5').innerHTML="Email:";
			$('column0_6').innerHTML="Confirm Email:";


		break;
		case 1:
			$('header-paypal-div').style.display='';
			$('header-paypal').style.display='';
			$('column0_5').innerHTML="PayPal Account (Email):";
			$('column0_6').innerHTML="Confirm PayPal Account:";

		break;
	}
}

function checkRestitution(f){

	var rType = parseInt(f.Type.value);

	var rerrs='';
	
  if (f.EMail.value!=f.confEMail.value){
    rerrs=rerrs + '<p><b>Your PayPal account (email) is not properly confirmed</b></p>';
  }

	switch (rType){
		case 0:
			if (f.Address1.value==0){rerrs=rerrs + '<p><b>Please enter your address (line 1)</b></p>';}
			if (f.City.value==0){rerrs=rerrs + '<p><b>Please enter your city</b></p>';}
			if (f.State.value==0){rerrs=rerrs + '<p><b>Please enter your state</b></p>';}
			if (f.Country.value==0){rerrs=rerrs + '<p><b>Please select your country</b></p>';}
			if (f.ZIP.value==0){rerrs=rerrs + '<p><b>Please enter your ZIP/Postal code</b></p>';}
			if ((f.Phone1.value==0)&&(f.Phone2.value==0)){rerrs=rerrs + '<p><b>Please enter at least one phone number!</b></p>';}
		break;
	}

  if (f.ffoeTermsChk.checked == false)
  {
    rerrs=rerrs + '<p><b>You must accept the terms before proceeding</b></p>';
  }
  
	return rerrs;

}
/* end /home/websites/stickk.com/web/js/forms/transfer-delivery.js size 1978 */
