function openWindowSlim(url, width, height, scrollbars)
{
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	
	if (scrollbars) scrollbars = 'yes';
	else scrollbars = 'no'
	
	winprops = 'height='+height+',width='+width+',top='+wint+',left='+winl+',scrollbars='+scrollbars+',resizable';

	var win = window.open(url, 'task_window', winprops)
	if (parseInt(navigator.appVersion) >= 4) win.window.focus(); 
	return win;
}

var iconTable = new Class({
	initialize: function(table, links){
		table.getElements('td').each(function(element) {
			if (links[element.getProperty('id')]) {
				if (links[element.getProperty('id')]['active']) {
					element.addEvent('mouseenter', function() {
						this.addClass('icon_table_hover');
					});
					element.addEvent('mouseleave', function() {
						this.removeClass('icon_table_hover');
					});
				}
				else {
					element.addClass('inactive');
				}
				
				element.addEvent('click', function(){
					window.location = links[element.getProperty('id')]['url'];
				});
			}
			
		});
	}
});

function sendEmail(url, address) {
	email = prompt('Email Address to send to', address);
	if (email)
		document.location=url+"/mode/email/" + escape(email);
}

function generate_address(username, txt) {
	var atsign = "&#64;";
	var hostname = "bluedogtraining.com.au";
	var addr = username + atsign + hostname;
	if (txt.lenght==0) txt = addr;
		document.write('<' + 'a' + ' ' + 'href=\"' + 'mail' + 'to:' + addr + '\">' + txt + '</a>');
}



function remember (uct)
{	
	new Request({
		'url': '/user/usercoursetaskfacts/create',
		'data': { 'uct': uct, 'facts': browserDetails() }
	}).send();
}


window.addEvent('domready', function () {
	if ($$('#courses-list .details')) {
		$$('#courses-list .details').each(function (el) {
			var slider = new Fx.Slide(el, { duration:0 });
			slider.slideOut();
		});
		
		$$('#courses-list .group').each(function (element) {
			var details = element.getElement('.details');
			var slider = new Fx.Slide(details, { duration: 100} );
			
			element.addEvent('mouseenter', function (ev) {
				ev.stop();
				slider.slideIn();
			}).addEvent('mouseleave', function (ev) {
				ev.stop();
				slider.slideOut();
			});
		});
	}
});