// Tab function for Homepage.

var allmaintabs = new Array();

allmaintabs.push('choosing_tab');

allmaintabs.push('managing_tab');

allmaintabs.push('service_tab');



function switchMainTab(tabname) {

	for(var x=0; x < allmaintabs.length; x++){

		var  currenttab = document.getElementById(allmaintabs[x]);

		var  currentcontent = document.getElementById(allmaintabs[x]+"_content");

		var  currenttabtext = document.getElementById(allmaintabs[x]+"_text");

		if (allmaintabs[x] != tabname) {

			currenttab.className = '';

			currentcontent.style.display = 'none';

			currenttabtext.style.color = 'white';

		}

		else {

			currenttab.className = 'primarytabs-currentpage';

			currentcontent.style.display = '';

			currenttabtext.style.color = '#000000';

		}

	}

}





// Feature Card & Optional Service switch

function switchFeaturedCard(num){

	document.getElementById('featured_card_1').style.display = ( num==1 ) ? '' : 'none';

	document.getElementById('featured_card_2').style.display = ( num==2 ) ? '' : 'none';

	document.getElementById('featured_card_3').style.display = ( num==3 ) ? '' : 'none';

}



function switchOptionalService(num){

	document.getElementById('opt_service_1').style.display = ( num==1 ) ? '' : 'none';

	document.getElementById('opt_service_2').style.display = ( num==2 ) ? '' : 'none';

	document.getElementById('opt_service_3').style.display = ( num==3 ) ? '' : 'none';

	document.getElementById('opt_service_4').style.display = ( num==4 ) ? '' : 'none';

	document.getElementById('opt_service_5').style.display = ( num==5 ) ? '' : 'none';

	document.getElementById('opt_service_6').style.display = ( num==6 ) ? '' : 'none';

}





// Choose your card switch tab

function switchChooseYourCardTab(tabname) {

	var alltabs = new Array();

	alltabs.push('rewards_tab');

	alltabs.push('travel_tab');

	alltabs.push('lowinterest_tab');

	alltabs.push('student_tab');

	alltabs.push('nofee_tab');

	alltabs.push('default_tab');



	for(var x=0; x < alltabs.length; x++){

		var  currenttab = document.getElementById(alltabs[x]);

		var  currentcontent = document.getElementById(alltabs[x]+"_content");

		if (alltabs[x] != tabname) {

			if (alltabs[x] != 'default_tab') currenttab.className = 'btn-off';

			currentcontent.style.display = 'none';

		}

		else {

			if (alltabs[x] != 'default_tab') currenttab.className = 'btn-on';

			currentcontent.style.display = 'block';

		}

	}

	//Change Background

	document.getElementById('choosing_right_card_bg').style.backgroundImage = 'url("/cards/_assets-custom/images/choose-your-card-bg.gif")';

}





// Rewards switch tab

function switchRewardsTab(tabname) {

	var alltabs = new Array();

	alltabs.push('redeempoint_tab');

	alltabs.push('redeemflight_tab');

	alltabs.push('browsecatalog_tab');

	alltabs.push('checkbalance_tab');

	alltabs.push('signupforemail_tab');

	alltabs.push('learnaboutrewards_tab');



	for(var x=0; x < alltabs.length; x++){

		var  currenttab = document.getElementById(alltabs[x]);

		var  currentcontent = document.getElementById(alltabs[x]+"_content");

		if (alltabs[x] != tabname) {

			if (alltabs[x] != 'default_tab') currenttab.className = 'btn-off';

			currentcontent.style.display = 'none';

		}

		else {

			if (alltabs[x] != 'default_tab') currenttab.className = 'btn-on';

			currentcontent.style.display = 'block';

		}

	}

}





// How do I switch tab

function switchHowDoITab(tabname) {

	var alltabs = new Array();

	alltabs.push('requestlimit_tab');

	alltabs.push('reportalost_tab');

	alltabs.push('paymyvisa_tab');

	alltabs.push('requestastate_tab');

	alltabs.push('seerewardspoint_tab');



	for(var x=0; x < alltabs.length; x++){

		var  currenttab = document.getElementById(alltabs[x]);

		var  currentcontent = document.getElementById(alltabs[x]+"_content");

		if (alltabs[x] != tabname) {

			if (alltabs[x] != 'default_tab') currenttab.className = 'btn-off';

			currentcontent.style.display = 'none';

		}

		else {

			if (alltabs[x] != 'default_tab') currenttab.className = 'btn-on';

			currentcontent.style.display = 'block';

		}

	}

}





//Flips the "Choosing the Right Visa Card For You" Sub Section

function flipChoosingSubSection(section, card) {

	///////////////////////////////

	//START: CARD SUB SECTIONS

	///////////////////////////////

	var rewards = new Array();

	rewards.push('avion_inf');

	rewards.push('rewards_gold');

	rewards.push('classic2');



	var travel = new Array();

	travel.push('avion_inf');

	travel.push('ba_platinum');

	travel.push('gold_p');

	

	var student = new Array();

	student.push('classic_student');

	student.push('classic2_student');

	

	var nofee = new Array();

	nofee.push('rewards_gold');

	nofee.push('rewards_classic');

	nofee.push('starbucks');

	///////////////////////////////

	//END: CARD SUB SECTIONS

	///////////////////////////////

	

	//Rewards

	if (section == "rewards") {

		for(var x=0; x<rewards.length; x++){

			if (rewards[x] == card) {

				document.getElementById(section + '_' + rewards[x]).style.display = '';

				document.getElementById(section + '_' + rewards[x] + '_link').style.fontWeight = 'bold';

				document.getElementById(section + '_' + rewards[x] + '_link').style.color = '#000000';

			}

			else {

				document.getElementById(section + '_' + rewards[x]).style.display = 'none';

				document.getElementById(section + '_' + rewards[x] + '_link').style.fontWeight = 'normal';

				document.getElementById(section + '_' + rewards[x] + '_link').style.color = '#002888';

			}

		}

	}

	

	//Travel

	if (section == "travel") {

		for(var x=0; x<travel.length; x++){

			if (travel[x] == card) {

				document.getElementById(section + '_' + travel[x]).style.display = '';

				document.getElementById(section + '_' + travel[x] + '_link').style.fontWeight = 'bold';

				document.getElementById(section + '_' + travel[x] + '_link').style.color = '#000000';

			}

			else {

				document.getElementById(section + '_' + travel[x]).style.display = 'none';

				document.getElementById(section + '_' + travel[x] + '_link').style.fontWeight = 'normal';

				document.getElementById(section + '_' + travel[x] + '_link').style.color = '#002888';

			}

		}

	}

	

	//Students

	if (section == "student") {

		for(var x=0; x<student.length; x++){

			if (student[x] == card) {

				document.getElementById(section + '_' + student[x]).style.display = '';

				document.getElementById(section + '_' + student[x] + '_link').style.fontWeight = 'bold';

				document.getElementById(section + '_' + student[x] + '_link').style.color = '#000000';

			}

			else {

				document.getElementById(section + '_' + student[x]).style.display = 'none';

				document.getElementById(section + '_' + student[x] + '_link').style.fontWeight = 'normal';

				document.getElementById(section + '_' + student[x] + '_link').style.color = '#002888';

			}

		}

	}

	

	//No Fee

	if (section == "nofee") {

		for(var x=0; x<nofee.length; x++){

			if (nofee[x] == card) {

				document.getElementById(section + '_' + nofee[x]).style.display = '';

				document.getElementById(section + '_' + nofee[x] + '_link').style.fontWeight = 'bold';

				document.getElementById(section + '_' + nofee[x] + '_link').style.color = '#000000';

			}

			else {

				document.getElementById(section + '_' + nofee[x]).style.display = 'none';

				document.getElementById(section + '_' + nofee[x] + '_link').style.fontWeight = 'normal';

				document.getElementById(section + '_' + nofee[x] + '_link').style.color = '#002888';

			}

		}

	}

	

	//Change Card Image and Reset Reflection

	// var card_image = document.getElementById(section + '_choosing_card_image');

	// card_image.src = '/cards/_assets-custom/images/mid-cards/m_' + card + '.gif';

	//Reflection.add(card_image, { height: 0.33, opacity: 1/2 });

}



// Change Title for Choosing your card

function rolltext(div_name, text){

	document.getElementById(div_name).innerHTML = text;

}



//Adds reflection bannercard if not ie7

function addReflectionToBannerCard() {



	if (!usingIE7()) {

		var card_image = document.getElementById('banner_card1');

		Reflection.add(card_image, { height: 0.08, opacity: 1/2 });

	}

}