
/* 
÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷

Elastic Columns


enter the ID names of the column divs that require balancing into the columnList array. (see example below).

Note :  If you have several layouts, with different column ID names, make sure you add all of them to the list. 

If your columns don't align...

This script will automatically find the longest column in your layout , and then stretch the other columns to the length of the
longest column. If your columns have any padding, borders or margin (most columns do!) you may find that the columns do not quite
align when this script is executed (Unfortunately, when javascript finds the height of a div, it does not include the  padding, 
borders and margin - which means that the actual height of the div may be greater or less than the height found by javascript.)
									
You can fix this by specifying a 'tweak' value for a particular column. The 'tweak' value is a number of pixels that will be added
(or subtracted if the tweak is a negative value) to the  height of the column. So, run the script, see how your columns line up. If
some columns are longer or shorter than the others, add tweak values to make up the difference. If you wish, you may enter a negative value
to reduce the height of a column.

How to add a tweak value : 

Tweak values for each column are stored in the tweakList. The default tweak value for each column is 0.
Tweak values in the tweakList are matched to columns in the columnList according to the order in which they are entered in the tweakList.
the height of the  first column in the 'columnList' list is adjusted by the first value in the 'tweakList' list. 
the height of the  second column in the 'columnList' list is adjusted by  the second value in the 'tweakList' list. 
and so on...

  
÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷ 
*/

function setHeights(){
	
	var columnList = new Array('left_sidebar', 'right_sidebar');
	
	var tweakList =new Array(0,0);
	
	var maxHeight = 0;

	//  1. find the height of the longest column.
	
	for (var i=0;i<columnList.length;i++){								// loop through all columns in columnlist
		var column = document.getElementById(columnList[i]);			// find column in the page
		if (column){													// check if column exists
			var newHeight = column.offsetHeight + column.offsetTop;		// calculate length of column
			if (newHeight > maxHeight) maxHeight = newHeight;			// save it if it's the longest column
		}
	}
	
	//  2. set height of all divs to the longest column.

	for (var i=0;i<columnList.length;i++){								// loop through all columns in columnlist
		var column = document.getElementById(columnList[i]);			// find column in the page
		if (column){													// check if column exists
			var tweak = tweakList[i];									// load 'tweak' value for the column
			var newHeight = maxHeight - column.offsetTop + tweak;		// set the new height of the column
			column.style.height = newHeight + 'px';						
		}
	}
}



/***********************************************
* Drop Down Date select script- by JavaScriptKit.com
* This notice MUST stay intact for use
* Visit JavaScript Kit at http://www.javascriptkit.com/ for this script and more
***********************************************/

var monthtext=['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sept','Oct','Nov','Dec'];

function populatedropdown(dayfield, monthfield, yearfield){
var today=new Date()
var dayfield=document.getElementById(dayfield)
var monthfield=document.getElementById(monthfield)
var yearfield=document.getElementById(yearfield)
for (var i=0; i<31; i++)
dayfield.options[i]=new Option(i+1, i+1)
dayfield.options[today.getDate()]=new Option(today.getDate(), today.getDate(), true, true) //select today's day
for (var m=0; m<12; m++)
monthfield.options[m]=new Option(monthtext[m], monthtext[m])
monthfield.options[today.getMonth()]=new Option(monthtext[today.getMonth()], monthtext[today.getMonth()], true, true) //select today's month
var thisyear=today.getFullYear()
for (var y=0; y<2; y++){
yearfield.options[y]=new Option(thisyear, thisyear)
thisyear+=1
}
yearfield.options[0]=new Option(today.getFullYear(), today.getFullYear(), true, true) //select today's year
}







window.onload = function(){
		
	setHeights();
	populatedropdown("daydropdown", "monthdropdown", "yeardropdown");
	redirect ();
}



/* 
÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷

This script is a modified version of 'setHeights', 
a simple column stretching script by PPK.

Updated by Dave Agius to allow for addition of 'tweakin' values.
  
÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷÷ 
*/