$(document).ready(function() {
	
/**
 *  Start of Generic URL Linking Technique - used for News Box and FAQ Box
 */	
	//store the hash object of the URL
	var hashObject = location.hash;
	
	//convert the hash object to a string value
	var hashString = hashObject.toString();
	
	//store the substring
	var hashSubString = hashString.substring(1);
	
	//assign the reference value to the linkable item
	var linkableItemRef = '#linkableItem_' + hashSubString;
	
	//expand the relevant news article
	$(linkableItemRef).show();
/**
 *  End of Generic URL Linking Technique - used for News Box and FAQ Box
 */		
	
	
/**
 *  Start of javascript for News Box
 */
	// Init the index position in the array 'newsList'
	var currentNewsListPos = 0;
	
	// Variable that stores the rotation interval for news items
	var headline_interval;
		
	// newsAbstract substring IF the string length exceeds the permitted value
	var newsAbstractSubStr;
		
	// Init the arry 'newsList' with news values
	var newsList = [	{newsDate: "March 25, 2009 - 5:00pm", newsTitle: "Great food. Even better company.", newsAbstract: "Hello, We recently hosted a dinner with 20 of our customers in Sydney. We wanted to give our customers a chance to tell us how we're doing so far, what we could do better - and what products we should be introducing next!"},
	                	{newsDate: "February 17, 2009 - 9:00am", newsTitle: "Your most important deposit yet.", newsAbstract: "Hello, Usually when you hear from us, it's to tell you about a new way we can help you grow your money. How you can do more with it. And make more of it. But now - in the wake of the catastrophic..."},
	                	{newsDate: "January 19, 2009 - 9:00am", newsTitle: "Happy New Year from UBank!", newsAbstract: "2009 is now well and truly underway -  and isn't time flying! Already we're halfway through January - and it sill feels like only yesterday that we were launching UBank (way back in October!). So much..."}
                   ];
	
	//Array - news pages html names
	var newsPagesNamesArray = ['great-food', 
	                           'your-most-important-deposit-yet',
	                           'happy-new-year-from-ubank'
	                           ];
	
	// Determine the size of the newsList array
	var newsListSize = newsList.length;
	
	//Calculate the length (in chars) of the newsAbstract string
	var newsAbstractStrLength = newsList[currentNewsListPos].newsAbstract.length;		
	
	// Init the news box with the first news item 
	populateNewsDiv();

	// Init the headline interval
	headline_interval = setInterval(headline_rotate,5000);
	 
	// Function to clear the interval when a user hovers over the news box
	$(".ddNewsContent").hover(function(){clearInterval(headline_interval);}, function() {headline_interval = setInterval(headline_rotate,5000);});

	// News item rotator function
	  function headline_rotate(){
		  nextNewsItem();
	  }
	
	// Function to retreive the previous news item when the left arrow is clicked
	$("#prevNewsItem").click(function(){
		previousNewsItem();
	});
	
	// Function to retreive the next news item when the right arrow is clicked
	$("#nextNewsItem").click(function(){
		nextNewsItem();
	});
	
	// Scrolling in the 'left' direction 
	function previousNewsItem() {
		if (currentNewsListPos == 0){
			currentNewsListPos=newsListSize-1; //reset the position to the last index in the array to enable looping
		}
		else {
			currentNewsListPos--;
		}
		populateNewsDiv();
	}
	
	//Scrolling in the 'right' direction
	function nextNewsItem() {
		if (currentNewsListPos < (newsListSize-1)){
			currentNewsListPos++;
		}
		else{
			currentNewsListPos=0; //reset the position to the first index in the array to enable looping
		}
		populateNewsDiv();
	}
	
	//Populate the news div with the news details
	function populateNewsDiv(){
		$("#newsTitle").text(newsList[currentNewsListPos].newsTitle);
		$("#newsDate").text(newsList[currentNewsListPos].newsDate);
		setSubStr(newsList[currentNewsListPos].newsAbstract);
		$("#newsAbstract").text(newsAbstractSubStr);
		var locationString="../whoWeAre/news/"; 
		var anchorLocation=(locationString + newsPagesNamesArray[currentNewsListPos.toString()]+".html");	//Sets anchor point of the whoweare-news.xhtml page
		$("#newsTitle").attr({href:anchorLocation});
	}
	
	//Set the substring of the newsAbstract string if the string length is greater than the maximum allowed value
	function setSubStr(newsAbstractString) {
		var newsAbstractMaxStrLength = 206; 		// Max allowable length (in chars) for the newsAbstract string
		var newsAbstractMaxStrLengthWithDots=203; 	// Max length (in chars) for the newsAbstract string if '...' are required

		if (newsAbstractString.length>newsAbstractMaxStrLength){
			newsAbstractSubStr=newsAbstractString.substring(0, newsAbstractMaxStrLengthWithDots) + "...";
		}
		else {
			newsAbstractSubStr=newsList[currentNewsListPos].newsAbstract;
		}
	}
/**
 *  End of News Box JavaScript Section
 */
	
	
/**
 *  Start of news box and whoarewe-news JavaScript Section
 */	
	//enable news articles to expand and contract	
	$(".newsTitleHolder").toggle(
			function(){
				
				$(this).next("div").show();
				$(this).children().css("backgroundPosition","0 -78px");
			},
			function(){
				$(this).next("div").hide();
				$(this).children().css("backgroundPosition","0 6px");
			}								 
		);
/**
 *  End of whoarewe-news JavaScript Section
 */	
	
	
/**
 *  Start of Money Box JavaScript Section
 */
	// Init the index position in the webisodeList array
	var currentWebisodePos = 0;
	
	if ($("#hWebisodeArrayPos").val() != "")
	{
		currentWebisodePos = $("#hWebisodeArrayPos").val();
	}

	// Init the arry 'newsList' with news values
	var webisodeList = [	{	webisodeId: "Webisode 1", 
								webisodeIntroPassage: "In our first instalment we cover:", 
								webisodePoint1: "The global credit crisis", 
								webisodePoint2: "The way Aussies save", 
								webisodePoint3: "What a bear market is",
								webisodePoint4: "",								
								webisodeInstruction: "Click on the link below to view our webisode instalment.",
								webisodeLink: "Webisode 1",
								youTubeValue: "http://www.youtube.com/v/z7VkPJB2WoU&amp;hl=en&amp;fs=1&amp;autoplay=1", 
								youTubeSrc: "http://www.youtube.com/v/z7VkPJB2WoU&amp;hl=en&amp;fs=1&amp;autoplay=1",
								webisodeDescription: "In our first instalment we cover the global credit crisis, the way Aussies save and what a bear market is.",
								webisodeDivLocation: "../whoWeAre/whoweare-moneybox1.html#webisodePreview"},
								{webisodeId: "Webisode 2", 
								webisodeIntroPassage: "In our second instalment we cover:", 
								webisodePoint1: "The definition of a recession", 
								webisodePoint2: "Why recessions happen", 
								webisodePoint3: "The best way to survive a recession",
								webisodePoint4: "The difference between a recession and a depression",
								webisodeInstruction: "Click on the link below to view our webisode instalment.",
								webisodeLink: "Webisode 2",
								youTubeValue: "http://www.youtube.com/v/dqpwNnidl58&amp;hl=en&amp;fs=1&amp;autoplay=1", 
								youTubeSrc: "http://www.youtube.com/v/dqpwNnidl58&amp;hl=en&amp;fs=1&amp;autoplay=1",
								webisodeDescription: "In our second instalment we cover the definition of a recession, why recessions happen, the best way to survive a recession, and the difference between a recession and a depression.",
								webisodeDivLocation: "../whoWeAre/whoweare-moneybox2.html#webisodePreview"},
								{webisodeId: "Webisode 3", 
								webisodeIntroPassage: "In our third instalment we cover:", 
								webisodePoint1: "The movement in the value of the Aussie Dollar", 
								webisodePoint2: "The factors that affect the Aussie Dollar", 
								webisodePoint3: "Investing and trading in currency",
								webisodePoint4: "",			
								webisodeInstruction: "Click on the link below to view our webisode instalment.",
								webisodeLink: "Webisode 3",
								youTubeValue: "http://www.youtube.com/v/reZm0UR69uU&amp;hl=en&amp;fs=1&amp;autoplay=1", 
								youTubeSrc: "http://www.youtube.com/v/reZm0UR69uU&amp;hl=en&amp;fs=1&amp;autoplay=1",
								webisodeDescription: "Now in High Definition! Click 'watch in HD' to view. In our third instalment we cover the movement in the value of the Aussie Dollar, the factors that affect the Aussie Dollar and ways of trading in currency.",
								webisodeDivLocation: "../whoWeAre/whoweare-moneybox3.html#webisodePreview"},
								{webisodeId: "Webisode 4", 
								webisodeIntroPassage: "In our fourth instalment we cover:", 
								webisodePoint1: "The differences between investing in property vs stock", 
								webisodePoint2: "The benefits and risks of both investments", 
								webisodePoint3: "Using the stock market to purchase property",
								webisodePoint4: "",			
								webisodeInstruction: "Click on the link below to view our webisode instalment.",
								webisodeLink: "Webisode 4",
								youTubeValue: "http://www.youtube.com/v/flQZoR1fikc&amp;hl=en&amp;fs=1&amp;autoplay=1", 
								youTubeSrc: "http://www.youtube.com/v/flQZoR1fikc&amp;hl=en&amp;fs=1&amp;autoplay=1",
								webisodeDescription: "Now in High Definition! Click 'watch in HD' to view. In our fourth instalment we cover the differences between investing in property vs stock, the benefits and risks of both investments, using the stock market to purchase property.",
								webisodeDivLocation: "../whoWeAre/whoweare-moneybox4.html#webisodePreview"},
								{webisodeId: "Webisode 5", 
								webisodeIntroPassage: "In our fifth instalment we cover:", 
								webisodePoint1: "Enoughism vs Consumerism", 
								webisodePoint2: "Whether you should spend wildly or be frugal", 
								webisodePoint3: "The potential downsides",
								webisodePoint4: "",			
								webisodeInstruction: "Click on the link below to view our webisode instalment.",
								webisodeLink: "Webisode 5",
								youTubeValue: "http://www.youtube.com/v/pe5yFYryYLI&amp;hl=en&amp;fs=1&amp;autoplay=1", 
								youTubeSrc: "http://www.youtube.com/v/pe5yFYryYLI&amp;hl=en&amp;fs=1&amp;autoplay=1",
								webisodeDescription: "Now in High Definition! Click 'watch in HD' to view. In our fifth instalment we cover Enoughism vs Consumerism, Whether you should spend wildly or be frugal, The potential downsides.",
								webisodeDivLocation: "../whoWeAre/whoweare-moneybox5.html#webisodePreview"},
								{webisodeId: "Webisode 6", 
								webisodeIntroPassage: "In our sixth instalment we cover:", 
								webisodePoint1: "What exactly superannuation is", 
								webisodePoint2: "What happens to your super once you pay it?", 
								webisodePoint3: "Types of superannuation funds available",
								webisodePoint4: "Whether you should move funds everytime you move jobs",			
								webisodeInstruction: "Click on the link below to view our webisode instalment.",
								webisodeLink: "Webisode 6",
								youTubeValue: "http://www.youtube.com/watch/v/W1gFqKsTN9Y&amp;hl=en&amp;fs=1&amp;autoplay=1", 
								youTubeSrc: "http://www.youtube.com/watch/v/W1gFqKsTN9Y&amp;hl=en&amp;fs=1&amp;autoplay=1",
								webisodeDescription: "Now in High Definition! Click 'watch in HD' to view. In the sixth instalment of Money Box we cover, what exactly superannuation is, what happens to it once you pay it, the types of superannuation funds available and if you should move funds everytime you move jobs.",
								webisodeDivLocation: "../whoWeAre/whoweare-moneybox6.html#webisodePreview"},
								{webisodeId: "Webisode 7", 
								webisodeIntroPassage: "We asked what you wanted to see on Money Box, and here it is. We counted the votes, and in the seventh instalment of Money Box we look at legitimate ways you can pay less tax, such as:", 
								webisodePoint1: "Maximising your allowable deductions", 
								webisodePoint2: "Minimising Capital Gains Tax ", 
								webisodePoint3: "Negative Gearing",
								webisodePoint4: "",			
								webisodeInstruction: "Click on the link below to view our webisode instalment.",
								webisodeLink: "Webisode 7",
								youTubeValue: "http://www.youtube.com/watch/v/qM5wy_Zv6s8&amp;hl=en&amp;fs=1&amp;autoplay=1", 
								youTubeSrc: "http://www.youtube.com/watch/v/qM5wy_Zv6s8&amp;hl=en&amp;fs=1&amp;autoplay=1",
								webisodeDescription: "Now in High Definition! Click 'watch in HD' to view. We asked what you wanted to see on Money Box, and here it is. We counted the votes, and in the seventh instalment of Money Box we look at legitimate ways you can pay less tax, such as; Maximising your allowable deduction, getting the best out of Capital Gains Tax and negative gearing.",
								webisodeDivLocation: "../whoWeAre/whoweare-moneybox.html#webisodePreview"}
															
								
						];
	
	// Determine the size of the webisodeList array
	var webisodeListSize = webisodeList.length;
	
	// Init the news box with the first news item 
	populateMoneyBoxDiv();
	
	$("#prevMoneyBoxItem").click(function(){
		previousMoneyBoxItem();
	});
	
	$("#nextMoneyBoxItem").click(function(){
		nextMoneyBoxItem();
	});
		
	// Scrolling the moneyBoxDiv in the 'left' direction 
	function previousMoneyBoxItem() {
		if (currentWebisodePos == 0){
			currentWebisodePos=webisodeListSize-1; 			//reset the position to the last index in the array to enable looping
		}
		else {
			currentWebisodePos--;
		}
		populateMoneyBoxDiv();
	}
	
	//Scrolling the moneyBoxDiv in the 'right' direction
	function nextMoneyBoxItem() {
		if (currentWebisodePos < (webisodeListSize-1)){
			currentWebisodePos++;
		}
		else{
			currentWebisodePos=0; //reset the position to the first index in the array to enable looping
		}
		populateMoneyBoxDiv();
	}

	//Populate the money box div with the news details
	function populateMoneyBoxDiv(){
		
		if (webisodeList != undefined && webisodeList[currentWebisodePos] != undefined) {
			$("#webisodeId").text(webisodeList[currentWebisodePos].webisodeId);
			$("#webisodeIntroPassage").text(webisodeList[currentWebisodePos].webisodeIntroPassage);
			$("#webisodePoint1").text(webisodeList[currentWebisodePos].webisodePoint1);
			$("#webisodePoint2").text(webisodeList[currentWebisodePos].webisodePoint2);
			$("#webisodePoint3").text(webisodeList[currentWebisodePos].webisodePoint3);
			if (webisodeList[currentWebisodePos].webisodePoint4.length == 0)
			{
				$("#webisodePoint4").hide();
			}
			else
			{
				$("#webisodePoint4").show();
				$("#webisodePoint4").text(webisodeList[currentWebisodePos].webisodePoint4);	
			}
			$("#webisodeInstruction").text(webisodeList[currentWebisodePos].webisodeInstruction);
			
			// var webisodeDivLocation="../whoWeAre/whoweare-moneybox.xhtml#webisodePreview";	//Sets anchor point of the webisode preview box	
			var strHTML = "";	//Initialises strHTML
			strHTML += "<object width='336' height='270'>\n";
			strHTML += "<param name='movie' value=" + webisodeList[currentWebisodePos].youTubeValue + "><\/param>\n";
			strHTML += "<param name='allowFullScreen' value='true'><\/param>\n";
			strHTML += "<param name='allowscriptaccess' value='always'><\/param>\n";
			strHTML += "<embed src=" + webisodeList[currentWebisodePos].youTubeSrc + "type='application\/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='336' height='270'><\/embed>\n";
			strHTML += "<\/object>\n";
			
			$(".webisodeLink").text(webisodeList[currentWebisodePos].webisodeLink);
			$(".webisodeLink").attr({href:(webisodeList[currentWebisodePos].webisodeDivLocation)});
		}
	}  	
/**
 *  End of Money Box JavaScript Section
 */
	
	
	//Set the colour of the UBank Loyalty Bonus row
	$("table#rates tbody tr:eq(1) td").addClass("lightGreenRow");
						   
	$(".helpArticle h3").toggle(
		function(){
			$("#" +$(this).attr("id") + " ~ div").attr({style: "display:block"});
		},
		function(){
			$("#" +$(this).attr("id") + " ~ div").attr({style: "display:none"});
		}								 
	);

$(".browserType").click(function () {
      $("#q9" + " ~ div").attr({style: "display:block"});
    });
					
	
	$("table.oddEven thead th td").css("background-color", "none");
	$("table.oddEven tbody tr:even").css("background-color", "#efefef");
	$("table.oddEven tbody tr:odd").css("background-color", "#ffffff");
	
	$("table.largeOddEven thead th td").css("background-color", "none");
	$("table.largeOddEven tbody tr:even").css("background-color", "#efefef");
	$("table.largeOddEven tbody tr:odd").css("background-color", "#ffffff");
	$("table.largeOddEven tbody tr:first").css("background-color", "#004942");
	$("table.largeOddEven tbody tr:first").css("color", "#ffffff");
	$("table.largeOddEven tbody tr:first").css("font-weight", "bold");
	
	$(":radio").css({background:"none", border:"none"});
	$(":checkbox").css({background:"none", border:"none"});
	
	$(window).load(function(){				
		placeElement($("#topDivider"),$("#whoFeature"),700,-322);

		
	if ($("#dropFAQ").hasClass("ddTitle"))
	{
		$("#dropFAQContent").hide();
	}
	else
	{
		$("#dropFAQContent").show();
	}
	
	if ($("#dropCalc").hasClass("ddTitle"))
	{
		$("#dropCalcContent").hide();
	}
	else
	{
		$("#dropCalcContent").show();
	}	
	
	if ($("#dropNews").hasClass("ddTitle"))
	{
		$("#dropNewsContent").hide();
	}
	else
	{
		$("#dropNewsContent").show();
	}	

	if ($("#dropMoney").hasClass("ddTitle"))
	{
		$("#dropMoneyContent").hide();
	}
	else
	{
		$("#dropMoneyContent").show();
	}
	
	if ($("#dropTwitter").hasClass("ddTitle"))
	{
		$("#dropTwitterContent").hide();
	}
	else
	{
		$("#dropTwitterContent").show();
	}	
	
	if ($("#dropTwitterFollowers").hasClass("ddTitle"))
	{
		$("#dropTwitterFollowersContent").hide();
	}
	else
	{
		$("#dropTwitterFollowersContent").show();
	}	
	
	
	});
	
	$(window).resize(function(){
		placeElement($("#topDivider"),$("#whoFeature"),700,-322);
	});	
	
	/*Function places passed element (movingEl) to X(extraX) & Y(extraY) coords relative to a positioned element (relEl)*/
	function placeElement(relEl,movingEl,extraX,extraY)
	{
		if (relEl.attr("id") != undefined)
		{
			var xPos = (relEl.offset().left + extraX);
			var yPos = (relEl.offset().top + extraY);		
			movingEl.css({ left: xPos+"px", top: yPos+"px" });	
		}
	}	
	
	
	$("ul#topNav li.active").attr({style:"background-position: 0px -74px"});
	$("ul#tabs li.tabActive").attr({style:"background-position: 0px -27px"});
	$("ul#tabsHelp li.tabActive").attr({style:"background-position: 0px -27px"});	
	$("#productLinks .active").attr({style:"background-position: 0px -37px"});
	
	$("ul#topNav li").hover(
		function () {
			$(this).attr({style:"background-position: 0px -37px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});
		}
	);
	
	$("ul#topNav li.active").hover(
		function () {
			$(this).attr({style:"background-position: 0px -74px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px -74px"});
		}
	);
	
	$("ul#tabs li").hover(
		function () {
			$(this).attr({style:"background-position: 0px -27px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});
		}
	);
	
	$("ul#tabsHelp li").hover(
		function () {
			$(this).attr({style:"background-position: 0px -27px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});
		}
	);	


	
	$("ul#tabs li.tabActive").hover(
		function () {
			$(this).attr({style:"background-position: 0px -27px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px -27px"});
		}
	);
	
	$("ul#tabsHelp li.tabActive").hover(
		function () {
			$(this).attr({style:"background-position: 0px -27px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px -27px"});
		}
	);	
	
	$("#productLinks div").hover(
		function () {
			$(this).attr({style:"background-position: 0px -37px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});
		}
	);

/* More button hover */
	$(".btnMore").hover(
		function () {
			$(this).attr({style:"background-position: 0px -21px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
/* Apply now button hover */
	$("#bannerApplyBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -26px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);
	
/* Follow Twitter button hover */
	$("#followUBankBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -26px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
/* Apply now button hover on homepage */
	$("#homeBannerApplyBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -28px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);

	/* Large Apply now button hover on promo_landingpage */
	$(".btnApplyNowLrg").hover(
		function () {
			$(this).attr({style:"background-position: 0px -32px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
	/* Large Apply now button hover on promo_landingpage */
	$(".btnOpenAcct").hover(
		function () {
			$(this).attr({style:"background-position: 0px -32px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);		
/* News item left button hover */
	$(".prevArrowHolder").hover(	
			function () {
				$(this).attr({style:"background-position: 0px -30px"});
			},
			function () {
				$(this).attr({style:"background-position: 0px 0px"});		
			}
	);	

/* News item right button hover */
	$(".nextArrowHolder").hover(
		function () {
			$(this).attr({style:"background-position: 0px -30px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
/* Edit button hover */
	$(".formStep3Btn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -19px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
/* Print confirmation button hover */
	$("#printConfirmBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -21px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);
	
/* Download confirmation button hover */
	$("#downloadConfirmBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -21px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);
	
/* Share on facebook button hover */
	$("#shareOnFaceBookBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -26px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
		
/* Print page button hover */
	$("#printPageBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -21px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
/* Back home button hover */
	$("#backHomeBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -21px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);		

/* Install now button hover */
	$("#btnInstall").hover(
		function () {
			$(this).attr({src:"../img/btnInstallOver.gif"});
		},
		function () {
			$(this).attr({src:"../img/btnInstall.gif"});		
		}
	);		
	
/* Download printed application button hover */
	$("#downloadPrintedAppBtn").hover(
		function () {
			$(this).attr({style:"background-position: 0px -26px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
	/* Open at 10pm button hover */
	$("#btnOpenAtTen").hover(
		function () {
			$(this).attr({style:"background-position: 0px -96px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
	/* Become a UBank member now button hover */
	$("#btnLrgBecomeMbr").hover(
		function () {
			$(this).attr({style:"background-position: 0px -32px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
	/* Apply now 10 at 10 button hover */
	$("#btnApply10at10").hover(
		function () {
			$(this).attr({style:"background-position: 0px -96px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
	/* UTable Submit your question hover */
	$("#btnUTableSubmitYourQ").hover(
		function () {
			$(this).attr({style:"background-position: 0px -37px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
	/* UTable view all tweets hover */
	$("#btnViewAllTweets").hover(
		function () {
			$(this).attr({style:"background-position: 0px -21px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px 0px"});		
		}
	);	
	
	
	/* Help bubble placement*/
	
	$(".helpPreferredPhoneNumber").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">Please provide either a landline (including an area code without spaces e.g. 0299999999) or a mobile phone number</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);
	
	$(".helpMobilePhoneNumber").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">This is for extra security - we might occasionally send you an SMS to confirm instructions you've given us.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	
	$(".helpEmail").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">We'll use this to send you information about your account(s). We won't send you marketing information unless you ask us to.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	
	$("#helpInvestmentAmount").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">You can deposit between $10,000 and $2 million</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);	
	
	$("#helpChooseTerm").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">If you take out a 12-month term deposit, you can choose to have your interest paid to your chosen bank account every month, three months, six months, or at the end of the term</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);
	
	$("#helpInterestPaid").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">You can decide whether the interest is paid into your chosen bank account every month, once a quarter, every 6 months or at maturity</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);	
	
	$("#helpInterestPaid2Yrs").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">The interest is paid into your chosen bank account annually</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	
	$("#helpMaturityInst").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">'No' will see your term deposit automatically rollover for another term - unless you give us other instructions at least 5 days before your maturity date.</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);

	$(".helpTrustName").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">This must match the Fund name shown on your Trust Deed and registered with the ATO.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	

	$(".helpTrustAddress").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">This must be your Trust's registered address, not postal address.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	$(".helpCorporateName").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">This must match the name shown on your Trust Deed.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	

	$(".helpCorporateAddress").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">This must be your registered corporate address, not postal address.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	
	$("#helpInvestmentAmount").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">You can deposit between $10,000 and $2 million</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);	
	
	


	$("#helpMaturity").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">Maturity help goes here.</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);
	
	$("#helpDeposit").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">You can choose how you'd like to make your deposit - either BPAY, funds transfer or by cheque.</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);
	
	// new help bubbles
	
	$(".helpSecQuestion").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">We'll ask you this question to identify you when you call, so if you choose 'Other' it's important to be sure it's a question and answer that no-one else can easily guess.</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);	
	
	$(".helpSecAnswer").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">This is the answer to your security question that you'll need to give us when you call</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);
	
	$(".helpResAddr").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">This must be your current Australian residential address, not a PO Box</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);	
	
	$(".helpPrevAddr").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">This must an Australian residential address, not a PO Box</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);	
	
	
	/*Help hover for radio btns on term deposit step 2*/
	
	$("#helpRolloverFull").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">Rollover my full deposit (or more) at the current rate and get my Loyalty Bonus of 0.10% p.a.</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);	
	
	$("#helpRolloverPart").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">Rollover into another UBank Term Deposit, but with a reduced amount or different term</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);	
	
	$("#helpClose").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">Transfer my deposit (plus interest) to my chosen bank account and close my UBank Term Deposit</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);
	
	$(".helpSrcCode").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\">If you can see a 4 digit code on the back of your printed application form or on your downloaded application form please enter it here.</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);	
	
	$(".helpSrcCode3").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">If a friend has provided you with a promotional code, please enter it here.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);	
	
	$(".helpSrcCode4").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">Please enter the source code.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);	
	
	$("#helpExtendTerm1").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\"><strong>How the Loyalty Bonus works</strong><br/>The UBank Term Deposit Loyalty Bonus is added to the standard rate applicable on the date of rollover, when you rollover 100% of your initial UBank Term Deposit (or more). <br/><br/>For example. If the standard rate at rollover is 4.00% p.a., a 0.20% <strong>Loyalty Bonus</strong> makes this 4.20%</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);
	
	$("#helpExtendTerm2").hover(
		function () {
			var yPos = ($(this).offset().top - 10);
			var xPos = ($(this).offset().left + 22);
			$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
			$("#helpText").html("<p style=\"text-align:left;\"><strong>How the Loyalty Bonus works</strong><br/>The UBank Term Deposit Loyalty Bonus is added to the standard rate applicable on the date of rollover, when you rollover 100% of your initial UBank Term Deposit (or more). <br/><br/>For example. If the standard rate at rollover is 4.00% p.a., a 0.10% <strong>Loyalty Bonus</strong> makes this 4.10%</p>");
			$("#helpBubble").show();
			
		},
		function () {
			$("#helpBubble").hide();
		}
	);
	
	
	$(".helpSignAuthority").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">Authority of Trustees/Directors required to make changes to this account</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	  		
	$(".helpABN").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">This is an 11 digit number often displayed as 12 123 123 123.<br/>Please enter this without spaces.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	$(".helpABN_ACN").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">ABNs are 11 digit numbers (e.g. 12 123 123 123) and ACNs are 9 digits (e.g. 123 123 123).<br/>Please enter this without spaces.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);
	$(".helpTFN").hover(
			function () {
				var yPos = ($(this).offset().top - 10);
				var xPos = ($(this).offset().left + 22);
				$("#helpBubble").css({ left: xPos+"px", top: yPos+"px" });
				$("#helpText").html("<p style=\"text-align:left;\">We can always get this from you later, but if you have entered an ACN above and don't provide it we are required by law to deduct withholding tax at the highest marginal tax rate.</p>");
				$("#helpBubble").show();
				
			},
			function () {
				$("#helpBubble").hide();
			}
		);

	// Tooltip on uhomeloan callback modal
	if (jQuery().tooltip) {
		$("#helpPreferredNumber").tooltip({offset: [10, 2], effect: 'slide', position: 'bottom center',  tipClass: 'tooltip-help'});
	}

	
	//add new drop downs to these arrays
	var dropArrayBar = new Array($("#dropCalc"),$("#dropNews"),$("#dropFAQ"), $("#dropMoney"), $("#dropTwitter"),$("#dropTwitterFollowers"))
	var dropArrayContent = new Array($("#dropCalcContent"),$("#dropNewsContent"),$("#dropFAQContent"), $("#dropMoneyContent"), $("#dropTwitterContent"),$("#dropTwitterFollowersContent"))
	
	$("#dropCalc").click(function () {
		toggleFunction($(this));
	});

	$("#productLinks .active").hover(
		function () {
			$(this).attr({style:"background-position: 0px -37px"});
		},
		function () {
			$(this).attr({style:"background-position: 0px -37px"});
		}
	);

	$("#dropNews").click(function () {
		toggleFunction($(this));
	});
	
	$("#dropFAQ").click(function () {
		toggleFunction($(this));
	});
	
	$("#dropMoney").click(function () {
		toggleFunction($(this));
	});
	
	$("#dropTwitter").click(function () {
		toggleFunction($(this));
	});	
	
	$("#dropTwitterFollowers").click(function () {
		toggleFunction($(this));
	});	
	
	
	function toggleFunction(el)
	{
		for (var i=0;i<dropArrayBar.length;i++)
		{
			if ((dropArrayBar[i].attr("id") != undefined))
			{
				if (dropArrayBar[i].attr("id") != el.attr("id"))
				{
					dropArrayBar[i].removeClass("ddActive");
					dropArrayBar[i].addClass("ddTitle");
					dropArrayContent[i].slideUp();
				} 
				else
				{
					if(el.hasClass("ddActive"))
					{
						el.removeClass("ddActive");
						el.addClass("ddTitle");
						dropArrayContent[i].slideUp();
					}
					else
					{				
						el.removeClass("ddTitle");
						el.addClass("ddActive");
						dropArrayContent[i].slideDown();
					}
				}
			}
		}
	}
	
	
	// IE6 specific code breaks Google custom search
//	if ($.browser.msie && (jQuery.browser.version < 7))
//	{
//		$("#pageDiv").attr({style:"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/bgndShadow.png',sizingMethod='scale')"});
//		$("#shadowBtm").attr({style:"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/bgndFooterShadow.png',sizingMethod='scale')"});
//		$("#whoFeature").attr({style:"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/whoAreWeFeature.png',sizingMethod='scale')"});
//	}
//	else
//	{
		//$("#pageDiv").attr({style:"background: url(../img/bgndShadow.png) repeat-y"});
		//$("#shadowBtm").attr({style:"background: url(../img/bgndFooterShadow.png) no-repeat"});
		//$("#whoFeature").attr({style:"background: url(../img/whoAreWeFeature.png) no-repeat"});
//	}
	
});

function toggleFormDisable1(checkBoxValue,elementname1)
{
	if (checkBoxValue == true)
	{
		document.getElementById(elementname1).value = '';
		document.getElementById(elementname1).disabled=true;
	}
	else
	{
		document.getElementById(elementname1).disabled=false;
	}
}
function toggleFormDisable(checkBoxValue,elementname1, elementname2)
{
	if (checkBoxValue == true)
	{
		document.getElementById(elementname1).value = '';
		document.getElementById(elementname2).value = '';
		document.getElementById(elementname1).disabled=true;
		document.getElementById(elementname2).disabled=true;
	}
	else
	{
		document.getElementById(elementname1).disabled=false;
		document.getElementById(elementname2).disabled=false;
	}
}

function toggleFormDivs(inputVal,triggerVal,containerDivId)
{
	if (inputVal == triggerVal)
	{
		document.getElementById(containerDivId).style.display = 'block';
	}
	else
	{
		document.getElementById(containerDivId).style.display = 'none';
	}
}
function toggleFormDivs2(inputVal,triggerVal1,containerDivId,triggerVal2)
{
	if (inputVal == triggerVal1 || inputVal == triggerVal2)
	{
		document.getElementById(containerDivId).style.display = 'block';
	}
	else
	{
		document.getElementById(containerDivId).style.display = 'none';
	}
}
function showFormDivs(inputVal,triggerVal,containerDivId)
{
	if (inputVal == triggerVal)
	{
		document.getElementById(containerDivId).style.display = 'block';
	}
}
function hideFormDivs(inputVal,triggerVal,containerDivId)
{
	if (inputVal == triggerVal)
	{
		document.getElementById(containerDivId).style.display = 'none';
	}
}
function toggleBeneficiaries(inputVal)
{
	if (inputVal == 1)
	{
		document.getElementById('beneficiary1Div').style.display = 'block';
		document.getElementById('beneficiary2Div').style.display = 'none';
		document.getElementById('beneficiary3Div').style.display = 'none';
		document.getElementById('beneficiary4Div').style.display = 'none';
	}
	else if (inputVal == 2)
	{
		document.getElementById('beneficiary1Div').style.display = 'block';
		document.getElementById('beneficiary2Div').style.display = 'block';
		document.getElementById('beneficiary3Div').style.display = 'none';
		document.getElementById('beneficiary4Div').style.display = 'none';
	}
	else if (inputVal == 3)
	{
		document.getElementById('beneficiary1Div').style.display = 'block';
		document.getElementById('beneficiary2Div').style.display = 'block';
		document.getElementById('beneficiary3Div').style.display = 'block';
		document.getElementById('beneficiary4Div').style.display = 'none';
	}
	else if (inputVal == 4)
	{
		document.getElementById('beneficiary1Div').style.display = 'block';
		document.getElementById('beneficiary2Div').style.display = 'block';
		document.getElementById('beneficiary3Div').style.display = 'block';
		document.getElementById('beneficiary4Div').style.display = 'block';
	}
}
function toggleMaturity(inputVal,triggerVal)
{
	if (inputVal == triggerVal)
	{
		$("#maturityInstrDiv").hide();
		$("#maturityDiv").hide();
		$("input[name='maturityChk']:nth(1)").attr("checked","checked"); 
	}
	else
	{
		$("#maturityInstrDiv").show();
	}
}function toggleMaturity(inputVal,triggerVal, maturityValue)
{
	if (inputVal == triggerVal)
	{
		$("#maturityInstrDiv").hide();
		$("#maturityDiv").hide();
	}
	else
	{
		$("#maturityInstrDiv").show();
		if(document.getElementById(maturityValue).value){
			$("#maturityDiv").show();
		}
	}
}
function downloadPdfApplication(serverUrl, inputValue)
{
	if (inputValue == null || inputValue == '') return;
	var link;
	if (inputValue == 0){
		link = serverUrl+"/ub/ShowProperty/WLP%20Repository/UBank/PDF/UBank_USaver_application_form";
	} else if (inputValue == 1){
		link = serverUrl+"/ub/ShowProperty/WLP%20Repository/UBank/PDF/UBank_Term_deposit_application_form";
	}else if (inputValue == 2){
		link = serverUrl+"/ub/ShowProperty/WLP%20Repository/UBank/PDF/UBank_SMSF_TD_application_form";
	} else {
		link = null;
	}
	if (link != null){
		window.open(link);
	}
}
