
////////////////////////////////////////////////////////////////////////////////////////////////	
//	
//	keep functions separate from pop-ups
//
////////////////////////////////////////////////////////////////////////////////////////////////
function pricingExternal() {
			wrapTables();
			styleTables();
			wrapPTables();
			stylePTables();
}

//////////////////////////////////////////////////////////////////////////////////////////////////
//
//	add html markup under .tablewrap to allow for curved corners
//
//////////////////////////////////////////////////////////////////////////////////////////////////
	function wrapTables() {
		$('.tablewrap').append('<div class="tbottom_inside"></div>');
		$('.tbottom_inside').wrap('<div class="tbottom"></div>');
		$('.tablewrap').prepend('<div class="ttop_inside"></div>');
		$('.ttop_inside').wrap('<div class="ttop"></div>');
		$('.tablewrap table').wrap('<div class="tmid"></div>');
	};
//////////////////////////////////////////////////////////////////////////////////////////////////
//
//	stripe tables w/ inline styles and add curved corner images top and bottom 
//
//////////////////////////////////////////////////////////////////////////////////////////////////
function styleTables() {
	$("table tr:odd td").css("background-color", "#edf1f7").addClass('odd');
	$("table tr:even td").css("background-color", "#f5f7fa").addClass('even');
	
	$('.tablewrap table').each(function(n) {
		var myTable = $(this).width();
		$(this).parents('div.tablewrap').css('width',myTable+2); 
	});
	$('.tablewrap table tr:last-child td.odd').each(function(n) {
		$('.tablewrap table tr:last-child td.odd').parents().next('div').css('background-position','bottom left');
		$('.tablewrap table tr:last-child td.odd').parents().next('div').children('div').css('background-position','bottom right');
	});
	$('.tablewrap table tr:last-child td.even').each(function(n) {
		$('.tablewrap table tr:last-child td.even').parents().next('div').css('background-position','top left');
		$('.tablewrap table tr:last-child td.even').parents().next('div').children('div').css('background-position','top right');
	});
	$('.tablewrap table tr:first-child td.odd').each(function(n) {  
		$('.tablewrap table tr:first-child td.odd').parents().prev('.ttop').css({'background-image' : 'url(images/table_top_blues_bg.png)', 'background-position' : 'top left'});
		$('.tablewrap table tr:first-child td.odd').parents().prev('.ttop').children('div').css({'background-image' : 'url(images/table_top_blues_bg.png)', 'background-position' : 'top right'});
	});
	$('.tablewrap table tr:first-child td.even').each(function(n) {  
		$('.tablewrap table tr:first-child td.even').parents().prev('.ttop').css({'background-image' : 'url(images/table_top_blues_bg.png)', 'background-position' : 'bottom left'});
		$('.tablewrap table tr:first-child td.even').parents().prev('.ttop').children('div').css({'background-image' : 'url(images/table_top_blues_bg.png)', 'background-position' : 'bottom right'});
	});
};

//////////////////////////////////////////////////////////////////////////////////////////////////
//
//	PRICING: add html markup under .pricing to allow for curved corners
//
//////////////////////////////////////////////////////////////////////////////////////////////////
	function wrapPTables() {
		$('.pricing').append('<div class="pbottom_inside"></div>');
		$('.pbottom_inside').wrap('<div class="pbottom"></div>');
		$('.pricing').prepend('<div class="ptop_inside"></div>');
		$('.ptop_inside').wrap('<div class="ptop"></div>');
		$('.pricing table').wrap('<div class="pmid"></div>');
	};
//////////////////////////////////////////////////////////////////////////////////////////////////
//
//	PRICING: stripe tables w/ inline styles and add curved corner images top and bottom 
//
//////////////////////////////////////////////////////////////////////////////////////////////////
function stylePTables() {
	$("table tr:odd td").css("background-color", "#edf1f7").addClass('odd');
	$("table tr:even td").css("background-color", "#f5f7fa").addClass('even');
	
	$('.pricing table').each(function(n) {
		var myTable = $(this).width();
		$(this).parents('div.pricing').css('width',myTable+2); 
	});
	$('.pricing table tr:last-child td.odd').each(function(n) {
		$('.pricing table tr:last-child td.odd').parents().next('div').css('background-position','bottom left');
		$('.pricing table tr:last-child td.odd').parents().next('div').children('div').css('background-position','bottom right');
	});
	$('.pricing table tr:last-child td.even').each(function(n) {
		$('.pricing table tr:last-child td.even').parents().next('div').css('background-position','top left');
		$('.pricing table tr:last-child td.even').parents().next('div').children('div').css('background-position','top right');
	});
	$('.pricing table tr:first-child td.odd').each(function(n) {  
		$('.pricing table tr:first-child td.odd').parents().prev('.ptop').css({'background-image' : 'url(images/table-simplified_top_blues_bg.png)', 'background-position' : 'top left'});
		$('.pricing table tr:first-child td.odd').parents().prev('.ptop').children('div').css({'background-image' : 'url(images/table-simplified_top_blues_bg.png)', 'background-position' : 'top right'});
	});
	$('.pricing table tr:first-child td.even').each(function(n) {  
		$('.pricing table tr:first-child td.even').parents().prev('.ptop').css({'background-image' : 'url(images/table-simplified_top_blues_bg.png)', 'background-position' : 'bottom left'});
		$('.pricing table tr:first-child td.even').parents().prev('.ptop').children('div').css({'background-image' : 'url(images/table-simplified_top_blues_bg.png)', 'background-position' : 'bottom right'});
	});
};



