var speed=500;
var count=6;
var duration=8000;
var timergo=1;

function featureFade(num,type){
	$('#feature_1').css({"display":"none"});
	$('#feature_2').css({"display":"none"});
	$('#feature_3').css({"display":"none"});
	
	if(num==0){
		while((num==oldnum)||(num==0)){
			num=Math.floor((2)*Math.random()) + 1;
		}
	}
	
	oldnum=num;
	if(type==1){
		$('#feature_'+num).fadeIn(speed);
	}else{
		$('#feature_'+num).fadeIn(speed, timerFade());
	}
}

function timerFade(){
	if(count>0){
		count--;
		$.timer(duration, function (timer) {
			if(timergo==1){featureFade(0);}
			timer.stop();
		});
	}
}

$(document).ready(function() {

	/*
	// starts jquery version mission introduction
	$('#content-feature #feature_mission a').attr('href', 'javascript:void(0)');

	if($('#feature_1').attr('style')!="display: none;"){oldnum=1;}
	if($('#feature_2').attr('style')!="display: none;"){oldnum=2;}
	if($('#feature_3').attr('style')!="display: none;"){oldnum=3;}
	
	$('#content-feature a').hover(function(){
		if(count>0){count=0;}
		timergo=0;
	});
	
	//autofade disabled in ipad 
	if(navigator.platform!="iPad"){
		timerFade();
	}*/

	if ($('body#home').size()) {
		var flashvars = {};
		var params = {
			scale: 'noorder',
			wmode: 'transparent',
			menu: 'false',
			allowScriptAccess:'always',
			hasVersionFail: function (options) {

				// starts jquery version mission introduction
				$('#content-feature #feature_mission a').attr('href', 'javascript:void(0)');

				if($('#feature_1').attr('style')!="display: none;"){oldnum=1;}
				if($('#feature_2').attr('style')!="display: none;"){oldnum=2;}
				if($('#feature_3').attr('style')!="display: none;"){oldnum=3;}
				
				$('#content-feature a').hover(function(){
					if(count>0){count=0;}
					timergo=0;
				});
				
				//autofade disabled in ipad 
				if(navigator.platform!="iPad"){
					timerFade();
				}
			}
		};
		var attributes = {};
		swfobject.embedSWF('http://apps.prescott.edu/prescott_college_mission.swf', 'content-feature', '970', '429', '8.0.0', 'http://apps.prescott.edu/files/expressInstall.swf', flashvars, params, attributes);
	};
	
});





