var courseArray = new Array();
var courseIdArray = new Array();
var courseTextArray = new Array();
var courseUrlArray = new Array();
var lessonArray = new Array();
var vidSelected = 1;
var courseSelect = 1;
var pause = false;
var c;
var t=90;
var destBuffer;
var country;
var slide=0;
var agentID;
var fName;
var lName;

courseArray[0] = 'Bermuda Specialist';
courseArray[1] = 'Cayman Islands Master Specialist: Dive &amp; Nature';
courseArray[2] = 'Cayman Islands Master Specialist: Family Travel';
courseArray[3] = 'Cayman Islands Specialist';
courseArray[4] = 'Destination Weddings 3.0';
courseArray[5] = 'Dive Specialist';
courseArray[6] = 'Dominican Republic Specialist';
courseArray[7] = 'Grenada Specialist';
courseArray[8] = 'Honeymoon Specialist';
courseArray[9] = 'Spa Specialist 2008';
courseArray[10] = 'US Airways Vacations';
courseArray[11] = 'US Airways Vacations - Atlantis';

courseIdArray[0] = 362;
courseIdArray[1] = 299;
courseIdArray[2] = 303;
courseIdArray[3] = 331;
courseIdArray[4] = 365;
courseIdArray[5] = 363;
courseIdArray[6] = 301;
courseIdArray[7] = 339;
courseIdArray[8] = 361;
courseIdArray[9] = 360;
courseIdArray[10] = 338;
courseIdArray[11] = 366;

courseUrlArray[0] = 'http://tauniv.com/home.asp?cID=362';
courseUrlArray[1] = 'http://tauniv.com/home.asp?cID=299';
courseUrlArray[2] = 'http://tauniv.com/home.asp?cID=303';
courseUrlArray[3] = 'http://tauniv.com/home.asp?cID=331';
courseUrlArray[4] = 'http://tauniv.com/home.asp?cID=365';
courseUrlArray[5] = 'http://tauniv.com/home.asp?cID=363';
courseUrlArray[6] = 'http://tauniv.com/home.asp?cID=301';
courseUrlArray[7] = 'http://tauniv.com/home.asp?cID=339';
courseUrlArray[8] = 'http://tauniv.com/home.asp?cID=361';
courseUrlArray[9] = 'http://tauniv.com/home.asp?cID=360';
courseUrlArray[10] = 'http://tauniv.com/home.asp?cID=338';
courseUrlArray[11] = 'http://tauniv.com/home.asp?cID=366';

courseTextArray[0] = '<span class="E">Bermuda is proof</span> that good things come in small packages – for you and for your clients. Brush up on your knowledge so you can put your customers &quot;in the pink&quot; – and yourself in the green.';
courseTextArray[1] = '<span class="E">Learn the ins and outs</span> of dive and nature vacations to boost your Cayman Islands bookings! (Prerequisite: Cayman Islands Specialist course)';
courseTextArray[2] = '<span class="E">Become an expert</span> in handling family vacations in the Cayman Islands‚ and reap the rewards. (Prerequisite: Cayman Islands Specialist course)';
courseTextArray[3] = '<span class="E">Recertify now</span> to maintain your Specialist status and eligibility for fam trip invitations, Cayman Rewards, and more.';
courseTextArray[4] = '<span class="E">This business is booming</span> - up 400 percent in 10 years - and a huge source of new customers that you can tap. Find out how to get your share.';
courseTextArray[5] = '<span class="E">Take advantage</span> of this niche\'s profit potential - divers have to travel to enjoy their sport.';
courseTextArray[6] = '<span class="E">Complete your knowledge</span> of this popular Caribbean destination to boost your sales and to become eligible for special fam rates.';
courseTextArray[7] = '<span class="E">The &quot;Isle of Spice,&quot;</span> Grenada, and sister islands Carriacou and Petite Martinique, are ideal for your &quot;been-there-done-that&quot; clients.';
courseTextArray[8] = '<span class="E">With 2.3 million U.S. honeymooners</span> a year, this is a resilient market worth pursuing.';
courseTextArray[9] = '<span class="E">Become well versed</span> on the new vacation essential.';
courseTextArray[10] = 'Welcome to <span class="E">the new US Airways Vacations,</span> where bookings are easier than ever, and you earn more commission under our new all-bulk rules program.';
courseTextArray[11] = '<span class="E">No ordinary vacation spot,</span> Atlantis is a range of hotels and villas, water park and more - superbly packaged through US Airways Vacations.';

function courseDown(c) {
	document.getElementById('c'+c).style.background = '#fff url(../images/courseDown.gif) top center no-repeat';
	document.getElementById('c'+c).style.color = '#a8db5a';
}

function courseUp(c) {
	document.getElementById('c'+c).background = '#fff url(../images/courseUp.gif) top center no-repeat';
	document.getElementById('c'+c).color = '#fff';
}

function pause(c) {
	pause=true;
	changeCourse(c);
}

function unpause() {
	pause=false;
}

function changeCourse(c) {
	document.getElementById('c'+c).style.background = '#fff url(../images/courseDown.gif) top center no-repeat';
	document.getElementById('c'+c).style.color = '#a8db5a';
	document.getElementById('cPicLeft').src='http://www.tauniv.com/titleImages/'+ courseIdArray[c-1] + '.jpg';
	if (c==0) {
		document.getElementById('cPicLeft').src='http://www.tauniv.com/titleImages/'+ courseIdArray[11] + '.jpg';
		}
	document.getElementById('cPicCenter').src='http://www.tauniv.com/titleImages/'+ courseIdArray[c] + '.jpg';
	document.getElementById('cPicRight').src='http://www.tauniv.com/titleImages/'+ courseIdArray[c+1] + '.jpg';
	if (c==11) {
		document.getElementById('cPicRight').src='http://www.tauniv.com/titleImages/'+ courseIdArray[0] + '.jpg';
		}
	document.getElementById('courseName').innerHTML=(courseArray[c]);
	document.getElementById('courseBlurbText').innerHTML=(courseTextArray[c]);
	for (i=0;i<=11;i++) {
		if (i != c) {
		document.getElementById('c'+i).style.background = '#fff url(../images/courseUp.gif) top center no-repeat';
		document.getElementById('c'+i).style.color = '#fff';
		}
	}
}

function clearCourse() {
}

function StartShow() {
	if (!pause) {
		changeCourse(c);
		c++;
		if (c>11) {
			c=0;
		}
		clearCourse();
	}
		Xtimer = setTimeout("StartShow();",7350);
}

function courseGo(c) {
	location.href=courseUrlArray[c];
}

function menuDown() {
	document.getElementById('menuWrapper').style.left = '150px';
}

function menuUp() {
	document.getElementById('menuWrapper').style.left = '-3000px';
}
function seeResults() {
	var hotel = new Array();
	hotel = $('input:checkbox').fieldValue();
	hotelCount = hotel.length -1;
	hotel_1=hotel[1];
	hotel_2=hotel[2];
	hotel_3=hotel[3];
	if (hotelCount <= 2) {
		hotel_3=0;
	}
	if (hotelCount <= 1) {
		hotel_2=0;
	}
	if (hotelCount == 0) {
		hotel_1=0;
	}
	$('#accommodations').load('getHotels2.asp','h1='+hotel_1+'&h2='+hotel_2+'&h3='+hotel_3);
	document.getElementById('accomHeader').innerHTML="&nbsp;&nbsp;<img id='back' src='images/acc-2-backBTN-up.jpg' width='84' height='31' alt='back' onclick='goBack2();' />";
}
function goBack() {
	document.getElementById('contentWide').innerHTML=destBuffer;
}

function goBack2() {
	$('#accommodations').load('getHotels.asp','c='+country);
	document.getElementById('accomHeader').innerHTML="Step 2: CHOOSE UP TO 3 PROPERTIES&nbsp;&nbsp;<img id='results' src='images/acc-2-resultsBTN-up.jpg' width='146' height='31' alt='next' onclick='seeResults();' />&nbsp;&nbsp;<img id='back' src='images/acc-2-backBTN-up.jpg' width='84' height='31' alt='back' onclick='goBack();' />";
}

function listProperties() {
	country = $('input[name=dest]:radio:checked').val();
	$('#accommodations').load('getHotels.asp','c='+country);
	document.getElementById('accomHeader').innerHTML="Step 2: CHOOSE UP TO 3 PROPERTIES&nbsp;&nbsp;<img id='results' src='images/acc-2-resultsBTN-up.jpg' width='146' height='31' alt='next' onclick='seeResults();' />&nbsp;&nbsp;<img id='back' src='images/acc-2-backBTN-up.jpg' width='84' height='31' alt='back' onclick='goBack();' />";
}

function saveBuffer() {
	destBuffer=document.getElementById("contentWide").innerHTML;
}


// lesson loading & navigation
var PageMax=67; // last page in series
var lp;

function getMainHeight() {
	M = $('#pCurrent').height();
}
function getSideHeight() {
	S = $('#sCurrent').height();
}

function setMainHeight(Z) {
	M = 0 + $('#pCurrent').height();
	S = 0 + $('#sCurrent').height();
	if (Z == p) {
		if (M >= S) {
			$('#pCurrent').height(M);
			$('#sCurrent').height(M);
			}
		else {
			$('#pCurrent').height(S);
			$('#sCurrent').height(S);
		}
	}
}

function loadDiv(lp) {
	p=lp;
	$('#N' + (p)).addClass('seen');
	if (p > 1) {
		$('#previous').removeClass('inactive');
		$('#previous').addClass('active');
	}
	if (p > 1) {
		$('#pPrevious').load('getPageContent.asp?pageNum='+(p-1)+'&contentType=M&courseID=380');
		$('#sPrevious').load('getPageContent.asp?pageNum='+(p-1)+'&contentType=S&courseID=380');
	}
	$('#pCurrent').load('getPageContent.asp?pageNum='+p+'&contentType=M&courseID=380');
	$('#sCurrent').load('getPageContent.asp?pageNum='+p+'&contentType=S&courseID=380');
	
	if (p < PageMax) {
		$('#pNext').load('getPageContent.asp?pageNum='+(p+1)+'&contentType=M&courseID=380');
		$('#sNext').load('getPageContent.asp?pageNum='+(p+1)+'&contentType=S&courseID=380');
	}
	$('#sCurrent').height(660);
}

function goNext() {
	p=p+1;
	if (p > 1) {
		$('#previous').removeClass('inactive');
		$('#previous').addClass('active');
	}
	if (p == PageMax) {
		$('#next').removeClass('active');
		$('#next').addClass('inactive');
		Exam(agentID,fName,lName);
	}
	
	
	if (p < PageMax) {
	$("#pPrevious").html($("#pCurrent").html());
	$("#sPrevious").html($("#sCurrent").html());
	$("#pCurrent").html($("#pNext").html());
	$("#sCurrent").html($("#sNext").html());
	$('#sCurrent').height($('#pCurrent').height());
	$('#pNext').load('getPageContent.asp?pageNum='+(p+1)+'&contentType=M&courseID=380');
	$('#sNext').load('getPageContent.asp?pageNum='+(p+1)+'&contentType=S&courseID=380');
	}
	N = p;
	$('.nav1').removeClass('current');
	if (N % 2 == 0) {
		N=N-1;
	} 
	$('#N'+N).addClass('current');
	$('#N'+N).addClass('seen');
	window.scrollTo(0,190);
}

function goPrevious() {
	p=p-1;
	if (p == 1) {
		$('#previous').removeClass('active');
		$('#previous').addClass('inactive');
	}
	if (p < PageMax) {
		$('#next').removeClass('inactive');
		$('#next').addClass('active');
	}
	if (p > 0) {
	$('#pNext').html($("#pCurrent").html());
	$('#sNext').html($("#sCurrent").html());
	$('#pCurrent').html($("#pPrevious").html());
	$('#sCurrent').html($("#sPrevious").html());
	$('#sCurrent').height($('#pCurrent').height());
	$('#pPrevious').load('getPageContent.asp?pageNum='+(p-1)+'&contentType=M&courseID=380');
	$('#sPrevious').load('getPageContent.asp?pageNum='+(p-1)+'&contentType=S&courseID=380');
	}
	N = p;
	$('.nav1').removeClass('current');
	if (N % 2 == 0) {
		N=N-1;
	} 
	$('#N'+N).addClass('current');
	$('#N'+N).addClass('seen');
	window.scrollTo(0,190);
}
function slideLeft() {
	slide=slide+261;
	if (slide > 0) {
		slide=0;
	}
	$('#lessonNavSlider').css('left',slide+'px');
}
function slideRight() {
	slide=slide-261;
	if (slide < -1999) {
		slide = -1999;
	}
	$('#lessonNavSlider').css('left',slide+'px');
}

function navTo(N) {
	lp = N;
	$('.nav1').removeClass('current');
	if (N % 2 == 0) {
		N=N-1;
	} 
	$('#N'+N).addClass('current');
	if (lp > 0) {
		loadDiv(lp);
	}
}

function change() {
document.getElementById('para'+p).style.left='-3000px';
p=((p+1) % 2);
document.getElementById('para'+p).style.left='10px';
document.getElementById('active'+p).innerHTML="page " + (p+1);
}
function showActive() {
document.getElementById('active'+p).innerHTML="page " + (p+1);
}


function loadLesson() {
	loadDiv(1);
	agentID = $('#agentID').html();
	fName = $('#fName').html();
	lName = $('#lName').html();
}
function Exam() {
	agentID = $('#agentID').html();
	fName = $('#fName').html();
	lName = $('#lName').html();
	window.open('exam.asp?IDnum='+agentID+'&fName='+fName+'&lName='+lName+'&cID=380','Exam')
}


var mm;
var yy;
var cc;
function loadEvent(M,Y,C) {
	mm=M;
	yy=Y;
	cc=C;
	$('#eTable').load('getEvents.asp?m='+ mm +'&y=' + yy + '&c=' + cc);
}
function loadNewEventMonth(M) {
	mm=M;
	$('#eTable').load('getEvents.asp?m='+ mm +'&y=' + yy + '&c=' + cc);
}
function loadNewEventYear(Y) {
	yy=Y;
	$('#eTable').load('getEvents.asp?m='+ mm +'&y=' + yy + '&c=' + cc);
}
function loadNewEventCountry(C) {
	cc=C;
	$('#eTable').load('getEvents.asp?m='+ mm +'&y=' + yy + '&c=' + cc);
}
function loadBrochure(C) {
	cc=C;
	$('#brochureBox').load('getBrochures.asp?c='+ cc);
}

function switchUser() {
	$('#logged').css('left','-5000px');
	$('#logged').css('display','none');
	$('#signIn').css('left','0px');
	$('#signIn').css('display','block');
//	$('#navBar').css('height','100px');
}
function switchUser2() {
	$('#signUp').css('left','-5000px');
	$('#signUp').css('display','none');
	$('#signIn').css('left','0px');
	$('#signIn').css('display','block');
//	$('#navBar').css('height','100px');
}
function signUp() {
	$('#signIn').css('left','-5000px');
	$('#signIn').css('display','none');
	$('#signUp').css('left','0px');
	$('#signUp').css('display','block');
}
function checkID() {
	agentID = $('#agentID').html();
	if (agentID==0) {
		switchUser();
	}
}
