
	/**
	 * Build a new Object for the programbanners function
	 */
	var bannerRequest = null;

	try {
	 bannerRequest = new XMLHttpRequest();
	} catch (trymicrosoft) {
	 try {
	   bannerRequest = new ActiveXObject("Msxml2.XMLHTTP");
	 } catch (othermicrosoft) {
	   try {
	     bannerRequest = new ActiveXObject("Microsoft.XMLHTTP");
	   } catch (failed) {
	     bannerRequest = null;
	   }
	 }
	}

	var divbannerRequest = null;

	try {
	 divbannerRequest = new XMLHttpRequest();
	} catch (trymicrosoft) {
	 try { divbannerRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) {
	   try {  divbannerRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { divbannerRequest = null; }
	 }
	}

/**
 * Open and close divs on the page
 */
function programTab(tab) {
	var showEffect = 'appear';  var showTime = .4;
	var hideEffect = 'fade';    var hideTime = .01;
	
	if(document.getElementById('opentab').value != tab) {
		document.getElementById('socialBookMarks').style.visibility = 'hidden';
		myEffects(hideEffect,document.getElementById('opentab').value,hideTime); // Close the open div
		myEffects(showEffect,tab,showTime);									   // Open the new div
		setTimeout("document.getElementById('socialBookMarks').style.visibility = 'visible'",400);
	}
	document.getElementById('opentab').value = tab;
}	

/**
 * Function to toggle scholarships 
 */
function toggleScholarship(id) {
	var showEffect = 'appear';
	var hideEffect = 'fade';
	var hideSpeed  = .01;
	var showSpeed  = .5;
	var currentdiv = document.getElementById('openscholarship').value;

	// Close div if one is open
	if(document.getElementById('openscholarship').value) {
		myEffects(hideEffect,'schdiv' + document.getElementById('openscholarship').value,hideSpeed);
		document.getElementById('li' + currentdiv).style.listStyleImage = 'url(/templates/common/imx/icons/plus.gif)';
		document.getElementById('openscholarship').value = '';
	}	
	
	// Open the new one
	if(id != currentdiv) {
		myEffects(showEffect,'schdiv' + id,showSpeed);
		document.getElementById('li' + id).style.listStyleImage = 'url(/templates/common/imx/icons/minus.gif)';
		document.getElementById('openscholarship').value = id;
	}	
	
	// Reset the hidden div
	if(id == currentdiv) { document.getElementById('openscholarship').value = '' }
}

/**
 * Switch between tabs
 */
function switch_tab(newtab) {	
	
	/**
	 * Open tab
	 */
	 programTab(newtab); // Open the new div and close the old
	 document.getElementById('tab_' + newtab).style.visibility      =  'hidden';  // Hide the off tab
	 document.getElementById('selected_' + newtab).style.visibility =  'visible'; // Show the selected tab
	
	/**
	 * Reset all tabs
	 */
	var careers     = parseInt(document.getElementById('careerCount').value);
	var testimonies = parseInt(document.getElementById('testimonyCount').value);
	
	     if(careers > 0 && testimonies > 0)   { var mytabs = new Array('summary','details','contacts','scholarships','careers','testimonials'); }	
	else if(careers > 0 && testimonies == 0)  { var mytabs = new Array('summary','details','contacts','scholarships','careers');                }	
	else if(careers == 0 && testimonies > 0)  { var mytabs = new Array('summary','details','contacts','scholarships','testimonials');           }	
	else if(careers == 0 && testimonies == 0) { var mytabs = new Array('summary','details','contacts','scholarships');                          }
	else                                      { var mytabs = new Array('summary','details','contacts','scholarships');                          }	
	
	
	for( var i = 0 ; i < mytabs.length ; i++ ) {
		//alert(mytabs[i]);
		setOpacity(100, 'tab_' + mytabs[i]) // Restore opacity for all tabs to 100%
		if (navigator.userAgent.indexOf("MSIE") != -1) { document.getElementById('tab_' + mytabs[i]).style.backgroundColor = "#DFDFDF"; } // Reset background color for IE
		
		if(mytabs[i] != newtab) {
		 document.getElementById('tab_' + mytabs[i]).style.visibility      =  'visible';  // Hide the off tab
		 document.getElementById('selected_' + mytabs[i]).style.visibility =  'hidden';   // Show the selected tab
		}
	}
}

/**
 * Toggle onmouseover
 */
function dummy_over(id) {

	if(id != document.getElementById('opentab').value) {
		setOpacity(55, 'tab_' + id) // Set tab opacity
		document.getElementById('tab_' + id).style.cursor = 'hand';
		document.getElementById('tab_' + id).style.cursor = 'pointer';
		if (navigator.userAgent.indexOf("MSIE") != -1) { document.getElementById('tab_' + id).style.backgroundColor = "#DFDFDF"; } // Reset background color for IE
	}
}

/**
 * Toggle onmouseout
 */
function dummy_out(id) {
	if(id != document.getElementById('opentab').value) {
		setOpacity(100, 'tab_' + id) // Set tab opacity
		if (navigator.userAgent.indexOf("MSIE") != -1) { document.getElementById('tab_' + id).style.backgroundColor = "#DFDFDF"; } // Reset background color for IE
	}
}

/**
 * Image rotation script for the programs page
 */	
function fadePics(piccount,showme,myobject) {
	var piccount        = parseFloat(piccount);
	var showduration    = 10000;
	
	document.getElementById('currentImage').value = myobject + ' - ' + piccount;
		
	if(piccount > 1 && parseInt(document.getElementById('swapimage').value)) {
		
		document.getElementById('currentImage').value = myobject + ' - ' + piccount + '  within';
		
		document.getElementById('swapimage').value = 0;
		showme         = parseFloat(showme);
		var showEffect = 'appear';	
		var hideEffect = 'fade';	
		var tohide     = (showme-1);
		if(tohide < 0) { tohide = piccount -1; }

		//myEffects(hideEffect,myobject + tohide, .85);
		Effect.Fade(myobject + tohide, {duration:.85, from:1.0, to:0}); 
		//document.getElementById(myobject + tohide).style.display = 'none';
		//document.getElementById(myobject + showme).style.display = '';

		setTimeout(showit,850);   // Show the next image
		setTimeout(loopit,showduration); // Continue the loop
	}
	else {
		setTimeout("fadePics('" + piccount + "','" + showme + "','" + myobject + "')",1500);
	}
	
		function showit() { myEffects(showEffect,myobject + showme, 2); }
		function loopit() {
			document.getElementById('swapimage').value = 1;
			
			var nextpic = showme + 1;
			if(nextpic > (piccount-1)) { nextpic = 0; }

			setTimeout("fadePics('" + piccount + "','" + nextpic + "','" + myobject + "')",1500); 
		}
}


function programbanners(id) {
	var str = '&program=' + id;
	//alert(str);
	bannerRequest.open("POST", '/catalogsearch/program/php/xt-programbanners.php', true);
    bannerRequest.onreadystatechange = function() {
		if(bannerRequest.readyState == 4) {
			//alert(bannerRequest.responseText);
		
			var myhtml = bannerRequest.responseText.split('^ajax^');
		
		    //alert(myhtml[0]);alert(myhtml[1]);
		
			/**
			 * Conditionally show the custom ad-banners
			 */
			if(trim(myhtml[1])) {
				//alert(myhtml[1]);
				document.getElementById('custombanners').innerHTML          = myhtml[1];
				document.getElementById('custombanners').style.minHeight    = '100px';
				document.getElementById('globalbanners').style.marginBottom = '10px';    // Add margin to global banners div
			}
			else {
				document.getElementById('custombanners').style.height       = '0px';
				document.getElementById('custombanners').innerHTML          = '';
				document.getElementById('globalbanners').style.marginBottom = '10px'; 
			}
			
			//document.getElementById('custombanners').innerHTML =  bannerRequest.responseText;
			//document.getElementById('custombanners').style.minHeight    = '100px';
			/**
			 * Write hiddden div for count of custom adbanners
			 */
			document.getElementById('adcustomhid').innerHTML = myhtml[2];
			
		} // if(request.readyState == 4)
    }
    bannerRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    bannerRequest.send(str);
}	


function divisionbanners(id) {
	var str = 'program=' + id;
	//alert(str);
	divbannerRequest.open("POST", '/catalogsearch/program/php/xt-divisionbanners.php', true);
    divbannerRequest.onreadystatechange = function() {
		if(divbannerRequest.readyState == 4) {
			//alert(divbannerRequest.responseText);
		
		    /**
			 * Conditionally show the division ad-banners
			 */
			if(trim(divbannerRequest.responseText)) {
				//alert(myhtml[1]);
				document.getElementById('divisionbanners').innerHTML          = divbannerRequest.responseText;
				document.getElementById('divisionbanners').style.minHeight    = '100px';
				document.getElementById('divisionbanners').style.marginBottom = '10px';    // Add margin to global banners div
			}
			else {
				document.getElementById('divisionbanners').style.height       = '0px';
				document.getElementById('divisionbanners').innerHTML          = '';
				document.getElementById('divisionbanners').style.marginBottom = '0px'; 
			}		/**/	
		} // if(request.readyState == 4)
    }
    divbannerRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    divbannerRequest.send(str);
}