// EN FONCTION
function lib_bwcheck()
{
 //Browsercheck (needed)
 this.ver=navigator.appVersion
 this.agent=navigator.userAgent
 this.dom=document.getElementById?1:0
 this.opera5=this.agent.indexOf("Opera 5")>-1
 this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
 this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
 this.ie7=(this.ver.indexOf("MSIE 7")>-1 && this.dom && !this.opera5)?1:0;
 this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
 this.ie=this.ie4||this.ie5||this.ie6||this.ie7
 this.mac=this.agent.indexOf("Mac")>-1
 this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
 this.ns4=(document.layers && !this.dom)?1:0;
 this.bw=(this.ie7 || this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
 return this
}

// EN FONCTION
var bw=new lib_bwcheck()


// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

/**********************************************************************************   
* ZoomFade 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/

/*Here are the variables you have to set, play with different values:                                                                 
First the text: (it will stop and fade/change the colors on the last one)*/
zText=new Array('')
  
//Now the colors:
//all you have to do is set the color you want to have in here: 
//(the first color will be the color that the text is when it zooms.)
zColor=new Array('#33FF33','#39CE39','#3FBD3F','#45A145','#4B854B','#516951','#575757')
 
var zEndSize=5   //The fontsize in px you want the zoom to end at
var zSpeed=10     //Zoom speed
var zAddSize=5    //Px to add to the fontsize on each interval
var zFadeSpeed=70 //Color change/fade speed
var zFont="'courier new', typewriter, matrix, monospace" //Font
var zHide=true;    //do you want it to hide when its done? (true or false)
var zHideWait=100  //Time to wait before hiding
var zStartSize=5 //The size to start at
var zEndCode="slideit()"   // Code to execute when the zoom and fade is finished. ie: "location.href='newpage.html', executes when the hide does.

/*You can remove this if you don't wan't it to start right away.
You can have it start if someone clicks a link (make a link like this:
<a href="#" onclick="fadeInit()">Click to Zoomtext</a>)*/
//onload=zoomInit;


/********************************************************************************
Objects constructors
********************************************************************************/
function makeObj(obj,speed,xmove,ymove,works)
{
 this.el=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj]:0;	
 this.css=bw.dom || bw.ie4?this.el.style:bw.ns4?this.el:0;
 this.moveIt=b_moveIt;
}

function makeNewsObj(obj,nest,font,size,color,news,fadespeed,betweendelay,slidespeed,works,newsheight)
{
 nest=(!nest) ? "":'document.'+nest+'.'
 this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;	
 this.writeref=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;
 if(font)
 {
  this.color=new Array();
  this.color=eval(color);
  this.news=new Array();
  this.news=eval(news)
  this.font=font;
  this.size=size;
  this.speed=fadespeed;
  this.delay=betweendelay;
  this.newsheight=newsheight;
  this.fadeIn=b_fadeIn;
  this.fadeOut=b_fadeOut;
  this.newsWrite=b_newsWrite;
  this.y=1
  this.slideIn=b_slideIn;
  this.moveIt=b_moveIt;
  this.slideSpeed=slidespeed;
  this.works=works
  if(bw.dom || bw.ie4)
  {
   this.css.fontFamily=this.font;
   this.css.fontSize=this.size;
   this.css.color=this.color[0]
  }
 }
 this.obj = obj + "Object";
 eval(this.obj + "=this");
 return this
}

// EN FONCTION
function makeZoomObj(obj,font,size,endsize,color,text,zspeed,fadespeed,addsize,hide,hidewait,endcode)
{
 this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?document.layers[obj]:0;	
 this.writeref=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?document.layers[obj].document:0;	
 this.zoomWrite=b_zoomWrite;
 this.zoomIt=b_zoomIt;
 this.fadeIt=b_fadeIt;
 this.zoomFade=b_zoomFade;
 this.font=font;
 this.color=new Array();
 this.color=eval(color);
 this.text=new Array();
 this.text=eval(text);
 this.zspeed=zspeed;
 this.fadespeed=fadespeed;
 this.addsize=addsize;
 this.endcode=endcode
 this.hide=hide;
 this.hidewait=hidewait;
 this.size=size;
 this.startsize=size;
 this.endsize=endsize
 if(size<endsize)
 {
  this.way="<";
  this.addsize=this.addsize
 }
 else
 {
  this.way=">";
  this.addsize=-this.addsize}
  if(bw.dom || bw.ie4)
  {
   //Setting the style properties
   this.css.fontFamily=this.font;
   this.css.fontSize=this.size+"px";
   this.css.color=this.color[0]
  }
  this.obj = obj + "Object";
  eval(this.obj + "=this");
  return this
}


/********************************************************************************
Objects functions
********************************************************************************/
function b_moveIt(x,y)
{
 this.x=x;
 this.y=y;
 this.css.left=this.x+px;
 this.css.top=this.y+px;
}

function b_newsWrite(num,i)
{
 if (bw.ns4)
 {
  this.writeref.write("<a href=\""+this.news[num]['link']+"\" style=\"text-decoration:none; font-size:"+this.size+"px\">"+"<font face=\""+this.font+"\" color=\""+this.color[i]+"\">"+this.news[num]['text']+"</font></a>")
  this.writeref.close()
 }
 else
  this.writeref.innerHTML = '<a id="'+this.obj+'link' +'" style="text-decoration:none; font-size:'+this.size+'px; color:'+this.color[i]+'" href="'+this.news[num]['link']+'">'+this.news[num]['text']+'</a>'
}

//Slide in
function b_slideIn(num,i)
{
 if (this.y>0)
 {
  if (i==0)
  {
   this.moveIt(0,this.newsheight);
   this.newsWrite(num,this.color.length-1)
  }
  this.moveIt(this.x,this.y-this.slideSpeed)
  i ++
  setTimeout(this.obj+".slideIn("+num+","+i+");",50)
 }
 else
  setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay)
}

//The fade functions
function b_fadeIn(num,i)
{
 if (i<this.color.length)
 {
  if (i==0 || bw.ns4)
   this.newsWrite(num,i)
  else
  {
   obj = bw.ie4?eval(this.obj+"link"):document.getElementById(this.obj+"link")
   obj.style.color = this.color[i]
  }
  i ++
  setTimeout(this.obj+".fadeIn("+num+","+i+")",this.speed)
 }
 else
  setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay)
}

function b_fadeOut(num,i)
{
 if (i>=0)
 {
  if (i==0 || bw.ns4)
   this.newsWrite(num,i)	
  else
  {
   obj = bw.ie4?eval(this.obj+"link"):document.getElementById(this.obj+"link")
   obj.style.color = this.color[i]
  }
  i --
  setTimeout(this.obj+".fadeOut("+num+","+i+")",this.speed)
 }
 else
 {
  num ++
  if(num==this.news.length)
  {
   num=0;
   zoomInit()
  }
  else
  {
   works = !this.works?0:this.works==1?1:Math.round(Math.random())
   if(works==0)
    setTimeout(this.obj+".fadeIn("+num+",0)",500)
   else
    if (works==1)
    {
     this.y=1;
     setTimeout(this.obj+".slideIn("+num+",0)",500)
    }
  }
 }
}

function b_zoomFade(num)
{
 if(num<this.text.length)
 {
  this.size=this.startsize
  this.zoomIt(num,'this.zoomFade('+(num+1)+')')
 }
 else
  if(num==this.text.length)
   this.fadeIt(0,'this.zoomFade('+(num+1)+')')
  else
   if(this.hide)
    setTimeout(this.obj+".css.visibility='hidden'; eval("+this.obj+".endcode)",this.hidewait)
}

function b_zoomWrite(num,cnum)
{
 if(bw.ns4)
 {
  this.writeref.write('<span style="text-align:center; font-size:' +this.size+'px; font-family:'+this.font+'; color:'+this.color[cnum]+'">'+this.text[num]+'</span>')
  this.writeref.close()
 }
 else
  this.writeref.innerHTML="<center>"+this.text[num]+"</center>"
}

function b_zoomIt(num,fn)
{
 if(eval(this.size+this.way+this.endsize))
 {
  if(this.size==this.startsize || bw.ns4)
   this.zoomWrite(num,0)
  if(bw.dom || bw.ie4)
   this.css.fontSize=this.size+"px"
  this.size=this.size+this.addsize
  setTimeout(this.obj+".zoomIt("+num+",'"+fn+"')",this.zspeed)
 }
 else
  eval(fn)	
}

function b_fadeIt(num,fn)
{
 if(num<this.color.length)
 {
  if(bw.ns4)
   this.zoomWrite(this.text.length-1,num)
  else
   this.css.color=this.color[num]
  num++
  setTimeout(this.obj+".fadeIt("+num+",'"+fn+"')",this.fadespeed)
 }
 else
  eval(fn)	
}


/***************************************************************************
Initiating page and starting animation
****************************************************************************/
var posArray,oZdivs;

function introInit()
{
 pageXcenter = bw.op5||bw.ns4 ||bw.ns6?innerWidth/2:document.body.offsetWidth/2
 pageYcenter = bw.op5||bw.ns4||bw.ns6?innerHeight/2:document.body.offsetHeight/2
 oZdivs = new Array()
 for(var i=0; i<numberOfLetters; i++)
 {
  oZdivs[i] = new makeObj('div'+i)
  oZdivs[i].moveIt(-200,0)
  oZdivs[i].css.visibility = "visible"
 }
 if (animation==4)
  animation = Math.round(Math.random()*2)+1
 if (!testing)
  eval('anim'+animation+'(0)')
 else
  testIt()
}

function testIt()
{
 alert(pageYcenter)
 for(var i=0; i<oZdivs.length; i++)
 {
  oZdivs[i].moveIt((pageXcenter+xpos[i]),(pageYcenter+ypos))
 }	
}

//*** EN fonction 
function zoomInit()
{
 if(bw.bw)
 {
  oZoom=new makeZoomObj('divZoom',zFont,zStartSize,zEndSize,'zColor','zText',zSpeed,zFadeSpeed,zAddSize,zHide,zHideWait,zEndCode)
  oZoom.zoomFade(0)
  oZoom.css.visibility='visible'
 }
}

/********************************************************************************************
The init function. Calls the object constructor and set some properties and starts the fade
*********************************************************************************************/
function fadeInit()
{
 oNews = new makeNewsObj('divNews','divNewsCont',nFont,nFontsize,"nColor","nNews",nFadespeed,nBetweendelay,nSlidespeed,nWorks,nNewsheight)
 oNewsCont = new makeNewsObj('divNewsCont')
 works = !oNews.works?0:oNews.works==1?1:Math.round(Math.random())
 if (works==0)
  oNews.fadeIn(0,0)
 else
  if (works==1)
   oNews.slideIn(0,0)
 oNewsCont.css.visibility = "visible"
}

/***************************************************************************
Intro 1
****************************************************************************/
xPath1 = new Array(-277,-271,-264,-255,-245,-234,-223,-210,-196,-181,-161,-134,-98,-52,1,53,98,131,151,156,147,124,92,59,0)
yPath1 = new Array(-240,-206,-162,-114,-64,-16,29,71,112,151,187,217,241,255,260,254,239,213,179,143,108,77,51,30,0)
function anim1(num,test)
{
 if (num<oZdivs.length)
 {
  st = test?test:0;
  animX(num,'xPath1','yPath1',aspeed,st,'anim1('+(num+1)+','+st+')')
 }
 else
  endanim(0)
}

/***************************************************************************
Intro 2
****************************************************************************/
xPath2 = new Array(-285,-270,-255,-240,-225,-210,-195,-180,-165,-150,-135,-120,-105,-90,-75,-60,-45,-30,-15,0)
yPath2 = new Array(-353,-344,-335,-324,-312,-299,-285,-270,-254,-236,-218,-198,-177,-155,-132,-108,-83,-56,-29,0)
function anim2(num)
{
 if (num<oZdivs.length)
 {
  animX(num,'xPath2','yPath2',aspeed,0,'anim2('+(num+1)+')')
 }
 else
  endanim(0)
}

/***************************************************************************
Intro 3
****************************************************************************/
xPath3 = new Array(0,-2,-6,-13,-23,-36,-50,-66,-83,-100,-117,-134,-150,-164,-177,-187,-194,-198,-200,-198,-194,-187,-177,-164,-150,-134,-117,-100,-83,-66,-50,-36,-23,-13,-6,-2,0)
yPath3 = new Array(0,-17,-34,-50,-64,-77,-87,-94,-98,-100,-98,-94,-87,-77,-64,-50,-34,-17,0,17,34,50,64,77,87,94,98,100,98,94,87,77,64,50,34,17,0)
function anim3(num)
{
 if (num<oZdivs.length)
 {
  animX(num,'xPath3','yPath3',aspeed,0,'anim3('+(num+1)+')')
 }
 else
  endanim(0)
}

/***************************************************************************
Animation function
****************************************************************************/
function animX(divnum,arrayX,arrayY,speed,num,fn)
{
 arrayXr = new Array();
 arrayYr = new Array();
 arrayXr = eval(arrayX);
 arrayYr = eval(arrayY);
 arrayX = "'"+arrayX+"'";
 arrayY = "'"+arrayY+"'"
 if (num<arrayXr.length)
 {
  oZdivs[divnum].moveIt(arrayXr[num]+(pageXcenter+xpos[divnum]),arrayYr[num]+(pageYcenter+ypos))
  num ++;
  setTimeout("animX("+divnum+","+arrayX+","+arrayY+","+speed+","+num+",'"+fn+"')",speed)
 }
 else
  eval(fn)
}

/***************************************************************************
This is what happens when the animation is over. If
you want something else to happen edit here!
****************************************************************************/
function endanim(num)
{
 if (num<oZdivs.length)
 {
  oZdivs[num].css.visibility = "hidden" //Hiding divs
  num ++
  setTimeout("endanim("+num+")",300)
 }
 else
 {
  // After the animation start the next animation
 }
}

//*****************************************
// Blending Image Slide Show Script- 
// © Dynamic Drive (www.dynamicdrive.com)
// For full source code, visit http://www.dynamicdrive.com
//*****************************************

//specify interval between slide (in mili seconds)
var slidespeed=2000

//specify images
var slideimages=new Array("/images/title/ephide_com_title_index.jpg","/images/title/ephide_com_title_index.jpg","/images/title/ephide_com_title_index.jpg")

//specify corresponding links
var slidelinks=new Array("home.php","home.php","home.php")

var newwindow=0 //open links in new window? 1=yes, 0=no

var imageholder=new Array()
var ie=document.all

for (i=0;i<slideimages.length;i++)
{
 imageholder[i]=new Image()
 imageholder[i].src=slideimages[i]
}

function gotoshow()
{
 if (newwindow)
  window.open(slidelinks[whichlink])
 else
  window.location=slidelinks[whichlink]
}


/***************************************************************************
Starting the intro when the page is loaded.
****************************************************************************/

onload = zoomInit;
