1function flashMessage(msg) { 2 $("body").insert({top:'<div id="flashMessage" class="message">' + msg + '</div>'}); 3 $("flashMessage").fade({duration:1.5, delay:1.5}); 4} 5 6function jsdebug(msg) { 7 if (!$('jsDebug')) { 8 $('body').insert({top:'<div style="position:fixed; right:5px; top:5px; width:150px; z-index:9999; border:solid 1px #333333; background:#cccccc; overflow:scroll; height:350px; padding:5px" id="jsDebug">JS Debug:</div>'}); 9 } 10 $('jsDebug').insert({bottom:'<p style="margin:0;padding:0; font-size:10px">' + msg + '</p>'}); 11} 12 13function debugjs(msg) { 14 jsdebug(msg); 15} 16 17function loadScript(src) { 18 script = new Element("script", { type: "text/javascript", src: "/js/" + src + ".js" }); 19 $("head").appendChild(script); 20} 21 22function setActive(active) { 23 $$('.menu a').each(function(e) { 24 e.removeClassName('active'); 25 }); 26 27 active.addClassName('active'); 28 29 while(active.up(2)) { 30 active = active.up(2).firstDescendant(); 31 active.addClassName('active'); 32 } 33} 34 35 36 37Event.observe(window, 'load', function() { 38 39 // blur links 40 $$('a').each(function(e) { 41 Event.observe(e, 'click', function() { 42 e.blur(); 43 }); 44 }); 45 46 // click active 47 $$('.menu a').each(function(e) { 48 Event.observe(e, 'click', function() { 49 setActive(e); 50 }); 51 }); 52 53 // flash message 54 if ($('flashMessage')) { 55 $('flashMessage').fade({duration:2, delay:2.5}); 56 } 57 58}); 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73/*cart and checkout pages*/ 74function updatePrices(request, json){ 75 var flag = true; 76 var response = (request.responseText).evalJSON(); 77 /*update total price, total netto, total tax*/ 78 $('totalPrice').innerHTML = response.total[0].totalPrice; 79 $('totalTax').innerHTML = response.total[0].totalTax; 80 $('totalNetto').innerHTML = response.total[0].totalNetto; 81 $('cart_count_top').innerHTML = response.total[0].cartCount; 82 $('cart_count_top_msg').innerHTML = response.total[0].cartCountMsg; 83 var l = response.variation.length; 84 /*update price, netto, tax for a row in shopping cart*/ 85 for (var i=0; i<l; i++) { 86 varId = response.variation[i].varId; 87 $('variationTotal_'+varId).innerHTML = response.variation[i].variationTotal; 88 $('tax_'+varId).innerHTML = response.variation[i].tax; 89 $('netto_'+varId).innerHTML = response.variation[i].netto; 90 91 $('Shop'+varId).removeClassName('quantityerror'); 92 $('morequantity_'+varId).style.display='none'; 93 } 94 95 var length = response.notUpdated.length; 96 for(var j=0; j<length; j++){ 97 $('Shop'+response.notUpdated[j].cartid).className = 'quantityerror'; 98 $('availablestock_'+response.notUpdated[j].cartid).innerHTML = response.notUpdated[j].stock; 99 $('morequantity_'+response.notUpdated[j].cartid).style.display =''; 100 $('morequantity_'+response.notUpdated[j].cartid).pulsate({from:0.5,pulses:100,duration:100}); 101 } 102 103 if(typeof(response.notUpdated[j-1])!='undefined'){ 104 $('Shop'+response.notUpdated[j-1].cartid).focus(); 105 flag = false; 106 } 107 108 if(l!=length){ 109 $('cartmessage').style.display = ''; 110 $('cartmessage').style.opacity = '1'; 111 Effect.Fade($('cartmessage'), {duration: 4}); 112 } 113 return flag; 114} 115function removeCart(request, json, id){ 116 Effect.BlindUp(id, {duration: 0.9,afterFinish:removeNode});/*BlindUp the cart row*/ 117 Effect.Fade(id, {duration: 0.9});/*BlindUp the cart row*/ 118 var response = (request.responseText).evalJSON(); 119 120 if ($('totalPriceWithShipping')) { /*checkout page, show grand total, shipping charge/name*/ 121 $('totalPriceWithShipping').innerHTML = response.total[0].totalPriceWithShipping; 122 $('totalShipping').innerHTML = response.total[0].shippingCharge; 123 $('shippingName').innerHTML = response.total[0].shippingName; 124 } 125 $('totalPrice').innerHTML = response.total[0].totalPrice; 126 $('totalTax').innerHTML = response.total[0].totalTax; 127 $('totalNetto').innerHTML = response.total[0].totalNetto; 128 $('cart_count_top_msg').innerHTML = response.total[0].cartCountMsg; 129 var cartCount = response.total[0].cartCount; 130 if (cartCount==0) { 131 $('cart_count_top').innerHTML = 0; 132 Effect.Fade('cartBasket',{duration:0.9,afterFinish:function(){$('cartBasket').className = 'cartEmpty';$('cart_count_top_div').style.display='none';Effect.Appear('cartBasket',{duration:0.9});}}); 133 /*if checkout page*/ 134 if ($('checkoutMethodsAndButtons')!=null) { 135 $('checkoutMethodsAndButtons').style.display='none'; 136 $("checkoutForm").payment_type.value = ''; 137 } 138 /*if cart page*/ 139 if ($('cartButttons')!=null) { 140 $('cartButttons').style.display='none'; 141 } 142 } 143 if(cartCount>0 && cartCount!=''){ 144 $('cart_count_top').innerHTML = cartCount; 145 } 146} 147function removeNode(e){
148 $(e.element.id).remove();//after fadeout, remove the DOM node 149 var childs = $('shoppingcart').childNodes; 150 var l = childs.length; 151 for(var i =0;i<l;i++){ 152 childs[i].className = (i%2 == 0) ? 'cart_odd_row' : 'cart_even_row'; 153 } 154} 155 156clearSearch = function(text) { 157 if ($('liveSearch').value == text) { 158 $('liveSearch').value = ''; 159 } 160} 161 162liveSearch = function(text){ 163 var val = $('liveSearch').value; 164 if (val == text || val == '') { 165 return; 166 } 167 $('searchform').submit(); 168} 169 170/*previously used to chk the html code in the string for guestbook entry. now this is not used.*/ 171function sample() { 172 var tat = $('gbTA').value; 173 if($('gbTA').value.match(/<(.|\n)*?>/)) 174 { 175 /*$('tacont_err').appear(); 176 return false;*/ 177 $('gbne').submit(); 178 } 179 else { 180 $('gbne').submit(); 181 } 182}
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.