function setInputBg(field,act,alternative) {
	
	var sfield = document.getElementById(field);

	if (act=='on') {
		if (sfield.value && sfield.value == alternative) {
			sfield.value = '';
			sfield.className = 'input-on';
		}
	} else {
		if (!sfield.value || sfield.value == alternative) {
			sfield.value = alternative;
			sfield.className = '';
		}
	}
}

function submitEnter(myfield,e) {

	var keycode;
	
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;

	if (keycode == 13) {
		
		submit_search();
		return false;
	} else {
   
		return true;
	}
}

function submit_search() {
	var sfield1 = document.getElementById('j').value;
	var sfield2 = document.getElementById('l').value;
	var cfield1 = document.getElementById('alternative1').value;
	var cfield2 = document.getElementById('alternative2').value;
	if (sfield1==cfield1) { document.getElementById('j').value=''; }
	if (sfield2==cfield2) { document.getElementById('l').value=''; }
	document.sjobs.submit();
}

// find all the links with class japply and jtitle and activate lightbox for them
$(window).load(function () {
	$('.japply').fancybox({
		'transitionIn'		:	'elastic',
		'transitionOut'		:	'elastic',
		'speedIn'			:	400, 
		'speedOut'			:	400, 
		'overlayShow'		:	true,
		'titleShow'			:	false,
		'type'				:	'ajax',
		'padding'			:	0
	});
	$('.jtitle').fancybox({
		'transitionIn'		:	'elastic',
		'transitionOut'		:	'elastic',
		'speedIn'			:	400, 
		'speedOut'			:	400, 
		'overlayShow'		:	true,
		'titleShow'			:	false,
		'type'				:	'ajax',
		'padding'			:	0
	});
});

