//gracias a Dr.Yes.
function OnloadLibrary(){
    var t = this;
    t.docLoaded = false;
    t.event = [];
    t.addEvent = function(str){
        t.event[t.event.length] = str;
        return t.event.length;
    }
    t.loadEvents = function(){
        for(var i=0; i<t.event.length;i++) {
            eval(t.event[i]);
        }
        t.docLoaded = true;
    }
    window.onload = t.loadEvents;
}
var onloadLib = new OnloadLibrary();

//Drop down jump to url menu
function goto_URL(object) {
var jmp=eval('object.options[object.selectedIndex].value')
//newWin = window.open(jmp)
}
// New Global jump menu function
function OnChange(dropdown){
	var myindex  = dropdown.selectedIndex;
	var SelValue = dropdown.options[myindex].value;
	window.open(SelValue);
}

function bannerSwap(varImages, imageName){
	var imagePos = 0;
	var imageArrayLength = varImages.length;
	imagePos = randomImg(imageArrayLength);		
	document.images[imageName].src = varImages[imagePos];		
};

function randomImg(varLength){
var currentPos = 0;	 //Variable to the current image position		
	if (!document.images) return	
		currentPos = Math.floor(Math.random()*varLength);
	
	return currentPos;
};

function modHref(ref, anch){
	var browserName=navigator.appName;      //Browser Detection
	
	if (browserName=="Microsoft Internet Explorer"){
		getStarted.setAttribute('href',ref); //getStarted is the ID of the anchor tag in the GetStarted.jsp page
	}
	else {
		document.links[anch].href = ref;
	}	
}

function getStartedMod(){
	var path = window.location.pathname;
	var folderLevel = path.split("/")
	var sectionName =  folderLevel[1];


	if (sectionName == "calgary"){
		modHref("https://www.devry2.com/landing12/default.aspx?vc=140175", "getStarted");
	}

}

function homeBannerSwap(){
	if (window.location.pathname == "/" || window.location.pathname == "/index.jsp"){
		var studentImages = new Array("/resources/images/hp_1.jpg", "/resources/images/hp_2.jpg", "/resources/images/hp_3.jpg", "/resources/images/hp_4.jpg", "/resources/images/hp_5.jpg", "/resources/images/hp_6.jpg", "/resources/images/hp_7.jpg", "/resources/images/hp_8.jpg", "/resources/images/hp_9.jpg", "/resources/images/hp_10.jpg", "/resources/images/hp_11.jpg");
		bannerSwap(studentImages, "student");
	}
}

function hireSwap(){
	if (window.location.pathname.indexOf('hiredevry') >= 0){
		var studentImages = new Array("/resources/images/hd_pix-1.jpg", "/resources/images/hd_pix-2.jpg", "/resources/images/hd_pix-3.jpg");
		bannerSwap(studentImages, "hireHeader");
	}
}