/* Images and links for home page if user doesn't have Flash */

var noFLimage = new Array();
noFLimage[0] = '../../../uta/mystory/2009/slides/nguyen-replacement.jpg ';
noFLimage[1] = '../../../uta/mystory/2009/slides/chiao-replacement.jpg';
noFLimage[2] = '../../../uta/mystory/2009/slides/nguyen-replacement.jpg';

var noFLlink = new Array();
noFLlink[0] = '#';
noFLlink[1] = '#';
noFLlink[2] = '#';



/* If IE, use a script to apply rounded corners (other browsers support CSS corner rounding */

if (jQuery.browser.msie) {
	addEvent(window, 'load', initCorners);
	function initCorners() {
		if(document.getElementById('latestnewshead') && document.getElementById('latestnewscontents')) {
			var cB1 = {tl: { radius: 5 },antiAlias: true};curvyCorners(cB1,"#latestnewshead");
			var cB2 = {bl: { radius: 5 },antiAlias: true};curvyCorners(cB2,"#latestnewscontents");
		}
	}
}



/* Apply Cufon fonts */

Cufon.replace('#globalnav a'); // The links at the very top above the header
Cufon.replace('#head a');      // The links in the blue header bar beside the logo
Cufon.replace('.subnav a');    // The links in the "Explore" box on the right



/* These functions expand the div holding the large flash movie on the homepage when necessary,
   so when the flash is narrower, the right hand links are not blocked. These functions are 
   triggered inside the flash movie itself when it expands and contracts.                        */

function expandFlash(){
 $("#flashcontent").width(884);
}

function shrinkFlash(){
 $("#flashcontent").width(580);
}



/* These items occur at page load */

$(document).ready(function(){

	/* On the homepage, make the "Get Ready" vertical scroller */

	if(document.getElementById('getreadyslides')){
		$("div#getreadyslides .items").css({'position':'absolute','height':20000});
		$("div#getreadyslides").css({'height':485}).scrollable({
			vertical:true,
			size: 2
		}).mousewheel();
	}

	/* On the homepage, load the large flash movie */

	if(document.getElementById('getreadyslides')){
		flashembed('flashcontent', {
			src:'../../../uta/images/uta.swf',
			wmode:'transparent',
			width:884,
			height:400,
			
			/* If the user has a Flash version lower than 7, or doesn't have Flash, the following function chooses an image 
			   named Flow1.jpg, Flow2.jpg, or Flow3.jpg and puts it inside the div which would otherwise hold the Flash.    */
			
			version: [7, 0],
			onFail: function() {
				var randomnumber=Math.floor(Math.random()*3);
				$("#flashcontent").html('<a href="' + noFLlink[randomnumber] + '"><img src="' + noFLimage[randomnumber] + '" width="580" height="400" /></a>'); 
			}
			
			/* End of the function described above. */
			
		});
	}

	/* Set up the News and Events tabs on the home page */
	
	if(document.getElementById('newsevents')) {
		$("ul.tabs").tabs("div.panes > div");
	}

});
