hCounter = 0;
mCounter = 0;
sCounter = 0;
req = new Request({
	url: '/application/clock/clock.htm',
	onSuccess: function(html)
	{
		$('live_clock').getElement('span').empty();
		$('live_clock').getElement('span').set('text',html);
	}
});
function updateClock(uDate,txt)
{
	req.send();
}

window.addEvent('domready', function(){
	// Clock
	var txt = $('live_clock').getElement('span').get('text');
	var cDate = new Date();
	updateClock.periodical(200,this,[cDate,txt]);
	
	$$('p.app_course_select select').each(function(el){
		var id = el.id;
		el.addEvent('change', function(){
			$$('p.app_course_select select').each(function(el1){
				if (el1.id != id)
				{
					el1.selectedIndex = 0;
				}
			});
		});
	});
});

//window.addEvent('unload', Request.Comet.cancel);

/*
window.addEvent('domready', function(){
	// page tools
	$$('a.print').each(function(el){
		el.addEvent('click', function(e){
			e = new Event(e).stop();
			window.print();
		});
	});
	
	// search box input clearing
	$$('input.clearMe').each(function(el){
		el.setAttribute('origval', el.value);
		
		el.addEvent('click', function(){
			if (el.value == el.getAttribute('origval'))
			{
				el.value = '';
			}
		});
		
		el.addEvent('blur', function(){
			if ((el.value == '') || (el.value == null))
			{
				el.value = el.getAttribute('origval');
			}
		});
	});
	
	subnav = false;
	// Navigation images for IE6
	$$('body.subnav').each(function(el){
		subnav = true;
	});
	if ((window.ie6) && (subnav == true))
	{
		var img = new Element('div', {
			'styles': {
				'height': 25,
				'width': 6,
				'float': 'left',
				'position': 'absolute',
				'right': -7,
				'top': -5,
				'z-index': 200
			}
		});
		img.setHTML('&nbsp;');
		
		$$('#navigation li.nav_active a span').each(function(el){
			img.setStyles({
				'background-color': el.getParent().getStyle('background-color')
				//'background-color': 'green'
			});
			img.clone().injectInside(el);
		});
		$$('#navigation li.nav_active li a span div').each(function(el){
			el.remove();
		});
		
	}
	$$('#navigation li a').each(function(el){
		el.setStyle('display', 'none');
		el.setStyle('display', 'block');
	});
	
	// Sliding links for anchors
	var scroller = new Fx.Scroll(window, {duration: 900, wait: false, transition: Fx.Transitions.sineInOut});
	$$('a').each(function(el){
		if (el.href.indexOf('#') > -1)
		{
			var href = el.href.substr(el.href.indexOf('#')+1, el.href.length);
			if (href.length > 1)
			{
				el.addEvent('click', function(e){
					e = new Event(e).stop();
					if ($(href))
					{
						scroller.toElement(href);
					} else
					{
						$$('a').each(function(el1){
							if (el1.getAttribute('name') == href)
							{
								toEl = el1.getParent();
								console.log(el1.getAttribute('name'));
							}
						});
						scroller.toElement(toEl);
					}
				});
			}
		}
	});
	
	// Popup links
	popup_id = 1;
	$$('a.popup').each(function(el){
		el.addEvent('click', function(e){
			e = new Event(e).stop();
			window.open(el.href, 'p_'+popup_id, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizeable=0,width=500,height=620,left=100,top=100');
		});
		popup_id++;
	});
	
	$$('a.popup_large').each(function(el){
		el.addEvent('click', function(e){
			e = new Event(e).stop();
			window.open(el.href, 'p_'+popup_id, 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizeable=0,width=1024,height=768');
		});
		popup_id++;
	});
});
*/