function updateRating()
 {
       var ratingValue = document.getElementById('rating').value;
       if (ratingValue < 1)
       {     alert('Please rate by sliding and clicking the stars');
            return false;
       }

      $.ajax({ url : baseUrl+'recipes.php?_mf=utils&action=update_rating&mode=ajax&recipeid='+recipeId+'&rating='+ratingValue,
               success : function(msg)
               {
	              if (msg.split(':')[0]=='UPDATED')
                  {
                     $('#update-rating-section').fadeOut('slow');
                     $('#avgrating').html(msg.split(':')[1]);
                  }
               }
                });
 }

function validateFormFeedback(formObj)
{
   if (!emptyCheck(formObj.feedback.value))
    {
       errAlert(formObj.feedback, 'text', alertErr.MESSAGE_REQUIRED);
       return false;
    }

    if (!emptyCheck(formObj.rating_taste.value) && formObj.rating_taste.value < 1)
    {
      alert(alertErr.RECIPE_FEEDBACK_RATE_THE_TASTE);
      return false;
    }

    if (!emptyCheck(formObj.rating_cost.value) && formObj.rating_cost.value < 1)
    {
      alert(alertErr.RECIPE_FEEDBACK_RATE_THE_COST);
      return false;
    }

    if (!emptyCheck(formObj.rating_difficulty.value) && formObj.rating_difficulty.value < 1)
    {
      alert(alertErr.RECIPE_FEEDBACK_RATE_THE_DIFFICULTY);
      return false;
    }

   formObj.submit();
}

$(document).ready(function() {
    $('#emailpage').click(function(e){
                e.preventDefault();
                popupWin(this.href, 530, 430)
           });

    $('.editpage_showpopup').click(function(e){
                e.preventDefault();
                popupWin(this.href, 430, 100)
           });
   /*
    $('.view-photo-link').click(function(e){
        e.preventDefault();
        popupWin(this.href, 770, 600, 'scrollbars=yes,resizable=yes', 'RecipePhotoWin')
    });
   */

})