
/***************** AUTO-SCROLLING CODE *******************/          
var NUM_PAGES = 3;
var DELAY_MILLISECONDS = 7000;  //This controls the delay (in milliseconds) between pages.
var disableScrolling;

var timeOut;                    //Variable to keep track of the current timeout variable
var curPage = 0;                //The current page being displayed

function addTimeout() {
   //Clear the current timeout (if any)
   if (timeOut) {
        clearTimeout(timeOut);
   }
   timeOut = setTimeout("showNextPage();", DELAY_MILLISECONDS); 
}

//pause scrolling 
function pauseScrolling(index) {
    curPage=index;
    disableScrolling = true;
}

//start or resume scrolling
function resumeScrolling() {
    disableScrolling = false;
    addTimeout();
}

//this function clears out any other active timeouts, and if scrolling is enabled shows the next page 
//(will loop 1 - 2 - 3 - 1 - 2 - 3, etc...
function showNextPage() {
    if (!disableScrolling) {
        curPage++;
        changeArrow( ( (curPage-1) % NUM_PAGES ) + 1 );
        addTimeout();
    }
}
/*************** END OF SCROLLING CODE ******************/

function renderFlash(src, width, height, features) {
	document.writeln('<embed src="' + src + '" quality="high" width="' + width + 
					 '" height="' + height + '" align="middle" allowscriptaccess="sameDomain" ' +
					 'type="application/x-shockwave-flash" ' + features + 
  					 'pluginspage="http://www.macromedia.com/go/getflashplayer" />');
}

function changeArrow(index) {
	var arrow = document.getElementById("arrow");
	var text1 = document.getElementById("text1");
	var text2 = document.getElementById("text2");
	var text3 = document.getElementById("text3");

	switch (index) {
		case 1:
			arrow.style.backgroundPosition = "0px 0px";
			text1.style.display = "";
			text2.style.display = "none";
			text3.style.display = "none";
			break;
		case 2:
			arrow.style.backgroundPosition = "0px -32px";
			text1.style.display = "none";
			text2.style.display = "";
			text3.style.display = "none";
			break;
		case 3:
			arrow.style.backgroundPosition = "0px -64px";
			text1.style.display = "none";
			text2.style.display = "none";
			text3.style.display = "";
			break;
	}
}

function CreateGrid(DivID, CLSID, ObjectID, WIDTH, HEIGHT, MV, FV, QT, BG) {
	var d = document.getElementById(DivID);
	d.innerHTML = '<object classid=clsid:' + CLSID + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width=' + WIDTH + ' height=' + HEIGHT +' id=' + ObjectID + ' ALIGN=""><PARAM NAME=movie VALUE=' + MV + '><PARAM NAME="FlashVars" VALUE=' + FV + '><PARAM NAME=quality VALUE=' + QT + '><PARAM NAME=bgcolor VALUE=' + BG + '><EMBED src=' + MV + ' FlashVars=' + FV + ' quality=' + QT + ' bgcolor=' + BG + ' width=' + WIDTH + ' height=' + HEIGHT +' NAME=' + ObjectID + ' ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';
}

function openWindow(site) {
	window.open(site, "_blank", "top=" + window.screenTop + ",left=" + window.screenLeft + ",width=" + window.document.body.scrollWidth + ",height=" + window.document.body.scrollHeight);
}
