def focusImg(tweet,ti):
	if (u'further' in tweet):
		indexUp = tweet.index('further')+8
                nUp = u''
                if indexUp < len(tweet):
			try:
				while tweet[indexUp] != u' ':
                        		nUp = nUp+tweet[indexUp]
                        		indexUp = indexUp+1
                        		if indexUp > len(tweet)-1:
                                		break
			except IndexError,TypeError:
				nUp = 1
		if nUp == u'':
			nUp = 1
		else:
			nUp = int(nUp)
		up(nUp)
		on()
		c = picamera.PiCamera()
	        s(1)
		c.capture(ti+'.png')
        	c.close()
		off()
                c.stop_preview()
                c.close()
                prevOn = False
                focus.off()
            mc.postToChat("Picture taken")
            mc.events.clearAll()
            focus.on()
            c = cam.PiCamera()
            c.capture(str(i) + png)
            c.close()
            focus.off()
            i = i + 1
            # Open/close the preview window.
        if p.x == -34 and p.y == 1 and p.z == 59:
            if prevOn:
                focus.off()
                c.stop_preview()
                c.close()
                prevOn = False
            elif not prevOn:
                focus.on()
                c = cam.PiCamera()
                c.start_preview()
                c.preview_fullscreen = False
                c.preview_window = (0, 0, 640, 640)
                prevOn = True
                # Move the sample stage up
        if p.x == -34 and p.y == 1 and p.z == 57:
            mc.events.clearAll()
            focus.up()
                        nFocus = 1
                else:
                        nFocus = int(nFocus)

		on()
		for i in range(0,2):
		        down(nFocus)
			c = picamera.PiCamera()
			s(1)
               		c.capture(str(i)+'.png')
                	imgAddNumber = img.open(str(i)+'.png').resize((400,400))
			imgD.Draw(imgAddNumber).text((360,360),str(i+1),font=fonT)
			imgAddNumber.save(str(i)+'.png')
			imgArray.append(img.open(str(i)+'.png'))
			c.close()
		up(nFocus*3)

		for i in range(2,4):
			up(nFocus)
			c = picamera.PiCamera()
			s(1)
                        c.capture(str(i)+'.png')
                        imgAddNumber = img.open(str(i)+'.png').resize((400,400))
                        imgD.Draw(imgAddNumber).text((360,360),str(i+1),font=fonT)
                        imgAddNumber.save(str(i)+'.png')
                        imgArray.append(img.open(str(i)+'.png'))
                        c.close()
		off()
 	
		down(nFocus*3)
		tempIm = img.new('RGB',(900,900))