
  function fill_time() {
    var h,m,s,t,d,a,d1,m1,y1,m2;
    t = new Date();
    h = t.getHours();
    m = t.getMinutes();
    s = t.getSeconds();
    h = ((h<10)?'0':'')+h;
    m = ((m<10)?'0':'')+m;
    s = ((s<10)?'0':'')+s;
    t = ' (' + h + ':' + m + ':' + s + ')';
    var element = window.document.getElementById('casx');
    if (element != null || element != undefined)
      element.innerHTML = t;  
    //ele.style.display = 'none';
  }

  function run_email(prefix, postfix) {
    document.location = 'mailto:' + prefix + '@' + postfix;
  }
  
  function fill_email(element_id, prefix, postfix) {
    var element = window.document.getElementById(element_id);
    if (element != null || element != undefined)
      element.innerHTML = prefix + '@' + postfix;      
  }
  
  function fill_email_str(prefix, postfix) {
    return prefix + '@' + postfix;      
  }
  
  function hide_loading() {
    var ele = document.getElementById('loading');
    ele.style.display = 'none';
  }
  
  function show_loading() {
    var ele = document.getElementById('loading');
    ele.style.display = 'block';
  }






// ADAMS's RADIO CUSTOMISATION
// adam.burmister@gmail.com, Copyright 2005.


/**
NAME: initARC()

ABOUT:
 Detects the current user browser and customises the form's radio buttons if
 the browser is not IE mac, <= IE 4 or NS4.

USAGE:
 In your main HTML body use onLoad() to call initARC(), passing in the form id
 and on/off class names you wish to use to customise your radio buttons.
 e.g. <body onLoad="initARC('myform','radioOn', 'radioOff');">

PARAMS:
 formId   - The ID of the form you wish to customise
 onClass  - The CSS class name for the radio button's on style
 offClass - The CSS class name for the radio button's off style
*/
function initARC(onClassRadio,offClassRadio,onClassCheckbox,offClassCheckbox) {
    var agt=navigator.userAgent.toLowerCase();

    // Browser Detection stuff
    this.major = parseInt(navigator.appVersion);
    this.ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
    this.ie3    = (this.ie && (this.major < 4));
    this.ie4    = (this.ie && (this.major == 4) && (agt.indexOf("msie 4")!=-1) );
	this.iemac  = (this.ie && (agt.indexOf("mac")!=-1));

	if( !(this.iemac || ie3 || ie4) ){
		customiseInputs(onClassRadio,offClassRadio,onClassCheckbox,offClassCheckbox);
	}
}



//Add a .label reference to all input elements. Handy! Borrowed from...
//http://www.codingforums.com/archive/index.php/t-14672
function addLabelProperties(f){
	if(typeof f.getElementsByTagName == 'undefined') return;
	var labels = f.getElementsByTagName("label"), label, elem, i = j = 0;

	while (label = labels[i++]){
		if(typeof label.htmlFor == 'undefined') return;
		elem = document.getElementById(label.htmlFor);
		//elem = f.elements[label.htmlFor]; /* old method */

		if(typeof elem == 'undefined'){
			//no label defined, find first sub-input
			var inputs = label.getElementsByTagName("input");
			if(inputs.length==0){
				continue;
			} else {
				elem=inputs[0];
			}
		} else if(typeof elem.label != 'undefined') { // label property already added
			continue;
		} else if(typeof elem.length != 'undefined' && elem.length > 1 && elem.nodeName != 'SELECT'){
			for(j=0; j<elem.length; j++){
				elem.item(j).label = label;
			}
		}
		elem.label = label;
	}
}



/**
NAME: toggleLabelStyle()

ABOUT:
 This function is attached to our label's onClick event. So when the label is
 clicked this function alters the radio group's members to an unchecked state
 and style, and alters the currently selected label to the on style and checked
 state.

USAGE:
 ARC currently assumes that the label contains a FOR='id' in it's HTML. The other
 valid form of a label is <label>text <input /></label> - while it is possible
 to modify this code to allow for this form I have left this as an exercise for
 the reader.

PARAMS:
 formId   - Parent form of this label
 label    - The label for a radio button we wish to toggle
 onClass  - The CSS class name for the radio button's on style
 offClass - The CSS class name for the radio button's off style
*/
function toggleLabelStyle( label, onClass, offClass){
	if(!document.getElementById || !label) return;

	var form = label.firstChild.form; //label.form;
	if(!form) return;

	//find radio associated with label (if in htmlFor form)
	if(label.firstChild) {
		var e = label.firstChild;

		if(e.type=="checkbox"){
			e.parentNode.className = (e.parentNode.className==onClass) ? offClass : onClass;
			e.checked = (e.parentNode.className==onClass);
		} else if(e.type=="radio"){
			var radioGroup = form.elements[e.name];
			if(!radioGroup) return;

			for(var i=0; i<radioGroup.length; i++){
        radioGroup[i].checked = (radioGroup[i] == e);
        if(radioGroup[i].parentNode){
					radioGroup[i].parentNode.className = (radioGroup[i].checked) ? onClass : offClass;
				}
			}
		}
	}
}


