// -- http://www.eyefi.nl --
// -- +31 (0)20 4 279 919 --
// -- W.G.Plein 369, 1054 SG Amsterdam , The Netherlands --
// -- thanks to T. Brattli --
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 && !this.ie)?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.newsUp=gonewsUp; // news ticker function
  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 wwidth = 650;
var wheight = 450;
function popup(pagename,winid,wwidth,wheight) {
	window.open(pagename,winid,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrolling=0,scrollbars=0,resizable=no,width='+wwidth+',height='+wheight);			
}
// ************ code for newsticker ************** */
var pauseTimer=0; 
var rollIt=0; // do not change
var newsconTent=0; // do not change
var newspause=0; // do not change
var loaded; // do not change
var newsloop, newstimer
function gonewsUp(newsmove,rollStop,newsconTent){ 
	if (rollIt<=(rollStop-1) && !(rollIt == 0 && pauseTimer == 1)) { 
		if(this.y>-newsconTent){ 
			this.moveIt(0,this.y-newsmove) 
			if(newsloop) { 
				newstimer = setTimeout(this.obj+".newsUp("+newsmove+")",newsspeed); 
			} 
			rollIt=rollIt+1; 
		} else if (this.y<=newsconTent){ 
			this.moveIt(0,0); 
			nText.newsUp(newsmove); 
		} 
	} else { 
		nonewsScroll(); 
		setTimeout("newsScroll("+1+")",newspause); 
	} 
}
function newsScroll(newsspeed){
	if(loaded){
		newsloop=true;
		if(newsspeed>0) nText.newsUp(newsspeed,rollStop,newsconTent)
	}
}
function nonewsScroll(){
	newsloop=false;
	clearTimeout(newstimer);
	rollIt=0;
}
/* ********** initializing code - DO NOT CHANGE - *********** */
function allInit() {
	page=new eyefi_doc_size() // Making page object
	// code for newsticker - DO NOT CHANGE -
	nCont=new eyefi_obj('newsCont');
    nText=new eyefi_obj('newsText','newsCont');
	nText.moveIt(0,0);
	newsconTent=(nText.h/2);
	nCont.clipTo(0,rollStop,rollHeight,0); // ns6 fix
	nCont.showIt();
	nText.showIt();	
	loaded=true;
	newsScroll(1);
}