var pause=false;
var sPos=200;
var xTimer="";
var Aframe=4;

function openquiz() { // opens home page wizard quiz
	$('div#banner').css({'position':'absolute','overflow':'visible','z-index':'600','background':'#fff','left':'230px'});
	$('div#logBar').css({'z-index':'490'});
	var H = $('div#homePageQuiz h4').height() + $('p.HPQ').height() + $('form#bonusQuiz').height() ;
	$('div#homePageQuiz').css('top','-3px');
//	$('div#homePageQuiz').animate({'height':'300'},700);
	$('div#homePageQuiz').animate({'height':H+30},300);
//	$('a#quizCloser').css({'position':'absolute','top':(H-30) + 'px','right':'20px'});
	$('a#quizCloser').css({'position':'absolute','bottom':'5px','right':'20px'});
	$('a#hPq').css('display','none');
//	alert(H);
}

function markQuiz() {
	var A= $('input#Ans').attr('value');
	var IDnum= $('input#IDnum').attr('value');
	var H = $('div#homePageQuiz').height() + 50;
	$('a#hPq').css('display','block');
	$('div#homePageQuiz').animate({'height':H},300);
//	$('a#quizCloser').css({'top':(H-60) + 'px'});
	if ($('input#A'+A).attr('checked')== true ) {
	$('h5.quizResult').html("Right you are! You've earned a bonus point for your Travel Wizard score.");
	$('p.quizResult').html("Click here to visit the lesson and learn more!<br /><br /><br />");
	$.get('../../addPoint.asp',{'IDnum':IDnum});
		}
	if ($('input#A'+A).attr('checked')== false ) {
	$('h5.quizResult').html('Sorry! Try another! (The correct answer is highlighted.)');
	$('p.quizResult').html("Click here to visit the lesson and learn more!<br /><br /><br />");
	$('p#AA'+A).css('background','#ff9');
		}
	$('input#BQ').attr('disabled','true');
}

function closeQuiz () {
	$('div#homePageQuiz').animate({'top':'-1000'},1200);
//	$('div#homePageQuiz').slideUp(1000);
//	$('div#homePageQuiz').css({'z-index':'0'});
	location.href='../../home.asp';
}

function logTip(i) {
	var X = 300;
	var Y = -5;
	$('div#tipBox').html('<br /><br /><br /><strong>Please sign in to take this course</strong><br /><br /><br /><br />');
	Event.observe (
		$('img#rc_'+i),
		'mousemove',
		function(event) {
		var e1=Event.element(event);
		if (Event.pointerY(event) < 70 ) {
			Y = -5;
		}
		if (Event.pointerX(event) < 320 ) {
			X = -40;
		}
		$('div#tipBox').css({'text-align':'center','top':(Event.pointerY(event) - Y)  + 'px','left':(Event.pointerX(event) - X) + 'px'})
		})
}

function Rewind() {
	sPos=sPos+500;
	if (sPos > 200) {
		sPos= -2620;
	}
}
function FForward() {
	sPos=sPos-500;
	if (sPos < -3120) {
		sPos=200;
	}
}
function RO(d,e) {
	$('img#'+d).attr('src','images/' + e);
}

function RO2(d,e) {
	$('img#'+d).attr('src','../images/' + e);
}


function SliderLeft() {
	sPos--;
	$('div#slider').css('left',sPos + 'px');
}

function ShowNow() {
	$('div.Sldr').hover( function(e) {
// actions for marquee mouseover
	var i= $(this).attr('id');
	i=parseInt(i.substr(1));
	pause=true;
	var j=i;
	if (i > 9) {
		j=j-10;
	}
	var X = 300;
	var Y = 295;
	var stars=0;
	var boxText = ""
	boxText=boxText + "<img src='http://images.tauniv.com/titleImages/" + CourseIDArrayR[j] + ".jpg' alt='' /><h3>";
	if (StatusArrayR[j]=="G") {
		boxText=boxText + "<img src='http://images.tauniv.com/grad_icon.jpg' width='24' height='17' alt='' border='0' /> ";
	}
	boxText=boxText + CourseNameArrayR[j] + "</h3>";
	boxText=boxText + CourseDescriptionArrayR[j];
	if (profile=="T") {
		boxText=boxText + "<h4>Rating based on your preferences</h4>";
		stars=Math.min(ProfileArrayR[j]*10,50);
	}
	if (profile=="F") {
		boxText=boxText + "<h4>Please sign in to see ratings</h4>";
		stars=Math.min((Math.round(ProfileArrayR[j]/1000)*10),50);
	}
	if (stars==0) {
		stars="00";
	}
	boxText=boxText + "<img src='http://images.tauniv.com/" + stars + "_stars.jpg' width='272' height='35' alt='' />";
	$('div#tipBox').html(boxText);

	if (e.pageY < 665 ) {
		Y = -5;
	}
	if (e.pageX < 320 ) {
		X = -40;
	}
	$('div#tipBox').css({'top':(e.pageY - Y)+ 'px','left':(e.pageX - X) + 'px'});
	$('div#tipBox').show();
	},function() {
// actions for marquee mouseout
	pause=false;
	$('div#tipBox').css({'top':'200px','left':'-3000px'})
	});
// actions for logo mouseover/mouseout
	$('img.icon').hover( function(e) {
// mouseover
	var i= $(this).attr('id');
	i=parseInt(i.substr(3));
	var X = 300;
	var Y = 295;
	var stars=0;
	var boxText = ""
	boxText=boxText + "<img src='http://images.tauniv.com/titleImages/" + CourseIDArray[i] + ".jpg' alt='' /><h3>";
	if (StatusArray[i]=="G") {
		boxText=boxText + "<img src='http://images.tauniv.com/grad_icon.jpg' width='24' height='17' alt='' border='0' /> ";
	}
	boxText=boxText + CourseNameArray[i] + "</h3>";
	boxText=boxText + CourseDescriptionArray[i];
	if (profile=="T") {
		boxText=boxText + "<h4>Rating based on your preferences</h4>";
		stars=Math.min(ProfileArray[i]*10,50);
	}
	if (profile=="F") {
		boxText=boxText + "<h4>Please sign in to see ratings</h4>";
		stars=Math.min((Math.round(ProfileArray[i]/1000)*10),50);
	}
	if (stars==0) {
		stars="00";
	}
	boxText=boxText + "<img src='http://images.tauniv.com/" + stars + "_stars.jpg' width='272' height='35' alt='' />";
	$('div#tipBox').html(boxText);

	if (e.pageY < 665 ) {
		Y = -5;
	}
	if (e.pageX < 320 ) {
		X = -40;
	}
	$('div#tipBox').css({'top':(e.pageY - Y)+ 'px','left':(e.pageX - X) + 'px'});
	$('div#tipBox').show();
	}, function() {
//	mouseout
	$('div#tipBox').css({'top':'200px','left':'-3000px'})
	});	



	
	StartShow();
}

function StartShow() {
	if (!pause) {
		SliderLeft();
		if (sPos<= -3120) {
			sPos=200;
		}
	}
	xTimer = setTimeout("StartShow();",18);
}

function LoadShow() {
	StartShow();
}


