//////////////////////////////////////////////////////
//
//	The purpose of this file is to
//	apply a hover class on mouseover
//	on the <li> elements in the nav.
//	This is because IE doesn't put
//	the pseudo class :hover on <li> elements
//
//	This is code that uses the
//	jquery javascript library (http://jquery.com/)
//
//////////////////////////////////////////////////////

$(window).load(function() {
	if (document.all&&document.getElementById) {
		// this is needed for the IE 6 pseudo hover class bug
		$(".navtop > li").hover(function() {
			$(this).addClass("hover");
		},
		function () {
			$(this).removeClass("hover");
		});
		// this adds flyout support for IE 6
		$(".navtop > li li ").hover(function () {
			$(this).addClass("hover");
		},
		function () {
			$(this).removeClass("hover");
		});
		
	} else {
		// this is need for safari when nav covers flash
		$(".navtop li ul").hover(function () {
			$(this).addClass("redraw");
		},
		function () {
			$(this).removeClass("redraw");
		});
	}
	
	
	// find the profile items
	var profileItems = $('.profile_item');	
	
	// pick a random profile item
	var itemsLength = profileItems.length;
	var profileIndex = (Math.floor(Math.random()*itemsLength));
	
	// get the id of the random profile item	
	var myProfile = $(profileItems[profileIndex]);	
	myProfile.addClass('show');
	var profileId = myProfile.attr('id');	
	
	// embedd the corresponding swf	
	var swfname = "/giving/swf/phase1/" + profileId + ".swf"; 
		var flashvars = {};
		var params = {
			allowfullscreen: "true",
			allowscriptaccess: "always",
			wmode:"transparent"
		};
		var attributes = {
			id: "VideoPlayback"
		};
		swfobject.embedSWF( swfname, "flashContent", "948", "460", "9.0.0", "", flashvars, params, attributes);
	
	
});


