// Config for rotating images, logos and text

// delay times for the text and the images, respectively
var millisForText = 10000
var millisForImages = 5000

// Text for the webs
var defaultText = "<ul><li><b><font color=\"#b35555\">Agile<br></font></b>";
    defaultText += "Adaptive systems for a dynamic business environment.<br><br></li>";
    defaultText += "<li><b><font color=\"#b35555\">Creative<br></font></b>";
    defaultText += "Innovative solutions to complex business problems.<br><br></li>";
    defaultText += "<li><b><font color=\"#b35555\">Solid<br></font></b>";
    defaultText += "Seasoned professionals; proven results.</li></ul>";


var MGtext = "US MatrixGroup LLC is a private equity investment and management ";
    MGtext += "and advisory firm.<br><br>";
    MGtext += "The firm provides management and support services to MatrixGroup ";
    MGtext += "companies.<br><br>";
    MGtext += "The firm is also chartered with assisting early stage technology ";
    MGtext += "start-ups to achieve viability.<br>";


var Mtext = "Matrix Integration Technology is a software development company ";
    Mtext += "providing application solutions to the financial services sector.<br><br>";
    Mtext += "Matrix's core technology, The Universal Trading Framework, ";
    Mtext += "provides a scalable, extensible platform for developing ";
    Mtext += "and deploying a broad array of capital market trading products.<br><br>";
    Mtext += "The Matrix Trading Solution includes web-base trading screens, order routing, and ";
    Mtext += "gateways into open outcry and electronic markets for FCMs, brokers, ";
    Mtext += "and their customers.";
	
	
var FPtext = "FuturesPoint, Inc. is an Internet Portal site for trading in capital markets.<br><br>";
    FPtext += "The portal provides access to commodity and derivative markets in the US and ";
    FPtext += "Europe for futures and options order execution.<br><br>";
    FPtext += "The portal is accessed by brokers and their clients over the internet using ";
    FPtext += "the Universal Trader screens. Institutional clients and FCMs typically employ ";
    FPtext += "proprietary front-ends, feeding orders directly into a FIX server interface on the portal.";


var AVtext = "AudioVisions, LLC is a technology start-up company within the MatrixGroup ";
    AVtext += "incubator program.<br><br>";
    AVtext += "AudioVision's core product offering, Cinatra, is designed to provide audio ";
    AVtext += "playback of printed media. Service delivery will be made available over the ";
    AVtext += "Internet to audio capable mobile electronic devices, such as cell phones, ";
    AVtext += "PDAs and MP3 players.<br><br>";
    AVtext += " The Cinatra product will initially focus on the needs of the 12 million vision impaired ";
    AVtext += "individuals in this country. Additionally, Cinatra has potential ";
    AVtext += "application in both the international community and the commercial sector.";
















// image array for the logos that go with the text
// you MUST have a logo for EVERY web!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
var logos = new Array();
logos[0]="matrixgroupcompanies.gif";
logos[1]="usmatrixgroup.gif";
logos[2]="matrix.gif";
logos[3]="fpo.gif";
logos[4]="AVlogo.gif";
// end Text/Logo section


// to add a site, create a var with the text, add it to the array below, and adda a logo to the logos[];
var text = new Array()
text[0]= defaultText
text[1]= MGtext
text[2]= Mtext
text[3]= FPtext
text[4]= AVtext


/*******************************

Fade in/out image section below

********************************/
var pause= millisForImages //SET PAUSE BETWEEN SLIDE (3000=3 seconds)

var fadeimages=new Array()
//SET IMAGE PATHS. Extend or contract array as needed
fadeimages[0]="appimages/skyscrapers.jpg"
fadeimages[1]="appimages/NYSE.jpg"
fadeimages[2]="appimages/cbot.jpg"
fadeimages[3]="appimages/wheat.jpg"
fadeimages[4]="appimages/currency.jpg"
fadeimages[5]="appimages/gold.jpg"
fadeimages[6]="appimages/oil.jpg"
fadeimages[7]="appimages/datacenter.jpg"
fadeimages[8]="appimages/tower.jpg"
fadeimages[9]="appimages/sinewave.jpg"
fadeimages[10]="appimages/headphone.jpg"

////////////////////////////////////////// end config


// JavaScript Document
var preloadimages=new Array()
for (p=0;p<logos.length;p++){
preloadimages[p]=new Image()
preloadimages[p].src="images/"+logos[p]
}
var menuLink = new Array();
menuLink[0]="";
menuLink[1]="http://www.usmatrixgroup.com";
menuLink[2]="http://www.matrixgroup.ws"
menuLink[3]="http://www.futurespoint.com"
menuLink[4]="http://www.audiovisions.com"

var currentText = 0
var textCount = text.length;

function changeLogo(index)
 {
 if (ie4 || dom)
 {
  document.getElementById('LogoHolder').src = "images/"+logos[index];
  }
  else
  {
  document.images.LogoHolder.src = "images/"+logos[index];
  }
 // changeMenu(index)
 }
 /*
 function changeMenu(num)
 {
   resetMenu()
   if (num > 0)
   {
     if (ie4 || dom)
      {
  	   document.getElementById('img'+num).src = "images/"+menuImagesdn[num]
  	  }
   }
 }
*/
function resetMenu()
{
var tmpMenuObj
 for (i=1;i<menuImages.length;i++)
 {
  	tmpMenuObj = document.getElementById('img'+i)
	theString = tmpMenuObj.src
	if (theString.charAt(theString.length -8) == "n")
	{
		tmpMenuObj.src = "images/"+menuImages[i];
	}
 }
}

function cycleText()
 {
 currentText++
   if (currentText >= textCount)
   	{
	  currentText = 0  // you can make this 0zero if you want the default text to be rotated as well
	}
	
	changeText(currentText);
	//currentText++
 }
 
var textInterval
function startTextInterval()
{
textInterval = window.setInterval("cycleText()",millisForText)
}
//window.setInterval("cycleImages()",millisForImages)

var dhtml = '', no = 0;
//if (navigator.appVersion.charAt(0) == "4") {
    if (navigator.appVersion.indexOf("MSIE") != -1)
        dhtml = 'IE';
    else
        dhtml = 'NN';
//}       

function hideAll()
 {
  for (i=0; i < 5; i++)
   {
	document.getElementById('TextHolder'+i).style.visibility = "hidden";
   }
 }

function changeText(index) {
    if (ie4 || dom) {
    	document.getElementById('TextHolder').innerHTML = text[index];
		currentText = index;
    }
    else {
        hideAll();
	    document.getElementById('TextHolder'+index).style.visibility = "visible";
		currentText = index;
    }
	
	changeLogo(index);
}

function dLink() {
    if (ie4 || dom)
        document.write('<div id="TextHolder">'+text[0]+'<\/div>');
    else
	{
		for (i=0; i < textCount; i++)
		{
          document.write('<div id="TextHolder'+i+'" style="visibility:hidden; position:absolute">'+text[i]+'<\/div>');
		}
	}
    document.write('<br>');
    no+=1;
}
function clearCycle()
{
window.clearInterval(textInterval)
}
function resetInterval()
{
textInterval = window.setInterval("cycleText()",millisForText)
}
var pauseTimer
var pauseSet = false;
function pauseRotations()
{
 clearCycle()
 pauseTimer = window.setInterval("resumeRotations()",30000)
 pauseSet = true;
}

function resumeRotations()
{
 if (pauseSet)
 {
 window.clearInterval(pauseTimer)
 //currentText++                          //////////////////////////////////// this is where the problem is!!!!!!!!
 textInterval = window.setInterval("cycleText()",millisForText)
 pauseSet=false;
 }
}
function stopPausing()
{
 if (pauseSet)
 {
 window.clearInterval(pauseTimer)
 textInterval = window.setInterval("cycleText()",millisForText)
 pauseSet=false;
 }
}
/***********************************************
* Fade-in image slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

var slideshow_width='140px' //SET IMAGE WIDTH
var slideshow_height='225px' //SET IMAGE HEIGHT

////NO need to edit beyond here/////////////

var preloadedimages=new Array()
for (p=0;p<fadeimages.length;p++){
preloadedimages[p]=new Image()
preloadedimages[p].src=fadeimages[p]
}

var ie4=document.all
var dom=document.getElementById

function createRotator()
{
if (ie4||dom)
document.write('<div style="position:relative"><div id="canvas0" style="position:absolute;top:0;left:-200;filter:alpha(opacity=10);-moz-opacity:10"></div><div id="canvas1" style="position:absolute;top:50;left:-300;filter:alpha(opacity=10);-moz-opacity:10;visibility: hidden"></div><div id="canvas2" style="position:absolute;top:100;left:-250;filter:alpha(opacity=10);-moz-opacity:10;visibility: hidden"></div></div>')
else
document.write('<img name="defaultslide" src="'+fadeimages[0]+'">')

initRot();
}

var curpos=10
var degree=10
var curcanvas="canvas0"
var curcanvasId = 0
var curimageindex=0
var nextimageindex=1
var canvasArray = new Array()
canvasArray[0] = "canvas0"
canvasArray[1] = "canvas1"
canvasArray[2] = "canvas2"
var lastcanvasId = canvasArray.length -1

function setNextCanvas()
{
var tmpn = curcanvasId+1
	if (tmpn >= canvasArray.length)
	{
	  tmpn  = 0
	}
	return  canvasArray[tmpn]
}

function getNextCanvas()
{
var tmpn = curcanvasId+1
	if (tmpn >= canvasArray.length)
	{
	  tmpn  = tmpn - canvasArray.length
	}
	//document.write(canvasArray[tmpn]);
	return  canvasArray[tmpn]
}

function getLastCanvas()
{
tmp = lastcanvasId
	if (tmp < 0)
	{
	  tmp = canvasArray.length -1
	}
	return  canvasArray[tmp]
}

function fadepic(){
if (curpos<100){
curpos+=10
if (tempobj.filters)
{
tempobj.filters.alpha.opacity=curpos
oldCanvas.filters.alpha.opacity=100-curpos
}
else if (tempobj.style.MozOpacity)
{
tempobj.style.MozOpacity=curpos/101
oldCanvas.style.MozOpacity=1-(curpos/101)
}
}
else{
clearInterval(dropslide)
nextcanvas=getNextCanvas()
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
//var tempobj2=ie4? eval("document.all."+getLastCanvas()) : document.getElementById(getLastCanvas())
//tempobj2.style.visibility="hidden"
oldCanvas.style.visibility="hidden"
setTimeout("rotateimage()",pause)
}
}

function rotateimage(){
if (ie4||dom){
resetit(curcanvas)
var crossobj=tempobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
oldCanvas=ie4? eval("document.all."+getLastCanvas()) : document.getElementById(getLastCanvas())
crossobj.style.zIndex++
tempobj.style.visibility="visible"
var temp='setInterval("fadepic()",50)'
dropslide=eval(temp)
lastcanvasId = curcanvasId
curcanvas=setNextCanvas()
curcanvasId=(curcanvasId<canvasArray.length-1)? curcanvasId+1 : 0
}
else
document.images.defaultslide.src=fadeimages[curimageindex]
curimageindex=(curimageindex<fadeimages.length-1)? curimageindex+1 : 0
}

function resetit(what){
curpos=10
var crossobj=ie4? eval("document.all."+what) : document.getElementById(what)
if (crossobj.filters)
crossobj.filters.alpha.opacity=curpos
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=curpos/101
}

function startit(){
var crossobj=ie4? eval("document.all."+curcanvas) : document.getElementById(curcanvas)
crossobj.innerHTML='<img src="'+fadeimages[curimageindex]+'">'
nextcanvas=getNextCanvas()
tempobj=ie4? eval("document.all."+nextcanvas) : document.getElementById(nextcanvas)
tempobj.innerHTML='<img src="'+fadeimages[nextimageindex]+'">'
nextimageindex=(nextimageindex<fadeimages.length-1)? nextimageindex+1 : 0
rotateimage()
}

function initRot()
{
if (ie4||dom)
window.onload=startit
else
setInterval("rotateimage()",pause)
}