function validateForm()
 {
  if (document.getElementById ('action').value === 'paypal' && jQuery('#SGC').val () != 1)
   {
    for (var i = 0, recipients = jQuery('#gift-recipients').val (); i < recipients; i++)
     {
      if (jQuery('#gift-quantity-'+i).val () < 1)
       {
        alert('Invalid Gift for Recipient #'+(i+1)+'.\n\n· Please choose the Number of Cards or eGifts for this Recipient.');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-quantity-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-quantity-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-quantity-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'E' && !jQuery.trim (jQuery('#gift-name-'+i).val ()))
       {
        alert('Invalid eGift Certificate for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Name');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-name-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-name-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-name-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'E' && !jQuery.trim (jQuery('#gift-email-'+i).val ()))
       {
        alert('Invalid eGift Certificate for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Email');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-email-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-email-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-email-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'E' && !jQuery.trim (jQuery('#gift-email-'+i).val ()).match (/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i))
       {
        alert('Invalid eGift Certificate #'+(i+1)+'.\n\nPlease supply the following information:\nA valid Recipient Email Address');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-email-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-email-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-email-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'E' && !jQuery.trim (jQuery('#gift-message-'+i).val ()))
       {
        alert('Invalid eGift Certificate for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Message To Recipient');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-message-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-message-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-message-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-name-'+i).val ()))
       {
        alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Name');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-name-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-name-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-name-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-street1-'+i).val ()))
       {
        alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Street');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-street1-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-street1-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-street1-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-city-'+i).val ()))
       {
        alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient City');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-city-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-city-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-city-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-state-'+i).val ()))
       {
        alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient State');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-state-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-state-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-state-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
      else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-zip-'+i).val ()))
       {
        alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Zip Code');
        jQuery('#gift-recipient-flippers a._'+(i+1)).each (function ()
         {
          flipperOnClick(this, i);
          setTimeout(function ()
           {
            jQuery('#gift-zip-'+i).each (function ()
             {
              this.focus ();
             });
            jQuery('#gift-zip-'+i).css ({'background-color': '#FF9999'});
            setTimeout(function ()
             {
              jQuery('#gift-zip-'+i).css ({'background-color': ''});
             }, 3000);
           }, 500);
         });
        return false;
       }
     }
    if (!jQuery.trim (jQuery('#fname').val ()))
     {
      alert('You must provide your First Name please.');
      jQuery('#fname').each (function ()
       {
        this.focus ();
       });
      jQuery('#fname').css ({'background-color': '#FF9999'});
      setTimeout(function ()
       {
        jQuery('#fname').css ({'background-color': ''});
       }, 3000);
      return false;
     }
    else if (!jQuery.trim (jQuery('#lname').val ()))
     {
      alert('You must provide your Last Name please.');
      jQuery('#lname').each (function ()
       {
        this.focus ();
       });
      jQuery('#lname').css ({'background-color': '#FF9999'});
      setTimeout(function ()
       {
        jQuery('#lname').css ({'background-color': ''});
       }, 3000);
      return false;
     }
    else if (!jQuery.trim (jQuery('#email').val ()) || !jQuery.trim (jQuery('#email').val ()).match (/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i))
     {
      alert('You must provide a valid Email Address.');
      jQuery('#email').each (function ()
       {
        this.focus ();
       });
      jQuery('#email').css ({'background-color': '#FF9999'});
      setTimeout(function ()
       {
        jQuery('#email').css ({'background-color': ''});
       }, 3000);
      return false;
     }
    else if (!document.getElementById ('agree').checked)
     {
      alert('You must check that you agree to the Terms and Conditions.');
      return false;
     }
    else
     {
      jQuery.cookie('fname', jQuery.trim (jQuery('#fname').val ()), {expires: 7, path: '/'});
      jQuery.cookie('lname', jQuery.trim (jQuery('#lname').val ()), {expires: 7, path: '/'});
      jQuery.cookie('email', jQuery.trim (jQuery('#email').val ()), {expires: 7, path: '/'});
      return handleOrderReview ();
     }
   }
  else
   {
    jQuery.cookie('fname', jQuery.trim (jQuery('#fname').val ()), {expires: 7, path: '/'});
    jQuery.cookie('lname', jQuery.trim (jQuery('#lname').val ()), {expires: 7, path: '/'});
    jQuery.cookie('email', jQuery.trim (jQuery('#email').val ()), {expires: 7, path: '/'});
   }
 }
function singleRecipientOnClick(obj)
 {
  jQuery('#gift-photo-recipients-single-s').each (function ()
   {
    if (this.src !== 'http://www.catchacharacter.com/wp-content/themes/custom/images/inner-content/check.png')
     {
      this.src = 'http://www.catchacharacter.com/wp-content/themes/custom/images/inner-content/check.png';
      /**/
      jQuery('#gift-photo-recipients-multi-s').each (function ()
       {
        this.src = 'http://www.catchacharacter.com/wp-content/themes/custom/images/inner-content/radio.png';
       });
      /**/
      jQuery('#gift-photo-recipients-single-a').css ({'font-weight': 'bold'});
      jQuery('#gift-photo-recipients-multi-a').css ({'font-weight': 'normal'});
      /**/
      jQuery('#gift-recipients').val ('1');
      jQuery('#gift-recipient-selection').hide ();
      jQuery('#gift-recipient-flippers a').css ({'font-weight': 'normal', 'background': '#CCCCCC'});
      jQuery('#gift-recipient-flippers a._1').css ({'font-weight': 'bold', 'background': '#FFFFFF'});
      jQuery('#gift-recipient-flippers a').hide ();
      jQuery('#gift-recipient-flippers').hide ();
      jQuery('#gift-recipient-pagination').hide ();
      /**/
      jQuery('select[id^=gift-quantity-]').val ('0');
      jQuery('select[id^=gift-type-]').val ('E');
      jQuery('#gift-quantity-0').val ('1');
      /**/
      jQuery('div[id^=gift-certificate-]').show ();
      jQuery('div[id^=gift-card-]').hide ();
      /**/
      jQuery('div[id^=gift-purchase-]').html ('$'+numberFormat(singleGiftPhotoPrice, 2, '.', ''));
      jQuery('div[id^=gift-total-]').html ('$'+numberFormat(singleGiftPhotoPrice, 2, '.', ''));
      jQuery('div[id^=gift-shipping-]').html ('$0.00');
      /**/
      jQuery('#numerical-gift-recipients div[id^=gift-recipient-]').hide ();
      jQuery('#gift-recipient-0').show ();
      /**/
      jQuery('#gift-photo-customizations').show ();
      /**/
      updatePriceCalculations ();
     }
   });
 }
function multiRecipientOnClick(obj)
 {
  jQuery('#gift-photo-recipients-multi-s').each (function ()
   {
    if (this.src !== 'http://www.catchacharacter.com/wp-content/themes/custom/images/inner-content/check.png')
     {
      this.src = 'http://www.catchacharacter.com/wp-content/themes/custom/images/inner-content/check.png';
      /**/
      jQuery('#gift-photo-recipients-single-s').each (function ()
       {
        this.src = 'http://www.catchacharacter.com/wp-content/themes/custom/images/inner-content/radio.png';
       });
      /**/
      jQuery('#gift-photo-recipients-single-a').css ({'font-weight': 'normal'});
      jQuery('#gift-photo-recipients-multi-a').css ({'font-weight': 'bold'});
      /**/
      jQuery('#gift-recipients').val ('2');
      jQuery('#gift-recipient-selection').show ();
      jQuery('#gift-recipient-flippers a').css ({'font-weight': 'normal', 'background': '#CCCCCC'});
      jQuery('#gift-recipient-flippers a._1').css ({'font-weight': 'bold', 'background': '#FFFFFF'});
      jQuery('#gift-recipient-flippers a').hide ();
      for (var i = 1; i <= 2; i++)
       jQuery('#gift-recipient-flippers a._'+i).show ();
      jQuery('#gift-recipient-flippers').show ();
      jQuery('#gift-recipient-pagination').show ();
      /**/
      jQuery('select[id^=gift-quantity-]').val ('0');
      jQuery('select[id^=gift-type-]').val ('E');
      jQuery('#gift-quantity-0').val ('1');
      /**/
      jQuery('div[id^=gift-certificate-]').show ();
      jQuery('div[id^=gift-card-]').hide ();
      /**/
      jQuery('div[id^=gift-purchase-]').html ('$'+numberFormat(singleGiftPhotoPrice, 2, '.', ''));
      jQuery('div[id^=gift-total-]').html ('$'+numberFormat(singleGiftPhotoPrice, 2, '.', ''));
      jQuery('div[id^=gift-shipping-]').html ('$0.00');
      /**/
      jQuery('#numerical-gift-recipients div[id^=gift-recipient-]').hide ();
      jQuery('#gift-recipient-0').show ();
      /**/
      jQuery('#gift-photo-customizations').show ();
      /**/
      updatePriceCalculations ();
     }
   });
 }
function flipperOnClick(obj, n)
 {
  jQuery('#numerical-gift-recipients div[id^=gift-recipient-]').hide (), jQuery('#gift-recipient-'+n).show ();
  jQuery('#gift-recipient-flippers a').css ({'font-weight': 'normal', 'background': '#CCCCCC'});
  obj.style.fontWeight = 'bold', obj.style.background = '#FFFFFF';
  /**/
  updatePriceCalculations ();
 }
function recipientsOnChange(obj)
 {
  jQuery('#gift-recipient-flippers a').hide ();
  for (var i = 1, v = jQuery('#gift-recipients').val (); i <= v; i++)
   jQuery('#gift-recipient-flippers a._'+i).show ();
  /**/
  jQuery('#numerical-gift-recipients div[id^=gift-recipient-]').hide (), jQuery('#gift-recipient-0').show ();
  /**/
  jQuery('#gift-recipient-flippers a').css ({'font-weight': 'normal', 'background': '#CCCCCC'});
  jQuery('#gift-recipient-flippers a._1').css ({'font-weight': 'bold', 'background': '#FFFFFF'});
  /**/
  for (var i = v; i <= 9; i++)
   jQuery('select[id^=gift-quantity-]').val ('0');
  /**/
  if (v > 1) /* If there is more than 1. */
   jQuery('#gift-recipient-pagination').show ();
  else /* There is no need to paginate. */
   jQuery('#gift-recipient-pagination').hide ();
  /**/
  updatePriceCalculations ();
 }
function paginateRecipients(obj)
 {
  for (var i = 1, v = jQuery('#gift-recipients').val (); i <= v; i++)
   {
    if ((jQuery('#gift-recipient-flippers a._'+i).css ('font-weight') == 700 || jQuery('#gift-recipient-flippers a._'+i).css ('font-weight') === 'bold') && (i+1) <= v)
     {
      if (validateRecipient(i-1))
       {
        jQuery('#gift-recipient-flippers a').css ({'font-weight': 'normal', 'background': '#CCCCCC'});
        jQuery('#gift-recipient-flippers a._'+(i+1)).css ({'font-weight': 'bold', 'background': '#FFFFFF'});
        jQuery('#numerical-gift-recipients div[id^=gift-recipient-]').hide (), jQuery('#gift-recipient-'+i).show ();
       }
      break;
     }
    else if ((jQuery('#gift-recipient-flippers a._'+i).css ('font-weight') == 700 || jQuery('#gift-recipient-flippers a._'+i).css ('font-weight') === 'bold'))
     {
      if (validateRecipient(i-1))
       {
        jQuery('#gift-recipient-flippers a').css ({'font-weight': 'normal', 'background': '#CCCCCC'});
        jQuery('#gift-recipient-flippers a._1').css ({'font-weight': 'bold', 'background': '#FFFFFF'});
        jQuery('#numerical-gift-recipients div[id^=gift-recipient-]').hide (), jQuery('#gift-recipient-0').show ();
       }
      break;
     }
   }
  /**/
  updatePriceCalculations ();
 }
function validateRecipient(i)
 {
  if (jQuery('#gift-quantity-'+i).val () < 1)
   {
    alert('Invalid Gift for Recipient #'+(i+1)+'.\n\n· Please choose the Number of Cards or eGifts for this Recipient.');
    jQuery('#gift-quantity-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-quantity-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-quantity-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'E' && !jQuery.trim (jQuery('#gift-name-'+i).val ()))
   {
    alert('Invalid eGift Certificate for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Name');
    jQuery('#gift-name-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-name-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-name-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'E' && !jQuery.trim (jQuery('#gift-email-'+i).val ()))
   {
    alert('Invalid eGift Certificate for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Email');
    jQuery('#gift-email-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-email-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-email-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'E' && !jQuery.trim (jQuery('#gift-email-'+i).val ()).match (/^([a-z_~0-9\+\-]+)(((\.?)([a-z_~0-9\+\-]+))*)(@)([a-z0-9]+)(((-*)([a-z0-9]+))*)(((\.)([a-z0-9]+)(((-*)([a-z0-9]+))*))*)(\.)([a-z]{2,6})$/i))
   {
    alert('Invalid eGift Certificate #'+(i+1)+'.\n\nPlease supply the following information:\nA valid Recipient Email Address');
    jQuery('#gift-email-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-email-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-email-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'E' && !jQuery.trim (jQuery('#gift-message-'+i).val ()))
   {
    alert('Invalid eGift Certificate for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Message To Recipient');
    jQuery('#gift-message-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-message-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-message-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-name-'+i).val ()))
   {
    alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Name');
    jQuery('#gift-name-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-name-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-name-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-street1-'+i).val ()))
   {
    alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Street');
    jQuery('#gift-street1-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-street1-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-street1-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-city-'+i).val ()))
   {
    alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient City');
    jQuery('#gift-city-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-city-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-city-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-state-'+i).val ()))
   {
    alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient State');
    jQuery('#gift-state-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-state-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-state-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else if (jQuery('#gift-type-'+i).val () === 'P' && !jQuery.trim (jQuery('#gift-zip-'+i).val ()))
   {
    alert('Invalid Gift Card for Recipient #'+(i+1)+'.\n\nPlease supply the following information:\n\n· Recipient Zip Code');
    jQuery('#gift-zip-'+i).each (function ()
     {
      this.focus ();
     });
    jQuery('#gift-zip-'+i).css ({'background-color': '#FF9999'});
    setTimeout(function ()
     {
      jQuery('#gift-zip-'+i).css ({'background-color': ''});
     }, 3000);
    return false;
   }
  else
   {
    return true;
   }
 }
function updatePriceCalculations()
 {
  var i = 0, amount = 0, shipping = 0, total = 0, gphotos = 0, pgrecs = 0, pgloc, pglocs = [];
  ;
  /**/
  jQuery('select[id^=gift-quantity-]').each (function ()
   {
    gphotos = gphotos+parseInt(jQuery(this).val ());
   });
  /**/
  for (i = 0; i <= 9; i++)
   {
    pgloc = jQuery('#gift-name-'+i).val ().toLowerCase ()+jQuery('#gift-street1-'+i).val ().toLowerCase ()+jQuery('#gift-street2-'+i).val ().toLowerCase ()+jQuery('#gift-city-'+i).val ().toLowerCase ()+jQuery('#gift-state-'+i).val ().toLowerCase ()+jQuery('#gift-zip-'+i).val ().toLowerCase ();
    /**/
    if (jQuery('#gift-type-'+i).val () === 'P' && jQuery('#gift-quantity-'+i).val () > 0 && !inArray(pgloc, pglocs))
     {
      pglocs.push (pgloc), pgrecs = pgrecs+1;
     }
   }
  /**/
  amount = ((gphotos >= 1) ? singleGiftPhotoPrice * 1 : 0)+((gphotos-1 >= 1) ? multiExtraGiftPhotoPrice * (gphotos-1) : 0);
  shipping = (pgrecs * giftCardShippingPrice);
  total = (amount+shipping);
  /**/
  jQuery('div[id^=gift-purchase-]').html ('$'+numberFormat(amount, 2, '.', ''));
  jQuery('div[id^=gift-shipping-]').html ('$'+numberFormat(shipping, 2, '.', ''));
  jQuery('div[id^=gift-total-]').html ('$'+numberFormat(total, 2, '.', ''));
  /**/
  return {'amount': numberFormat(amount, 2, '.', ''), 'shipping': numberFormat(shipping, 2, '.', ''), 'total': numberFormat(total, 2, '.', '')};
 }
function typeOnChange(obj)
 {
  if (obj.value === 'E')
   {
    jQuery('#gift-certificate-'+obj.id.substr (obj.id.length-1)).show ();
    jQuery('#gift-card-'+obj.id.substr (obj.id.length-1)).hide ();
   }
  else if (obj.value === 'P')
   {
    jQuery('#gift-certificate-'+obj.id.substr (obj.id.length-1)).hide ();
    jQuery('#gift-card-'+obj.id.substr (obj.id.length-1)).show ();
   }
  /**/
  updatePriceCalculations ();
 }
function quantityOnChange(obj)
 {
  updatePriceCalculations ();
 }
function continueShoppingOnClick(obj)
 {
  jQuery('#SGC').val (1);
 }
function checkoutOnClick(obj)
 {
  jQuery('#SGC').val (0);
 }
var order_reviewed = false, handleOrderReview = function ()
 {
  if (!order_reviewed)
   {
    var price = updatePriceCalculations (), r = '', review = '';
    /**/
    location.hash = 'shadowbox';
    /**/
    var type, quantity, name, email, msg, street1, street2, city, state, zip, total = 0;
    /**/
    for (var i = 0, recipients = jQuery('#gift-recipients').val (); i < recipients; i++)
     {
      type = jQuery('#gift-type-'+i).val ();
      quantity = jQuery('#gift-quantity-'+i).val ();
      name = jQuery('#gift-name-'+i).val ();
      email = jQuery('#gift-email-'+i).val ();
      msg = jQuery('#gift-message-'+i).val ();
      street1 = jQuery('#gift-street1-'+i).val ();
      street2 = jQuery('#gift-street2-'+i).val ();
      city = jQuery('#gift-city-'+i).val ();
      state = jQuery('#gift-state-'+i).val ();
      zip = jQuery('#gift-zip-'+i).val ();
      total = parseInt(total)+parseInt(quantity);
      /**/
      if (type === 'E')
       {
        r += '('+quantity+') eGift Certificate'+((quantity > 1) ? 's' : '')+'<br/>';
        r += name+' ( '+email+' )<br/><br/>';
       }
      else if (type === 'P')
       {
        r += '('+quantity+') Plastic Gift Card'+((quantity > 1) ? 's' : '')+'<br/>';
        r += name+'<br/>';
        r += street1+' '+street2+'<br/>';
        r += city+', '+state+' '+zip+'<br/><br/>';
       }
     }
    /**/
    review += '<div id="order-review" style="z-index:1000; position:absolute; top:50px; left:'+(jQuery(document).width ()-400) / 2+'px; width:380px; background:#FFFFFF; padding:10px; border:10px solid #6699CC; -moz-border-radius:5px; -webkit-border-radius:5px; -moz-box-shadow:1px 1px 5px #000000; -webkit-box-shadow:1px 1px 5px #000000;">';
    review += '<div style="font-weight:bold; font-size:120%; border:1px solid #6699CC; -moz-border-radius:2px; -webkit-border-radius:2px; padding:5px; background:#6699CC; color:#FFFFFF;">Please Review Gift Details</div>';
    review += '<div style="margin:10px 0 0 0;">';
    review += '<div style="text-align:right;">';
    review += '<img src="http://www.catchacharacter.com/wp-content/themes/custom/images/inner-content/arrow-down.png" width="16" height="16" alt="Arrow" style="float:left;" /><small>Total Recipients:</small> <b style="font-size:110%;">'+jQuery('#gift-recipients').val ()+'</b>&nbsp;&nbsp;&nbsp;<small>Total Gifts:</small> <b style="font-size:110%;">'+total+'</b>';
    review += '</div>';
    review += '<div style="margin:20px;">';
    review += '<div style="font-family:courier new, monospace;">'+r+'</div>';
    review += '<div style="clear:both;"></div>';
    review += '<div style="float:right; width:150px; text-align:center; margin:30px 0 0 0;"><div><a href="#" onclick="jQuery(\'#order-review\').remove(); return false;">MAKE CHANGES</a></div><div style="margin:10px 0 10px 0;">&mdash;OR&mdash;</div><div><a href="#" style="font-weight:bold;" onclick="jQuery(\'form\').submit(); return false;">CONFIRM ORDER</a></div></div>';
    review += '<div style="background:url(http://www.catchacharacter.com/wp-content/themes/custom/images/inner-content/cart-bg.png); width:161px; height:91px; position:relative; margin:20px 0 0 0;"><div id="gift-purchase-r" style="width:65px; top:20px; left:80px; text-align:right; position:absolute;">$'+price['amount']+'</div><div id="gift-shipping-r" style="width:65px; top:38px; left:80px; text-align:right; position:absolute;">$'+price['shipping']+'</div><div id="gift-total-r" style="width:65px; top:66px; left:80px; text-align:right; position:absolute; font-weight:bold;">$'+price['total']+'</div></div>';
    review += '</div>';
    review += '</div>';
    review += '</div>';
    /**/
    jQuery('#order-review').remove ();
    jQuery('body').append (review);
    /**/
    return false;
   }
  /**/
  return true;
 }
function numberFormat (number, decimals, dec_point, thousands_sep)
 {
  var n = number, prec = decimals;
  var toFixedFix = function(n, prec)
   {
    var k = Math.pow (10, prec);
    return (Math.round (n * k) / k).toString ();
   };
  n = !isFinite(+n) ? 0 : +n;
  prec = !isFinite(+prec) ? 0 : Math.abs (prec);
  var sep = ( typeof thousands_sep === 'undefined') ? ',' : thousands_sep;
  var dec = ( typeof dec_point === 'undefined') ? '.' : dec_point;
  var s = (prec > 0) ? toFixedFix(n, prec) : toFixedFix(Math.round (n), prec);
  var abs = toFixedFix(Math.abs (n), prec);
  var _, i;
  if (abs >= 1000)
   {
    _ = abs.split (/\D/);
    i = _[0].length % 3 || 3;
    _[0] = s.slice (0, i+(n < 0))+_[0].slice (i).replace (/(\d{3})/g, sep+'$1');
    s = _.join (dec);
   }
  else
   {
    s = s.replace ('.', dec);
   }
  var decPos = s.indexOf (dec);
  if (prec >= 1 && decPos !== -1 && (s.length-decPos-1) < prec)
   {
    s += new Array(prec-(s.length-decPos-1)).join (0)+'0';
   }
  else if (prec >= 1 && decPos === -1)
   {
    s += dec+new Array(prec).join (0)+'0';
   }
  return s;
 }
function inArray(needle, haystack, strict)
  {
   if (typeof needle !== 'undefined' && typeof haystack === 'object')
    {
     for (var key in haystack)
      {
       if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle))
        {
         return true;
        }
      }
    }
   return false;
  }