$(document).ready(function() {
   /*Locate all relevant elements depending on their style attribute*/
$('.bluebox h4 a,.greenbox h4 a,.redbox h4 a,.orangebox h4 a,.turquoisebox h4 a').each(function(index) {
/*for each even item that is matched, do the following */

  /*Set property to parent div*/

  /*Grab the style attribute of the anchor, the background image*/
   var x=$(this).attr('style');
   /*Strip unwanted characters and get the URL*/
   var y=x.trim().substring(22,x.length-2).replace('"','');
   /*Remove the background image and set some custom styles*/
   $(this).removeAttr('style','').attr('style','height: auto; padding-bottom: 5px;')
   /*add an image after the anchor*/
   $(this).after('<img src="' + y + '" width="161" height="65" style="margin-top:5px;" />')



});

/*loop through all even parents and set a style*/
$('.bluebox h4 a,.greenbox h4 a,.redbox h4 a,.orangebox h4 a,.turquoisebox h4 a').filter(':even').each(function(index) {
   $(this).parent().parent().attr('style','clear:left');
});

/*fix the clear issue with the last div*/
$('.article div[style*="width:480px"]').attr("style","width:480px; clear:left; height:1px;");
 });



// **** Fix import content boxes
// - Removes background images and h4 height
// - Adds image tag to h4 with padding
// - Adds float:left to even boxes ------SS Issues with other browsers- review JS temp disabled-------
// - Fixes division float
/*
var box_arr_nodes = new Array();
var arr_nodes = document.getElementsByTagName('div');

for (i = 0; i < arr_nodes.length; i++) {
	if (
		arr_nodes[i].className == 'box bluebox' ||
		arr_nodes[i].className == 'box greenbox' ||
		arr_nodes[i].className == 'box redbox' ||
		arr_nodes[i].className == 'box orangebox' ||
		arr_nodes[i].className == 'box turquoisebox'
	)
		box_arr_nodes.push(arr_nodes[i]);

	if (arr_nodes[i].style.cssText == 'width: 480px; clear: right; height: 1px;')
		arr_nodes[i].style.cssText = 'clear: left;';
}

for (i = 0; i < box_arr_nodes.length; i++) {
	if (i % 2 == 0)
		box_arr_nodes[i].style.cssText += 'clear: left;';
		
	var boxImg = box_arr_nodes[i].children[0].children[0].style.backgroundImage;
	boxImg = boxImg.substring(5,boxImg.length-2);
	
	box_arr_nodes[i].children[0].children[0].style.height = 'auto';
	box_arr_nodes[i].children[0].children[0].style.paddingBottom = '5px';
	box_arr_nodes[i].children[0].children[0].style.backgroundImage = '';
	box_arr_nodes[i].children[0].innerHTML += '<img src="' + boxImg + '" width="161" height="65" />';
}
*/

