function showDateTime(id)
{
	
	if (!document.layers&&!document.all&&!document.getElementById)
		return
	if (id == null)
		return
	var Digital=new Date();
	var hours=Digital.getHours();
	var minutes=Digital.getMinutes();
	var seconds=Digital.getSeconds();
	var day=Digital.getDate();
	var month=Digital.getMonth();
	var year=Digital.getFullYear();
	var dn="AM" ;
	if (hours>12)
	{
		dn="PM";
		hours=hours-12;
	}
	if (hours==0)
		hours=12;
	if (minutes<=9)
		minutes="0"+minutes;
	if (seconds<=9)
		seconds="0"+seconds;
	if (day<=9)
		day = "0"+day;
	month=month+1;

	if (month==1)
		month = "Jan";
	if (month==2)
		month = "Feb";
	if (month==3)
		month = "Mar";
	if (month==4)
		month = "Apr";
	if (month==5)
		month = "May";
	if (month==6)
		month = "Jun";
	if (month==7)
		month = "Jul";
	if (month==8)
		month = "Aug";
	if (month==9)
		month = "Sep";
	if (month==10)
		month = "Oct";
	if (month==11)
		month = "Nov";
	if (month==12)
		month = "Dec"; 
	
	myclock=day + " "+ month + " " + year + " "+hours+":"+minutes+" "+dn; 

	document.getElementById(id).innerHTML=myclock;
	setTimeout("showDateTime('"+id+"')",10000);
 }
 
 function getLocalDateTime(id)
{
	
	if (!document.layers&&!document.all&&!document.getElementById)
		return
	if (id == null)
		return
	var Digital=new Date();
	var hours=Digital.getHours();
	var minutes=Digital.getMinutes();
	var seconds=Digital.getSeconds();
	var day=Digital.getDate();
	var month=Digital.getMonth();
	var year=Digital.getFullYear();
	var dn="AM" ;
	if (hours<10)
	{
		hours="0"+hours;
	}
		
	if (minutes<=9)
		minutes="0"+minutes;
	
	if (seconds<=9)
		seconds="0"+seconds;
	
	if (day<=9)
		day = "0"+day;
	month=month+1;
	
	if (month==1)
		month = "01";
	if (month==2)
		month = "02";
	if (month==3)
		month = "03";
	if (month==4)
		month = "04";
	if (month==5)
		month = "05";
	if (month==6)
		month = "06";
	if (month==7)
		month = "07";
	if (month==8)
		month = "08";
	if (month==9)
		month = "09";
	
	//for testing
	myclock=year+""+month+""+day+""+hours+""+minutes
	document.getElementById(id).value=myclock;
	
 }
/// ---------------------------------------------------------------------------- ///
/// ---------------------------------------------------------------------------- ///
/// DropDownFunctions

function selSort(selId) {
    var sel = document.getElementById(selId);
    var ar = [],i;
    function compare(a,b)
    {
        return (a.o.text == b.o.text) ? 0 : (a.o.text < b.o.text) ? -1 : 1;
    }
    if (sel.options.length >= 2)
    {
        for (i=0; i<sel.options.length; i++) ar.push({o:sel.options[i],s:sel.options[i].selected});
        ar.sort(compare);
        sel.options.length = 0;
        for (i=0; i<ar.length; i++)
        {
            sel.options.add(ar[i].o)
            //sel.add(ar[i].o,null);
            ar[i].o.selected = ar[i].s;
        }
    }
}

function selDel(sel)
{
    if (sel.selectedIndex >= 0) 
    { 
        for (var i=sel.options.length-1; i >= 0; i--)
            if (sel.options[i].selected)
                sel.removeChild(sel.options[i]);
    }
}

function selMove(fromId, toId, actualUser)
{
    var from = document.getElementById(fromId);
    var to = document.getElementById(toId);
    var i;
    var au;
    var out = true;
    
    if (actualUser!='')
    {
		au = document.getElementById(actualUser);
    }
    else
    {
		au = '';
    }
    
    if (from.selectedIndex >= 0)
    {
        for (i=0; i<from.options.length; i++) 
            if (from.options[i].selected)
            {
				out = true;
                if (au!=''){
					
					if (from.options[i].value==au.value)
					{
						out = confirm('Are you sure you want to remove yourself as moderator of the group?');
					}
                }
                if (out)
                {
					var opt = new Option(from.options[i].text,from.options[i].value);
					to.options.add(opt, from.length);
                }else
                {
					from.options[i].selected = false;
                }
            }
        selDel(from);
    }
    to.focus();
}

function selUp(sel)
{
    var opt,sopt,i;
    if (sel.selectedIndex > 0)
    {
        for (i=0; i<sel.options.length; i++)
        {
            opt = sel.options[i];
            if (opt.selected)
            {
                sopt = opt;
                if (opt.previousSibling != null)
                    sel.insertBefore(opt,opt.previousSibling);
                break;
            }
        }
        for (i=0; i<sel.options.length; i++)
            sel.options[i].selected = (sel.options[i] === sopt);
    }
}
function selDn(sel)
{
    var opt,sopt,i;
    if (sel.selectedIndex > 0)
    {
        for (i=0; i<sel.options.length; i++)
        {
            opt = sel.options[i];
            if (opt.selected)
            {
                sopt = opt;
                if (opt.nextSibling != null)
                    sel.insertBefore(opt,opt.nextSibling.nextSibling);
                break;
            }
        }
        for (i=0; i<sel.options.length; i++)
            sel.options[i].selected = (sel.options[i] === sopt);
    }
}

function setIds(selId,hiddenId)
{
    var sel = document.getElementById(selId);
    var hidden = document.getElementById(hiddenId);
    hidden.value = "";
    for (i=0; i<sel.options.length; i++)
    {
        var newValue = sel.options[i].value + "|";
        hidden.value = hidden.value + newValue;
    }
}
function Validate_Email_Address(email_address)
    {
    //Assumes that valid email addresses consist of user_name@domain.tld
    at = email_address.indexOf('@');
    dot = email_address.indexOf('.');

    if(at == -1 ||
    dot == -1 ||
    dot <= at + 1 ||
    dot == 0 ||
    dot == email_address.length - 1)
    return(false);

    user_name = email_address.substr(0, at);
    domain_name = email_address.substr(at + 1, email_address.length);

    if(Validate_String(user_name) === false ||
    Validate_String(domain_name) === false)
    return(false);

    return(true);
 }
 
 function SelectOnlyOne(selId)
 {
	var sel = document.getElementById(selId);
	var i, obj;
	for (i=0; i<document.all.length; i++) {
		obj = document.all(i);
		if (obj.type == "radio") 
		{
			if (sel.id == obj.id){
				obj.checked = true;
			}
			else
			{
				obj.checked = false;
			}
		}
	}
	
 
 }
/// ---------------------------------------------------------------------------- ///
/// ---------------------------------------------------------------------------- ///