// this script alters the colors of the table's rows.

function changeColor( tbl, startpoint, classnames ) {
		var rows = tbl.getElementsByTagName('tr');
		var c=2;		
		for ( var i=startpoint; i<rows.length; i++ ) {
			
			if ( rows[i].className != 'ad_row' ) {
				if ( c % 2 == 1 ) {
					rows[i].className += ' dark ';
					c=2;
				}else{
					rows[i].className += ' bright ';
					c=3;
				}
			}
		}
}
		

// assumes only one body and no other parts (head, foot, etc..) present in the table

function addShadow( tbl ) {
	var parent_node = tbl.parentNode;
	var next_sibling = tbl.nextSibling;
	var orig_table = parent_node.removeChild( tbl );
	var table = document.createElement( 'table' );
	if(tbl.id == 'bdates'){
		table.id = 'temp';
		if(tbl.style.display == 'none'){
			table.style.display = 'none';
		}
	}
	table.align = 'center';
	table.style.border = '0';
	table.style.width = orig_table.style.width;
	orig_table.style.width = '100%';
	//table.className = orig_table.className;
	//orig_table.className = '';
	table.cellSpacing = '0';
	table.cellPadding = '0';
	var body = document.createElement( 'tbody' );
	var mid_row = document.createElement( 'tr' );
	var left_shadow_td = document.createElement( 'td' );
	left_shadow_td.className = 'left_border';
	mid_row.appendChild( left_shadow_td );
	var table_td = document.createElement( 'td' );
	table_td.appendChild( orig_table );
	mid_row.appendChild( table_td );
	var right_shadow_td = document.createElement( 'td' ); 
	right_shadow_td.className = 'right_border';
	mid_row.appendChild( right_shadow_td );
	body.appendChild( mid_row );
	//Bottom shadow
	var bottom_tr = document.createElement( 'tr' );
	var bottom_left_td = document.createElement( 'td' );
	bottom_left_td.className= 'bottom_left';
	bottom_tr.appendChild( bottom_left_td );
	var bottom_shadow_td = document.createElement( 'td' );
	bottom_shadow_td.className = 'register_shadow';
	bottom_tr.appendChild( bottom_shadow_td );
	var bottom_right_td = document.createElement( 'td' );
	bottom_right_td.className= 'bottom_right';
	bottom_tr.appendChild( bottom_right_td );
	body.appendChild( bottom_tr );
	table.appendChild( body );
	if ( next_sibling == null )
	{
		parent_node.appendChild( table );
	} else {
		parent_node.insertBefore( table, next_sibling );
	}
}


