var s 
var sx
var aniname
var xx1,yy1,xx2,yy2
var aninum=0
var divnum=0
var atnum=0
var mywindow
var ie4p=false
var backar=new Array()
//********* Check Browser type
if(navigator.appVersion.split(".")[0]<4)
	{
	alert("Your browser does not support HTML4 ,the demo will take you to Amal Teacher home page")
	location.href="../products/amalt.html"
	}
if(navigator.appName=="Netscape")
{
doc="document."
sty=""
}
if(navigator.appName=="Microsoft Internet Explorer")
{
doc="document.all."
sty=".style"
ie4p=true
}
//******** Inz Back Array
backar[0]=0
backar[1]=0
backar[2]=0
backar[3]=1
backar[4]=1
backar[5]=1
backar[10]=5
//******** Animation
function startani()
{
	aniname='a'
	lay=eval(doc+aniname+sty)
	lay.visibility='visible'
	mover()
}

function startani2()
{
	aniname='a'
	lay=eval(doc+aniname+sty)
	
	lay.visibility='visible'
	
}

function mover()
{
clearTimeout(s)
lay=eval(doc+aniname+sty)
if (xx>(screen.width-200))
	{
	clearTimeout(s)
	lay.visibility='hidden'

	}
	else
	{
	lay.left=xx
	xx=xx+5
	s=setTimeout('mover()',100)
	}
}
//************************************************
//******** Move Object on the screen      ********
//************************************************
function frgmove(fromx,tox,fromy,toy,xmove,ymove,mwait,clcscr,xsub,ysub,hdaf)
{
clearTimeout(s)
lay=eval(doc+aniname+sty)
rxmove=xmove
rymove=ymove
rmwait=mwait
rxsub=xsub
rysub=ysub
rhdaf=hdaf

	fx1=fromx
	fx2=tox
	fy1=fromy
	fy2=toy

lay.left=fx2
lay.top=fy2
//alert(fx1+" "+fx2+" "+fy1+" "+fy2)
//******** Move Object
if (fx2<=fx1 && fy2<=fy1)
	{
	clearTimeout(s)

	//******** Hidden after move
	if (hdaf==1)
		{
		lay.visibility='hidden'
		}
	if (hdaf==2)
		{
		lay.visibility='visible'
		}
	//alert(xx)
        divnum=divnum+1
	nextdiv()
	
	}
	else
	{
	if (fx2>fx1)
		{
		lay.left=fx2
		fx2=fx2+xmove
		}
	if (fy2>fy1)
		{
		lay.top=fy2
		fy2=fy2+ymove
		}
	s=setTimeout('frgmove(fx1,fx2,fy1,fy2,rxmove,rymove,rmwait,0,0,0,0)',mwait)


	}
}


//******** Show Div
function frgshow()
{
	lay=eval(doc+aniname+sty)
	lay.visibility='visible'
}
//******** Show Div
function frghide()
{
	lay=eval(doc+aniname+sty)
	lay.visibility='hidden'
}
//******** Show Animation
function showani(I)
{
aninum=I

	switch(I)
	{
	case 1 :
		//******** Background
		aniname='b'
		divnum=0
		frgmove(0,0,0,0,0,0,1000,0,400,100,2)
		break
	}
	
}
//******** Pass 2
function nextdiv()
{
	switch(aninum)
	{
	case 1 :
	
		switch(divnum)
		{
		//******** Text		
		case 1 :
			aniname='b3'
			showdiv(0,0)
			frgmove(100,300,100,300,-10,-10,100,0,0,0,2)
			break		
	
		case 2 :
			break
		case 3 :
			frghide()
			aniname='a'		
			frgshow()
			frgmove(120,320,80,340,-20,-10,100,0,0,0,2)
			break
		case 4 :
			frghide()
			aniname='b4'
			frgshow()
		        divnum=divnum+1
			nextdiv()

			break	
		case 5 : 
			aniname='b5'
			frgshow()
			break
		//******** Questions Type
		case 6 :
			frghide()
			aniname='a'		
			frgshow()
			frgmove(320,320,120,340,-20,-10,100,0,0,0,2)
			break
		case 7 :
			frghide()
			aniname='b6'
			frgshow()
			break
		//******** Questions File
		case 8 :
			frghide()
			aniname='a'		
			frgshow()
			frgmove(320,320,160,340,-20,-10,100,0,0,0,2)
			break
		case 9 :
			frghide()
			aniname='b8'
			frgshow()
			aniname='b7'
			frgshow()
			break
		case 10 :
			aniname='b7'
			frghide()
			aniname='b8'
			frghide()
			aniname='b9'
			frgshow()
			break
		case 11 :
			frghide()
			aniname='b10'
			frgshow()
			break
		case 12 :
			if (ie4p==true)
			{
			mywindow=window.open("domeno.html","Domeno","width=640,height=480,scrollbars=1,location=0")		
			}
			else
			{
			mywindow=window.open("domenon.html","Domeno","width=640,height=480,scrollbars=1,location=0")		
			}
			break
		case 13 :
			frghide()
			aniname='b4'
			frghide()
			aniname='b12'
			frgshow()
				
		}
	break
	}
}

function showdiv(stop1,sleft)
{
	lay=eval(doc+aniname+sty)
	lay.top=stop1
	lay.left=sleft
	lay.visibility='visible'

}
function frgnextstep()
{

        divnum=divnum+1
	nextdiv()
}

function frgbackstep()
{
zbo=backar[divnum]
if (zbo==0)
	{
	alert("You are in the first screen ,you can not go back")
	}
if (zbo==1)
	{
	
	divnum=0
	thishide('b5')
	thishide('b4')
	showani(1)
	}
if (zbo==5)
	{
	
	divnum=5
	thishide('b9')
	nextdiv()
	}

}
function thishide(annm)
{
aniname=annm
frghide()
}
//********  Image Sizing
function imgsiz(w1,w2,h1,h2,iw,ih)
{

mw1=w1
mw2=w2
mh1=h1
mh2=h2
miw=iw
mih=ih
clearTimeout(sx)
if (mw1>=mw2 || mh1>=mh2)
	{
	clearTimeout(sx)
	document.pic1.height=h2
	document.pic1.width=w2
	document.pic1.src="domeno.gif"
	aniname='b11'
	frgshow()
	
	}
	else
	{
	mw1=mw1+iw
	mh1=mh1+ih
	document.pic1.height=mh1
	document.pic1.width=mw1
	document.pic1.src="domeno.gif"
	sx=setTimeout('imgsiz(mw1,mw2,mh1,mh2,miw,mih)',100)
	}
}
function backp()
{
mywindow.close()
divnum=divnum+1
nextdiv()

}
//************************************************************************
//******** Styls List                                             ********
//************************************************************************
//******** a=cursour
//******** b=background
//******** b2=letsstart
//******** b3=help info
//******** b4=sel game image
//******** b5=sel game text
//******** b6=sel questions type
//******** b7=select questions files
//******** b8=bookmark
//******** b11=domeno
//************************************************************************
