//
// this site design and all code Copyright © 2001 to M.Keating VOS Ltd
//


function soln() {
  rtl = 1
  changeImage('cardDiv','cardS','cardSol')
  FWS(7);
  card.hover.stop()
  setTimeout("card.slideTo(350,-150,10,20)", 2000)
  chL(3)
  setTimeout('window.status = "thats the card ... how, you ask?  its magic of course!"',2000)
}

function chL(LL) {        
if (chS == 1) return;
chS = 1
//alert(chS)
        
        txtTMP1="<font size=3 color=white><br><br><br><br><br><br><br><br><br><br><br><b><h3>"
        txtTMP2= "going UP for a sec..."
        txtTMP3= "</h3></b></font>"
        if (LL =="1") {txtTMP=txtF} else {txtTMP=txtE}
        if (LL =="0") {txtTMP=txtE} 
        if (LL =="3") {txtTMP=txtT; txtTMP2="some MAGIC tricks"}
        if (LL=="31") txtTMP=txtT1
        if (LL=="32") txtTMP=txt21
        if (LL=="81") txtTMP=txtE1
        if (LL=="666") txtTMP=txtM1

        if (LL=="82") txtTMP=txtE2
        if (LL=="82") txtTMP=txtE2
        if (LL=="82") txtTMP=txtE2
        if (LL=="82") txtTMP=txtE2


        if (LL=="82") txtTMP=txtSE
        if (LL=="83") txtTMP=txtCE
        if (LL=="821") txtTMP=txtSF
        if (LL=="831") txtTMP=txtCF

        if (LL=="762") txtTMP=txtG
        if (LL=="311") txtTMP=txt11
        if (LL=="312") txtTMP=txt12
        if (LL=="709") txtTMP=txtH
        if (LL=="321") txtTMP=txt211
        if (LL=="33") { txtTMP="";setTimeout('this.location="trick"+"0.html" ',2500) ; txtTMP2="loading game now......."}
        if (LL=="4") {txtTMP=txtC; txtTMP2="My contacts coming up now."}
        if (LL=="6") {txtTMP="";setTimeout('this.location="links.html"',2500) ; txtTMP2="here comes the LINKS Page"}
        if (LL=="5") {txtTMP="";setTimeout('this.location="photos.html"',2500) ; txtTMP2="Some of my PHOTOS"}
        if (LL=="9") txtTMP=txtTMP1 +"Click the card to see your selection" + txtTMP3
//        butroll(7)
        txtTMPx = txtTMP1 + txtTMP2 + txtTMP3

      //layerT.write(txtTMPx)

      rt()

      if (fst2 !=0) rt4()

      if (fst !=0) {
      butroll(7,0)
      mylayer2.show();
      setTimeout('mylayer2.hide()',2000)
      if(Math.random() >= 0.5) {mylayer6.show(); setTimeout('mylayer6.hide()',3500)}
        else {  if(Math.random() >= 0.5) {mylayer5.show(); setTimeout('mylayer5.hide()',2000)}}
      if(Math.random() >= 0.5) {mylayer4.show(); setTimeout('mylayer4.hide()',3500)}
     
      }
      fst++
      setTimeout('chS = 0',1500)

}
function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=4)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
}
is = new BrowserCheck()


function mkDL(id,nestref,frame) {
	if (!is.ns5 && !mkDL.set && !frame) mkDLInit()
	this.frame = frame || self
	if (is.ns) {
		if (is.ns4) {
			if (!frame) {
				if (!nestref) var nestref = mkDL.nestRefArray[id]
				if (!mkDLTest(id,nestref)) return
				this.css = (nestref)? eval("document."+nestref+".document."+id) : document.layers[id]
			}
			else this.css = (nestref)? eval("frame.document."+nestref+".document."+id) : frame.document.layers[id]
			this.elm = this.event = this.css
			this.doc = this.css.document
		}
		else if (is.ns5) {
			this.elm = document.getElementById(id)
			this.css = this.elm.style
			this.doc = document
		}
		this.x = this.css.left
		this.y = this.css.top
		this.w = this.css.clip.width
		this.h = this.css.clip.height
	}
	else if (is.ie) {
		this.elm = this.event = this.frame.document.all[id]
		this.css = this.frame.document.all[id].style
		this.doc = document
		this.x = this.elm.offsetLeft
		this.y = this.elm.offsetTop
		this.w = (is.ie4)? this.css.pixelWidth : this.elm.offsetWidth
		this.h = (is.ie4)? this.css.pixelHeight : this.elm.offsetHeight
	}
	this.id = id
	this.nestref = nestref
	this.obj = id + "mkDL"
	eval(this.obj + "=this")
}
function mkDLMoveTo(x,y) {
	if (x!=null) {
		this.x = x
		if (is.ns) this.css.left = this.x
		else this.css.pixelLeft = this.x
	}
	if (y!=null) {
		this.y = y
		if (is.ns) this.css.top = this.y
		else this.css.pixelTop = this.y
	}
}
function mkDLMoveBy(x,y) {
	this.moveTo(this.x+x,this.y+y)
}
function mkDLShow() {
	this.css.visibility = (is.ns4)? "show" : "visible"
}
function mkDLHide() {
	this.css.visibility = (is.ns4)? "hide" : "hidden"
}
mkDL.prototype.moveTo = mkDLMoveTo
mkDL.prototype.moveBy = mkDLMoveBy
mkDL.prototype.show = mkDLShow
mkDL.prototype.hide = mkDLHide
mkDLTest = new Function('return true')

// mkDLInit Function
function mkDLInit(nestref) {
	if (!mkDL.set) mkDL.set = true
	if (is.ns) {
		if (nestref) ref = eval('document.'+nestref+'.document')
		else {nestref = ''; ref = document;}
		for (var i=0; i<ref.layers.length; i++) {
			var divname = ref.layers[i].name
			mkDL.nestRefArray[divname] = nestref
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new mkDL("'+divname+'","'+nestref+'")')
			}
			if (ref.layers[i].document.layers.length > 0) {
				mkDL.refArray[mkDL.refArray.length] = (nestref=='')? ref.layers[i].name : nestref+'.document.'+ref.layers[i].name
			}
		}
		if (mkDL.refArray.i < mkDL.refArray.length) {
			mkDLInit(mkDL.refArray[mkDL.refArray.i++])
		}
	}
	else if (is.ie) {
		for (var i=0; i<document.all.tags("DIV").length; i++) {
			var divname = document.all.tags("DIV")[i].id
			var index = divname.indexOf("Div")
			if (index > 0) {
				eval(divname.substr(0,index)+' = new mkDL("'+divname+'")')
			}
		}
	}
	return true
}
mkDL.nestRefArray = new Array()
mkDL.refArray = new Array()
mkDL.refArray.i = 0
mkDL.set = false

// Slide Methods
function mkDLSlideTo(endx,endy,inc,speed,fn) {
	if (endx==null) endx = this.x
	if (endy==null) endy = this.y
	var distx = endx-this.x
	var disty = endy-this.y
	this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function mkDLSlideBy(distx,disty,inc,speed,fn) {
	var endx = this.x + distx
	var endy = this.y + disty
	this.slideStart(endx,endy,distx,disty,inc,speed,fn)
}
function mkDLSlideStart(endx,endy,distx,disty,inc,speed,fn) {
	if (this.slideActive) return
	if (!inc) inc = 10
	if (!speed) speed = 20
	var num = Math.sqrt(Math.pow(distx,2) + Math.pow(disty,2))/inc
	if (num==0) return
	var dx = distx/num
	var dy = disty/num
	if (!fn) fn = null
	this.slideActive = true
	this.slide(dx,dy,endx,endy,num,1,speed,fn)
}
function mkDLSlide(dx,dy,endx,endy,num,i,speed,fn) {
	if (!this.slideActive) return
	if (i++ < num) {
		this.moveBy(dx,dy)
		this.onSlide()
		if (this.slideActive) setTimeout(this.obj+".slide("+dx+","+dy+","+endx+","+endy+","+num+","+i+","+speed+",\""+fn+"\")",speed)
		else this.onSlideEnd()
	}
	else {
		this.slideActive = false
		this.moveTo(endx,endy)
		this.onSlide()
		this.onSlideEnd()
		eval(fn)
	}
}
function mkDLSlideInit() {}
mkDL.prototype.slideInit = mkDLSlideInit
mkDL.prototype.slideTo = mkDLSlideTo
mkDL.prototype.slideBy = mkDLSlideBy
mkDL.prototype.slideStart = mkDLSlideStart
mkDL.prototype.slide = mkDLSlide
mkDL.prototype.onSlide = new Function()
mkDL.prototype.onSlideEnd = new Function()

// Clip Methods
function mkDLClipInit(clipTop,clipRight,clipBottom,clipLeft) {
	if (is.ie) {
		if (arguments.length==4) this.clipTo(clipTop,clipRight,clipBottom,clipLeft)
		else if (is.ie4) this.clipTo(0,this.css.pixelWidth,this.css.pixelHeight,0)
	}
}
function mkDLClipTo(t,r,b,l) {
	if (t==null) t = this.clipValues('t')
	if (r==null) r = this.clipValues('r')
	if (b==null) b = this.clipValues('b')
	if (l==null) l = this.clipValues('l')
	if (is.ns) {
		this.css.clip.top = t
		this.css.clip.right = r
		this.css.clip.bottom = b
		this.css.clip.left = l
	}
	else if (is.ie) this.css.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}
function mkDLClipBy(t,r,b,l) {
	this.clipTo(this.clipValues('t')+t,this.clipValues('r')+r,this.clipValues('b')+b,this.clipValues('l')+l)
}
function mkDLClipValues(which) {
	if (is.ie) var clipv = this.css.clip.split("rect(")[1].split(")")[0].split("px")
	if (which=="t") return (is.ns)? this.css.clip.top : Number(clipv[0])
	if (which=="r") return (is.ns)? this.css.clip.right : Number(clipv[1])
	if (which=="b") return (is.ns)? this.css.clip.bottom : Number(clipv[2])
	if (which=="l") return (is.ns)? this.css.clip.left : Number(clipv[3])
}
mkDL.prototype.clipInit = mkDLClipInit
mkDL.prototype.clipTo = mkDLClipTo
mkDL.prototype.clipBy = mkDLClipBy
mkDL.prototype.clipValues = mkDLClipValues

// Write Method
function mkDLWrite(html) {
	if (is.ns) {
		this.doc.open()
		this.doc.write(html)
		this.doc.close()
	}
	else if (is.ie) {
		this.event.innerHTML = html
	}
}
mkDL.prototype.write = mkDLWrite



// CSS Function
function css(id,left,top,width,height,color,vis,z,other) {
	if (id=="START") return '<STYLE TYPE="text/css">\n'
	else if (id=="END") return '</STYLE>'
	var str = (left!=null && top!=null)? '#'+id+' {position:absolute; left:'+left+'px; top:'+top+'px;' : '#'+id+' {position:relative;'
	if (arguments.length>=4 && width!=null) str += ' width:'+width+'px;'
	if (arguments.length>=5 && height!=null) {
		str += ' height:'+height+'px;'
		if (arguments.length<9 || other.indexOf('clip')==-1) str += ' clip:rect(0px '+width+'px '+height+'px 0px);'
	}
	if (arguments.length>=6 && color!=null) str += (is.ns)? ' layer-background-color:'+color+';' : ' background-color:'+color+';'
	if (arguments.length>=7 && vis!=null) str += ' visibility:'+vis+';'
	if (arguments.length>=8 && z!=null) str += ' z-index:'+z+';'
	if (arguments.length==9 && other!=null) str += ' '+other
	str += '}\n'
	return str
}
function writeCSS(str,showAlert) {
	str = css('START')+str+css('END')
	document.write(str)
	if (showAlert) alert(str)
}

function Hover(mkDL,name) {
	this.mkDL = mkDL
	this.name = name
	this.play = HoverPlay
	this.slide = HoverSlide
	this.pause = HoverPause
	this.stop = HoverStop
}
function HoverPlay(amplitude,angleinc,angle,cycles,orientation,speed,fn) {
	if (this.active) return
	if (!this.paused) {
		this.amplitude = amplitude
		this.angleinc = angleinc
		this.angle = angle
		this.cycles = cycles
		this.orientation = orientation
		this.speed = speed
		this.active = false
		this.centerX = eval(this.mkDL+'.x') - this.amplitude*Math.sin(this.angle*Math.PI/180)
		this.centerY = eval(this.mkDL+'.y') + this.amplitude*Math.sin(this.angle*Math.PI/180)
	}
	this.active = true
	this.paused = false
	eval(this.mkDL+'.'+this.name+'.slide()')
}
function HoverSlide() {
	if (this.active && (this.cycles==null || Math.abs(this.angleinc)<Math.abs(this.cycles*360-this.angle))) {
		this.angle += this.angleinc
		var x = (this.orientation=="h")? this.centerX + this.amplitude*Math.sin(this.angle*Math.PI/180) : null
		var y = (this.orientation=="v")? this.centerY - this.amplitude*Math.sin(this.angle*Math.PI/180) : null
		eval(this.mkDL+'.moveTo('+x+','+y+')')
		setTimeout(this.mkDL+'.'+this.name+'.slide()',this.speed)
	}
	else if (!this.paused) {
		this.active = false
		eval(this.fn)
	}
}
function HoverPause() {
	if (this.active) {
		this.active = false
		this.paused = true
	}
}
function HoverStop() {
	this.active = false
	this.paused = false
}

function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}
function changeImage(layer,imgName,imgObj) {
	if (document.images) {
		if (document.layers && layer!=null) eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src')
		else document.images[imgName].src = eval(imgObj+".src")
	}
}
