PageSourceSearch

https://www.ibisbis.com.au/library/Default/js/custom/jsinclude.js?vers=6844

js ibisbis.com.au collected 2026-10-05 02:21:59 UTC 93,615 bytes, 2,584 lines download raw bytes

1$(document).ready(function () {
2
3    $(".top-mini-content");
4
5    $("#cart").hover(
6        function () {
7            $('.top-mini-content').toggleClass('inspectcart');
8        }, function () {
9            $('.top-mini-content').toggleClass('inspectcart');
10        }
11    );
12
13    $(".top-mini-content").hover(
14        function () {
15            $('.top-mini-content').toggleClass('inspectcart');
16        }, function () {
17            $('.top-mini-content').toggleClass('inspectcart');
18        }
19    );
20
21    $('.productList').on("click", "a.productOptionLink", function () {
22        var isPrimaryProduct = false;
23
24        var variantRow = $(this).closest('.variantrow');
25
26        if (variantRow.hasClass('primaryProduct')) {
27            isPrimaryProduct = true;
28        }
29
30        var productUniqueCodeRegex = /.+\[(.+)\]/g;
31        var match = productUniqueCodeRegex.exec($(this).text());
32        if (match != null) {
33            // Replace main image with the variant image.
34            var newimagesrc = $('.prodOptionImdDiv' + match[1] + ' > a').attr("href");
35            $('#prodImgDiv #prodImgSubLightboxLink').attr('href', newimagesrc);
36            $('#prodImgDiv #prodImg').attr('src', newimagesrc);
37            $('#prodImgDiv .zoomImg').attr('src', newimagesrc);
38        }
39    });
40});
41
42function CleanQuickCart() {
43    $('.top-mini-content').remove();
44}
45
46function ShowQuickCartBriefly() {
47
48    $("html, body").animate({ scrollTop: 0 }, 1000);
49
50    $('.top-mini-content').toggleClass('inspectcart');
51    setTimeout(function () {
52        $('.top-mini-content').toggleClass('inspectcart');
53    }, 3500);
54}
55
56
57function ReorderAllItems(reorderButton) {
58
59    var itemRows = $(reorderButton).closest('tr.orderHeaderRow').next().find('tr.orderItemRow');
60
61    var items = "";
62
63    $.each(itemRows, function (index, itemRow) {
64
65        var productid = $(itemRow).find('input[name="itemNo_orderhistory"]').val();
66
67        var quantity = $(itemRow).find('input[name="qty_orderhistory"]').val();
68
69        if (isNaN(quantity)) {
70            quantity = 0;
71        }
72
73        if (quantity > 0) {
74
75            items += productid + ":" + quantity + "|";
76        }
77
78    });
79
80    // remove trailing pipe
81    items = items.substring(0, items.length - 1);
82
83    DoAjaxRequest("/addcart.aspx?items=" + items + "&action=addCart", function () {
84
85        CleanQuickCart();
86
87        DoAjaxRequest("/quickcart.aspx", function (response) {
88            document.getElementById("cart").innerHTML = response;
89            ShowQuickCartBriefly();
90        });
91    });
92
93}
94function MakePayment(makePaymentButton) {
95    var orderRow = $(makePaymentButton).closest('tr');
96    var OrderID = $(orderRow).find('input[id="Order_ID"]').val();
97    //alert("MakePayment Called.." + OrderID);
98    DoAjaxRequest("/addcart.aspx?orderid=" + OrderID + "&action=addOrderToCart", function () {
99        CleanQuickCart();
100        DoAjaxRequest("/quickcart.aspx", function (response) {
101            document.getElementById("cart").innerHTML = response;
102            ShowQuickCartBriefly();
103        });
104        window.location.replace("/checkout.aspx");
105    });
106}
107
108
109function ReorderIndividualItem(addToCartButton) {
110
111    var itemRow = $(addToCartButton).closest('tr.orderItemRow');
112
113    var productId = $(itemRow).find('input[name="itemNo_orderhistory"]').val();
114
115    var quantity = $(itemRow).find('input[name="qty_orderhistory"]').val();
116
117    addToCart(productId, quantity);
118
119}
120
121
122function addToCart_Short(productId, quantity, minValue) {
123    addToCart(productId, 1, false);
124}
125function addAllToCart() {
126    var itemQuantities = $("input.ItemQty");
127    var length = itemQuantities.length;
128    var items = "";
129
130    itemQuantities.each(function (index) {
131        var productid = $(this).attr('id');
132        var quantity = $(this).val();
133
134        if (productid.indexOf('itemqty') !== -1) {
135            productid = productid.replace("itemqty", "");
136        }
137
138        if (isNaN(quantity)) {
139            quantity = 0;
140        }
141
142        if (quantity > 0) {
143            items += productid + ":" + quantity + "|";
144        }
145
146    });
147    if (items.length > 0) {
148        $("span.qtyalert").hide();
149        // remove trailing pipe
150        items = items.substring(0, items.length - 1);
151
152        DoAjaxRequest("/addcart.aspx?items=" + items + "&action=addCart", function () {
153
154            CleanQuickCart();
155
156            DoAjaxRequest("/quickcart.aspx", function (response) {
157                document.getElementById("cart").innerHTML = response;
158                ShowQuickCartBriefly();
159            });
160        });
161    } else {
162        $("span.qtyalert").show();
163    }
164
165}
166function removeFromCart(productId) {
167    //alert("addcart.aspx?DelAction=" + productId + "&action=DelCart");
168    $("input#itemqty" + productId).val("");
169    DoAjaxRequest("/addcart.aspx?DelAction=" + productId + "&action=DelCart", function () {
170
171        CleanQuickCart();
172
173        DoAjaxRequest("/quickcart.aspx", function (response) {
174            document.getElementById("cart").innerHTML = response;
175            ShowQuickCartBriefly();
176        });
177    });
178}
179
180function addToCart(productId, quantity) {
181    if ($("input#itemqty" + productId).val() != quantity) {
182        quantity = $("input#itemqty" + productId).val();
183    }
184    DoAjaxRequest("/addcart.aspx?itemNo=" + productId + "&qty=" + (quantity == null || quantity == "" ? 1 : quantity) + "&action=addCart", function () {
185        var prodImg = document.getElementById("prodImg" + productId);
186        if (prodImg == null) {
187            prodImg = document.getElementById("prodImg");
188        }
189        DoAjaxRequest("/quickcart.aspx", function (response) {
190
191            CleanQuickCart();
192
193            document.getElementById("cart").innerHTML = response;
194            ShowQuickCartBriefly();
195        });
196    });
197
198}
199
200function UpdateProductTotalPrice() {
201
202    var debuginfo = "";
203    var itemQuantities = $("input.ItemQty");
204    var length = itemQuantities.length;
205    var TotalPrice = 0;
206    itemQuantities.each(function (index) {
207        var productid = $(this).attr('id');
208        var quantity = $(this).val();
209        if (productid.indexOf('itemqty') !== -1) {
210            productid = productid.replace("itemqty", "");
211        }
212        if (isNaN(quantity)) {
213            quantity = 0;
214        }
215        var optionprice = $("input#" + productid).val();
216        optionprice = optionprice.replace('$', '');
217        //debuginfo += "|" + optionprice + "*" + quantity;
218        TotalPrice += optionprice * quantity;
219    });
220    if (isNaN(TotalPrice)) {
221        TotalPrice = $("p.price span.price").text();
222    } else {
223        TotalPrice = "$" + TotalPrice.toFixed(2);
224    }
225    $("p.price span.price").text(TotalPrice);
226    $("p.price span.pricelabel").text("Total:");
227    $("span.qtyalert").hide();
228}
229
230if (!window.XMLHttpRequest) {
231    XMLHttpRequest = function () {
232        try { return new ActiveXObject("MSXML3.XMLHTTP") } catch (ex) { }
233        try { return new ActiveXObject("MSXML2.XMLHTTP.3.0") } catch (ex) { }
234        try { return new ActiveXObject("Msxml2.XMLHTTP") } catch (ex) { }
235        try { return new ActiveXObject("Microsoft.XMLHTTP") } catch (ex) { }
236    }
237}
238
239function MM_openBrWindow(theURL, winName, features) { //v2.0
240    window.open(theURL, winName, features);
241}
242function MM_findObj(n, d) { //v3.0
243    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
244        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
245    }
246    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
247    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document); return x;
248}
249function MM_swapImage() { //v3.0
250    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2) ; i += 3)
251        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
252}
253function MM_swapImgRestore() { //v3.0
254    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
255}
256function changeImages() {
257    if (document.images) {
258        for (var i = 0; i < changeImages.arguments.length; i += 2) {
259            document[changeImages.arguments[i]].src = changeImages.arguments[i + 1];
260        }
261    }
262}
263function MM_preloadImages() { //v3.0
264    var d = document; if (d.images) {
265        if (!d.MM_p) d.MM_p = new Array();
266        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
267            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; }
268    }
269}
270function confPass() {
271    if (document.RegisterMe.thePass.value == document.RegisterMe.CPass.value) {
272        if (document.RegisterMe.thePass.value == "") {
273            alert("Please enter a password");
274            return false;
275        } else {
276            if (document.RegisterMe.UName.value == "") {
277                alert("Please enter a Username");
278                return false;
279            } else {
280                if (document.RegisterMe.theEmail.value == "") {
281                    alert("Please enter a valid email address");
282                    return false;
283                } else {
284                    return true;
285                }
286            }
287        }
288    } else {
289        alert("Your password and confirmation of password are different. Please re-enter these details");
290        document.RegisterMe.thePass.value = "";
291        document.RegisterMe.CPass.value = "";
292        return false;
293    }
294}
295
296function giveWarningAndFixValue(field) {
297    //removes all non-numeric value and replaces
298    var value = parseInt(field.value);
299    if (!isNaN(value)) field.value = value;
300    else field.value = "0";
301    //used for NS4.7 because when changing value the cursor is placed in front of the value, instead of behind
302    if (document.layers) field.select();
303}
304
305function isNumericValue(str) {
306    var isValid = true;
307    if (str.search(/^[0-9]+$/) == -1) {
308        isValid = false;
309    }
310    return isValid;
311}
312function checkValue(field) {
313    if (!isNumericValue(field.value)) {
314        giveWarningAndFixValue(field);
315    }
316}
317/*
318function confirmdel()
319{
320return window.confirm("If you delete this page all data in it will be lost. Are you sure you wish to continue?");
321}
322
323function confirmdelCont()
324{
325return window.confirm("Are you sure you wish to delete this content?");
326}*/
327
328function CheckPrice(obj) {
329    //validate the price is a positive integer
330    if (obj.value == "") {
331        alert("You must enter a price.");
332        return false;
333    }
334    else {
335
336        if (obj.value.search(/[^\d]/) > -1) {
337            alert("The price must be whole dollars in numbers only with no other characters.");
338            obj.value = '0';
339            return false;
340        }
341        else {
342            return true;
343        }
344    }
345}
346function CheckQuantity(obj) {
347    if (obj.value == "") {
348        alert("You must enter a quantity.");
349        return false;
350    }
351    else {
352        if (obj.value.search(/[^\d]/) > -1) {
353            alert("The quantity must be a positive number and contain numbers only with no other characters.");
354            obj.value = '1';
355            return false;
356        }
357        else {
358            return true;
359        }
360    }
361}
362function CheckDiscontinuedStockLevel(obj, stockLevel) {
363    if (obj.value > stockLevel) {
364        alert("There is only " + stockLevel + " units available in stock.");
365        obj.value = stockLevel;
366    }
367}
368function MM_reloadPage(init) {  //reloads the window if Nav4 resized
369    if (init == true) with (navigator) {
370        if ((appName == "Netscape") && (parseInt(appVersion) == 4)) {
371            document.MM_pgW = innerWidth; document.MM_pgH = innerHeight; onresize = MM_reloadPage;
372        }
373    }
374    else if (innerWidth != document.MM_pgW || innerHeight != document.MM_pgH) location.reload();
375}
376MM_reloadPage(true);
377
378function MM_findObj(n, d) { //v4.01
379    var p, i, x; if (!d) d = document; if ((p = n.indexOf("?")) > 0 && parent.frames.length) {
380        d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);
381    }
382    if (!(x = d[n]) && d.all) x = d.all[n]; for (i = 0; !x && i < d.forms.length; i++) x = d.forms[i][n];
383    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
384    if (!x && d.getElementById) x = d.getElementById(n); return x;
385}
386
387function MM_showHideLayers() { //v6.0
388    var i, p, v, obj, args = MM_showHideLayers.arguments;
389    for (i = 0; i < (args.length - 2); i += 3) if ((obj = MM_findObj(args[i])) != null) {
390        v = args[i + 2];
391        if (obj.style) { obj = obj.style; v = (v == 'show') ? 'visible' : (v == 'hide') ? 'hidden' : v; }
392        obj.visibility = v;
393    }
394}
395
396function MM_timelinePlay(tmLnName, myID) { //v1.2
397    //Copyright 1997, 2000 Macromedia, Inc. All rights reserved.
398    var i, j, tmLn, props, keyFrm, sprite, numKeyFr, firstKeyFr, propNum, theObj, firstTime = false;
399    if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
400    tmLn = document.MM_Time[tmLnName];
401    if (myID == null) { myID = ++tmLn.ID; firstTime = true; } //if new call, incr ID
402    if (myID == tmLn.ID) { //if Im newest
403        setTimeout('MM_timelinePlay("' + tmLnName + '",' + myID + ')', tmLn.delay);
404        fNew = ++tmLn.curFrame;
405        for (i = 0; i < tmLn.length; i++) {
406            sprite = tmLn[i];
407            if (sprite.charAt(0) == 's') {
408                if (sprite.obj) {
409                    numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
410                    if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr - 1]) {//in range
411                        keyFrm = 1;
412                        for (j = 0; j < sprite.values.length; j++) {
413                            props = sprite.values[j];
414                            if (numKeyFr != props.length) {
415                                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew - firstKeyFr];
416                                else sprite.obj[props.prop2][props.prop] = props[fNew - firstKeyFr];
417                            } else {
418                                while (keyFrm < numKeyFr && fNew >= sprite.keyFrames[keyFrm]) keyFrm++;
419                                if (firstTime || fNew == sprite.keyFrames[keyFrm - 1]) {
420                                    if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm - 1];
421                                    else sprite.obj[props.prop2][props.prop] = props[keyFrm - 1];
422                                }
423                            }
424                        }
425                    }
426                }
427            } else if (sprite.charAt(0) == 'b' && fNew == sprite.frame) eval(sprite.value);
428            if (fNew > tmLn.lastFrame) tmLn.ID = 0;
429        }
430    }
431}
432
433function MM_timelineGoto(tmLnName, fNew, numGotos) { //v2.0
434    //Copyright 1997, 2000 Macromedia, Inc. All rights reserved.
435    var i, j, tmLn, props, keyFrm, sprite, numKeyFr, firstKeyFr, lastKeyFr, propNum, theObj;
436    if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
437    tmLn = document.MM_Time[tmLnName];
438    if (numGotos != null)
439        if (tmLn.gotoCount == null) tmLn.gotoCount = 1;
440    else if (tmLn.gotoCount++ >= numGotos) { tmLn.gotoCount = 0; return }
441    jmpFwd = (fNew > tmLn.curFrame);
442    for (i = 0; i < tmLn.length; i++) {
443        sprite = (jmpFwd) ? tmLn[i] : tmLn[(tmLn.length - 1) - i]; //count bkwds if jumping back
444        if (sprite.charAt(0) == "s") {
445            numKeyFr = sprite.keyFrames.length;
446            firstKeyFr = sprite.keyFrames[0];
447            lastKeyFr = sprite.keyFrames[numKeyFr - 1];
448            if ((jmpFwd && fNew < firstKeyFr) || (!jmpFwd && lastKeyFr < fNew)) continue; //skip if untouchd
449            for (keyFrm = 1; keyFrm < numKeyFr && fNew >= sprite.keyFrames[keyFrm]; keyFrm++);
450            for (j = 0; j < sprite.values.length; j++) {
451                props = sprite.values[j];
452                if (numKeyFr == props.length) propNum = keyFrm - 1 //keyframes only
453                else propNum = Math.min(Math.max(0, fNew - firstKeyFr), props.length - 1); //or keep in legal range
454                if (sprite.obj != null) {
455                    if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];
456                    else sprite.obj[props.prop2][props.prop] = props[propNum];
457                }
458            }
459        } else if (sprite.charAt(0) == 'b' && fNew == sprite.frame) eval(sprite.value);
460    }
461    tmLn.curFrame = fNew;
462    if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)');
463}
464
465function MM_initTimelines() { //v4.0
466    //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.
467    var ns = navigator.appName == "Netscape";
468    var ns4 = (ns && parseInt(navigator.appVersion) == 4);
469    var ns5 = (ns && parseInt(navigator.appVersion) > 4);
470    document.MM_Time = new Array(1);
471    document.MM_Time[0] = new Array(1);
472    document.MM_Time["Timeline1"] = document.MM_Time[0];
473    document.MM_Time[0].MM_Name = "Timeline1";
474    document.MM_Time[0].fps = 15;
475    document.MM_Time[0][0] = new String("sprite");
476    document.MM_Time[0][0].slot = 1;
477    if (ns4)
478        document.MM_Time[0][0].obj = document["Layer2"];
479    else if (ns5)
480        document.MM_Time[0][0].obj = document.getElementById("Layer2");
481    else
482        document.MM_Time[0][0].obj = document.all ? document.all["Layer2"] : null;
483    document.MM_Time[0][0].keyFrames = new Array(1, 45);
484    document.MM_Time[0][0].values = new Array(4);
485    if (ns5)
486        document.MM_Time[0][0].values[0] = new Array("625px", "614px", "604px", "593px", "583px", "572px", "562px", "551px", "541px", "530px", "520px", "509px", "498px", "488px", "477px", "467px", "456px", "446px", "435px", "425px", "414px", "404px", "393px", "382px", "372px", "361px", "351px", "340px", "330px", "319px", "309px", "298px", "288px", "277px", "266px", "256px", "245px", "235px", "224px", "214px", "203px", "193px", "182px", "172px", "161px");
487    else
488        document.MM_Time[0][0].values[0] = new Array(625, 614, 604, 593, 583, 572, 562, 551, 541, 530, 520, 509, 498, 488, 477, 467, 456, 446, 435, 425, 414, 404, 393, 382, 372, 361, 351, 340, 330, 319, 309, 298, 288, 277, 266, 256, 245, 235, 224, 214, 203, 193, 182, 172, 161);
489    document.MM_Time[0][0].values[0].prop = "left";
490    if (ns5)
491        document.MM_Time[0][0].values[1] = new Array("121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px", "121px");
492    else
493        document.MM_Time[0][0].values[1] = new Array(121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121, 121);
494    document.MM_Time[0][0].values[1].prop = "top";
495    if (!ns4) {
496        document.MM_Time[0][0].values[0].prop2 = "style";
497        document.MM_Time[0][0].values[1].prop2 = "style";
498    }
499    document.MM_Time[0][0].values[2] = new Array("hidden", "visible");
500    document.MM_Time[0][0].values[2].prop = "visibility";
501    if (!ns4)
502        document.MM_Time[0][0].values[2].prop2 = "style";
503    document.MM_Time[0][0].values[3] = new Array("1", "1");
504    document.MM_Time[0][0].values[3].prop = "zIndex";
505    if (!ns4)
506        document.MM_Time[0][0].values[3].prop2 = "style";
507    document.MM_Time[0].lastFrame = 45;
508    for (i = 0; i < document.MM_Time.length; i++) {
509        document.MM_Time[i].ID = null;
510        document.MM_Time[i].curFrame = 0;
511        document.MM_Time[i].delay = 1000 / document.MM_Time[i].fps;
512    }
513}
514
515//-------- menu ---------
516function initialiseMenu(menutype) {
517    if (menutype == 'True') {
518        document.visibleMenu = null;
519        document.checkMenuTimer = null;
520        document.closeMenuTimer = null;
521        var menu = document.getElementById("header-nav");
522        if (menu == null) menu = document.getElementById("mainmenu");
523        if (menu != null) {
524            var objLICollection = menu.getElementsByTagName("LI");
525            for (var i = 0; i < objLICollection.length; i++) {
526
527                var objLI = objLICollection[i];
528
529                if (objLI.className == "rootitem") {
530                    processNodes(objLI);
531                }
532            }
533            objLICollection = menu.getElementsByTagName("TD");
534            for (var i = 0; i < objLICollection.length; i++) {
535
536                var objLI = objLICollection[i];
537
538                if (objLI.className == "rootitem") {
539                    processNodes(objLI);
540                }
541            }
542            objLICollection = menu.getElementsByTagName("LI");
543            for (var i = 0; i < objLICollection.length; i++) {
544                var objLI = objLICollection[i];
545
546                if (objLI.className == "menuitem") {
547                    processNodes(objLI);
548                }
549            }
550        }
551    }
552    else {
553        //nothing required
554    }
555}
556
557function initialiseAdminMenu(menutype) {
558    if (menutype == 'True') {
559        document.visibleMenu = null;
560        document.checkMenuTimer = null;
561        document.closeMenuTimer = null;
562        var menu = document.getElementById("adminmainmenu");
563        if (menu != null) {
564            var objLICollection = menu.getElementsByTagName("TD");
565            for (var i = 0; i < objLICollection.length; i++) {
566                var objLI = objLICollection[i];
567
568                if (objLI.childNodes.length > 0 && objLI.childNodes[0].tagName.toLowerCase() == 'div')
569                    objLI = objLI.childNodes[0];
570
571                processNodes(objLI);
572            }
573            objLICollection = menu.getElementsByTagName("LI");
574            for (var i = 0; i < objLICollection.length; i++) {
575                var objLI = objLICollection[i];
576                processNodes(objLI);
577            }
578        }
579    }
580    else {
581        //nothing required
582    }
583}
584
585function processNodes(objLI) {
586    objLI.onmouseover = hideSubMenu;
587
588    objLI.onmouseout = menuLostFocus;
589
590    var subMenus = objLI.getElementsByTagName("UL");
591    for (var j = 0; j < subMenus.length; j++) {
592        var child = subMenus.item(j);
593        if (child.nodeName == "UL") {
594            objLI.onmouseover = showSubMenu;
595            objLI.onmouseout = menuLostFocus;
596            if (objLI.className != "rootitem") {
597                for (var k = 0; k < objLI.childNodes.length; k++) {
598                    var link = objLI.childNodes.item(k);
599                    if (link.nodeName == "A") {
600                        link.style.backgroundImage = "url(/wmsimages/arrows.gif)";
601                        link.style.backgroundRepeat = "no-repeat";
602                        link.style.backgroundPosition = "140px center"; //controls postition of arrow
603                        link.style.paddingRight = "12px";
604                    }
605                }
606            }
607            child.onmouseover = menuGotFocus;
608        }
609    }
610}
611
612function menuGotFocus() {
613    resetCloseTimer();
614}
615
616function menuLostFocus() {
617    startCloseTimer();
618}
619
620function startCloseTimer() {
621    resetCloseTimer();
622    document.closeMenuTimer = window.setInterval("hideAllMenus()", 500);
623}
624
625function resetCloseTimer() {
626    if (document.closeMenuTimer != null) {
627        window.clearInterval(document.closeMenuTimer);
628    }
629}
630
631function showSubMenu() {
632    showSubMenuCore(this);
633}
634
635function isChild(parent, child) {
636    var par = child;
637    while (par != null) {
638        if (parent == par) {
639            return true;
640        }
641        par = par.parentNode;
642    }
643    return false;
644}
645
646function showSubMenuCore(objThis) {
647
648    if (objThis.className == "rootitem") {
649        // objThis.style.backgroundImage="url(images/rollover.gif)";
650    }
651    resetCloseTimer();
652    if (document.visibleMenu != null) {
653        if (document.visibleMenu.owner == objThis | isChild(objThis, document.visibleMenu.owner)) {
654            return;
655        }
656        else {
657            if (!isChild(document.visibleMenu.owner, objThis)) {
658                if (objThis.className == "rootitem") {
659                    hideMenuCore(document.visibleMenu, true);
660                }
661                else {
662                    hideMenuCore(document.visibleMenu, false);
663                }
664            }
665        }
666    }
667    for (var i = 0; i < objThis.childNodes.length; i++) {
668        var menu = objThis.childNodes.item(i);
669        if (menu.nodeName == "UL") {
670            var style = menu.style;
671            style.display = "block";
672            if (objThis.className == "rootitem") {
673                //style.left = getAbsoluteLeft(objThis) + "px";
673 //controls the x offset of the rollouts
674                //style.top = (getAbsoluteTop(objThis) + objThis.offsetHeight) + "px";
675            }
676            else {
677                //style.left = objThis.offsetWidth + "px";
678                //style.top = (objThis.offsetTop -1) + "px";
679            }
680            menu.parentMenu = document.visibleMenu;
681            document.visibleMenu = menu;
682            document.visibleMenu.has_focus = 1;
683            menu.owner = objThis;
684            if (document.checkMenuTimer != null) {
685                window.clearInterval(document.checkMenuTimer);
686                document.checkMenuTimer = null;
687            }
688            document.checkMenuTimer = window.setInterval("checkMenu()", 3000);
689
690            resetCloseTimer();
691            break;
692        }
693    }
694}
695
696function checkMenu() {
697    if (document.visibleMenu != null) {
698        if (!(document.visibleMenu.has_focus == 1)) {
699            hideMenuCore(document.visibleMenu, true);
700        }
701    }
702}
703
704function hideAllMenus() {
705    resetCloseTimer();
706    hideMenuCore(document.visibleMenu, true);
707}
708
709function hideSubMenu() {
710    hideMenuCore(document.visibleMenu, false);
711}
712
713
714function hideMenuCore(menu, hideAll) {
715    if (hideAll & document.checkMenuTimer != null) {
716        window.clearInterval(document.checkMenuTimer);
717        document.checkMenuTimer = null;
718    }
719    if (hideAll) {
720        var p = menu;
721        while (p != null) {
722            if (p.className == "rootitem") {
723                // p.style.backgroundImage="url(images/button.gif)";
724                break;
725            }
726            p = p.parentNode;
727        }
728        while (menu != null) {
729            menu.style.display = "none";
730            menu = getParentMenu(menu);
731        }
732        document.visibleMenu = null;
733    }
734    else {
735        if (menu != null) {
736            if (menu.className == "rootitem") {
737                // menu.style.backgroundImage="url(images/button.gif)";
738            }
739            menu.style.display = "none";
740            document.visibleMenu = menu.parentMenu;
741        }
742    }
743}
744
745function getParentMenu(menu) {
746    var element = menu.parentNode;
747    while (element != null) {
748        if (element.className == "rootitem") {
749            return null;
750        }
751        if (element.nodeName == "UL") {
752            return element;
753        }
754        element = element.parentNode;
755    }
756    return null;
757}
758
759function getAbsoluteLeft(element) {
760    if (element == null) {
761        return 0;
762    }
763    var pos;
764    if (element.offsetParent == null) {
765        pos = 0;
766    }
767    else {
768        pos = 0; //element.offsetParent.clientLeft;
769    }
770    return pos + element.offsetLeft + getAbsoluteLeft(element.offsetParent);
771}
772
773function getAbsoluteTop(element) {
774    if (element == null) {
775        return 0;
776    }
777    var pos;
778    if (element.offsetParent == null) {
779        pos = 0;
780    }
781    else {
782        pos = 0; //element.offsetParent.clientTop;
783    }
784    return pos + element.offsetTop + getAbsoluteTop(element.offsetParent);
785}
786
787function showStandard() {
788    var layerToShow = document.getElementById("StandardPanel");
789    var layerToHide = document.getElementById("AdvancedPanel");
790
791
792    layerToShow.style.display = 'inline';
793    layerToHide.style.display = 'none';
794}
795
796
797function showAdvanced() {
798    var layerToShow = document.getElementById("AdvancedPanel");
799    var layerToHide = document.getElementById("StandardPanel");
800
801
802    layerToShow.style.display = 'inline';
803    layerToHide.style.display = 'none';
804}
805
806function openNewWindow(sURL, sName, iWidth, iHeight, bResizable, bScrollbars) {
807    var iTop = (screen.height - iHeight) / 2;
808    var iLeft = (screen.width - iWidth) / 2;
809
810    var sOptions = "toolbar=no";
811    sOptions += ",width=" + iWidth;
812    sOptions += ",height=" + iHeight;
813    sOptions += ",resizable=" + (bResizable ? "yes" : "no");
814    sOptions += ",scrollbars=" + (bScrollbars ? "yes" : "no");
815    sOptions += ",left=" + iLeft;
816    sOptions += ",top=" + iTop;
817
818    var oWindow = window.open(sURL, sName, sOptions)
819    oWindow.focus();
820
821    return oWindow;
822}
823
824// --- upload images
825function OpenImageUpload(ownerWindow, strImageElement, strElementName, strImageFolder, parameters, renameTo) {
826    var oWindow = dialog("/components/imageuploader.aspx?ImageElement=" + strImageElement + "&ElementName=" + strElementName + "&ImageLocation=" + strImageFolder + "&parameters=" + parameters + "&renameTo=" + renameTo, 'UploadWindow', "width=320,height=200,resizable=0", false);
827    /*var oWindow = openNewWindow("/components/imageuploader.aspx?ImageElement="+strImageElement+"&ElementName="+strElementName+"&ImageLocation="+strImageFolder+"&parameters="+parameters, 'UploadWindow', 300, 150, false, false);*/
828    oWindow.mainWindow = ownerWindow;
829    oWindow.opener = ownerWindow;
830}
831function cloneElement(elementID) {
832    var imgIndex = document.imageUploadIndex;
833    var element = document.getElementById(elementID);
834    if (element != null) {
835        var elements = document.getElementsByTagName(element.nodeName);
836        for (var i = 0; i < elements.length; i++) {
837            if (elementID != null && elementID != '' && elements[i].id == elementID) {
838                element = elements[i];
839                break;
840            }
841        }
842
843        if (element != null) {
844            if (imgIndex == null) {
845                imgIndex = 0;
846            }
847            // the element to be cloned is hidden, 0 is reserved for it
848            imgIndex++;
849            var clone = cloneOne(element, imgIndex);
850            element.parentNode.parentNode.appendChild(clone);
851            document.imageUploadIndex = imgIndex;
852            return clone;
853        }
854    }
855    return null;
856}
857function cloneOne(element, index) {
858    var clone = document.createElement(element.nodeName);
859    var oldText = "btnDeleteImage')";
860    var oldText2 = "btnDeleteImage|productImage|0')";
861    var newText = "btnDeleteImage|productImage|" + index + "')";
862    var newHtml = element.innerHTML.replace(oldText, newText).replace(oldText, newText).replace(oldText2, newText).replace(oldText2, newText);
863    clone.innerHTML = newHtml;
864    clone.controlIndex = index;
865    var oAttrColl = element.attributes;
866    for (i = 0; i < oAttrColl.length; i++) {
867        oAttr = oAttrColl.item(i);
868        bSpecified = oAttr.specified;
869        sName = oAttr.nodeName;
870        vValue = oAttr.nodeValue;
871        if (bSpecified) {
872            clone.setAttribute(sName, vValue);
873        }
874    }
875    clone.style.cssText = element.style.cssText;
876    clone.style.display = 'block';
877
878    return clone;
879}
880function setImage(file, imageUrl, elementID, imageElementID, parameters) {
881    // parameters: width|height|delete_image_button_id|index_if_multiple_controls_used
882    var width = null;
883    var height = null;
884    var deleteBtnID = null;
885    var controlIndex = null;
886    var parentID = null;
887    if ($('#ImageNames').length > 0) {
888        var existingImage = $('#' + elementID).val();
889        existingImage = existingImage.replace(/&ticks=.+/, "");
890        $('#ImageNames').val($('#ImageNames').val().replace(',' + existingImage, ''));
891        $('#ImageNames').val($('#ImageNames').val().replace(existingImage, ''));
892        alert('removed' + existingImage);
893        alert($('#ImageNames').val());
894    }
895
896    if (parameters != null) {
897        var tmp = parameters.split("|");
898        if (tmp.length > 0) {
899            width = tmp[0];
900        }
901        if (tmp.length > 1) {
902            height = tmp[1];
903        }
904        if (tmp.length > 2) {
905            deleteBtnID = tmp[2];
906        }
907        if (tmp.length > 3) {
908            parentID = tmp[3];
909        }
910        if (tmp.length > 4) {
911            controlIndex = tmp[4];
912            controlIndex = parseInt(controlIndex);
913        }
914    }
915
916    var root;
917    if (parentID == null || parentID == '' || controlIndex != null) {
918        root = document;
919    }
920    else {
921        root = document.getElementById(parentID);
922    }
923
924    var elements;
925    var fields = new Array();
926    var btns = new Array();
927    var index = 0;
928    elements = root.getElementsByTagName('input');
929    for (var i = 0; i < elements.length; i++) {
930        if (elementID != null && elementID != '' && elements[i].id == elementID) {
931            fields[index] = elements[i];
932            index++;
933        }
934    }
935    index = 0;
936    for (var i = 0; i < elements.length; i++) {
937        if (deleteBtnID != null && deleteBtnID != '' && elements[i].id == deleteBtnID) {
938            btns[index] = elements[i];
939            index++;
940        }
941    }
942    elements = root.getElementsByTagName('img');
943    var images = new Array();
944    index = 0;
945    for (var i = 0; i < elements.length; i++) {
946        if (imageElementID != null && imageElementID != '' && elements[i].id == imageElementID) {
947            images[index] = elements[i];
948            index++;
949        }
950    }
951
952    var objelement = null;
953    var objimageElement = null;
954    var deleteBtn = null;
955    if (controlIndex != null) {
956        if (fields.length > controlIndex) {
957            objelement = fields[controlIndex];
958        }
959        if (images.length > controlIndex) {
960            objimageElement = images[controlIndex];
961        }
962        if (btns.length > controlIndex) {
963            deleteBtn = btns[controlIndex];
964        }
965    }
966    else {
967        if (fields.length > 0) {
968            objelement = fields[0];
969        }
970        if (images.length > 0) {
971            objimageElement = images[0];
972        }
973        if (btns.length > 0) {
974            deleteBtn = btns[0];
975        }
976    }
977
978    if (objelement == null) objelement = document.getElementById(elementID);
979    if (objelement != null) {
980        objelement.value = file;
981    }
982    if (objimageElement == null) objimageElement = document.getElementById(imageElementID);
983    if (objimageElement != null) {
984        objimageElement.src = imageUrl + "?_r!=" + Math.random();
985    }
986    if (deleteBtn != null) {
987        deleteBtn.disabled = file == null || file == '';
988    }
989    /*if (objimageElement != null)
990    {
991    if (objimageElement.onimagechanged != null) 
992    {
993    objimageElement.parentNode.onimagechanged(objimageElement, true, controlIndex);
994    }
995    }*/
996    if (parentID != null && parentID != '') {
997        var pr = document.getElementById(parentID);
998        if (pr != null && pr.onimagechanged != null) {
999            pr.onimagechanged(pr, true, controlIndex);
1000        }
1001    }
1002}
1003function OpenImageUploadPublic(strImageSrcName, strElementName, strImagePath, strProdID) {
1004    var oWindow = openNewWindow("/imageUpload.aspx?imageLocation=" + strImagePath + "&ElementName=" + strElementName + "&ImagePath=" + strImageSrcName + "&prodID=" + strProdID + "&serial=3r8g89a2d-gjmvb98jf", 'UploadWindow2', 300, 150, false, false);
1005}
1006
1007// --------- for textarea control --------
1008// Keep user from entering more than maxLength characters
1009function doKeypress(control) {
1010    maxLength = control.attributes["maxLength"].value;
1011    value = control.value;
1012    if (maxLength && value.length > maxLength - 1) {
1013        event.returnValue = false;
1014        maxLength = parseInt(maxLength);
1015    }
1016}
1017// Cancel default behavior
1018function doBeforePaste(control) {
1019    maxLength = control.attributes["maxLength"].value;
1020    if (maxLength) {
1021        event.returnValue = false;
1022    }
1023}
1024// Cancel default behavior and create a new paste routine
1025function doPaste(control) {
1026    maxLength = control.attributes["maxLength"].value;
1027    value = control.value;
1028    if (maxLength) {
1029//        event.returnValue = false;
1030//        maxLength = parseInt(maxLength);
1031//        var oTR = control.document.selection.createRange();
1032//        var iInsertLength = maxLength - value.length + oTR.text.length;
1033//        var sData = window.clipboardData.getData("Text").substr(0, iInsertLength);
1034//        oTR.text = sData;
1035    }
1036}
1037function ValidContent() {
1038    if (MyReplace(document.form1.frmtitle.value, ' ', '') == '') {
1039        alert('You must provide a title for this content');
1040        document.form1.frmtitle.focus();
1041        return false;
1042    }
1043    else {
1044        showLoad();
1045        document.form1.action = '';
1046        document.form1.target = '';
1047
1048        return true;
1049    }
1050}
1051// -------- end textarea ----------
1052
1053// -------- modal window ----------
1054String.prototype.isArgument = function() {
1055    return /^([a-zA-Z]){1,}=([0-9]){1,}$/.test(this);
1056}
1057
1058/*
1059call this function just work like window.open(url,name,feature);
1060however, for IE5.0+, it will open a showModelessDialog window;
1061and For Gecko(Mozilla or Netscape), the child window will stay on top focus untill user close it.
1062programmed by hedger
1063[email protected]
1064*/
1065
1066function dialog(url, name, feature, isModal) {
1067    if (url == null) { return false; }
1068    url = url
1069    if (name == null) { name = "" }
1070    if (feature == null) { feature = "" };
1071    if (window.showModelessDialog) {
1072        var WindowFeature = new Object();
1073        WindowFeature["width"] = 400;
1074        WindowFeature["height"] = 400;
1075        WindowFeature["left"] = "";
1076        WindowFeature["top"] = "";
1077        WindowFeature["resizable"] = "";
1078
1079        if (feature != null && feature != "") {
1080            feature = (feature.toLowerCase()).split(",");
1081
1082            for (var i = 0; i < feature.length; i++) {
1083                if (feature[i].isArgument()) {
1084                    var featureName = feature[i].split("=")[0];
1085                    var featureValue = feature[i].split("=")[1];
1086
1087                    if (WindowFeature[featureName] != null) { WindowFeature[featureName] = featureValue; }
1088                }
1089            }
1090        }
1091
1092        if (WindowFeature["resizable"] == 1 || WindowFeature["resizable"] == "1" || WindowFeature["resizable"].toString().toLowerCase() == "yes") { WindowFeature["resizable"] = "resizable:1;minimize:1;maximize:1;" }
1093        if (WindowFeature["left"] != "") { WindowFeature["left"] = "dialogLeft:" + WindowFeature["left"] + "px;"; }
1094        if (WindowFeature["top"] != "") { WindowFeature["top"] = "dialogTop:" + WindowFeature["Top"] + "px;"; }
1095        if (window.ModelessDialog == null) { window.ModelessDialog = new Object(); };
1096        if (name != "") {
1097            if (window.ModelessDialog[name] != null && !window.ModelessDialog[name].closed) {
1098                window.ModelessDialog[name].focus();
1099                return window.ModelessDialog[name];
1100            }
1101        }
1102        var F = WindowFeature["left"] + WindowFeature["top"] + "dialogWidth:" + WindowFeature["width"] + " px;dialogHeight:" + WindowFeature["height"] + "px;center:1;help:0;" + WindowFeature["resizable"] + "status:0;unadorned:0;edge: raised; ;border:thick;"
1103        if (isModal) {
1104            window.showModalDialog(url, self, F);
1105            return false;
1106        }
1107        else {
1108            window.ModelessDialog[name] = window.showModelessDialog(url, self, F);
1109            return window.ModelessDialog[name];
1110        }
1111    }
1112    else {
1113        if (document.getBoxObjectFor) {
1114
1115
1116            if (isModal) {
1117                var Modal = window.open(url, name, "modal=1," + feature);
1118                var ModalFocus = function() {
1119                    if (!Modal.closed) { Modal.focus(); }
1120                    else { Modal = null; window.removeEventListener(ModalFocus, "focus"); ModalFocus = null; };
1121                }
1122                window.addEventListener("focus", ModalFocus, false);
1123                return false;
1124            }
1125            else {
1126                return window.open(url, name, "modal=1," + feature);
1127            }
1128        }
1129        else {
1130            return window.open(url, name, feature);
1131        }
1132        //
1133    }
1134    return null;
1135}
1136
1137function modal(url, feature) {
1138    dialog(url, "", feature, true);
1139    return false;
1140}
1141//-------- end ------------
1142
1143function PopulateForm(arrElements) {
1144    PopulateForm2(arrElements, true);
1145}
1146
1147function PopulateForm2(arrElements, loadChildren) {
1148    for (i = 0; i < arrElements.length; i++) {
1149        //index of js arrays not always sequential
1150        if (arrElements[i] != null) {
1151            var elementObj = document.getElementById(arrElements[i][0]);
1152            if (elementObj != null) {
1153                if (elementObj.nodeName.toUpperCase() == "INPUT" && elementObj.type.toUpperCase() == "RADIO") {
1154                    elementObj.checked = elementObj.value == arrElements[i][1];
1155                }
1156                else if (elementObj.nodeName.toUpperCase() == "INPUT" && elementObj.type.toUpperCase() == "CHECKBOX") {
1157                    elementObj.checked = arrElements[i][1].toUpperCase() == "TRUE";
1158                }
1159                else if (elementObj.nodeName.toUpperCase() == "INPUT" && elementObj.type.toUpperCase() == "HIDDEN") {
1160                    elementObj.value = arrElements[i][1];
1161                    var img = document.getElementById(arrElements[i][0] + '_src');
1162                    if (img != null) {
1163                        if (arrElements[i][1] == null || arrElements[i][1] == '') {
1164                            img.src = '/wmsimages/no_image_supplied.jpg';
1165                        }
1166                        else {
1167                            img.src = arrElements[i][1];
1168                        }
1169                    }
1170                }
1171                else {
1172                    elementObj.value = arrElements[i][1];
1173                }
1174                if (loadChildren && elementObj.onchange != null) {
1175                    elementObj.onchange();
1176                    elementObj.upldateCallback = function(element) {
1177                        element.upldateCallback = null;
1178                        PopulateForm2(arrElements, false);
1179                    }
1180                }
1181                if (arrElements[i][2] == 'False') {
1182                    elementObj.disabled = true;
1183                    elementObj.Title = "Editing this field is not allowed.";
1184                }
1185            }
1186        }
1187    }
1188}
1189
1190// ------------------
1191function trackChanges(parentTable, change, childTable, update) {
1192    if (change != null && update != null) {
1193        var prev = change.onchange;
1194        change.onchange = function() {
1195            var xmlhttp = new XMLHttpRequest();
1196            xmlhttp.open('POST', '/options.aspx', true);
1197            xmlhttp.onreadystatechange = function() {
1198                if (xmlhttp.readyState == 4 || xmlhttp.readyState == "complete") {
1199                    if (xmlhttp.status == 200) {
1200                        updateOptions(xmlhttp.responseXML, update);
1201                    }
1202                    if (change.upldateCallback != null) {
1203                        change.upldateCallback(change);
1204                    }
1205                }
1206            }
1207            xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1208            var data = 'table=' + childTable + '&parentTable=' + parentTable + '&parentValue=' + change.value;
1209            xmlhttp.send(data);
1210            if (prev != null) {
1211                prev();
1212            }
1213        }
1214    }
1215}
1216
1217function updateOptions(xml, el) {
1218    var special = null;
1219    if (el.options.length > 0 && (el.options[0].value == null || el.options[0].value == "")) {
1220        special = el.options[0];
1221    }
1222    el.innerHTML = "";
1223    while (el.options.length > 0) {
1224        el.remove(0);
1225    }
1226    if (special != null) {
1227        el.options.add(special);
1228    }
1229    var opts = xml.getElementsByTagName("option");
1230    for (var j = 0; j < opts.length; j++) {
1231        var option = document.createElement("OPTION");
1232        el.options.add(option);
1233        if (opts[j].firstChild == null) {
1234            option.appendChild(document.createTextNode(opts[j].text));
1235            option.value = opts[j].getAttribute("value");
1236        }
1237        else {
1238            option.appendChild(document.createTextNode(opts[j].firstChild.nodeValue));
1239            option.value = opts[j].getAttribute("value");
1240        }
1241    }
1242    if (el.onchange != null) {
1243        el.onchange();
1244    }
1245}
1246
1247//Old form validation function
1248
1249//function CheckRequiredFields(formObject) {
1250//    var missingFields = _CheckRequiredFields_Recurse(formObject);
1251
1252//    if (missingFields && missingFields != "") {
1253//        missingFields = "The following fields are required:\r\n\r\n" + missingFields;
1254
1255//        alert(missingFields);
1256
1257//        return false;
1258//    }
1259
1260//    return true;
1261//}
1262
1263function CheckRequiredFields(formObject) {
1264
1265    var isValid = true;
1266
1267    //The main validation check
1268    var missingFields = _CheckRequiredFields_Recurse(formObject);
1269
1270    if (missingFields && missingFields != "") {
1271        missingFields = "The following fields are required:\r\n\r\n" + missingFields;
1272
1273        alert(missingFields);
1274
1275        isValid = false;
1276    }
1277
1278    //Validate the file input (less than 5 files at a time)
1279    if (document.getElementById("290_FileUpload") != null) {
1280        var fileInput = document.getElementById("290_FileUpload");
1281
1282        if (fileInput.files.length > 5) {
1283            alert("You may only upload up to 5 images");
1284            isValid = false;
1285        }
1286    }
1287
1288    //Validation code goes here, set isValid to false if your validation code detects incorrect form data
1289
1290    //if (isValid)
1291    //{
1292    //    //If the form is valid, disable the button to prevent it from clicked more than once
1293    //    document.getElementById("contact_us_enq_submit").disabled = "true";
1294    //    document.getElementById("contact_us_enq_submit").value = "Please wait";
1295    //}
1296
1297    return isValid;
1298}
1299//End of modified code for file upload form validation
1300
1301function _CheckRequiredFields_Recurse(element) {
1302    var missingFields = "";
1303
1304    for (var i = 0; i < element.childNodes.length; i++) {
1305        var childNode = element.childNodes[i];
1306
1307        if (childNode.tagName && childNode.getAttribute("required") && childNode.getAttribute("required").toLowerCase() == "true") {
1308            var tagName = childNode.tagName.toLowerCase();
1309
1310            if (tagName == "input") {
1311                if (childNode.type == "text") {
1312                    if (childNode.value == "")
1313                        missingFields += (missingFields == "" ? "" : "\r\n") + _CheckRequiredFields_FormatFieldName(childNode.name);
1314                }
1315                else if (childNode.type == "radio") {
1316                }
1317                else if (childNode.type == "checkbox") {
1318                }
1319            }
1320            else if (tagName == "textarea") {
1321                if (childNode.value == "")
1322                    missingFields += (missingFields == "" ? "" : "\r\n") + _CheckRequiredFields_FormatFieldName(childNode.name);
1323            }
1324            else if (tagName == "select") {
1325                if (childNode.selectedIndex == -1 || childNode.options[childNode.selectedIndex].value == "")
1326                    missingFields += (missingFields == "" ? "" : "\r\n") + _CheckRequiredFields_FormatFieldName(childNode.name);
1327            }
1328        }
1329
1330        var childMissingFields = _CheckRequiredFields_Recurse(childNode);
1331
1332        if (childMissingFields && childMissingFields != "")
1333            missingFields += (missingFields == "" ? "" : "\r\n") + childMissingFields;
1334    }
1335
1336    return missingFields;
1337}
1338
1339function _CheckRequiredFields_FormatFieldName(fieldName) {
1340    if (fieldName.match(/[0-9]+?_/))
1341        return fieldName.substring(fieldName.indexOf("_") + 1);
1342
1343    return fieldName;
1344}
1345
1346
1347
1348
1349function Delegate(Instance, Method) {
1350    return function() {
1351        return Method.apply(Instance, arguments);
1352    }
1353}
1354
1355function SetOpacity(Object, Percentage) {
1356    Object.style.filter = "alpha(opacity=" + Percentage + ")";
1357    Object.style.opacity = Percentage / 100;
1358
1359    Object._Opacity = Percentage;
1360}
1361
1362function FadeElement(element, start, stop, duration, callback) {
1363    var speed = Math.round(duration / 100);
1364    var opacity = start;
1365
1366    if (start < stop) {
1367        for (var i = start, timer = 0; i <= stop; i++, timer++) {
1368            setTimeout(new Delegate(element, function() {
1369                SetOpacity(this, opacity);
1370
1371                opacity++;
1372            }), (timer * speed));
1373        }
1374    }
1375    else {
1376        for (var i = start, timer = 0; i >= stop; i--, timer++) {
1377            setTimeout(new Delegate(element, function() {
1378                SetOpacity(this, opacity);
1379
1380                opacity--;
1381            }), (timer * speed));
1382        }
1383    }
1384
1385    if (callback)
1386        setTimeout(callback, duration);
1387}
1388// bubs
1389function updateProducts(items) {
1390    for (var i = 0; i < items.length; i++) {
1391        var sel = getElementsById("prodColour", "SELECT", items[i]);
1392        if (sel != null && sel.length > 0) {
1393            updateProduct(sel[0]);
1394        }
1395    }
1396}
1397
1398function FindParent(parentID, child) {
1399    var current = child;
1400    while (current != null) {
1401        if (current.id == parentID) {
1402            return current;
1403        }
1404        current = current.parentNode;
1405    }
1406    return null;
1407}
1408
1409function updateProduct(sel) {
1410    var item = FindParent("prodItem", sel);
1411    var data = sel.value.split('|');
1412    var el;
1413    var ProductUniqueCode;
1414   
1415    var ProductID = data[0];
1416    $('#itemNo').val(ProductID);
1417
1418    var CodeData = data[1];
1419    $('#displayCode').html("Code: " + CodeData);
1420
1421    var PriceData = data[2];
1422    $('#displayPrice').html(PriceData);      
1423
1424    el = getElementsById("divSpecialText", "DIV", item);
1425    if (el.style != null) {
1426        if (data[5] == "") {
1427            el[0].style.display = "none";
1428        }
1429        else {
1430            el[0].style.display = "block";
1431            el[0].innerHTML = data[5];
1432        }
1433    }
1434    el = getElementsById("DiscontinuedCount", "SPAN", item);
1435    if (el != null) {
1436        for (var i = 0; i < el.length; i++) {
1437            el[i].innerHTML = data[6];
1438        }
1439    }
1440    	el = getElementsById("prodImgDiv", "DIV", item);
1441    //el = getElementsById("prodImgTD", "SPAN", item);
1442    for (var i = 0; i < el.length; i++) {
1443        if (data[3] == null || data[3] == '') {
1444            el[i].style.display = "none";
1445        }
1446        else {
1447            el[i].style.display = "";
1448            var imgs = getElementsById("prodImg", "IMG", item);
1449            for (var j = 0; j < imgs.length; j++) {
1450                var start = imgs[j].src.indexOf("src=");
1451                var end = imgs[j].src.indexOf("&", start);
1452                //imgs[j].src = imgs[j].src.substring(0, start + 4) + data[3] + imgs[j].src.substring(end);
1453                imgs[j].src = "/pi/" + encodeURIComponent(data[4].replace(/[\.\%\&\*\|\\\:\/\<\>\?]/g, " ")).replace(/\%20/g, "+") + "@" + data[3].replace(".jpg", "") + "@300x275.jpg";
1454            }
1455
1456            var lblinks = getElementsById("prodImgLightboxLink", "A", item);
1457            for (var g = 0; g < lblinks.length; g++) {
1458                //lblinks[g].attributes["href"].value = "/adm/watermark.aspx?src=" + data[3] + "&bgcolor=ffffff&width=240&height=180";
1459                lblinks[g].attributes["href"].value = "/pi/" + encodeURIComponent(data[4].replace(/[\.\%\&\*\|\\\:\/\<\>\?]/g, " ")).replace(/\%20/g, "+") + "@" + data[3].replace(".jpg", "") + ".jpg";
1460                //alert(lblinks[g].outerHTML);
1461            }
1462
1463            //			var links = getElementsById("enlargedphoto", "A", item);
1464            //			for (var j = 0; j < links.length; j++)
1465            //			{
1466            //				links[j].onclick = function(){
1467            //				window.open('/adm/thumbnailer.aspx?src=/prodimg/' + ProductUniqueCode + '.jpg&width=400&height=500&bgcolor=ffffff','Product_' + ProductUniqueCode ,'width=440,height=550,toolbars=false,resizable=yes');
1468            //				}
1469            //			}
1470        }
1471    }
1472
1473    el = getElementsById("TheProductName", "SPAN", item);
1474    for (var i = 0; i < el.length; i++) {
1475        el[i].innerHTML = data[4];
1476    }
1477
1478    el = getElementsById("TheTellAFriendLink", "A", item)
1479    {
1480        for (var j = 0; j < el.length; j++) {
1481            el[j].onclick = function() {
1482                showTellFriend(data[0], '"' + data[4] + '"'); return false;
1483            }
1484        }
1485    }
1486
1487    el = document.getElementById("addtocart");
1488    if (el != null) {
1489        el.style.display = (data[7] == "True" ? "none" : "");
1490    }
1491    //Hide out of stock message
1492    el = document.getElementById("OSM");
1493    if (el != null) el.style.display = (data[7] == "True" ? "" : "none");
1494
1495    el = document.getElementById("p_message");
1496    if (el != null) {
1497        el.innerHTML = data[8];
1498        if (data[7] == "True") {
1499
1500            el.innerHTML += "<BR><span style='clear: both; color: rgb(255, 0, 0); display: block; font-size: 11px; font-weight: bold; line-height: 12px;'>
1500This product is currently on backorder.</span>";
1501        }
1502    }
1503}
1504
1505function updateProductMobile(sel) {
1506    var item = FindParent("prodItem", sel);
1507    var data = sel.value.split('|');
1508    var el;
1509    var ProductUniqueCode;
1510    el = getElementsById("itemNo", "INPUT", item);
1511    for (var i = 0; i < el.length; i++) {
1512        el[i].value = data[0];
1513    }
1514
1515    el = getElementsById("prodUniqueCode", "SPAN", item);
1516    for (var i = 0; i < el.length; i++) {
1517        el[i].innerHTML = "Code: " + data[1];
1518        ProductUniqueCode = data[1];
1519    }
1520
1521    el = getElementsById("prodPrice", "STRONG", item);
1522    for (var i = 0; i < el.length; i++) {
1523        //        el[i].innerHTML = "RRP: " + data[2];
1524        el[i].innerHTML = data[2];
1525    }
1526
1527    el = getElementsById("prodRRP", "SPAN", item);
1528    for (var i = 0; i < el.length; i++) {
1529        //        el[i].innerHTML = "RRP: " + data[2];
1530        el[i].innerHTML = data[9];
1531    }
1532
1533    el = getElementsById("prodSaving", "STRONG", item);
1534    for (var i = 0; i < el.length; i++) {
1535        //        el[i].innerHTML = "RRP: " + data[2];
1536        el[i].innerHTML = data[10];
1537    }
1538
1539    el = getElementsById("divSpecialText", "DIV", item);
1540    if (data[5] == "") {
1541        el[0].style.display = "none";
1542    }
1543    else {
1544        el[0].style.display = "block";
1545        el[0].innerHTML = data[5];
1546    }
1547
1548    el = getElementsById("DiscontinuedCount", "SPAN", item);
1549    for (var i = 0; i < el.length; i++) {
1550        el[i].innerHTML = data[6];
1551    }
1552
1553    el = getElementsById("prodImg", "IMG", item);
1554    for (var i = 0; i < el.length; i++) {
1555        var start = el[i].src.indexOf("src=");
1556        var end = el[i].src.indexOf("&", start);
1557
1558        //el[i].src = el[i].src.substring(0, start + 4) + data[3] + el[i].src.substring(end);
1559        el[i].src = "/pi/" + encodeURIComponent(data[4].replace(/[\.\%\&\*\|\\\:\/\<\>\?]/g, " ")).replace(/\%20/g, "+") + "@" + data[3].replace(".jpg", "") + "@240x180.jpg";
1560    }
1561
1562    el = getElementsById("prodImgLightboxLink", "A", item);
1563    for (var i = 0; i < el.length; i++) {
1564        //el[i].attributes["href"].value = "/adm/watermark.aspx?src=" + data[3] + "&bgcolor=FFFFFF&width=-1&height=-1";
1565        el[i].attributes["href"].value = "/pi/" + encodeURIComponent(data[4].replace(/[\.\%\&\*\|\\\:\/\<\>\?]/g, " ")).replace(/\%20/g, "+") + "@" + data[3].replace(".jpg", "") + ".jpg";
1566    }
1567
1568    el = getElementsById("TheProductName", "SPAN", item);
1569    for (var i = 0; i < el.length; i++) {
1570        el[i].innerHTML = data[4];
1571    }
1572
1573    el = document.getElementById("addtocart");
1574    el.style.display = (data[7] == "True" ? "none" : "");
1575
1576    el = document.getElementById("p_message");
1577    el.innerHTML = data[8];
1578}
1579
1580function getElementsById(id, nodeName, parent) {
1581    var ret = new Array();
1582    var index = 0;
1583    var nodes;
1584    if (parent == null) {
1585        nodes = document.getElementsByTagName(nodeName);
1586    }
1587    else {
1588        nodes = parent.getElementsByTagName(nodeName);
1589    }
1590    for (var i = 0; i < nodes.length; i++) {
1591        if (nodes[i].id == id) {
1592            ret[index] = nodes[i];
1593            index++;
1594        }
1595    }
1596    return ret;
1597}
1598
1599function getElementsByTag(nodeName, parent) {
1600    var ret = new Array();
1601    var index = 0;
1602    var nodes;
1603    if (parent == null) {
1604        nodes = document.getElementsByTagName(nodeName);
1605    }
1606    else {
1607        nodes = parent.getElementsByTagName(nodeName);
1608    }
1609    for (var i = 0; i < nodes.length; i++) {
1610        if (nodes[i].id == id) {
1611            ret[index] = nodes[i];
1612            index++;
1613        }
1614    }
1615    return ret;
1616}
1617
1618
1619function showTellFriend(link, name) {
1620    if (document.tellFriendEditor != null && document.tellFriendEditor.parentNode.nodeName.toUpperCase() == "BODY") {
1621        document.body.removeChild(document.tellFriendEditor);
1622        document.tellFriendEditor = null;
1623    }
1624    var html = "<table>";
1625    html += "<tr><td>Friend's name:</td><td align='right'><input type='text' id='recipientName' style='width: 300px;'></td></tr>";
1626    html += "<tr><td>Friend's email:</td><td align='right'><input type='text' id='recipientEmail' style='width: 300px;'></td></tr>";
1627    html += "<tr><td>Your name:</td><td align='right'><input type='text' id='senderName' style='width: 300px;'></td></tr>";
1628    html += "<tr><td>Your email:</td><td align='right'><input type='text' id='senderEmail' style='width: 300px;'></td></tr>";
1629    html += "<tr><td>Subject:</td><td align='right'><input type='text' id='msgSubject' style='width: 300px;'></td></tr>";
1630    html += "<tr><td colspan='2'>Your message<br><textarea id='msgBody' cols='60' rows='6'></textarea></td></tr>";
1631    html += "<input type='hidden' name='tafProductID' id='tafProductID' value='" + link + "'>";
1632    html += "<input type='hidden' name='tafProductName' id='tafProductName' value='" + name + "'>";
1633    html += "<tr><td colspan='2' align='center'><input type='button' id='btnSend' value='Send' onclick='tellFriend(this);'>&nbsp;&nbsp;&nbsp;<input type='button' id='btnCancel' value='Cancel' onclick='document.body.removeChild(document.tellFriendEditor); document.tellFriendEditor = null;'></td></tr>";
1634    html += "</table>";
1635
1636    var el = document.createElement("div");
1637    el.innerHTML = html;
1638    el.style.cssText = "position: absolute;
1638 border: solid 2px #aaaaaa; left: 30%; top: " + (document.documentElement.scrollTop + 150) + "px; padding: 3px; background-color: #eeeeee; z-index: 500";
1639    document.body.appendChild(el);
1640    document.tellFriendEditor = el;
1641}
1642
1643function showTellFriend2(link, name) {
1644    if (document.tellFriendEditor != null && document.tellFriendEditor.parentNode.nodeName.toUpperCase() == "BODY") {
1645        document.body.removeChild(document.tellFriendEditor);
1646        document.tellFriendEditor = null;
1647    }
1648    var html = "<table>";
1649    //html += "<tr><td>Friend's name:</td><td align='right'><input type='text' id='recipientName' style='width: 300px;'></td></tr>";
1650    html += "<tr><td>Friend's email:</td><td align='right'><input type='text' id='recipientEmail' style='width: 330px;'><br /><span style='font-size: 9px;'>NB: you can add multiple email addresses separated by a comma.</td></tr>";
1651    html += "<tr><td>Your name:</td><td align='right'><input type='text' id='senderName' style='width: 330px;'></td></tr>";
1652    html += "<tr><td>Your email:</td><td align='right'><input type='text' id='senderEmail' style='width: 330px;'></td></tr>";
1653    html += "<tr><td>Subject:</td><td align='right'><input type='text' id='msgSubject' style='width: 330px;'></td></tr>";
1654    html += "<tr><td colspan='2'>Your message<br><textarea id='msgBody' cols='60' rows='12'>Hi,\r\n\r\nI have started a gift registry at Babies Direct.\r\n\r\nClick this link to check it out:\r\n\r\n" + link + "\r\n\r\nSo far the list includes:\r\n" + name.replace(/~NEWLINE~/g, "\r\n") + "</textarea></td></tr>";
1655    html += "<tr><td colspan='2' align='center'><input type='button' id='btnSend' value='Send' onclick='tellFriend2(this);'>&nbsp;&nbsp;&nbsp;<input type='button' id='btnCancel' value='Cancel' onclick='document.body.removeChild(document.tellFriendEditor); document.tellFriendEditor = null;'></td></tr>";
1656    html += "</table>";
1657
1658    var el = document.createElement("div");
1659    el.innerHTML = html;
1660    el.style.cssText = "position: absolute; border: solid 2px #aaaaaa; left: 30%; top: " + (document.documentElement.scrollTop + 150) + "px; padding: 3px; background-color: #eeeeee;";
1661    document.body.appendChild(el);
1662    document.tellFriendEditor = el;
1663}
1664
1665function tellFriend(btn) {
1666    var val;
1667    val = document.getElementById("recipientName").value;
1668    if (val == null || val == '') {
1669        window.alert("Please enter your friend's name.");
1670        return;
1671    }
1672    var recipientName = escape(val);
1673
1674    val = document.getElementById("recipientEmail").value;
1675    if (val == null || val == '') {
1676        window.alert("Please enter your friend's address.");
1677        return;
1678    }
1679    var recipientEmail = escape(val);
1680
1681    val = document.getElementById("senderName").value;
1682    if (val == null || val == '') {
1683        window.alert("Please enter your name.");
1684        return;
1685    }
1686    var senderName = escape(val);
1687
1688    val = document.getElementById("senderEmail").value;
1689    if (val == null || val == '') {
1690        window.alert("Please enter your address.");
1691        return;
1692    }
1693    var senderEmail = escape(val);
1694
1695    val = document.getElementById("msgSubject").value;
1696    if (val == null || val == '') {
1697        window.alert("Please enter the subject.");
1698        return;
1699    }
1700    var msgSubject = escape(val);
1701
1702    val = document.getElementById("msgBody").value;
1703    if (val == null || val == '') {
1704        window.alert("Please enter the message.");
1705        return;
1706    }
1707    var msgBody = escape(val);
1708
1709    var tafProductID = escape(document.getElementById("tafProductID").value);
1710    var tafProductName = escape(document.getElementById("tafProductName").value);
1711
1712    var xmlhttp = new XMLHttpRequest();
1713    xmlhttp.open('POST', '/tellfriend.aspx', true);
1714    xmlhttp.onreadystatechange = function() {
1715        if (xmlhttp.readyState == 4 || xmlhttp.readyState == "complete") {
1716            if (xmlhttp.status == 200) {
1717                window.alert('Your message has been sent.');
1718                document.body.removeChild(document.tellFriendEditor);
1719                document.tellFriendEditor = null;
1720            }
1721            else {
1722                window.alert('An error occured.');
1723                btn.disabled = false;
1724            }
1725        }
1726    }
1727    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1728    var data = 'recipientName=' + recipientName + '&recipientEmail=' + recipientEmail + '&senderName=' + senderName + '&senderEmail=' + senderEmail + '&msgSubject=' + msgSubject + '&msgBody=' + msgBody + '&tafProductID=' + tafProductID + '&tafProductName=' + tafProductName;
1729    btn.disabled = true;
1730    xmlhttp.send(data);
1731}
1732
1733function tellFriend2(btn) {
1734    var val;
1735    //val = document.getElementById("recipientName").value;
1736    //if (val == null || val == '')
1737    //{
1738    //	window.alert("Please enter your friend's name.");
1739    //	return;
1740    //}
1741    //var recipientName = escape(val);
1742
1743    val = document.getElementById("recipientEmail").value;
1744    if (val == null || val == '') {
1745        window.alert("Please enter your friend's address.");
1746        return;
1747    }
1748    var recipientEmail = escape(val);
1749
1750    val = document.getElementById("senderName").value;
1751    if (val == null || val == '') {
1752        window.alert("Please enter your name.");
1753        return;
1754    }
1755    var senderName = escape(val);
1756
1757    val = document.getElementById("senderEmail").value;
1758    if (val == null || val == '') {
1759        window.alert("Please enter your address.");
1760        return;
1761    }
1762    var senderEmail = escape(val);
1763
1764    val = document.getElementById("msgSubject").value;
1765    if (val == null || val == '') {
1766        window.alert("Please enter the subject.");
1767        return;
1768    }
1769    var msgSubject = escape(val);
1770
1771    val = document.getElementById("msgBody").value;
1772    if (val == null || val == '') {
1773        window.alert("Please enter the message.");
1774        return;
1775    }
1776    var msgBody = escape(val);
1777
1778    var xmlhttp = new XMLHttpRequest();
1779    xmlhttp.open('POST', '/tellfriend2.aspx', true);
1780    xmlhttp.onreadystatechange = function() {
1781        if (xmlhttp.readyState == 4 || xmlhttp.readyState == "complete") {
1782            if (xmlhttp.status == 200) {
1783                window.alert('Your message has been sent.');
1784                document.body.removeChild(document.tellFriendEditor);
1785                document.tellFriendEditor = null;
1786            }
1787            else {
1788                window.alert('An error occured.');
1789                btn.disabled = false;
1790            }
1791        }
1792    }
1793    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
1794    var data = 'recipientName=' + /*recipientName*/'' + '&recipientEmail=' + recipientEmail + '&senderName=' + senderName + '&senderEmail=' + senderEmail + '&msgSubject=' + msgSubject + '&msgBody=' + msgBody;
1795    btn.disabled = true;
1796    xmlhttp.send(data);
1797}
1798//function initialiseAdminMenu(menutype) {
1799//    if (menutype == 'True') {
1800//        document.visibleMenu = null;
1801//        document.checkMenuTimer = null;
1802//        document.closeMenuTimer = null;
1803//        var menu = document.getElementById("adminmainmenu");
1804//        if (menu != null) {
1805//            var objLICollection = menu.getElementsByTagName("TD");
1806//            for (var i = 0; i < objLICollection.length; i++) {
1807//                var objLI = objLICollection[i];
1808//                processNodes(objLI);
1809//            }
1810//            objLICollection = menu.getElementsByTagName("LI");
1811//            for (var i = 0; i < objLICollection.length; i++) {
1812//                var objLI = objLICollection[i];
1813//                processNodes(objLI);
1814//            }
1815//        }
1816//    }
1817//    else {
1818//        //nothing required
1819//    }
1820//}
1821////////////////////////////////////////AJAX BLOCK////////////////////////////////		
1822
1823// XMLHttpRequest
1824//     FireFox and IE 7 have native XMLHttpRequest methods.
1825//     This function allows IE 6 and below to "work" the same way.
1826if (!window.XMLHttpRequest) {
1827    XMLHttpRequest = function() {
1828        try { return new ActiveXObject("MSXML3.XMLHTTP") } catch (ex) { }
1829        try { return new ActiveXObject("MSXML2.XMLHTTP.3.0") } catch (ex) { }
1830        try { return new ActiveXObject("Msxml2.XMLHTTP") } catch (ex) { }
1831        try { return new ActiveXObject("Microsoft.XMLHTTP") } catch (ex) { }
1832    }
1833}
1834
1835
1836// DoAjaxRequest
1837//     Sends an AJAX request, and calls "Callback" if successful.
1838//     "Callback" function is user-defined, and must have the following prototype:
1839//
1840//     function MyCallback(responseText) { ... }
1841//
1842//     Example usage:
1843//
1844//     function MyCallback(responseText) {
1845//         // do something with "responseText"
1846//     }
1847//
1848//     DoAjaxRequest("http://www.foobar.com/page.aspx", MyCallback);
1849function DoAjaxRequest(Address, Callback) {
1850    if (Address.indexOf("?") == -1)
1851        Address += "?r=";
1852    else
1853        Address += "&r=";
1854
1855    for (var i = 0; i < 10; i++)
1856        Address += new String(Math.floor(Math.random() * 10));
1857
1858    var Request = new XMLHttpRequest();
1859
1860    Request.onreadystatechange = new Delegate(Request, function() {
1861        if (this.readyState == 4 && this.status == 200)
1862            Callback(this.responseText);
1863    });
1864
1865    Request.open("GET", Address, true);
1866
1867    Request.send(null);
1868}
1869
1870////////////////////////////////////////END AJAX BLOCK////////////////////////////
1871
1872//new checkout validation
1873function CheckTerms() {
1874
1875}
1876
1877
1878
1879function Delegate(Instance, Method) {
1880    return function() {
1881        return Method.apply(Instance, arguments);
1882    }
1883}
1884
1885function SetOpacity(Object, Percentage) {
1886    Object.style.filter = "alpha(opacity=" + Percentage + ")";
1887    Object.style.opacity = Percentage / 100;
1888
1889    Object._Opacity = Percentage;
1890}
1891
1892function FadeElement(element, start, stop, duration, callback) {
1893    var speed = Math.round(duration / 100);
1894    var opacity = start;
1895
1896    if (start < stop) {
1897        for (var i = start, timer = 0; i <= stop; i++, timer++) {
1898            setTimeout(new Delegate(element, function() {
1899                SetOpacity(this, opacity);
1900
1901                opacity++;
1902            }), (timer * speed));
1903        }
1904    }
1905    else {
1906        for (var i = start, timer = 0; i >= stop; i--, timer++) {
1907            setTimeout(new Delegate(element, function() {
1908                SetOpacity(this, opacity);
1909
1910                opacity--;
1911            }), (timer * speed));
1912        }
1913    }
1914
1915    if (callback)
1916        setTimeout(callback, duration);
1917}
1918
1919//hide slideshow if FF 2.x
1920
1921if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);
1922    var ffversion = new Number(RegExp.$1) // capture x.x portion and store as a number
1923    if (ffversion >= 3) {
1924        //document.write("You're using FF 3.x or above")
1925    }
1926    else if (ffversion >= 2) {
1927        //document.write("You're using FF 2.x")
1928        document.getElementById("BannerSlideShow").style.display = "none";
1929    }
1930    else if (ffversion >= 1) {
1931        //document.write("You're using FF 1.x")
1932    }
1933}
1934else {
1935    //document.write("n/a")
1936}
1937
1938function txtPostCode_OnKeyUp() {
1939    if (window.__timeout != null)
1940        clearTimeout(window.__timeout);
1941
1942    if (document.getElementById("txtPostCode").value.length < 3)
1943        return;
1944
1945    window.__timeout = setTimeout(function() {
1946        document.getElementById("sidefreight_list").style.display = "";
1947        document.getElementById('sidefreight_list').innerHTML = "<img style=\"margin: 5px 10px;\" alt=\"\" src=\"/wmsimages/loading.gif\" />";
1948
1949        DoAjaxRequest("/suburbs_list.aspx?txtPostCode=" + encodeURI(document.getElementById("txtPostCode").value), function(response) {
1950            var suburbs = eval(response);
1951
1952            if (suburbs.length == 0) {
1953                document.getElementById('sidefreight_list').innerHTML = "<a class=\"suburb\" disabled=\"disabled\">No matching suburbs found</a>";
1954            }
1955            else {
1956                var output = "";
1957
1958                for (var i = 0; i < suburbs.length - 1; i++) {
1959                    output += "<a class=\"suburb\" href=\"#\" onclick=\"SelectSuburb('" + suburbs[i].Postcode + "', '" + suburbs[i].Suburb + "'); void(0); return false;\">" + suburbs[i].Postcode + " - " + suburbs[i].Suburb + "</a>";
1960                }
1961
1962                document.getElementById('sidefreight_list').innerHTML = output;
1963            }
1964        });
1965    }, 500);
1966}
1967function txtPostCodeProduct_OnKeyUp(pId) {
1968    if (window.__timeout != null)
1969        clearTimeout(window.__timeout);
1970
1971    if (document.getElementById("txtPostCodeProduct").value.length < 3)
1972        return;
1973
1974    window.__timeout = setTimeout(function() {
1975        document.getElementById("productshippingcost").style.display = "";
1976        document.getElementById('productshippingcost').innerHTML = "<img style=\"margin: 5px 10px;\" alt=\"\" src=\"/wmsimages/loading.gif\" />";
1977
1978        DoAjaxRequest("/suburbs_list.aspx?txtPostCode=" + encodeURI(document.getElementById("txtPostCodeProduct").value), function(response) {
1979            var suburbs = eval(response);
1980
1981            if (suburbs.length == 0) {
1982                document.getElementById('productshippingcost').innerHTML = "<a class=\"suburb\" disabled=\"disabled\">No matching suburbs found</a>";
1983            }
1984            else {
1985                var output = "";
1986
1987                for (var i = 0; i < suburbs.length - 1; i++) {
1988                    output += "<a class=\"suburb\" href=\"#\" onclick=\"SelectSuburbProduct('" + suburbs[i].Postcode + "', '" + suburbs[i].Suburb + "','" + pId + "'); void(0); return false;\">" + suburbs[i].Postcode + " - " + suburbs[i].Suburb + "</a>";
1989                }
1990
1991                document.getElementById('productshippingcost').innerHTML = output;
1992            }
1993        });
1994    }, 500);
1995}
1996function SelectSuburbProduct(postcode, suburb, pid) {
1997    document.getElementById("productshippingcost").innerHTML = "<img style=\"margin: 5px 10px;\" alt=\"\" src=\"/wmsimages/loading.gif\" />";
1998
1999    DoAjaxRequest("/deliveryBoxProduct.aspx?txtPostCodeProduct=" + postcode + "&txtSuburb=" + suburb + "&pid=" + pid, function(response) {
2000        document.getElementById("deliveryBoxProduct").innerHTML = response;
2001        document.getElementById("productshippingcost").innerHTML = "";
2002    });
2003
2004}
2005function txtPostCodeSingle_OnKeyUp(productId) {
2006    if (window.__timeout != null)
2007        clearTimeout(window.__timeout);
2008
2009    if (document.getElementById("txtPostCodeSingle").value.length < 3)
2010        return;
2011
2012    window.__timeout = setTimeout(function() {
2013        document.getElementById("sidefreight_listSingle").style.display = "";
2014        document.getElementById('sidefreight_listSingle').innerHTML = "<img style=\"margin: 5px 10px;\" alt=\"\" src=\"/wmsimages/loading.gif\" />";
2015
2016        DoAjaxRequest("/suburbs_list.aspx?txtPostCode=" + encodeURI(document.getElementById("txtPostCodeSingle").value), function(response) {
2017            var suburbs = eval(response);
2018
2019            if (suburbs.length == 0) {
2020                document.getElementById('sidefreight_listSingle').innerHTML = "<a class=\"suburb\" disabled=\"disabled\">No matching suburbs found</a>";
2021            }
2022            else {
2023                var output = "";
2024
2025                for (var i = 0; i < suburbs.length - 1; i++) {
2026                    output += "<a class=\"suburb\" href=\"#\" onclick=\"SelectSuburbSingle(" + parseInt(productId) + ", '" + suburbs[i].Postcode + "', '" + suburbs[i].Suburb + "'); void(0); return false;\">" + suburbs[i].Postcode + " - " + suburbs[i].Suburb + "</a>";
2027                }
2028
2029                document.getElementById('sidefreight_listSingle').innerHTML = output;
2030            }
2031        });
2032    }, 500);
2033}
2034
2035function SelectSuburb(postcode, suburb) {
2036    document.getElementById("sidefreight_list").innerHTML = "<img style=\"margin: 5px 10px;\" alt=\"\" src=\"/wmsimages/loading.gif\" />";
2037
2038    DoAjaxRequest("/deliveryBox.aspx?txtPostCode=" + postcode + "&txtSuburb=" + suburb, function(response) {
2039        document.getElementById("deliveryBox").innerHTML = response;
2040    });
2041}
2042
2043function SelectSuburbSingle(productId, postcode, suburb) {
2044    document.getElementById("sidefreight_listSingle").innerHTML = "<img style=\"margin: 5px 10px;\" alt=\"\" src=\"/wmsimages/loading.gif\" />";
2045
2046    DoAjaxRequest("/deliveryBoxSingle.aspx?ProductID=" + parseInt(productId) + "&txtPostCode=" + postcode + "&txtSuburb=" + suburb, function(response) {
2047        document.getElementById("deliveryBoxSingle").innerHTML = response;
2048    });
2049}
2050
2051function imgCalculateSingle_OnClick(productId) {
2052    document.getElementById("sidefreight_listSingle").innerHTML = "<img style=\"margin: 5px 10px;\" alt=\"\" src=\"/wmsimages/loading.gif\" />";
2053
2054    DoAjaxRequest("/deliveryBoxSingle.aspx?ProductID=" + parseInt(productId), function(response) {
2055        document.getElementById("deliveryBoxSingle").innerHTML = response;
2056    });
2057}
2058
2059function addToWishlist(productId) {
2060
2061    $.get("/addwishlist.aspx?add=" + productId, function (data) {
2062        if (data == "success") {
2063            alert('This item has been added to your wishlist, you can access your wishlist by selecting MY Account from the top menu bar.');
2064        } else {
2065            window.location = "/wishlist.aspx";
2066        }
2067    });
2068}
2069function addToWishlistAndNotify(productId) {
2070    $.get("/addwishlist.aspx?add=" + productId + "&n=true", function (data) {
2071        if (data == "success") {
2072            alert('You will be notified by email as soon as this item comes back into stock.');
2073        } else {
2074            window.location = "/wishlist.aspx";
2075        }
2076    });
2077}
2078function addToWishlistAndNotifyPO(productId) {
2079    $.get("/addwishlist.aspx?add=" + productId + "&n=true", function (data) {
2080        if (data == "success") {
2081            alert('Please note, when a pre-ordered item arrives you will be sent an email informing you that it is ready to ship. The pre-order item will added to your wishlist so you can checkout at your leisure. Please note no pre-order items will be charged until the item is ready to ship.');
2082        } else {
2083            window.location = "/wishlist.aspx";
2084        }
2085    });
2086}
2087
2088
2089
2090//	function absoluteLocation(element) {
2091    //	var left = 0;
2092    //	var top = 0;
2093    //	while (element != null) {
2094    //	    left += element.offsetLeft;
2095    //	    top += element.offsetTop;
2096    //	    element = element.offsetParent;
2097    //	}
2098    //	return { left: left, top: top };
2099//	}
2100
2101function Delegate(instance, method) {
2102    return function() {
2103        return method.apply(instance, arguments);
2104    };
2105}
2106
2107var colors =
2108{
2109    aliceblue: "#F0F8FF",
2110    antiquewhite: "#FAEBD7",
2111    aqua: "#00FFFF",
2112    aquamarine: "#7FFFD4",
2113    azure: "#F0FFFF",
2114    beige: "#F5F5DC",
2115    bisque: "#FFE4C4",
2116    black: "#000000",
2117    blanchedalmond: "#FFEBCD",
2118    blue: "#0000FF",
2119    blueviolet: "#8A2BE2",
2120    brown: "#A52A2A",
2121    burlywood: "#DEB887",
2122    cadetblue: "#5F9EA0",
2123    chartreuse: "#7FFF00",
2124    chocolate: "#D2691E",
2125    coral: "#FF7F50",
2126    cornflowerblue: "#6495ED",
2127    cornsilk: "#FFF8DC",
2128    crimson: "#DC143C",
2129    cyan: "#00FFFF",
2130    darkblue: "#00008B",
2131    darkcyan: "#008B8B",
2132    darkgoldenrod: "#B8860B",
2133    darkgray: "#A9A9A9",
2134    darkgreen: "#006400",
2135    darkkhaki: "#BDB76B",
2136    darkmagenta: "#8B008B",
2137    darkolivegreen: "#556B2F",
2138    darkorange: "#FF8C00",
2139    darkorchid: "#9932CC",
2140    darkred: "#8B0000",
2141    darksalmon: "#E9967A",
2142    darkseagreen: "#8FBC8F",
2143    darkslateblue: "#483D8B",
2144    darkslategray: "#2F4F4F",
2145    darkturquoise: "#00CED1",
2146    darkviolet: "#9400D3",
2147    deepskyblue: "#00BFFF",
2148    dimgray: "#696969",
2149    dodgerblue: "#1E90FF",
2150    firebrick: "#B22222",
2151    floralwhite: "#FFFAF0",
2152    forestgreen: "#228B22",
2153    fuchsia: "#FF00FF",
2154    gainsboro: "#DCDCDC",
2155    ghostwhite: "#F8F8FF",
2156    gold: "#FFD700",
2157    goldenrod: "#DAA520",
2158    gray: "#808080",
2159    green: "#008000",
2160    greenyellow: "#ADFF2F",
2161    honeydew: "#F0FFF0",
2162    hotpink: "#FF69B4",
2163    indianred: "#CD5C5C",
2164    indigo: "#4B0082",
2165    ivory: "#FFFFF0",
2166    khaki: "#F0E68C",
2167    lavender: "#E6E6FA",
2168    lavenderblush: "#FFF0F5",
2169    lawngreen: "#7CFC00",
2170    lemonchiffon: "#FFFACD",
2171    lightblue: "#ADD8E6",
2172    lightcoral: "#F08080",
2173    lightcyan: "#E0FFFF",
2174    lightgoldenrodyellow: "#FAFAD2",
2175    lightgreen: "#90EE90",
2176    lightgrey: "#D3D3D3",
2177    lightpink: "#FFB6C1",
2178    lightsalmon: "#FFA07A",
2179    lightseagreen: "#20B2AA",
2180    lightskyblue: "#87CEFA",
2181    lightslategray: "#778899",
2182    lightsteelblue: "#B0C4DE",
2183    lightyellow: "#FFFFE0",
2184    lime: "#00FF00",
2185    limegreen: "#32CD32",
2186    linen: "#FAF0E6",
2187    magenta: "#FF00FF",
2188    maroon: "#800000",
2189    mediumauqamarine: "#66CDAA",
2190    mediumblue: "#0000CD",
2191    mediumorchid: "#BA55D3",
2192    mediumpurple: "#9370D8",
2193    mediumseagreen: "#3CB371",
2194    mediumslateblue: "#7B68EE",
2195    mediumspringgreen: "#00FA9A",
2196    mediumturquoise: "#48D1CC",
2197    mediumvioletred: "#C71585",
2198    midnightblue: "#191970",
2199    mintcream: "#F5FFFA",
2200    mistyrose: "#FFE4E1",
2201    moccasin: "#FFE4B5",
2202    navajowhite: "#FFDEAD",
2203    navy: "#000080",
2204    oldlace: "#FDF5E6",
2205    olive: "#808000",
2206    olivedrab: "#688E23",
2207    orange: "#FFA500",
2208    orangered: "#FF4500",
2209    orchid: "#DA70D6",
2210    palegoldenrod: "#EEE8AA",
2211    palegreen: "#98FB98",
2212    paleturquoise: "#AFEEEE",
2213    palevioletred: "#D87093",
2214    papayawhip: "#FFEFD5",
2215    peachpuff: "#FFDAB9",
2216    peru: "#CD853F",
2217    pink: "#FFC0CB",
2218    plum: "#DDA0DD",
2219    powderblue: "#B0E0E6",
2220    purple: "#800080",
2221    red: "#FF0000",
2222    rosybrown: "#BC8F8F",
2223    royalblue: "#4169E1",
2224    saddlebrown: "#8B4513",
2225    salmon: "#FA8072",
2226    sandybrown: "#F4A460",
2227    seagreen: "#2E8B57",
2228    seashell: "#FFF5EE",
2229    sienna: "#A0522D",
2230    silver: "#C0C0C0",
2231    skyblue: "#87CEEB",
2232    slateblue: "#6A5ACD",
2233    slategray: "#708090",
2234    snow: "#FFFAFA",
2235    springgreen: "#00FF7F",
2236    steelblue: "#4682B4",
2237    tan: "#D2B48C",
2238    teal: "#008080",
2239    thistle: "#D8BFD8",
2240    tomato: "#FF6347",
2241    turquoise: "#40E0D0",
2242    violet: "#EE82EE",
2243    wheat: "#F5DEB3",
2244    white: "#FFFFFF",
2245    whitesmoke: "#F5F5F5",
2246    yellow: "#FFFF00",
2247    green: "#9ACD32"
2248};
2249
2250function TimeLine() {
2251    this.animations = new Array();
2252    this.busy = false;
2253
2254    this.append = function(element, duration, animationObject) {
2255        var start = 0;
2256
2257        for (var i = 0; i < this.animations.length; i++) {
2258            var animation = this.animations[i];
2259
2260            if (start < animation.start + animation.duration)
2261                start = animation.start + animation.duration;
2262        }
2263
2264        this.animations.push({ element: element, start: start, duration: duration, animationObject: animationObject });
2265    };
2266
2267    this.schedule = function(element, start, duration, animationObject) {
2268        this.animations.push({ element: element, start: start, duration: duration, animationObject: animationObject });
2269    };
2270
2271    this.play = function(callback) {
2272        if (this.busy)
2273            return;
2274
2275        this.busy = true;
2276
2277        var start = new Date().getTime();
2278
2279        for (var i = 0; i < this.animations.length; i++)
2280            this.animations[i].complete = false;
2281
2282        function _() {
2283            var now = new Date().getTime() - start;
2284
2285            var more = false;
2286
2287            for (var i = 0; i < this.animations.length; i++) {
2288                var animation = this.animations[i];
2289
2290                if (now < animation.start)
2291                    continue;
2292
2293                if (now >= animation.start + animation.duration) {
2294                    if (!animation.complete) {
2295                        animation.animationObject._step(animation.element, 1);
2296
2297                        animation.complete = true;
2298
2299                        more = true;
2300                    }
2301
2302                    continue;
2303                }
2304
2305                more = true;
2306
2307                animation.animationObject._step(animation.element, (now - animation.start) / animation.duration);
2308            }
2309
2310            if (more) {
2311                setTimeout(new Delegate(this, _), 1);
2312            }
2313            else {
2314                this.busy = false;
2315
2316                if (callback != null)
2317                    callback();
2318            }
2319        }
2320
2321        setTimeout(new Delegate(this, _), 1);
2322    };
2323}
2324
2325function BackColorAnimation(from, to) {
2326    this.from = from;
2327    this.to = to;
2328
2329    this._step = function(element, percent) {
2330        if (this.from == null) {
2331            var color = (element.currentStyle != null ? element.currentStyle.backgroundColor : document.defaultView.getComputedStyle(element, "").getPropertyValue("background-color"));
2332
2333            if (colors[color] != null)
2334                color = colors[color];
2335
2336            if (color.match(/^rgb/)) {
2337                var components = color.replace(/rgb\((.+)\)/, "$1").replace(/\s/g, "").split(",");
2338
2339                this.from =
2340				{
2341				    red: parseInt(components[0]),
2342				    green: parseInt(components[1]),
2343				    blue: parseInt(components[2])
2344				};
2345            }
2346            else {
2347                this.from =
2348				{
2349				    red: parseInt(color.substring(1, 3), 16),
2350				    green: parseInt(color.substring(3, 5), 16),
2351				    blue: parseInt(color.substring(5, 7), 16)
2352				};
2353            }
2354        }
2355
2356        if (this.to == null) {
2357            var color = (element.currentStyle != null ? element.currentStyle.backgroundColor : document.defaultView.getComputedStyle(element, "").getPropertyValue("background-color"));
2358
2359            if (colors[color] != null)
2360                color = colors[color];
2361
2362            if (color.match(/^rgb/)) {
2363                var components = color.replace(/rgb\((.+)\)/, "$1").replace(/\s/g, "").split(",");
2364
2365                this.to =
2366				{
2367				    red: parseInt(components[0]),
2368				    green: parseInt(components[1]),
2369				    blue: parseInt(components[2])
2370				};
2371            }
2372            else {
2373                this.to =
2374				{
2375				    red: parseInt(color.substring(1, 3), 16),
2376				    green: parseInt(color.substring(3, 5), 16),
2377				    blue: parseInt(color.substring(5, 7), 16)
2378				};
2379            }
2380        }
2381
2382        element.style.backgroundColor = "RGB(" + parseInt(this.from.red + (this.to.red - this.from.red) * percent) + ", " + parseInt(this.from.green + (this.to.green - this.from.green) * percent) + ", " + parseInt(this.from.blue 
2382+ (this.to.blue - this.from.blue) * percent) + ")";
2383    };
2384}
2385
2386function HeightAnimation(from, to) {
2387    this.from = from;
2388    this.to = to;
2389
2390    this._step = function(element, percent) {
2391        if (this.from == null)
2392            this.from = element.offsetHeight;
2393
2394        if (this.to == null)
2395            this.to = element.offsetHeight;
2396
2397        element.style.height = parseInt(this.from + (this.to - this.from) * percent) + "px";
2398    };
2399}
2400
2401function LeftAnimation(from, to) {
2402    this.from = from;
2403    this.to = to;
2404
2405    this._step = function(element, percent) {
2406        if (this.from == null)
2407            this.from = absoluteLocation(element).left;
2408
2409        if (this.to == null)
2410            this.to = absoluteLocation(element).left;
2411
2412        element.style.left = parseInt(this.from + (this.to - this.from) * percent) + "px";
2413    };
2414}
2415
2416function LocationAnimation(from, to) {
2417    this.from = from;
2418    this.to = to;
2419
2420    this._step = function(element, percent) {
2421        if (this.from == null)
2422            this.from = absoluteLocation(element);
2423
2424        if (this.to == null)
2425            this.to = absoluteLocation(element);
2426
2427        element.style.left = parseInt(this.from.left + (this.to.left - this.from.left) * percent) + "px";
2428        element.style.top = parseInt(this.from.top + (this.to.top - this.from.top) * percent) + "px";
2429    };
2430}
2431
2432function OpacityAnimation(from, to) {
2433    this.from = from;
2434    this.to = to;
2435
2436    this._step = function(element, percent) {
2437        // FIXME
2438
2439        element.style.filter = "alpha(opacity = " + parseInt(this.from + (this.to - this.from) * percent) + ")";
2440        element.style.opacity = (this.from + (this.to - this.from) * percent) / 100;
2441    };
2442}
2443
2444function OrbitAnimation(from, to, radius, revolutions) {
2445    this.from = from;
2446    this.to = to;
2447    this.radius = radius;
2448    this.revolutions = revolutions;
2449
2450    this._step = function(element, percent) {
2451        if (this.from == null)
2452            this.from = absoluteLocation(element);
2453
2454        if (this.to == null)
2455            this.to = absoluteLocation(element);
2456
2457        element.style.left = parseInt((this.from.left + (this.to.left - this.from.left) * percent) + Math.sin(percent * Math.PI * 2 * this.revolutions) * this.radius) + "px";
2458        element.style.top = parseInt((this.from.top + (this.to.top - this.from.top) * percent) - Math.cos(percent * Math.PI * 2 * this.revolutions) * this.radius) + "px";
2459    };
2460}
2461
2462function RotateAnimation(from, to) {
2463    this.from = from;
2464    this.to = to;
2465
2466    this._step = function(element, percent) {
2467        if (this.from == null)
2468            ;  // FIXME
2469
2470        if (this.to == null)
2471            ;  // FIXME
2472
2473        element.style.transform = "rotate(" + parseInt(this.from + (this.to - this.from) * percent) + "deg)";
2474        element.style.MozTransform = "rotate(" + parseInt(this.from + (this.to - this.from) * percent) + "deg)";
2475        element.style.msTransform = "rotate(" + parseInt(this.from + (this.to - this.from) * percent) + "deg)";
2476        element.style.oTransform = "rotate(" + parseInt(this.from + (this.to - this.from) * percent) + "deg)";
2477        element.style.webkitTransform = "rotate(" + parseInt(this.from + (this.to - this.from) * percent) + "deg)";
2478    };
2479}
2480
2481function SizeAnimation(from, to) {
2482    this.from = from;
2483    this.to = to;
2484
2485    this._step = function(element, percent) {
2486        if (this.from == null)
2487            this.from = { width: element.offsetWidth, height: element.offsetHeight };
2488
2489        if (this.to == null)
2490            this.to = { width: element.offsetWidth, height: element.offsetHeight };
2491
2492        element.style.width = parseInt(this.from.width + (this.to.width - this.from.width) * percent) + "px";
2493        element.style.height = parseInt(this.from.height + (this.to.height - this.from.height) * percent) + "px";
2494    };
2495}
2496
2497function TopAnimation(from, to) {
2498    this.from = from;
2499    this.to = to;
2500
2501    this._step = function(element, percent) {
2502        if (this.from == null)
2503            this.from = absoluteLocation(element).top;
2504
2505        if (this.to == null)
2506            this.to = absoluteLocation(element).top;
2507
2508        element.style.top = parseInt(this.from + (this.to - this.from) * percent) + "px";
2509    };
2510}
2511
2512function WidthAnimation(from, to) {
2513    this.from = from;
2514    this.to = to;
2515
2516    this._step = function(element, percent) {
2517        if (this.from == null)
2518            this.from = element.offsetWidth;
2519
2520        if (this.to == null)
2521            this.to = element.offsetWidth;
2522
2523        element.style.width = parseInt(this.from + (this.to - this.from) * percent) + "px";
2524    };
2525}
2526
2527
2528/// LB - JQuery to add support for html5 element: 'placeholder' on input fields in IE 9 and below (27/06/14)
2529
2530// This adds 'placeholder' to the items listed in the jQuery .support object. 
2531jQuery(function() {
2532   jQuery.support.placeholder = false;
2533   test = document.createElement('input');
2534   if('placeholder' in test) jQuery.support.placeholder = true;
2535});
2536// This adds placeholder support to browsers that wouldn't otherwise support it. 
2537$(function() {
2538   if(!$.support.placeholder) { 
2539      var active = document.activeElement;
2540      $(':text').focus(function () {
2541         if ($(this).attr('placeholder') != '' && $(this).val() == $(this).attr('placeholder')) {
2542            $(this).val('').removeClass('hasPlaceholder');
2543         }
2544      }).blur(function () {
2545         if ($(this).attr('placeholder') != '' && ($(this).val() == '' || $(this).val() == $(this).attr('placeholder'))) {
2546            $(this).val($(this).attr('placeholder')).addClass('hasPlaceholder');
2547         }
2548      });
2549      $(':text').blur();
2550      $(active).focus();
2551      $('form:eq(0)').submit(function () {
2552         $(':text.hasPlaceholder').val('');
2553      });
2554   }
2555});
2556
2557$(document).ready(function () {
2558
2559    $('input:radio[name="pmethod"]').change(function () { $("#paymentmethodtext").html($(this).data("itemdescription")); CalcSurcharge(); });
2560
2561    $('.trackFbGa').click(function () {
2562        FB();
2563        GA(this);
2564    });
2565
2566    function FB() {
2567        try {
2568            fbq('track', 'Lead', {});
2569        } catch (err) {
2570        }
2571    }
2572
2573    function GA(sender) {
2574        try {
2575            var label = $(sender).data('label');
2576            var category = $(sender).data('category');
2577            ga('send', 'event', category, 'Click', label);
2578        } catch (err) {
2579        }
2580    }
2581});
2582
2583
2584//end

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.