<?php
	$width_multiply = 0;
	$height_multiply = 0;
	if ($show_awards_box == True ) {
	foreach($namedawards as $key=>$value)
	{ 
		if ($key != 2051907 && $key != 2051919 && $key != 2051902 && ($value > 0 || $split_ribbons_box != true)) {
		$first_char = substr($key, 0, 1);
		if ($first_char == 2)
		{
			$image_award = imagecreatefrompng("themes/".$theme."/awards/".$key.".png");
		}
		else
		{
			$image_award = imagecreatefrompng("themes/".$theme."/awards/".$key."_".$value.".png");
		}
		if ( ((5+$width_multiply*($award_width+2))+$award_width) > $award_box ) {
		$width_multiply = 0;
		$height_multiply += 1;
		}
		imagecopyresampled($image_out, $image_award, $award_x+$width_multiply*($award_width+2), $award_y+$height_multiply*($award_height), 0, 0, $award_width, $award_height, imagesx($image_award), imagesy($image_award));
		imagedestroy($image_award);
		$width_multiply += 1;
		}
	} 
	}

	$width_multiply = 0;
	$height_multiply = 0;
	if ($split_ribbons_box == True ) {
	foreach($namedawards as $key=>$value)
	{ 
		if ($key != 2051907 && $key != 2051919 && $key != 2051902 && $value == 0) {
		$first_char = substr($key, 0, 1);
		if ($first_char == 2)
		{
			$image_ribbon = imagecreatefrompng("themes/".$theme."/awards/".$key.".png");
		}
		else
		{
			$image_ribbon = imagecreatefrompng("themes/".$theme."/awards/".$key."_".$value.".png");
		}
		if ( ((5+$width_multiply*($ribbons_width+2))+$ribbons_width) > $ribbons_box ) {
		$width_multiply = 0;
		$height_multiply += 1;
		}
		imagecopyresampled($image_out, $image_ribbon, $ribbons_x+$width_multiply*($ribbons_width+2), $ribbons_y+$height_multiply*($ribbons_height), 0, 0, $ribbons_width, $ribbons_height, imagesx($image_ribbon), imagesy($image_ribbon));
		imagedestroy($image_ribbon);
		$width_multiply += 1;
		}
	} 
	}
	
	$width_multiply = 0;
	$height_multiply = 0;
	if ($show_unlocks_box == True ) {
	foreach($namedunlocks as $key=>$value)
	{ 
		if ($value == "s") {
		$image_unlock = imagecreatefrompng("themes/".$theme."/unlocks/".$key.".png");
		if ( ((5+$width_multiply*($unlock_width+2))+$unlock_width) > $unlock_box ) {
		$width_multiply = 0;
		$height_multiply += 1;
		}
		imagecopyresampled($image_out, $image_unlock, $unlock_x+$width_multiply*($unlock_width+2), $unlock_y+$height_multiply*($unlock_height), 0, 0, $unlock_width, $unlock_height, imagesx($image_unlock), imagesy($image_unlock));
		imagedestroy($image_unlock);
		$width_multiply += 1;
		}
	} 
	}
?>