// Tip of the Day Scrolling Front Page Logic and Data - MD - 20/09/2005

<!--
		
		// Adding / Removing new banks of data
		// 1 - Increment the 'bankNumber' property below.  The array is zero based, there 2 banks = 1, 5 banks = 4
		// 2 - Add the new bank by copying an existing one.  Remember to adjust the first element to represent its position
		//      in the array, e.g. appending a bank to the end of the bank array with 3 banks would be...
		//      		DataBank[2][0] = new Array(2);
		//				DataBank[2][0][0] = .... // TIP TITLE
		//				DataBank[2][0][1] = .... // TIP CONTENT
		//				DataBank[2][0][2] - .... // TIP TITLE LINK (minus http - this is added automatically)
		// 3 - if you need to test the current selection for the current day, scroll to the bottom of this script until you hit the line
		// 		"For debug purposes" - remove the "//" from the line below (starts with 'alert(' ) and a message box will display the current bank / tip position.
		// 		IMPORTANT - you MUST add the "//" back to this line before publishing!
		
		// Number of banks
		var bankNumber = 4;
		
		// Data Array
		var DataBank = new Array(bankNumber - 1);
		// Initialise for each day in the data array
		for( var x = 0 ; x <= 6 ; x++ ){
			DataBank[x] = new Array(6);
		}
		
		// Generate actual data.  Note: each tip is an array made up of a title, desc and link
		
		// BANK 1 - MONDAY
		DataBank[2][0] = new Array(2);
		DataBank[2][0][0] = "Citizens Advice Bureau"
		DataBank[2][0][1] = "Have a careful look at your weekly shopping. Are there less expensive brands or money-saving offers you can take advantage of?"
		DataBank[2][0][2] = "www.citizensadvice.org.uk";
		
		// BANK 1 - TUESDAY
		DataBank[2][1] = new Array(2);
		DataBank[2][1][0] = "Citizens Advice Bureau"
		DataBank[2][1][1] = "Before buying a takeaway, check your fridge so you don’t end up throwing money into the bin along with the mouldy contents of your fridge."
		DataBank[2][1][2] = "www.citizensadvice.org.uk";
		
		// BANK 1 - WEDNESDAY
		DataBank[2][2] = new Array(2);
		DataBank[2][2][0] = "Citizens Advice Bureau"
		DataBank[2][2][1] = "If you have a bank account, you can sometimes get a discount for paying bills by direct debit or standing order rather than cash or cheques."
		DataBank[2][2][2] = "www.citizensadvice.org.uk";
		
		// BANK 1 - THURSDAY
		DataBank[2][3] = new Array(2);
		DataBank[2][3][0] = "Citizens Advice Bureau"
		DataBank[2][3][1] = "Don’t be intimidated by money matters. This site can help you become more informed and so too can the money pages of weekend newspapers and personal finance programmes on the radio and television."
		DataBank[2][3][2] = "www.citizensadvice.org.uk";
		
		// BANK 1 - FRIDAY
		DataBank[2][4] = new Array(2);
		DataBank[2][4][0] = "Citizens Advice Bureau"
		DataBank[2][4][1] = "Shop around different companies to find ways of reducing your regular payments on gas, electricity, the phone and insurances."
		DataBank[2][4][2] = "www.citizensadvice.org.uk";
		
		// BANK 1 - SATURDAY
		DataBank[2][5] = new Array(2);
		DataBank[2][5][0] = "Citizens Advice Bureau"
		DataBank[2][5][1] = "Try to pay off debts with the highest interest first (while still paying the minimum on your other debts and paying priority bills such as the mortgage and Council Tax.) This way your debts will be paid off faster."
		DataBank[2][5][2] = "www.citizensadvice.org.uk";
		
		// BANK 1 - SUNDAY
		DataBank[2][6] = new Array(2);
		DataBank[2][6][0] = "Citizens Advice Bureau"
		DataBank[2][6][1] = "If you are offered optional insurance to cover payments, eg in case you are sick or made unemployed, think carefully about whether it is suitable for you or whether you need it at all – you may already have cover on an existing policy."
		DataBank[2][6][2] = "www.citizensadvice.org.uk";
		
		
		// BANK 2 - MONDAY
		DataBank[1][0] = new Array(2);
		DataBank[1][0][0] = "@SAFE - an initiative of Toynbee Hall"
		DataBank[1][0][1] = "If you are paid your wages or benefits weekly or fortnightly but you have bills to pay monthly, try to arrange to pay the bills the day after you receive your income.  This way, your bills will be paid before you have chance to spend your cash on little luxuries!"
		DataBank[1][0][2] = "www.toynbeehall.org.uk";
		
		// BANK 2 - TUESDAY
		DataBank[1][1] = new Array(2);
		DataBank[1][1][0] = "@SAFE - an initiative of Toynbee Hall"
		DataBank[1][1][1] = "Try keeping a spending diary for a week.  Record everything you spend in a few easy categories such as ‘food’, ‘phone’, ‘transport’.  This will help you know exactly where you’re spending your money and may help you identify where you can save a little."
		DataBank[1][1][2] = "www.toynbeehall.org.uk";
		
		// BANK 2 - WEDNESDAY
		DataBank[1][2] = new Array(2);
		DataBank[1][2][0] = "@SAFE - an initiative of Toynbee Hall"
		DataBank[1][2][1] = "Protect the environment and your cash with small but significant changes in your lifestyle – for instance only boil as much water as you need and reuse food packaging.  Empty plastic fruit punnets make great containers and any cardboard is fantastic craft material for kids!"
		DataBank[1][2][2] = "www.toynbeehall.org.uk";
		
		// BANK 2 - THURSDAY
		DataBank[1][3] = new Array(2);
		DataBank[1][3][0] = "@SAFE - an initiative of Toynbee Hall"
		DataBank[1][3][1] = "Be credit savvy: Beware of anything that sounds too good to be true – it probably is! Shop around for credit and always read what you’re signing first."
		DataBank[1][3][2] = "www.toynbeehall.org.uk";
		
		// BANK 2 - FRIDAY
		DataBank[1][4] = new Array(2);
		DataBank[1][4][0] = "@SAFE - an initiative of Toynbee Hall"
		DataBank[1][4][1] = "If you are thinking of taking out a loan to pay off debts: STOP! Before you do anything, talk to a local independent free debt advice service or call the National Debtline on 0808 808 4000."
		DataBank[1][4][2] = "www.toynbeehall.org.uk";
		
		// BANK 2 - SATURDAY
		DataBank[1][5] = new Array(2);
		DataBank[1][5][0] = "@SAFE - an initiative of Toynbee Hall"
		DataBank[1][5][1] = "Do you pay your bills by direct debt?  If you don’t already then check with your gas, electricity and phone companies to see how much you could save by switching payment methods.  It could be more than £100 per year!"
		DataBank[1][5][2] = "www.toynbeehall.org.uk";
		
		// BANK 2 - SUNDAY
		DataBank[1][6] = new Array(2);
		DataBank[1][6][0] = "@SAFE - an initiative of Toynbee Hall"
		DataBank[1][6][1] = "Join the local library for access to free Internet and books.  In fact, if you just want to check your e-mails you don’t even have to be a member.  For longer sessions you need to book."
		DataBank[1][6][2] = "www.toynbeehall.org.uk";

	// ====================================
		
		// BANK 3 - MONDAY
		DataBank[0][0] = new Array(2);
		DataBank[0][0][0] = "Consumer Credit Counselling Service"
		DataBank[0][0][1] = "If you use credit cards, try to pay back more than the minimum amount, otherwise interest costs escalate fast."
		DataBank[0][0][2] = "www.cccs.co.uk";
		
		// BANK 3 - TUESDAY
		DataBank[0][1] = new Array(2);
		DataBank[0][1][0] = "Consumer Credit Counselling Service"
		DataBank[0][1][1] = "Be wary of consolidation loans:  nine times out of ten such loans will be secured against your home which means that if you miss payments, your home could be at risk."
		DataBank[0][1][2] = "www.cccs.co.uk";
		
		// BANK 3 - WEDNESDAY
		DataBank[0][2] = new Array(2);
		DataBank[0][2][0] = "Consumer Credit Counselling Service"
		DataBank[0][2][1] = "To be sure you are not taking on too much debt, keep monthly payments to unsecured creditors such as credit cards and personal loans to below 20 percent of your take home pay."
		DataBank[0][2][2] = "www.cccs.co.uk";
		
		// BANK 3- THURSDAY
		DataBank[0][3] = new Array(2);
		DataBank[0][3][0] = "Consumer Credit Counselling Service"
		DataBank[0][3][1] = "Keep a money diary for a couple of weeks; write down everything you spend – be very honest.  This often reveals how much you are frittering away without realising."
		DataBank[0][3][2] = "www.cccs.co.uk";
		
		// BANK 3 - FRIDAY
		DataBank[0][4] = new Array(2);
		DataBank[0][4][0] = "Consumer Credit Counselling Service"
		DataBank[0][4][1] = "Make sure you are receiving all the benefits and tax allowances that you are entitled to.  An easy way of doing this is to check out the simple-to-use calculator on Entitledto.co.uk."
		DataBank[0][4][2] = "www.cccs.co.uk";
		
		// BANK 3 - SATURDAY
		DataBank[0][5] = new Array(2);
		DataBank[0][5][0] = "Consumer Credit Counselling Service"
		DataBank[0][5][1] = "Click on a price comparison website to see if you can save money on household bills such as utilities and phones."
		DataBank[0][5][2] = "www.cccs.co.uk";
		
		// BANK 3 - SUNDAY
		DataBank[0][6] = new Array(2);
		DataBank[0][6][0] = "Consumer Credit Counselling Service"
		DataBank[0][6][1] = "If you are unable to clear the full balances on your credit card, make sure you have a card with a low APR. You should aim to clear the balance before using the card again."
		DataBank[0][6][2] = "www.cccs.co.uk";

	// ====================================
		
		// BANK 4 - MONDAY
		DataBank[3][0] = new Array(2);
		DataBank[3][0][0] = "Help the Aged"
		DataBank[3][0][1] = "Make sure you pay priority bills such as mortgages, Council Tax and utilities first and if you’ve slipped behind, arrange to bring them up to date."
		DataBank[3][0][2] = "www.helptheaged.org.uk";
		
		// BANK 4 - TUESDAY
		DataBank[3][1] = new Array(2);
		DataBank[3][1][0] = "Help the Aged"
		DataBank[3][1][1] = "Organise your budget: you must have enough money coming in to meet your expenses. Small expenditures accumulate, so it’s important to stay within a daily allowance."
		DataBank[3][1][2] = "www.helptheaged.org.uk";
		
		// BANK 4 - WEDNESDAY
		DataBank[3][2] = new Array(2);
		DataBank[3][2][0] = "Help the Aged"
		DataBank[3][2][1] = "Never ignore a financial problem: it won’t go away, and the longer you leave it the worse it gets. You can receive help to negotiate with creditors at a local advice organisation."
		DataBank[3][2][2] = "www.helptheaged.org.uk";
		
		// BANK 4 - THURSDAY
		DataBank[3][3] = new Array(2);
		DataBank[3][3][0] = "Help the Aged"
		DataBank[3][3][1] = "Get a full benefit check. Some benefits act as passports to others so don’t assume that if you’re already receiving one benefit you won’t be entitled to another."
		DataBank[3][3][2] = "www.helptheaged.org.uk";
		
		// BANK 4 - FRIDAY
		DataBank[3][4] = new Array(2);
		DataBank[3][4][0] = "Help the Aged"
		DataBank[3][4][1] = "Year-round savings: you can avoid the financial strain of the festive season, holidays or unexpectedly large bills by saving small amounts throughout the year."
		DataBank[3][4][2] = "www.helptheaged.org.uk";
		
		// BANK 4 - SATURDAY
		DataBank[3][5] = new Array(2);
		DataBank[3][5][0] = "Help the Aged"
		DataBank[3][5][1] = "Make sure you are a bargain hunter! Take full advantage of sales, multi-buy specials, buy-one-get-one-frees but don’t be tempted to buy more than you need."
		DataBank[3][5][2] = "www.helptheaged.org.uk";
		
		// BANK 4 - SUNDAY
		DataBank[3][6] = new Array(2);
		DataBank[3][6][0] = "Help the Aged"
		DataBank[3][6][1] = "Before you buy anything, think again about whether you really need it. If you do, try to use cash or a debit card. If you really have to borrow or use a credit card, shop around for the lowest interest rates."
		DataBank[3][6][2] = "www.helptheaged.org.uk";

		
/*		// ====================================
		
		// BANK 2 - MONDAY
		DataBank[1][0] = new Array(2);
		DataBank[1][0][0] = "Title 1"
		DataBank[1][0][1] = "Description 1"
		DataBank[1][0][2] = "www.google.co.uk/search?q=1";
		
		// BANK 2 - TUESDAY
		DataBank[1][1] = new Array(2);
		DataBank[1][1][0] = "Title 2"
		DataBank[1][1][1] = "Description 2"
		DataBank[1][1][2] = "www.google.co.uk/search?q=2";
		
		// BANK 2 - WEDNESDAY
		DataBank[1][2] = new Array(2);
		DataBank[1][2][0] = "Title 3"
		DataBank[1][2][1] = "Description 3"
		DataBank[1][2][2] = "www.google.co.uk/search?q=3";
		
		// BANK 2 - THURSDAY
		DataBank[1][3] = new Array(2);
		DataBank[1][3][0] = "Title 4"
		DataBank[1][3][1] = "Description 4"
		DataBank[1][3][2] = "www.google.co.uk/search?q=4";
		
		// BANK 2 - FRIDAY
		DataBank[1][4] = new Array(2);
		DataBank[1][4][0] = "Title 5"
		DataBank[1][4][1] = "Description 5"
		DataBank[1][4][2] = "www.google.co.uk/search?q=5";
		
		// BANK 2 - SATURDAY
		DataBank[1][5] = new Array(2);
		DataBank[1][5][0] = "Title 6"
		DataBank[1][5][1] = "Description 6"
		DataBank[1][5][2] = "www.google.co.uk/search?q=6";
		
		// BANK 2 - SUNDAY
		DataBank[1][6] = new Array(2);
		DataBank[1][6][0] = "Title 7"
		DataBank[1][6][1] = "Description 7"
		DataBank[1][6][2] = "www.google.co.uk/search?q=7";

*/

// Calculate the total number of days this year
		var currentDate = new Date();
		var yearStart = new Date( currentDate.getYear() , 0 , 1 , 0 , 0 , 0 , 0);
		var totalDays = Math.floor((currentDate.getTime() - yearStart.getTime()) / (60 * 60 * 24 * 1000));
		// Adjust for the first monday in the year
		var adjustMonday = yearStart.getDay();
		// Calculate the week number
		var weekNum = Math.floor((totalDays + adjustMonday - 1 ) / 7);
		// Calculate the 'bank' position (1D Array pos)
		var bankPos = weekNum % bankNumber;
		// Calculate the tip position (2D Array pos)
		var tipPos = currentDate.getDay() == 0 ? 6 : currentDate.getDay() - 1 ;
				
		// For debug purposes
		//alert("Displaying this week, Bank No. " + bankPos + " @ position " + tipPos)

		// =========================================
		// 							SCROLLING LOGIC
		// =========================================
						
		/***********************************
		*   http://javascripts.vbarsan.com/
		*   This notice may not be removed
		***********************************/
		
		//-- Begin Scroller's Parameters and message -->
		//scroller width: change to your own;
		var swidth=117;
		
		//scroller height: change to your own;
		var sheight=74;
		
		//background color: change to your own;
		var sbcolor="#FFFFFF";
		
		//scroller's speed: change to your own;
		var sspeed=1;
		var restart=sspeed;
		rspeed=sspeed;
		
		//text: change to your own
		wholemessage="<div align=\"center\" class=scrollTitle><a class=scrollTitle href=\"http://"+ DataBank[bankPos][tipPos][2] + "\">Tip of the Day supplied by " + DataBank[bankPos][tipPos][0] + "</a></div><div align=\"center\" class=scrollMain>" + DataBank[bankPos][tipPos][1] + "</div>"
		//-- end Parameters and message -->
		
		//-- begin: Scroller's Algorithm -->
		function totdStart(){if(document.all) iemarquee(slider);else if(document.getElementById)ns6marquee(document.getElementById('slider'));else if(document.layers)ns4marquee(document.slider1.document.slider2);}
		function iemarquee(whichdiv){iediv=eval(whichdiv);iediv.style.pixelTop=sheight;iediv.innerHTML=wholemessage;sizeup=iediv.offsetHeight;ieslide();}
		function ieslide(){if(iediv.style.pixelTop>=sizeup*(-1)){iediv.style.pixelTop-=sspeed;setTimeout("ieslide()",100);}else{iediv.style.pixelTop=sheight;ieslide();}}
		function ns4marquee(whichlayer){ns4layer=eval(whichlayer);ns4layer.top=sheight;ns4layer.document.write(wholemessage);ns4layer.document.close();sizeup=ns4layer.document.height;ns4slide();}
		function ns4slide(){if(ns4layer.top>=sizeup*(-1)){ns4layer.top-=sspeed;setTimeout("ns4slide()",100);}else{ns4layer.top=sheight;ns4slide();}}
		function ns6marquee(whichdiv){ns6div=eval(whichdiv);ns6div.style.top=sheight;ns6div.innerHTML=wholemessage;sizeup=ns6div.offsetHeight;ns6slide();}
		function ns6slide(){if(parseInt(ns6div.style.top)>=sizeup*(-1)){ns6div.style.top=parseInt(ns6div.style.top)-sspeed;setTimeout("ns6slide()",100);}else{ns6div.style.top=sheight;ns6slide();}}
		//-- end Algorithm -->
				
		-->