var w, ow, oh, x, y, dx, dy, ds, count

w=document.body

// *** Enter the number of images here ***
numPics=4

// *** All images are the same size - Enter height and width here ***
pH=200
pW=300

// *** 2 = Oval ***
// *** 3 = Rectangle ***
// *** 4 = RoundedRectangle ***
shapeType=2

// It all starts here
function strt() {

	if (shapeType==1) {
		data="<v:shapetype id='heart' coordsize='21600,21600' path='m10860,2187c10451,1746,9529,1018,9015,730,7865,152,6685,0,5415,0,4175,152,2995,575,1967,1305,1150,2187,575,3222,242,4220,0,5410,242,6560,575,7597l10860,21600,20995,7597c21480,6560,21600,5410,21480,4220,21115,3222,20420,2187,19632,1305,18575,575,17425,152,16275,0,15005,0,13735,152,12705,730,12176,1018,11254,1746,10860,2187xe'>"
		data=data+"<v:shape id='pf' type='#heart' style='position:absolute; top:"+y[i]+"; left:"+x[i]+"; width: 90; height: 90; z-index: 20' strokecolor='#a00000' strokeweight='6pt' fillcolor=''>"
		data=data+"<v:stroke filltype='tile' src='"+bkg.src+"'/>"
		data=data+"<v:fill id=frm type='frame' src='"+pic1.src+"'>"
	}else{
		
		if (shapeType==2) {st="oval"}
		if (shapeType==3) {st="rect"}
		if (shapeType==4) {st="roundrect"}
		data="<v:"+st+" id='pf' style='position:absolute; top:-300; left:-300; width: 90; height: 90; z-index: 20' strokecolor='#a00000' strokeweight='6pt' fillcolor=''>"
		data=data+"<v:stroke filltype='tile' src='"+bkg.src+"'/>"
		data=data+"<v:fill id=frm type='frame' src='"+pic1.src+"'>"
	}
	w.insertAdjacentHTML("afterBegin", data)

	count=1
	setUp()
}

function setUp() {
	// Initialize stuff
	oh=2
	ow=2
	x=2
	y=2
	dx=4
	dy=2
	ds=2
	// Start the bounce
	doIt()
}

function flipIt() {
	count++
	if (count>numPics) {count=1}
	ss="pic"+count
	frm.src=document.all(ss).src
}

// Bounce routine
function doIt() {
	// Move the oval and check its position
	x=x+dx
	if (dx>0 && x>=w.clientWidth-ow) {
		dx=-dx
	}
	if (oh<w.clientHeight) {
		// Modify the oval dimensions
		oh=oh+ds
		ow=ow+ds
		y=y+dy
		if (dy>0 && y>=w.clientHeight-oh) {dy=-dy}
		if (dy<0 && y<0) {dy=-dy}
	}
	// Position the oval
	pf.style.height=oh
	pf.style.width=ow
	pf.style.top=y
	pf.style.left=x
	if (dx<0 && x<-w.clientWidth) {
		dx=-dx
		flipIt()
		setUp()
	}else{
		// Repeat
		setTimeout("doIt()",8)
	}
}
