// Load section specific rollover images
preloader("Jade_Home","/_global/images/content/bioware_splash_jade3.jpg","/_global/images/content/bioware_splash_jade3_rollover.jpg");
preloader("Wallpaper","/_global/images/content/bioware_splash_jade4.jpg","/_global/images/content/bioware_splash_jade4_rollover.jpg");

preloader("footerarrowright","/_global/images/footer/arrows_right_more.gif","/_global/images/footer/arrows_right_more_over.gif");

// -------------------- Image Scroll ---------------------------------------------------- 
// Image Scroll version 1.2
// By Robin Mayne
// Copyright (c) 2001 Robin Mayne. All Rights Reserved.

// Set the document images names that will be replaced, in the order they appear on the page
var imgName = new Array("footerlogo1","footerlogo2","footerlogo3","footerlogo4");

// Set the info for each item in the scroll set, by loading into an array
var arraynum = 0;
var scrollobj = new Array();
function scrollInfo(linkpath, offimg, onimg) {
    arraynum++;
  	scrollobj[arraynum] = new Array(3);
    scrollobj[arraynum][0] = new Image();
    scrollobj[arraynum][0].src = offimg;
    scrollobj[arraynum][1] = new Image();
    scrollobj[arraynum][1].src = onimg;
    scrollobj[arraynum][2] = linkpath;    
}
// arraynum is now set at the number of total items in the scroll set


// load the info into the array, in the order they are to scroll, using the following format:
// scrollInfo("path/to/page.html","path/to/image.gif","path/to/rollover.gif");
// Added rootpath to all file names to accomodate NS6: Duleepa Wijayawardhana, Dec 17 2001

scrollInfo("http://dragonage.bioware.com/",writeRootPath() + "/_global/images/footer/da_duo.gif",writeRootPath() + "/_global/images/footer/da_color.gif");
scrollInfo("http://masseffect.bioware.com/",writeRootPath() + "/_global/images/footer/me2_duo.gif",writeRootPath() + "/_global/images/footer/me2_color.gif");
scrollInfo("http://www.swtor.com/",writeRootPath() + "/_global/images/footer/tor_duo.gif",writeRootPath() + "/_global/images/footer/tor_color.gif");
scrollInfo("http://sonic.bioware.com/",writeRootPath() + "/_global/images/footer/sc_duo.gif",writeRootPath() + "/_global/images/footer/sc_color.gif");
scrollInfo("http://masseffect.bioware.com/",writeRootPath() + "/_global/images/footer/me_duo.gif",writeRootPath() + "/_global/images/footer/me_color.gif");
scrollInfo("http://jade.bioware.com/",writeRootPath() + "/_global/images/footer/jade_duo.gif",writeRootPath() + "/_global/images/footer/jade_color.jpg");
scrollInfo(writeRootPath() + "/games/knights_old_republic/",writeRootPath() + "/_global/images/footer/sw_duo.gif",writeRootPath() + "/_global/images/footer/sw_color.gif");
scrollInfo("http://nwn.bioware.com/",writeRootPath() + "/_global/images/footer/nwn_duo.gif",writeRootPath() + "/_global/images/footer/nwn_color.gif");
scrollInfo("http://nwn.bioware.com/underdark/",writeRootPath() + "/_global/images/footer/hotu_duo.gif",writeRootPath() + "/_global/images/footer/hotu_color.gif");
scrollInfo("http://nwn.bioware.com/shadows/",writeRootPath() + "/_global/images/footer/sou_duo.gif",writeRootPath() + "/_global/images/footer/sou_color.gif");
scrollInfo(writeRootPath() + "/games/baldurs_gate/",writeRootPath() + "/_global/images/footer/bg_duo.gif",writeRootPath() + "/_global/images/footer/bg_color.gif");
scrollInfo(writeRootPath() + "/games/tales_sword_coast/",writeRootPath() + "/_global/images/footer/tsc_duo.gif",writeRootPath() + "/_global/images/footer/tsc_color.gif");
scrollInfo(writeRootPath() + "/games/shadows_amn/",writeRootPath() + "/_global/images/footer/soa_duo.gif",writeRootPath() + "/_global/images/footer/soa_color.gif");
scrollInfo(writeRootPath() + "/games/throne_bhaal/",writeRootPath() + "/_global/images/footer/tob_duo.gif",writeRootPath() + "/_global/images/footer/tob_color.gif");
scrollInfo(writeRootPath() + "/games/mdk2/",writeRootPath() + "/_global/images/footer/mdk2_duo.gif",writeRootPath() + "/_global/images/footer/mdk2_color.jpg");
scrollInfo(writeRootPath() + "/games/mdk2_armageddon/",writeRootPath() + "/_global/images/footer/mdk2arma_duo.gif",writeRootPath() + "/_global/images/footer/mdk2arma_color.jpg");
scrollInfo(writeRootPath() + "/games/shattered_steel/",writeRootPath() + "/_global/images/footer/ss_duo.gif",writeRootPath() + "/_global/images/footer/ss_color.gif");


// Set the starting scroll position
var scrollPosition = 1;

function scrollOver(direction,scrollAmount) // Controls the scrolling of the items either 'left' or 'right', and the amount to scroll
{
	var scrollMove;
	if(direction == "left") {
		scrollMove = -1;
	}
	else { // direction = right
		scrollMove = 1;
	}
	
	for (s = 0; s < scrollAmount; s++) {
		scrollPosition = scrollPosition + scrollMove;	
		if(scrollPosition == 0) { // start at end
			scrollPosition = arraynum;
		}
		if(scrollPosition > arraynum) { // start at beginning
		scrollPosition = 1;
		}
	}
	// loop through all images to be replaced
	var scrollnum = scrollPosition;
	for (a = 0; a < imgName.length; a++) { // set all images to the new image sources in the array
		document[imgName[a]].src = scrollobj[scrollnum][0].src;		
		scrollnum = scrollnum + 1;
		if(scrollnum > arraynum) {
			scrollnum = 1;
		}
	}

}

function scrollOnMouse(name) // Controls rollover images of the item
{
	for (a = 1; a < scrollobj.length; a++) { 
		if(document[name].src == scrollobj[a][0].src) { // image is off
			document[name].src = scrollobj[a][1].src;   // turn corresponding image on			 
		} 
		else if(document[name].src == scrollobj[a][1].src) { // image is on
			document[name].src = scrollobj[a][0].src;        // turn corresponding image off
		}
	}
}

function scrollGoTo(name) // Links to corresponding linkpath of the item
{
		for (a = 1; a < scrollobj.length; a++) { 
		if((document[name].src == scrollobj[a][0].src) || (document[name].src == scrollobj[a][1].src)) { // this is the image (on or off state)
			location.href = scrollobj[a][2];
		} 
	}
}

function scrollLinkStatus(name) // Sets window status to display link path of the item
{
	if(!name) {
		window.status = '';
	}
	else {
		for (x = 1; x < scrollobj.length; x++) { 
			if((document[name].src == scrollobj[x][0].src) || (document[name].src == scrollobj[x][1].src)) { // this is the image (on or off state)
				window.status = scrollobj[x][2]; 
			}	
		}
	}
}

// ----------------------- End Image Scroll------------------------------------------------------
