
//Sequential fly-in text script- by JavaScriptKit.com
//For this script and 400+ more, visit http://www.javascriptkit.com
//This notice must stay intact for use

var pausebetweenmsg=300; //customize pause in miliseconds between each message showing up (3000=3 seconds)
var glidespeed=50;//customize glide speed in pixels per frame.
var curobjindex=0;
var glideInterval = 50;


var fadetime = 1800;	/* in and out */
var holdtime = 1800;	
var slideswap = fadetime + fadetime + holdtime;  

/* add ie code to change slideswap */
var sBrowser = navigator.userAgent;
if (sBrowser.toLowerCase().indexOf('msie') > -1)  
  	       slideswap = fadetime + holdtime +200 ;



var Pix = new Array();
Pix[0]="Pics/SoftPhone395h.jpg" ;
Pix[1]="Pics/AA290w.jpg" ;
Pix[2]="Pics/MyHR290w.jpg";
Pix[3]="Pics/Kinderstreet290.jpg";

var Ref = new Array();
Ref[0]="SoftPhone.html" ;
Ref[1]="AA.html" ;
Ref[2]="HRIntranet.html" ;
Ref[3]="Kinderstreet.html" ;

var Caption = new Array();
Caption[0]="Intelliverse's Soft Phone" ;
Caption[1]="AutoAttendant Creator" ;
Caption[2]="Georgia Power's Intranet" ;
Caption[3]="Kinderstreet School Management" ;

var howMany = Pix.length;

var PicCurrentNum = 0;
var PicCurrent = new Image();
PicCurrent.src = Pix[PicCurrentNum];



function actualstyle(el, cssproperty){
if (el.currentStyle)
	return el.currentStyle[cssproperty];
else if (window.getComputedStyle){
	var elstyle=window.getComputedStyle(el, "")
	return elstyle.getPropertyValue(cssproperty)
	}
}

function collectElementbyClass(){
var classname="glide";
glidearray=new Array();
direction=new Array();
var inc=0;
var str='';
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){	
	str = alltags[i].className.substring(0,5);  /* look for 'glide */	
    if (str==classname)	{      
	    direction[inc]=alltags[i].className.substring(5);  
	   	glidearray[inc++]=alltags[i];	  	  
	  }
	}
if (glidearray.length>0){
	setTimeout("onebyoneglide()", 700);
 	}
}

function onebyoneglide(){
if (curobjindex<glidearray.length) 
    if (direction[curobjindex] == 'left')
		glidetimer=setInterval("glideleft()",glideInterval);
	else if (direction[curobjindex] == 'right') {
		glideInterval = 15;
		glidetimer=setInterval("glideright()",glideInterval);
		}
	else 	setTimeout("makeVisible()", 200); 	
}


function glideleft(){
if (parseInt(actualstyle(glidearray[curobjindex], "left")) == 300) 
     glidearray[curobjindex].style.visibility="visible";

if (parseInt(actualstyle(glidearray[curobjindex], "left"))>0)
	glidearray[curobjindex].style.left=parseInt(actualstyle(glidearray[curobjindex], "left"))-50+"px";
else{
	/* glidearray[curobjindex].style.left=0 */
	curobjindex++;
	clearInterval(glidetimer);
	setTimeout("onebyoneglide()", pausebetweenmsg);
	}
}

function glideright(){

if (parseInt(actualstyle(glidearray[curobjindex], "right")) == 200) 
     glidearray[curobjindex].style.visibility="visible";

if (parseInt(actualstyle(glidearray[curobjindex], "right"))>0)
	glidearray[curobjindex].style.right=parseInt(actualstyle(glidearray[curobjindex], "right"))-50+"px";
else{
	curobjindex++;
	clearInterval(glidetimer);
	setTimeout("onebyoneglide()", pausebetweenmsg);
	}
}

function slideshow() {

document.getElementById("changePix").src=Pix[PicCurrentNum];
document.getElementById("changePix").alt=Caption[PicCurrentNum];
document.getElementById("changePix").title=Caption[PicCurrentNum];
document.getElementById("changeRef").innerHTML =Caption[PicCurrentNum]; 
document.getElementById("changeRef").href=Ref[PicCurrentNum];
document.getElementById("changeRef2").href=Ref[PicCurrentNum];

/* change */
opacity("fade1",0,100,fadetime)
setTimeout("fadeOut()",holdtime+fadetime);



PicCurrentNum++;
if (PicCurrentNum == howMany) {
	PicCurrentNum = 0;	}
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100);   /* was 100 */
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
        setTimeout("slideshow()",slideswap);
    } 
    
      /* setTimeout("slideshow()",7000);   4200*/
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100);  
    /* Kill the IE fade - too much jitter */
  	/* if  ( opacity % 3 == 0) 				/* do only every 5th time, otherwise too fast */
    /*   object.filter = "alpha(opacity=" + opacity  + ")";  */
     
       
} 
      
function fadeOut(){
	opacity("fade1",100,0,fadetime)
	/* opacity("fade1",100,0,2150) */
}


function makeVisible(){
     glidearray[curobjindex].style.visibility="visible"
     curobjindex++;
     /* clearInterval(glidetimer); */
	 setTimeout("onebyoneglide()", 10);
	 setTimeout("slideshow()",10);
	 /* setInterval("slideshow()", slideSwap);	 */
 }

        

if (window.addEventListener)
	window.addEventListener("load", collectElementbyClass, false);
else if (window.attachEvent)
	window.attachEvent("onload", collectElementbyClass);
else if (document.getElementById)
	window.onload=collectElementbyClass;


