$(window).load(function() {  

/**** CALLOUT POSITION OF CTA BUTTON ******/
//CURRENTLY WORKING FOR CALLOUt WITH PIC AND REQUIRES THE P tAG AROUND THE CTA LINK



$('.rw_relative_product_hold a.rw_cta').each(function(){

	//clone and rename
	$(this).clone().prependTo($(this).closest('.rw_relative_product_hold'));
	
	var rw_parent_width = $(this).closest('.rw_relative_product_hold').width();
	//alert(rw_parent_width);
	var rw_self_width = $(this).width();
	var rw_final_horz = rw_parent_width - rw_self_width;
	$(this).closest('.rw_relative_product_hold').children('.rw_relative_product_hold a.rw_cta').css({'margin-left':622+'px'})
	
	var rw_parent_ht = $(this).closest('.rw_relative_product_hold').height();
	var rw_self_ht = $(this).height() + 12;
	var rw_final_vert = rw_parent_ht - rw_self_ht;
	$(this).closest('.rw_relative_product_hold').children('.rw_relative_product_hold a.rw_cta').css({'margin-top':rw_final_vert+'px'})
	
	//remove original
	$(this).remove();
	
	

});//close each






/*** THIS POSITIONS THE CTA IN THE TEMPLATE SHORTCODE CALLOUTS *****/

$('.rw_callout_sc_hold a.rw_cta').each(function(){

	//clone and rename
	$(this).clone().prependTo($(this).closest('.rw_callout_sc_hold'));
	
	var rw_parent_sc_width = $(this).closest('.rw_callout_sc_hold').width();
	//alert(rw_parent_sc_width);
	var rw_self_sc_width = $(this).width();
	//alert(rw_self_sc_width);
	var rw_final_sc_horz = rw_parent_sc_width - rw_self_sc_width;
	$(this).closest('.rw_callout_sc_hold').children('.rw_callout_sc_hold a.rw_cta').css({'margin-left':rw_final_sc_horz+'px'})
	
	var rw_parent_sc_ht = $(this).closest('.rw_callout_sc_hold').height();
	var rw_self_sc_ht = $(this).height() + 12;
	var rw_final_sc_vert = rw_parent_sc_ht - rw_self_sc_ht;
	$(this).closest('.rw_callout_sc_hold').children('.rw_callout_sc_hold a.rw_cta').css({'margin-top':rw_final_sc_vert+'px'})
	
	//remove original
	$(this).remove();
	
	

});//close each








$('.rw_callout_hold a.rw_cta').each(function(){

	//clone and rename
	$(this).clone().prependTo($(this).closest('.rw_callout_hold'));
	
	var rw_parent_width = $(this).closest('.rw_callout_hold').width();
	//alert(rw_parent_width);
	var rw_self_width = $(this).width();
	var rw_final_horz = rw_parent_width - rw_self_width;
	$(this).closest('.rw_callout_hold').children('.rw_callout_hold a.rw_cta').css({'margin-left':rw_final_horz+'px'})
	
	var rw_parent_ht = $(this).closest('.rw_callout_hold').height();
	var rw_self_ht = $(this).height() + 12;
	var rw_final_vert = rw_parent_ht - rw_self_ht;
	$(this).closest('.rw_callout_hold').children('.rw_callout_hold a.rw_cta').css({'margin-top':rw_final_vert+'px'})
	
	//remove original
	$(this).remove();
	
	

});//close each

});