// ************ set up colours ****************
// specify background colour for main menu item:
var mainItem='#00aeef';
// specify rollover colour for main menu item:
var mainOver='#7fd6f7';
// specify background colour for sub menu item:
var subItem='#cccccc';
// specify rollover colour for sub menu item:
var subOver='#eeeeee';

// *********** set up ticker **********************
var newsspeed    = 50; // speed of scrolling
var rollStop     = 647; // width of ticker
var rollHeight   = 17; // height of ticker

// *********** start code ***************
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.saf=(this.mac && !this.ie)?1:0; this.ns6=(this.dom && !this.ie)?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0; this.ns=(this.ns4 || this.ns6 || this.saf);
	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.newsLeft=gonewsLeft; // 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() }
}
// ************ code for newsticker ************** */
var pauseTimer=0; var rollIt=0; var newsconTent=0; var newspause=0; var loaded; 
var newsloop, newstimer
function gonewsLeft(newsmove,rollStop,newsconTent){ 
	if (rollIt<=(rollStop-1) && !(rollIt == 0 && pauseTimer == 1)) { 
		if(this.x>-newsconTent){ 
			this.moveIt(this.x-newsmove,0) 
			if(newsloop) { newstimer = setTimeout(this.obj+".newsLeft("+newsmove+")",newsspeed); } 
			rollIt=rollIt+1; 
		} else if (this.x<=newsconTent){ this.moveIt(0,0); nText.newsLeft(newsmove); } 
	} else { nonewsScroll(); setTimeout("newsScroll("+1+")",newspause); } 
}
function newsScroll(newsspeed){
	if(loaded){
		newsloop=true;
		if(newsspeed>0) nText.newsLeft(newsspeed,rollStop,newsconTent)
	}
}
function nonewsScroll(){ newsloop=false;	clearTimeout(newstimer);rollIt=0; }

function popBlog(page) {
	window.open(page,'blog','toolbar=no,location=no,directories=no,status=no,menubar=no,scrolling=1,scrollbars=1,resizable=no,width=346,height=317');			
}

function popEcard(page) {
	window.open(page,'ecard','toolbar=no,location=no,directories=no,status=no,menubar=no,scrolling=1,scrollbars=1,resizable=no,width=360,height=455');			
}

// ******************************************************************************

var menuOn=false;
function move(e){
	x=eyefi.ns4 || eyefi.ns6?e.pageX:event.x
	y=eyefi.ns4 || eyefi.ns6?e.pageY:event.y
	if(eyefi.ie) y=y+eval(scrolled)
	if (menuOn==true) {
		if (x > (navPos+(obj*108)) || x < (navPos+(obj*108)-100)) { closeMenu(navOn); }
		if (y > 325 || y < 140) { closeMenu(navOn); }
	}	
}
var navOn='sub1';var obj=1;
function doMenu(obj) {
	document.getElementById('navigation').style.cursor='pointer';
	document.getElementById(navOn).style.display='none';
	document.getElementById('sub'+obj).style.display='block';
	over('menu'+obj); navOn='sub'+obj; menuOn=true;	
}
function closeMenu(navOn) {
	document.getElementById(navOn).style.display='none';
	document.getElementById('navigation').style.cursor='default';	
	menuOn=false;
}
function moveMenu() {
	navPos=((screen.availWidth/2)-350);
	document.getElementById('navigation').style.left=navPos;
	scrolled=eyefi.ns4 || eyefi.ns6?"window.pageYOffset":"document.body.scrollTop"
	if(eyefi.ns4)document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove=move;
}
function over(obj) {
	document.getElementById(obj).style.backgroundColor=mainOver;
	// document.getElementById(obj).style.color='#ffffff';
}
function out(obj) {
	document.getElementById('menu'+obj).style.backgroundColor=mainItem;
	// document.getElementById('menu'+obj).style.color='#ffffff';
}
function overs(obj) {
	obj.style.backgroundColor=subOver;
	// obj.style.color='#1a1e23';
}
function outs(obj) {
	obj.style.backgroundColor=subItem;
	// obj.style.color='#1a1e23';
}
function showMe(page, external) {
    if (external) { window.open(page); } 
	else { document.location=page; }
}
function pointerCursor(obj) { obj.style.cursor='pointer'; }
function defaultCursor(obj) { obj.style.cursor='default'; }
var navPos=0;
function moveMenu() {
	nonewsScroll();
	nCont=new eyefi_obj('newsCont');
    nText=new eyefi_obj('newsText','newsCont');
	nText.moveIt(0,0);
	if (rollStop>=(nText.w/2)) { newsconTent=(nText.w/2); }
	else { newsconTent=(nText.w/2); }
	nCont.clipTo(0,rollStop,rollHeight,0); // ns6 fix	
	// *********************************************************
	var winW = 0;
	if (navigator.appName.indexOf("Microsoft")!=-1) {
	 winW = document.body.offsetWidth;
	} else { winW = window.innerWidth; }
	navPos=((winW-906)/2)+240;
	scrolled=eyefi.ns4 || eyefi.ns6?"window.pageYOffset":"document.body.scrollTop"
	if(eyefi.ns4)document.captureEvents(Event.MOUSEMOVE)
	document.onmousemove=move;
	nCont.showIt();	nText.showIt();	loaded=true; newsScroll(1);
	
	//	run tooltip
	setTimeout('tt_Init();', 100); 
}
onload=moveMenu;

function popDis() {
	window.open('/disclaimer.html','popDis3','toolbar=no,location=no,directories=no,status=no,menubar=no,scrolling=1,scrollbars=1,resizable=no,width=346,height=317');			
}

function popScreen(inUrl){
	window.open('/screener.html?image='+inUrl, 'popScreen','toolbar=no,location=no,directories=no,status=no,menubar=no,scrolling=1,scrollbars=1,resizable=yes,width=346,height=317'); 
}
