
function hideSubPanels() {
	for (var i = 1; i < 7; i++) {
		document.getElementById("subpanel" + i).style.display = "none";
	}
}

function checkforNetscape4() {
	// if the browser is netscape 4, urge the user to upgrade the browser, its a terrible browser and is very old 
	if (navigator.appName == "Netscape" && (navigator.userAgent.indexOf("Mozilla/4.") != -1)) {
		location.href = "/upgrade.htm";
	}
}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=3) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                        document[changeImages.arguments[i]].alt = changeImages.arguments[i+2];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		pi1 = newImage("/images/banners/values_wide.jpg");
		pi2 = newImage("/images/banners/quality_wide.jpg");
		pi3 = newImage("/images/banners/community_wide.jpg");
		pi4 = newImage("/images/banners/partnership_wide.jpg");
		pi5 = newImage("/images/banners/teachereducation_wide.jpg");
		pi6 = newImage("/images/banners/liberalarts_wide.jpg");
		preloadFlag = true;
	}
}

function ImageCycler(theImageNumber) {
	if ((theImageNumber + 1) > myRandomImages.length-1) {
		theImageNumber = 1;
	} else {
		theImageNumber++;
	}
	showSubPanel(theImageNumber);
	//window.setTimeout("ImageCycler(" + theImageNumber + ")", theDelay);
	if (timer_is_on)
        {
          t=window.setTimeout("ImageCycler(" + theImageNumber + ")", theDelay);
        }
}

function showSubPanel(panelNumber) {
	//hideSubPanels();
	theImageNumber = panelNumber;
	//document.getElementById("subpanel" + panelNumber).style.display = "block";
	changeImages('homePageBanner', myRandomImages[panelNumber][0], arrImageAlts[panelNumber][0]);
}


function timerOn() 
{
  if (timer_is_on == 0) 
  {
   timer_is_on=1;
   //if (theImageNumber==undefined)
   //{
   //  theImageNumber = 1;
   //}
   ImageCycler(theImageNumber);
  }
}

function timerOff()
{
  clearTimeout(t);
  timer_is_on=0;
}


var myRandomImages = new Array();
myRandomImages[1] = ["/images/banners/values_wide.jpg"];
myRandomImages[2] = ["/images/banners/quality_wide.jpg"];
myRandomImages[3] = ["/images/banners/community_wide.jpg"];
myRandomImages[4] = ["/images/banners/partnership_wide.jpg"];
myRandomImages[5]= ["/images/banners/teachereducation_wide.jpg"];
myRandomImages[6] = ["/images/banners/liberalarts_wide.jpg"];

var arrImageAlts = new Array();
arrImageAlts[1] =["VALUES\nFundamental to the work of St Mary's are its religious, educational and professional values. In particular we work for the development of the whole person in a formative human environment and we strive to ensure that Christian values underpin the 'St Mary's experience'."];
arrImageAlts[2] =["QUALITY\nSt Mary's is committed to achieving the highest quality in all aspects of its mission. In particular we work closely with Queen's University Belfast to develop and implement procedures that will assure and enhance the quality of the College's academic provision."];
arrImageAlts[3] =["BUILDING COMMUNITY\nSt Mary's seeks to build a community which is based on Christian values and which is held together by a shared vision.\nWe strive to ensure that all our staff, students and visitors feel part of this community and enjoy positive experiences of the College."]
arrImageAlts[4] =["PARTNERSHIP\nSt Mary's recognises that it can only be effective in taking forward its mission in the context of partnerships. We value most highly our extensive network of university, school, governmental, business and community partnerships, which extend from our immediate locality to the wider world."]
arrImageAlts[5] =["TEACHER EDUCATION\nSt Mary's, the first dedicated Teacher Education provider in the North of Ireland, continues to offer undergraduate and postgraduate courses (in English and in Irish) for the education of teachers. We offer students high quality learning, teaching and support, in partnership with over three hundred schools."]
arrImageAlts[6] =["LIBERAL ARTS\nAs part of its strategy to increase access to higher education, St Mary's has developed a unique Liberal Arts honours degree programme. This programme combines the benefits of a well-grounded, broadly based education and the development of skills with a focus on employability. "]

var theImageNumber = 1;
var theDelay = 10000;
var t;
var timer_is_on=1;

checkforNetscape4();

