function techjobs(name) {
	var jobpage = 1;
	var jobnum = 1;
	var thispage;
	this.name = name;
	this.lock = false;
	this.cur = 1;
	this.entered = false;
	this.techjobs_page_width = 298;
	
	$('#'+name).data('obj', this);
	
	/* draw pages */
	$('#'+name).append('<div class="pages"></div>');
	$('#'+name).append('<a class="prev">Prev</a>');
	$('#'+name).append('<a class="next">Next</a>');
	$('#'+name).append('<div class="links"><ul class="pager"></ul><a class="showall" href="/jobs/">Show all jobs</a></div>')
	$('#'+name+' .job_list').hide();
	var short;
	var long;
	$('#'+name+' .job_list span').each(function() {
		switch($(this).html()) {
			case 'FT':
				short = 'F';
				long = 'Full Time'
				break;
			case 'PT':
				short = 'P';
				long = 'Part Time'
				break;
			case 'CC':
				short = 'C';
				long = 'Contract/Casual'
				break;
			case 'TP':
				short = 'T';
				long = 'Temporary'
				break;
			case 'IT':
				short = 'I';
				long = 'Internship'
				break;
		}
		$(this).html(short).attr('title',long);
	});
	$('#'+name+' .job_list li a').each(function() {
		jobtitle = $(this).html();
		$(this).attr('title',jobtitle);
		if (jobtitle.length > 40) {
			jobtitle = jobtitle.substring(0, 38);
			jobtitle = jobtitle.replace(/\w+$/, '');
			$(this).html(jobtitle + '...');
		}
	});

	$('#'+name+' .job_list li').each(function() {
		if (jobnum == 1) {
			thispage = $('<ul>').addClass('techjobs_page').attr('id','techjobs_page_'+jobpage);
			$('#'+name+' .pages').append(thispage);
			button = $('<li>'+jobpage+'</li>').click(function() { $(this).parent().parent().parent().data('obj').switchpage($(this).html()); });
			$('#'+name+' .pager').append(button);
			jobpage++;
		}
		thispage.append(this);
		if (++jobnum > 5) { jobnum = 1; }
	});
	$('#'+name+' .pages').width(this.techjobs_page_width * jobpage);
	this.pagenum = jobpage;
	
	/* buttons */
	$('#'+name+' .prev').click(function() { $(this).parent().data('obj').prev(); });
	$('#'+name+' .next').click(function() { $(this).parent().data('obj').next(); });
	$('#'+name).mouseover(function(){
		$(this).data('obj').entered = true;
	}).mouseout(function(){
		var techj = $(this).data('obj');
		techj.entered = false;
		clearTimeout(techjobs_timout);
		techjobs_timout = setTimeout(function(){ techj.rotate(); }, 5000);
	});

	/* start */
	this.switchpage(1);
	var techj = this;
	techjobs_timout = setTimeout(function(){ techj.rotate(); }, 5000);
}
techjobs.prototype.prev = function() {
	if (this.lock == false) {
		this.lock = true;
		this.cur--;
		if (this.cur < 1) { this.cur = this.pagenum - 1; }
		this.switchpage(this.cur);
	}
}
techjobs.prototype.next = function() {
	if (this.lock == false) {
		this.lock = true;
		this.cur++;
		if (this.cur == this.pagenum) { this.cur = 1; }
		this.switchpage(this.cur);
	}
}
techjobs.prototype.switchpage = function(num) {
	var techj = this;
	$('#'+this.name+' .pages').animate({
		left: -1 * this.techjobs_page_width * (num - 1)
	}, 300, function() { techj.lock = false; });
	$('#'+this.name+' .pager li').removeClass('selected');
	$('#'+this.name+' .pager li:nth-child('+num+')').addClass('selected');
}
techjobs.prototype.rotate = function() {
	if ( this.entered != true ) {
		this.next();
		var techj = this;
		techjobs_timout = setTimeout(function(){ techj.rotate(); }, 5000);
	}
}



