function check_form(obj) {

    var result = true;

    var fields = "";

    var is_email_invalid = false;

    jQuery('input',obj).each(

        function () {

            if (this.type != 'hidden') {

                if (this.value == '') {

                    fields = fields + jQuery(this).attr('rel')+"\n";                    

                    result = false;

                } else {

                   if (this.name == 'email' && !echeck(this.value)) {

                       is_email_invalid = true;

                   }

                }

            }

            

        }

    );



    if (!result || is_email_invalid) {

        str = ""; 

        if (!result) {

           str = str + "Please enter the following missing information(s):\n"+fields;   

        }   

        if (is_email_invalid) {

            str = str + "Invalid Email ID. Please Enter a valid Email ID.";

        }   

   

        alert(str);    

        result = false;

    }



    return result;

}



function echeck(str) {



      var at="@"

      var dot="."

      var lat=str.indexOf(at)

      var lstr=str.length

      var ldot=str.indexOf(dot)

      if (str.indexOf(at)==-1){

         return false

      }



      if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

         return false

      }



      if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

          return false

      }



       if (str.indexOf(at,(lat+1))!=-1){

          return false

       }



       if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

          return false

       }



       if (str.indexOf(dot,(lat+2))==-1){

          return false

       }

      

       if (str.indexOf(" ")!=-1){

          return false

       }



       return true               



}



function recalculate(amount) {

   total = parseFloat(jQuery('.amount').html());

   if (jQuery('input[@name=recovery_protection]')[0].checked) {

      total = total+9.95;

   } else {

      total = total-9.95; 

   }

   jQuery('.amount').html(total.toFixed(2));

}