﻿function parsePrice() {
    $('.pris').each(function(i, selected) {
        var text = $(selected).text();
        var subText = text.substring(0, text.lastIndexOf('00'));
        $(selected).text(subText);
    });
}

$(document).ready(function() {
	$('.bringFraktvalg:first input:radio').attr('checked', 'checked');
});



function FormatAmount(Amount, Delimiter, NumberOfDigits)
{
  var posOfPeriod = Amount.indexOf('.')
  var posOfComma = Amount.indexOf(',')
  
  var split1;
  var split2;
  var splittedStr;
  var MSG;
   if (posOfPeriod > 0)
  {
    //Alert ("found .")
    //MSG ='found .';
    splittedStr = Amount.split(".");
    split1 = splittedStr[0];
    split2 = splittedStr[1];
    if (split2.length > NumberOfDigits)
    {
      split2 = split2.substr(0,2);
    }
    MSG = split1+Delimiter+'-';
  }
  
  if(posOfComma > 0)
  {
    splittedStr = Amount.split(",");
    split1 = splittedStr[0];
    split2 = splittedStr[1];
    if (split2.length > NumberOfDigits)
    {
      split2 = split2.substr(0,2);
    }
    MSG = split1+Delimiter+'-';
  }
  return MSG;
}
// **************************************************

