#!/bin/csh -f

if ($JOBIN == "") then

	cd $IMGDIR
	echo
	ls -l
	echo
	echo "	To go to a job:		job <job name>"
	echo
	exit 0
else
        set JOB = $JOBIN

	if (! -d $IMGDIR/$JOB) then

		while (1)

			echo
			echo "Job '$JOB' does not exist.  Do you want to create it (y/n) ? "\\c

			set ANSWER=$<

			switch ($ANSWER)

				case [y]:

					mkdir $IMGDIR/$JOB
					chmod 777 $IMGDIR/$JOB

					break
					breaksw

				case [n]:

					echo
					exit 1

					break
					breaksw

				default:
					breaksw
			endsw
		end
	endif

	setenv  BG_IMG0 $IMGDIR/$JOB
	cd $BG_IMG0

	echo
	echo "You are now in the job directory '$BG_IMG0'."
	echo
endif
