function editcontact(id)
 {
 $('edit_contact_id').value = id;
 $('doedit').submit();
 }
function deletecontact(id)
 {
 $('delete_contact_id').value = id;
 $('dodelete').submit();
 }
function getcontacts(p,s)
 {
 $('page').value = p;
 $('show').value = s;
 $('dolist').submit();
 }
function editlist(id)
 {
 $('edit_list_id').value = id;
 $('doedit').submit();
 }
function deletelist(id)
 {
 $('delete_list_id').value = id;
 $('dodelete').submit();
 }
function calculateprice(count)
 {
 	if (count<50) $('pricespan').innerHTML = 'AUD$0.00';
	else if (count<200) $('pricespan').innerHTML = 'AUD$'+(count*0.16).toFixed(2)+' ($0.16 each)';
	else if (count<1000) $('pricespan').innerHTML = 'AUD$'+(count*0.16).toFixed(2)+' ($0.16 each)';
	else if (count>49) $('pricespan').innerHTML = 'AUD$'+(count*0.16).toFixed(2)+' ($0.16 each)';
 	else $('pricespan').innerHTML = 'AUD$0.00';
 }
function updatecounts()
 {
  $('submit').disabled = false;
	var message = $('message').value;
  var chars = message.length;
	var sms = 1;
	if (chars > 160)
	{
		// max (3) messages/char count
		if (chars > 465) {
			alert("You have reached the maximum character limit for one extended SMS message (3 parts)");
			sms = 3;
			$('submit').disabled = true;
		} else {
			sms = 1 + Math.floor(chars/155);
		}
	}
  $('chars').innerHTML = ' <strong>'+chars+'</strong> Chars in <strong>'+((sms>3)?3:sms)+'</strong> Messages';
  return true
 }

/*  ResizeableTextarea for the Prototype JavaScript framework, version 0.2
 *  (c) 2006 Bermi Ferrer <info -a-t bermi org>
 *
 *  ResizeableTextarea is freely distributable under the terms of an MIT-style license.
 *
 *  Requirements: Prototype JS framework http://prototypejs.org/
 *  Ussage: Add this attribute to the textarea you want to resize 
 *
 *    onfocus="new ResizeableTextarea(this);"
 *
/*--------------------------------------------------------------------------*/
ResizeableTextarea = Class.create();
ResizeableTextarea.prototype = {
  initialize: function(element, options) {
    this.element = $(element);
    this.size = parseFloat(this.element.getStyle('height') || '100');
    this.options = Object.extend({
      inScreen: true,
      resizeStep: 10,
      minHeight: this.size
      }, options || {});
    Event.observe(this.element, "keyup", this.resize.bindAsEventListener(this));
    if ( !this.options.inScreen ) {
      this.element.style.overflow = 'hidden';
    }
    /*this.element.setAttribute("wrap","soft");*/
    this.resize();
  },
  resize : function(){
    this.shrink();
    this.grow();
  },
  shrink : function(){
    if ( this.size <= this.options.minHeight ){
      return;
    }
    if ( this.element.scrollHeight <= this.element.clientHeight) {
      this.size -= this.options.resizeStep;
      this.element.style.height = this.size+'px';
      this.shrink();
    }
  },
  grow : function(){
    if ( this.element.scrollHeight > this.element.clientHeight ) {
      if ( this.options.inScreen && (20 + this.element.offsetTop + this.element.clientHeight) > document.body.clientHeight ) {
        return;
      }
      this.size += (this.element.scrollHeight - this.element.clientHeight) + this.options.resizeStep;
      this.element.style.height = this.size+'px';
      this.grow();
    }
  }
}
/* Onload events now */
Event.observe(window,'load',
  function(){
    if( $('themessage') )
    {
      window.setTimeout("Effect.SlideUp('themessage')",5000)
    }
  });