(function(){
   function disableInput(i)
   {
      if (i.find(':selected').html().toLowerCase().indexOf('own message')!=-1)
      {
         i.nextAll('input:first').removeAttr('readonly');
      } else {
         i.nextAll('input:first').attr('readonly','readonly');
      }
   }

   $(document).ready(function(){
      $('select:has(option:contains(own message))').change(function()
      {
          disableInput($(this));
      });

      $('select:has(option:contains(own message))').each(function()
      {
          disableInput($(this));
      });
		
		$('select:has(option:contains(Framed Size)),select:has(option:contains(framed Size))').each(function()
		{
			$(this).change(function()
			{
			   $('form[action="/ils/indexquick.asp?showpage=processcart"] input[name="recalc"]').trigger("click");
			});
		});
		
		$('td:contains(This transaction)').closest('table').insertAfter($('input[name="recalc"]').closest('table').parent().closest('table'));
		var font=$('font:contains(Discount Coupon)')
		font.attr('color','#ff0000').html("If you have a voucher code to redeem, please enter the details here");
		font.closest('td').attr('bgcolor','#ffffff');
		
   });
})();

