$(document).ready(function() {
	
	$("#news").newsTicker();
	
	var btnGoCount = $("div#numbers a").length;
	$(".carouselHolder .contentCarousel").jCarouselLite({
		btnGo: [".b1", ".b2", ".b3", ".b4", ".b5"],
    	visible: 1,
    	auto: 7000,
    	speed: 0,
    	beforeStart: function(a) {
				$(a).parent().fadeTo(600, 0);
    	},
    	afterEnd: function(i) {
    		$(i).parent().fadeTo(900, 1);
    		current = $(i).index();	//get the index of the current li
    		current = (current > btnGoCount) ? 1 : current;	//adjust to first, if more than num buttons, due to circular
    		$('div#numbers a').each(function(index) {
    			realIndex = index + 1;	//this index is 0-based, above is 1-based
    			if(realIndex == current) {
    				$(this).addClass('current');
    			} else {
    				$(this).removeClass('current');
    			}
    		});
    	}

	});
	
	$("a.vehicle-loan").click(function(e) {
		e.preventDefault();
		trackConv($(this), 962047012, 'isLmCKybyQMQpNjeygM');
	});
	
});

function trackConv($a, cid, clabel) {
    image = new Image(1,1);
    image.src = "http://www.googleadservices.com/pagead/conversion/"+ cid +"/?label="+ clabel +"&guid=ON&script=0";
    var destination = $a.attr('href');
    setTimeout(function() { window.location.href = destination; }, 500);

}


//ADDED FOR ANTI-PHISHING AND ONLINE BANKING LOGON BOX

function CheckBoxCheck(type){
	if(type == 0){
		if(document.Q2OnlineLogin.forgot_password[0].checked){
			document.Q2OnlineLogin.forgot_password[1].checked = false;
			document.Q2OnlineLogin.password.disabled = true;
			document.Q2OnlineLogin.password.style.backgroundColor = "#E5E5E5";
		} else {
			document.Q2OnlineLogin.password.disabled = false;
			document.Q2OnlineLogin.password.style.backgroundColor = "#FFFFFF";
		}
	} else if(type == 1){
		if(document.Q2OnlineLogin.forgot_password[1].checked){
			document.Q2OnlineLogin.forgot_password[0].checked = false;
			document.Q2OnlineLogin.password.disabled = true;
			document.Q2OnlineLogin.password.style.backgroundColor = "#E5E5E5";
		} else {
			document.Q2OnlineLogin.password.disabled = false;
			document.Q2OnlineLogin.password.style.backgroundColor = "#FFFFFF";
		}
	}
}

function MM_showHideLayers() { //v6.0
	  var i,p,v,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	    obj.visibility=v; }
	}
