
	if(!Array.indexOf){
	 Array.prototype.indexOf = function(obj){
	 for(var i=0; i<this.length; i++){
	 if(this[i]==obj){
	 return i;
	 }
	 }
	 return -1;
	 }
	}



	$(document).ready(function(){

		$('table.stripe-h tr:even').addClass('shade');

		$('table.stripe-v td').each(function(){
			var cell = $(this);
			var row = $(cell).parent("tr");
			// var rowIndex = row[0].sectionRowIndex;
			var cellIndex = cell[0].cellIndex

			if( cellIndex % 2 ) {
				$(this).addClass('shade');
			}

		}); // end: stripe-v

		$('table.line-h').each(function(){
			$('tr:last', this).addClass('lastrow');
		}); // end : line-h


		$('table.line-v').each(function(){
			$('tr', this).each(function(){
				$('th:last', this).addClass('lastColumn');
				$('td:last', this).addClass('lastColumn');
			});
		}); // end: line-v


		// fyi: http://stackoverflow.com/questions/306583/jquery-this-selector-and-children
		$('table.columnboder').each(function(){

			$('thead tr', this).each(function(){
				$('th:last', this).css('border-right', '0');
			});

			var spans = new Array(); // list of column span attributes

			$('tr:first th', this).each(function(){ // for each header in the table
				spans.push( parseInt($(this).attr('colspan')) ); // get the number of columns each one of them spans
			});

			var borders = new Array();
			var tmp_sum = 0;
			$.each( spans, function(){
				tmp_sum += this;
				borders.push( tmp_sum-1 );
			});
			// alert( borders );

			$('tbody tr td', this).each(function(){
				var cell = $(this);
				var row = $(cell).parent("tr");
				var cellIndex = cell[0].cellIndex
				var lastCell = borders[borders.length-1];

				if( cellIndex != lastCell ) {
					if( borders.indexOf( cellIndex ) > -1 ) {
						$(this).addClass('primaryborder');
					} else {
						$(this).addClass('secondaryborder');
					}
				}
			});

			// alert( spans );

			$('thead tr:last', this).addClass('subheads');
			$('tr.subheads th', this).each(function(){
				var cell = $(this);
				var row = $(cell).parent("tr");
				var cellIndex = cell[0].cellIndex
				var lastCell = borders[borders.length-1];

				if( cellIndex != lastCell ) {
					if( borders.indexOf( cellIndex ) > -1 ) {
						$(this).addClass('primaryborder');
					} else {
						$(this).addClass('secondaryborder');
					}
				}
			});
		}); // end: columnborder


		$('table.subsections').each(function(){
			$('tbody tr.section:first td').css('border-top','0');

			$('tbody tr.section').prev('tr').addClass('lastbeforesection');

		}); // end : sections


		$('table.rowheadings').each(function(){
			$('tbody tr', this).each(function(){
				$('td:first', this).addClass('heading');
			});
			$('tbody tr:last', this).each(function(){
				$('td:first', this).css('border-bottom', '0');
			});
		}); // end: rowheadings


	}); // end: document.ready

