1function getURLVar(key) {
2 var value = [];
3
4 var query = String(document.location).split('?');
5
6 if (query[1]) {
7 var part = query[1].split('&');
8
9 for (i = 0; i < part.length; i++) {
10 var data = part[i].split('=');
11
12 if (data[0] && data[1]) {
13 value[data[0]] = data[1];
14 }
15 }
16
17 if (value[key]) {
18 return value[key];
19 } else {
20 return '';
21 }
22 }
23}
24
25$(document).ready(function() {
26 // Highlight any found errors
27 $('.text-danger').each(function() {
28 var element = $(this).parent().parent();
29
30 if (element.hasClass('form-group')) {
31 element.addClass('has-error');
32 }
33 });
34
35 // Currency
36 $('#currency .currency-select').on('click', function(e) {
37 e.preventDefault();
38
39 $('#currency input[name=\'code\']').attr('value', $(this).attr('name'));
40
...
</html>