// -- http://www.eyefi.nl --
// -- +31 (0)20 4 279 919 --
// -- W.G.Plein 369, 1054 SG Amsterdam , The Netherlands --
function eyefi_checkBrowser(){
	this.ver=navigator.appVersion; this.dom=document.getElementById?1:0;
	this.mac=(this.ver.indexOf("PPC")!= -1)?1:0; this.win=(this.ver.indexOf("Win")!= -1)?1:0;
	this.ie5=(this.ver.indexOf("MSIE")!= -1 && this.dom && parseInt(this.ver) >= 4)?1:0;
	this.ie4=(document.all && !this.dom)?1:0; this.ie=(this.ie5 || this.ie4);
	this.ns6=(this.dom && parseInt(this.ver) >= 5)?1:0;
	this.ns4=(document.layers && !this.dom)?1:0; this.ns=(this.ns4 || this.ns6);
	this.eyefi=(this.ie || this.ns);
	return this;
}
eyefi=new eyefi_checkBrowser();
function eyefi_message(txt){alert(txt); return false}
function eyefi_obj(obj,nest){ 
  if(!eyefi.eyefi) return eyefi_message('Old browser')
  nest=(!nest) ? "":'document.'+nest+'.'
  this.evnt=eyefi.dom? document.getElementById(obj):
    eyefi.ie4?document.all[obj]:eyefi.ns4?eval(nest+"document.layers." +obj):0;	
  if(!this.evnt) return eyefi_message('The layer does not exist ('+obj+')' 
    +'- \nIf your using Netscape please check the nesting of your tags!')
  this.css=eyefi.dom||eyefi.ie4?this.evnt.style:this.evnt; 
  this.ref=eyefi.dom||eyefi.ie4?document:this.css.document;
  this.x=parseInt(this.css.left)||this.css.pixelLeft||this.evnt.offsetLeft||0;
  this.y=parseInt(this.css.top)||this.css.pixelTop||this.evnt.offsetTop||0;
  this.w=this.evnt.offsetWidth||this.css.clip.width||this.ref.width||this.css.pixelWidth||0; 
  this.h=this.evnt.offsetHeight||this.css.clip.height||this.ref.height||this.css.pixelHeight||0;
  this.c=0; //Clip values
  if((eyefi.dom || eyefi.ie4) && this.css.clip) {
  this.c=this.css.clip; this.c=this.c.slice(5,this.c.length-1); 
  this.c=this.c.split(' ');
  for(var i=0;i<4;i++){this.c[i]=parseInt(this.c[i])}
  }
  this.ct=this.css.clip.top||this.c[0]||0; 
  this.cr=this.css.clip.right||this.c[1]||this.w||0;
  this.cb=this.css.clip.bottom||this.c[2]||this.h||0; 
  this.cl=this.css.clip.left||this.c[3]||0;
  this.obj = obj + "Object"; eval(this.obj + "=this")
  // extra non standard functions:
  this.up=goUp;this.down=goDown; // scrolling functions
  return this
}
eyefi_obj.prototype.moveIt = function(x,y){
  this.x=x;this.y=y; this.css.left=x;this.css.top=y
}
eyefi_obj.prototype.moveBy = function(x,y){
  this.css.left=this.x+=x; this.css.top=this.y+=y
}
eyefi_obj.prototype.showIt = function(){this.css.visibility="visible"}
eyefi_obj.prototype.hideIt = function(){this.css.visibility="hidden"}
eyefi_obj.prototype.bg = function(color){ 
	if(eyefi.dom || eyefi.ie4) this.css.backgroundColor=color
	else if(eyefi.ns4) this.css.bgColor=color  
}
eyefi_obj.prototype.writeIt = function(text,startHTML,endHTML){
	if(eyefi.ns4){
    if(!startHTML){startHTML=""; endHTML=""}
	  this.ref.open("text/html"); 
    this.ref.write(startHTML+text+endHTML); 
    this.ref.close()
	}else this.evnt.innerHTML=text
}
eyefi_obj.prototype.clipTo = function(t,r,b,l,setwidth){ 
  this.ct=t; this.cr=r; this.cb=b; this.cl=l
  if(eyefi.ns4){
    this.css.clip.top=t;this.css.clip.right=r
    this.css.clip.bottom=b;this.css.clip.left=l
  }else{
    if(t<0)t=0;if(r<0)r=0;if(b<0)b=0;if(b<0)b=0
    this.css.clip="rect("+t+","+r+","+b+","+l+")";
    if(setwidth){this.css.pixelWidth=this.css.width=r; 
    this.css.pixelHeight=this.css.height=b}
  }
}
eyefi_obj.prototype.clipBy = function(t,r,b,l,setwidth){ 
  this.clipTo(this.ct+t,this.cr+r,this.cb+b,this.cl+l,setwidth)
}
function eyefi_doc_size(){ 
  this.x=0;this.x2=eyefi.ie && document.body.offsetWidth-20||innerWidth||0;
  this.y=0;this.y2=eyefi.ie && document.body.offsetHeight-5||innerHeight||0;
  if(!this.x2||!this.y2) return message('Document has no width or height') 
  this.x50=this.x2/2;this.y50=this.y2/2;
  return this;
}
function clearDots() {
	if (eyefi.ie) { dots.focus() }
}
var conTent=0;
var speed=50; // increase this (even) number for more speed
var n=0;
var loop, timer
//Makes the object go up
function goDown(move){
	if(this.y>conTent){
		if ((this.y-2*move)<conTent){
	    	move=Math.round(move*.5)
	    	if (this.y-move<conTent) {
	      		move=0;
			} 
		}
		this.moveIt(0,this.y-move)
			if(loop) setTimeout(this.obj+".down("+move+")",speed)
	}
}
//Makes the object go down
function goUp(move){
	if(this.y<0){
		if ((this.y-2*move)>0){
	    	move=Math.round(move*.5)
	    		if (this.y-move>0) {
	      		move=0;
	    		}
		}
		this.moveIt(0,this.y-move)
			if(loop) setTimeout(this.obj+".up("+move+")",speed)
	}
}
//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(n,speed){
oCont=eval("oCont"+n);
oText=eval("oText"+n);
conTent=eval("(-oText"+n+".h+oCont"+n+".cb)");
//if (eyefi.ns5up) { conTent=-100; }
//if (eyefi.ns5up) alert(conTent);
	if(loaded){
		loop=true;
		if(speed>0) oText.down(speed)
		else oText.up(speed)
	}
}
//Stops the scrolling (called on mouseout)
function noScroll(){
	clearDots();
	loop=false;
	clearTimeout(timer);
	n=0;
	return true;
}
var loaded;
function scrollInit(){
	page=new eyefi_doc_size()
	for (i=1; i <= (maxScroll) ; i++) // writing out the image map for each dropdown
		{
			eval("oUp"+i+"=new eyefi_obj('divUp"+i+"')");
			eval("oCont"+i+"=new eyefi_obj('divCont"+i+"')");
			eval("oText"+i+"=new eyefi_obj('divText"+i+"','divCont"+i+"')");
			eval("oText"+i+".moveIt(0,0);");
			eval("oCont"+i+".showIt()");
			if (eval("oText"+i+".h")>=eval("oCont"+i+".cb")) { eval("oUp"+i+".showIt()"); }
		}
	loaded=true;
}