
jQuery(document).ready(function () {

	fix_elements();
	center_me();

// END ON LOAD
});

function fix_elements()
{
	
	// (1) check left and right div
	var hleft = jQuery("#left").height();
	var hright = jQuery("#right").height();
	if( hleft > hright )
		jQuery("#right").height( hleft );
	// end (1) check left and right div
	
	// (2) check left and right div
	var spanw = '';
	jQuery(".r-title").each(function() {
									 
		spanw = jQuery(this).children(".span-2:first").width();
		jQuery(this).children(".span-3:first").width( 158 - spanw );
		
	});
	// end (2) check left and right div
	
	// (3) check left and right div
	var td_width = '';
	var td_height = '';
	jQuery(".color-me .tr:even").each(function() {
												   
		jQuery(this).children(".td").each(function() {
		
			td_width = jQuery(this).width();
			td_height = jQuery(this).height();
			
			jQuery(this).append( '<div class="color" style="width:' + td_width + 'px; height:' + td_height + 'px;"></div>' );
		
		});
		
	});
	// end (3) check left and right div
		
}

function center_me() {
	
	jQuery(".center_me").each(function(i){
									   
		var ah = jQuery(this).height();
		var aw = jQuery(this).width();
		var ph = jQuery(this).parent().height();
		var pw = jQuery(this).parent().width();
		var mh = (ph - ah) / 2;
		var mw = (pw - aw) / 2;
		jQuery(this).css( 'position' , 'relative' );
		jQuery(this).css( 'top' , mh );
		jQuery(this).css( 'left', mw );
		
	});
	
}

