var _QUERYSTRING = null;

function getQSValue(getThisVar) {

	if( _QUERYSTRING ) {
		return( _QUERYSTRING[ getThisVar ] );
	} 
	else {
		var toReturn = "";
		if( document.URL.indexOf("?") == -1 ) {
			return false;
		}
		var QS = document.URL.substring(document.URL.indexOf("?") + 1);
		var variables = QS.split("&"); 
		for(var i=0; i<variables.length; i++) {
			if( variables[i].indexOf(getThisVar + "=") > -1 ) {
				toReturn = variables[i].split("=")[1]; return toReturn;
			} 
		}
		return ""; 
	}
}

function initializeTabs() {

	for(var x=0; x<4; x++) {
		landingBg = new Image();
		landingBg.src = "images/landing/landing0" + x + ".jpg";
	}
	
	var szNormal = 0, szFull = -225;

	var kwicks = $$("#tabs .block");
	var fx = new Fx.Elements(kwicks, {wait: false, duration: 1000, transition: Fx.Transitions.Circ.easeInOut});
	
	var heroes = $$("#heroImages .heroImg");
	
	if(document.all) {
		var myFade = { wait: false, transition: Fx.Transitions.Quad.easeInOut, duration: 150, onStart: function () { landingFx.__ACTIVE = true; }, onComplete: function () { landingFx.__ACTIVE = false; } };
	}
	else {
		var myFade = { wait: false, transition: Fx.Transitions.Quad.easeInOut, duration: 1000, onStart: function () { landingFx.__ACTIVE = true; }, onComplete: function () { landingFx.__ACTIVE = false; } };
	}

	if(getQSValue("wam")) {
		var fx = new Fx.Elements(kwicks, {wait: false, duration: 1000, transition: Fx.Transitions.Back.easeOut});
		var myFade = { wait: false, transition: Fx.Transitions.Quad.easeIn, duration: 350 };
	}

	var landingFx = new Fx.Style($("landing0"), 'opacity', myFade);
	landingFx.__ACTIVE = false;
	
	kwicks.each(function(kwick, i) {
		kwick.addEvent("mouseenter", function(event) {
			var o = {};
			var p = {};
			o[i] = {top: [(kwick.getStyle("top").toInt() ? kwick.getStyle("top").toInt() : 0), szFull]};
			
			if(heroFx) heroFx.stop();		
			var heroFx = new Fx.Style(heroes[i], 'opacity', myFade).start((heroes[i].getStyle("opacity").toInt() ? heroes[i].getStyle("opacity").toInt() : 0),1);
			kwicks.each(function(other, j) {
				hero = heroes[j];
				if(i != j) {
					o[j] = {top: [(other.getStyle("top").toInt() ? other.getStyle("top").toInt() : 0), szNormal]};
					if(heroFx) heroFx.stop();		
					var heroFx = new Fx.Style(heroes[j], 'opacity', myFade).start((heroes[j].getStyle("opacity").toInt() ? heroes[j].getStyle("opacity").toInt() : 1),0);
				}
			});
			if(landingFx.__ACTIVE) landingFx.stop();		
			fx.start(o);
			landingFx.start(($("landing0").getStyle("opacity").toInt() ? $("landing0").getStyle("opacity").toInt() : 1),0);
			
		});
	});

	$("tabs").addEvent("mouseleave", function(event) {
		var o = {};
		
		kwicks.each(function(kwick, i) {
			o[i] = {top: [kwick.getStyle("top").toInt(), szNormal]};
			if(heroFx) heroFx.stop();
			var heroFx = new Fx.Style(heroes[i], 'opacity', myFade).start((heroes[i].getStyle("opacity").toInt() ? heroes[i].getStyle("opacity").toInt() : 1), 0);
			
		});
		if(landingFx.__ACTIVE) landingFx.stop();
		fx.start(o);
		landingFx.start(($("landing0").getStyle("opacity").toInt() ? $("landing0").getStyle("opacity").toInt() : 0),1);
		
	})

} // initializeTabs


function initializeFeatureBox() {

	var features = $$("#featureBoxWrapper .featureBox");
	features.each(function(fb, i) {
		fb.addEvent("mouseenter", function(event) {
			this.style.backgroundColor = "#fff";
		});
		fb.addEvent("mouseleave", function(event) {
			this.style.backgroundColor = "transparent";
		});
	});

} // initializeFeatureBox	


function preLoadNavImages(depth) {
	depth = depth ? depth : 0;

	var fol = "";
	for(var i=0; i<depth; i++) {
		fol += "../";
	}
	
	// if more navigation buttons are added, they should be placed here.
	var navImages = [
		"video_nav_asSeenOnTVOff.gif",
		"video_nav_asSeenOnTVOn.gif",
		"featurebox_nav_linksOff.gif",
		"featurebox_nav_linksOn.gif",
		"featurebox_nav_offersOff.gif",
		"featurebox_nav_offersOn.gif"
	];

	var navImgBg;
	for(var i=0; i<navImages.length; i++) {
		navImgBg = new Image();
		navImgBg.src = fol + "images/nav/" + navImages[i];
	}

} // preLoadNavImages


function initializeLanding() {
	initializeTabs();
	initializeFeatureBox();
	//preLoadNavImages(0);
} // initializeLanding


function initializeInternal(depth) {
	preLoadNavImages(depth);
} // initializeInternal


var creditTips = [
	"<strong>Sugerencia de<br />cr&eacute;dito No. 1</strong>Familiar&iacute;cese con su puntuaci&oacute;n de cr&eacute;dito &#8211; dicha puntuaci&oacute;n sirve de gu&iacute;a a las compa&ntilde;&iacute;as y a los bancos en sus decisiones acerca de si hacer o no negocios con usted y en cu&aacute;les t&eacute;rminos. Para m&aacute;s informaci&oacute;n, visite www.myfico.com.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 2</strong>Pagar los impuestos a la renta a tiempo en Estados Unidos resulta f&aacute;cil y c&oacute;modo con su tarjeta MasterCard. M&aacute;s tiempo para invertir en cosas importantes.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 3</strong>Rompa o destruya todas las solicitudes de tarjetas de cr&eacute;dito, los estados de cuenta o facturaciones del banco y cualquier otro documento sensible, en vez de botarlos a la basura, a fin de evitar un posible fraude.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 4</strong>Cerci&oacute;rese de comprobar su reporte de cr&eacute;dito al menos una vez al a&ntilde;o, e investigar si aparecen cuentas que no son suyas.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 5</strong>Ahorre tiempo al elaborar un presupuesto: existen muchos software de presupuesto que se pueden descargar gratis, que pueden ayudarle a administrar mejor sus gastos.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 6</strong>Su reporte de cr&eacute;dito contiene informaci&oacute;n pormenorizada de su historial de cr&eacute;dito. Una vez cada 12 meses, usted tiene derecho a recibir copias gratis de su reporte de cr&eacute;dito en cada una de las compa&ntilde;&iacute;as nacionales de informes crediticios al consumidor: Equifax, Experian y TransUnion.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 7</strong>Pagar m&aacute;s que la cantidad m&iacute;nima exigida en cuanto a su saldo de la tarjeta de cr&eacute;dito, es uno de los pasos m&aacute;s importantes para liquidar su deuda.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 8</strong>A dondequiera que viaje, siempre puede contar con MasterCard Global Service&trade; para todo lo relacionado con su tarjeta. Ll&aacute;menos a cualquier hora del d&iacute;a o la noche, los 365 d&iacute;as del a&ntilde;o, y lo pondremos en contacto con un representante que hable su idioma.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 9</strong>Est&eacute; siempre pendiente de sus ciclos de facturaci&oacute;n. Aseg&uacute;rese de llamar a sus acreedores si sus facturas no llegan a tiempo.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 10</strong>Cuando compre en l&iacute;nea, compruebe que el sitio que est&eacute; usando sea seguro. Busque pistas como por ejemplo un candado con llave en la esquina inferior de su explorador, un URL que comience con https.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 11</strong>MasterCard SecureCode es un modo sencillo de pagar a cientos de tiendas en l&iacute;nea. SecureCode es un c&oacute;digo privado que conocen usted y su banco solamente que le ofrece la mayor protecci&oacute;n en l&iacute;nea.",
	"<strong>Sugerencia de<br />cr&eacute;dito No. 12</strong>Puede evitar los cargos por pago tard&iacute;os si utiliza su tarjeta de cr&eacute;dito para pagar las facturas de los servicios p&uacute;blicos."
	
	
]; // creditTips


function rotateCreditTip() {
	document.getElementById("creditTipText").innerHTML = creditTips[Math.floor(Math.random()*12)];
} // rotateCreditTip


function toggleDisplay(node, dis) {
	if(typeof(node)=="string") {
		node = document.getElementById(node);
	}
	dis = dis ? dis : "block";

	if(node.style.display=="none") {
		node.style.display = dis;
	}
	else {
		node.style.display = "none";
	}
	if(node.style.display!="none")
		return "open";
	else
		return "";
	
} // toggleDisplay
var jsEspanol = true;